source: Sophya/trunk/AddOn/TAcq/brparam.cc@ 4012

Last change on this file since 4012 was 4012, checked in by ansari, 14 years ago

Codage du mode de calcul de visibilites par intervalle de temps (BRVisibiliyCalculator) et propagation des modifs (ajouts de parametres) ds mfacq.cc et vismfib.cc, Reza 02/08/2011

File size: 21.0 KB
RevLine 
[3704]1#include <stdlib.h>
2
[3671]3#include "brparam.h"
4#include "strutilxx.h"
5#include "bracqvers.h"
6
[3757]7#ifndef BRSPORTID
8#define BRSPORTID 6912
9#endif
10
[3672]11/* --Methode-- */
12ADCBoardDesc::ADCBoardDesc(int id, string sbid, string cyc_firmw, string str1_firmw, string str2_firmw)
13 : id_(id), sbid_(sbid), cyclone_firmware_(cyc_firmw), stratix1_firmware_(str1_firmw), stratix2_firmware_(str2_firmw)
14{
15
16}
[3671]17
[3672]18/* --Methode-- */
19ADCBoardDesc::ADCBoardDesc(ADCBoardDesc const& bdes)
20 : id_(bdes.id_), sbid_(bdes.sbid_), cyclone_firmware_(bdes.cyclone_firmware_),
21 stratix1_firmware_(bdes.stratix1_firmware_), stratix2_firmware_(bdes.stratix2_firmware_)
22{
23}
24
25/* --Methode-- */
26ADCBoardDesc& ADCBoardDesc::Set(ADCBoardDesc const & bdes)
27{
28 id_ = bdes.id_;
29 sbid_ = bdes.sbid_;
30 cyclone_firmware_ = bdes.cyclone_firmware_;
31 stratix1_firmware_ = bdes.stratix1_firmware_;
32 stratix2_firmware_ = bdes.stratix2_firmware_;
33 return(*this);
34}
35
36/* --Methode-- */
37ostream& ADCBoardDesc::Print(ostream& os)
38{
39 os << "ADCBoard#" << id_ << "(" << sbid_ << ") Cyclone:" << cyclone_firmware_
40 << " Stratix1: " << stratix1_firmware_ << " Stratix2: " << stratix2_firmware_ << endl;
41 return os;
42}
43
[3913]44#define PMAXNBFIBRES 64
[3672]45/* --Methode-- */
46BRConfList::BRConfList()
[3913]47 : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp")
[3672]48{
[3913]49 InitFromEnv();
[3672]50}
51
52/* --Methode-- */
53BRConfList::BRConfList(string basedir)
[3913]54 : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp")
[3672]55{
[3913]56 InitFromEnv();
57 SetBaseDirectory(basedir);
[3672]58}
59
60/* --Methode-- */
61BRConfList::BRConfList(string basedir, vector<ADCBoardDesc> boards)
[3913]62 : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp")
[3672]63{
[3913]64 InitFromEnv();
65 SetBaseDirectory(basedir);
66 boards_=boards;
[3672]67}
68
69/* --Methode-- */
70BRConfList::BRConfList(BRConfList const & cf)
[3913]71 : basedir_(cf.basedir_), boards_(cf.boards_), fiberIdsS_(cf.fiberIdsS_), fiberIds_(cf.fiberIds_), tmpdir_(cf.tmpdir_)
[3672]72{
73}
74
75/* --Methode-- */
[3913]76void BRConfList::InitFromEnv()
[3674]77{
[3913]78 const char* venvp = NULL;
79 venvp=getenv("BRACQ_TMPDIR");
80 if (venvp!=NULL) tmpdir_=venvp;
81 else {
82 if (venvp!=NULL) tmpdir_=venvp;
83 venvp = getenv("TMPDIR");
84 }
85 venvp=getenv("BRACQ_BASEDIR");
86 if (venvp!=NULL) {
87 string ebd=venvp;
88 SetBaseDirectory(ebd);
89 }
90 string fibids="1,2,3,4,5,6,7,8";
91 venvp=getenv("BRACQ_FIBERIDS");
92 if (venvp!=NULL) fibids=venvp;
93 SetFiberIds(fibids);
94}
95
96/* --Methode-- */
97int BRConfList::SetFiberIds(string& sfids)
98{
99 fiberIdsS_=sfids;
100 vector<string> fibids;
101 FillVStringFrString(sfids, fibids, ',');
102 int rc=0;
103 for (size_t fib=0; fib<fibids.size(); fib++) {
104 if (fib>fiberIds_.size()) break;
105 fiberIds_[fib]=atoi(fibids[fib].c_str());
106 rc++;
107 }
108 return rc;
109}
110
111/* --Methode-- */
112void BRConfList::SetBaseDirectory(string& basedir)
113{
114 if (basedir.length()<1) return;
[3674]115 basedir_=basedir;
116 size_t len = basedir_.length();
117 if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/';
118}
119
120/* --Methode-- */
[3913]121BRConfList& BRConfList::Set(BRConfList const & cf)
[3672]122{
123 basedir_=cf.basedir_;
124 boards_=cf.boards_;
[3913]125 fiberIdsS_=cf.fiberIdsS_;
126 fiberIds_=cf.fiberIds_;
127 tmpdir_=cf.tmpdir_;
128 return (*this);
[3672]129}
130
131/* --Methode-- */
132ostream& BRConfList::Print(ostream& os)
133{
[3913]134 os << " ----- BRConfList:: BaseDir=" << basedir_ << " TmpDir=" << tmpdir_
135 << " NBoards= " << boards_.size() << endl;
[3672]136 for(size_t k=0; k<boards_.size(); k++) boards_[k].Print(os);
[3913]137 os << " FiberIdString=" << fiberIdsS_ << endl;
[3672]138 return os;
139}
140
141/* --Methode-- */
142void BRConfList::ReadDCFile(string file)
143{
144 // A FAIRE
145}
146
[3671]147// Classe qui memorise tous les parametres importants de l'acquisition
148
149/* --Methode-- */
[3681]150BRParList::BRParList(string acqmod, string fibres,unsigned int paqsz,
151 unsigned int dmaszkb, int nfiles, int nblocfile,
152 string outpath, uint_4 nzon , uint_4 npaqzon)
[3671]153{
[3681]154 AcqMode=acqmod;
155 fgdatafft=false;
[3918]156 fgfftshrink=false;
[3681]157 fgsinglechannel=false;
158
[3671]159 FiberListS=fibres;
[3909]160
[3671]161 PaqSize=paqsz;
[3909]162
[3674]163 dmasizekb=dmaszkb;
[3909]164 maxkwedma_=1000;
165 nretrydma_=3;
166 first_maxkwedma_=20000;
167 first_nretrydma_=9;
[3681]168
[3671]169 NbFiles=nfiles;
170 NBlocPerFile=nblocfile;
171 OutPathName=outpath;
[3681]172
[3671]173 nZones=nzon;
174 nPaqZone=npaqzon;
[3681]175
[3671]176 swapall=BR_Copy;
177 savesigfits=true;
178 fgnulldev4fits=false;
[3674]179
[3681]180 fg_hard_ctrlc=false;
[3674]181
[3671]182 fgreducpsize=false;
[3674]183 reducneedcopy=false;
[3673]184 pqreducmode=BR_CopyRA;
[3671]185 redpqsize=PaqSize;
186 reducoffset=0;
187
[3757]188 tcpportid=BRSPORTID;
189 pci2eth_fgdirect=false;
[3897]190 ethr_nlink=0;
191 ethr_forcesamefc_=false;
[3901]192 ethr_sfc_maxdpc_=0;
193 ethr_sfc_maxresync_=0;
[3899]194 ethr_waitendmsg_=false;
[3757]195
[3674]196 skysource="";
[3681]197
[3876]198// --- variables de controle pour le monitoring
[3681]199 fgdoProc=false;
200 nmeanProc=512;
201 stepProc=5;
202 nmaxProc=0;
[3876]203// --- variables de controle pour le calcul des visibilites
[3920]204 fgdoVisiC=false;
[3876]205 nmeanVisiC=1024;
[4012]206 fgtimeintervalVisiC=false;
207 timeintervalVisiC=1.;
[3876]208 nbcalgrpVisiC=1;
209 nthrVisiC=1;
[3920]210 fgfdtVisiC=false;
[3915]211 firstpairVisiC=0;
212 nbpairsVisiC=999999999;
213 fgpimpVisiC=false;
[3876]214 freqminVisiC=freqmaxVisiC=0;
215 nbinfreqVisiC=1;
[4010]216 fgfitsVisiC=false;
[3681]217
[3876]218// Autres variables / variables speciales
[3671]219 monothr=false;
220 activate_pattern=false;
[3681]221 nopciLossRate=0.;
[3671]222
[3883]223// niveau d'impression,debug ...
224 prtlevel_=0;
225 prtmodulo_=50000;
[3923]226 prtmodulo2_=50;
[3671]227 Decode(); // On decode et on complete les parametres
228}
229
230/* --Methode-- */
231BRParList::BRParList(BRParList const & p)
232{
233 Set(p);
234}
235
236/* --Methode-- */
237void BRParList::Set(BRParList const & p)
238{
[3681]239 AcqMode=p.AcqMode;
240 fgdatafft=p.fgdatafft;
[3918]241 fgfftshrink=p.fgfftshrink;
[3681]242 fgsinglechannel=p.fgsinglechannel;
243
[3671]244 FiberListS=p.FiberListS;
[3913]245 fiberNum_=p.fiberNum_;
[3681]246
[3671]247 PaqSize=p.PaqSize;
[3909]248
[3674]249 dmasizekb=p.dmasizekb;
[3909]250 maxkwedma_=p.maxkwedma_;
251 nretrydma_=p.nretrydma_;
252 first_maxkwedma_=p.first_maxkwedma_;
253 first_nretrydma_=p.first_nretrydma_;
[3681]254
[3671]255 NbFiles=p.NbFiles;
256 NBlocPerFile=p.NBlocPerFile;
257 OutPathName=p.OutPathName;
[3681]258
[3671]259 nZones=p.nZones;
260 nPaqZone=p.nPaqZone;
[3681]261
[3671]262 swapall=p.swapall;
263 savesigfits=p.savesigfits;
264 fgnulldev4fits=p.fgnulldev4fits;
265 fg_hard_ctrlc=p.fg_hard_ctrlc;
266 fgnulldev4fits=p.fgnulldev4fits;
267
268 fgreducpsize=p.fgreducpsize;
[3674]269 reducneedcopy=p.reducneedcopy;
[3673]270 pqreducmode=p.pqreducmode;
[3671]271 redpqsize=p.redpqsize;
272 reducoffset=p.reducoffset;
273
[3760]274 tcpportid=p.tcpportid;
[3757]275 pci2eth_fgdirect=p.pci2eth_fgdirect;
276 eths_targets=p.eths_targets;
[3913]277 eths_stargs=p.eths_stargs;
278 eths_fibtargs=p.eths_fibtargs;
279
[3757]280 ethr_nlink=p.ethr_nlink;
[3883]281 ethr_forcesamefc_=p.ethr_forcesamefc_;
[3897]282 ethr_sfc_maxdpc_=p.ethr_sfc_maxdpc_;
283 ethr_sfc_maxresync_=p.ethr_sfc_maxresync_;
[3899]284 ethr_waitendmsg_=p.ethr_waitendmsg_;
[3757]285
[3674]286 skysource=p.skysource;
[3681]287
288 fgdoProc=p.fgdoProc;
289 nmeanProc=p.nmeanProc;
290 stepProc=p.stepProc;
291 nmaxProc=p.nmaxProc;
[3674]292
[3915]293 fgdoVisiC=p.fgdoVisiC;
[4012]294 nmeanVisiC=p.nmeanVisiC;
295 fgtimeintervalVisiC=p.fgtimeintervalVisiC;
296 timeintervalVisiC=p.timeintervalVisiC;
[3915]297 nbcalgrpVisiC=p.nbcalgrpVisiC;
[3920]298 nthrVisiC=p.nthrVisiC;
299 fgfdtVisiC=p.fgfdtVisiC;
[3915]300 firstpairVisiC=p.firstpairVisiC;
301 nbpairsVisiC=p.nbpairsVisiC;
302 fgpimpVisiC=p.fgpimpVisiC;
303 freqminVisiC=p.freqminVisiC;
304 freqmaxVisiC=p.freqmaxVisiC;
305 nbinfreqVisiC=p.nbinfreqVisiC;
[4010]306 fgfitsVisiC=p.fgfitsVisiC;
[3915]307
[3671]308 monothr=p.monothr;
309 activate_pattern=p.activate_pattern;
[3681]310
311 nopciLossRate=p.nopciLossRate;
[3883]312
313 prtlevel_=p.prtlevel_;
[3923]314 prtmodulo_=p.prtmodulo_;
315 prtmodulo2_=p.prtmodulo2_;
[3883]316
[3671]317 return;
318}
319
320/* --Methode-- */
321void BRParList::ReadDCFile(string file)
322{
323 DataCards conf(file);
[3909]324 if(conf.HasKey("fibres"))
325 FiberListS= conf.SParam("fibres",0,"1");
326 else if(conf.HasKey("fibers"))
327 FiberListS= conf.SParam("fibers",0,"1");
328
[3674]329 OutPathName= conf.SParam("outpathname",0,"TstAcq");
330 skysource= conf.SParam("skysource",0,"");
331 PaqSize=(uint_4)conf.IParam("paqsize",0,16424);
[3909]332
[3674]333 dmasizekb =(uint_4) conf.IParam("dmasizekb",0,32);
[3909]334 maxkwedma_=(unsigned int)conf.IParam("waitenddma",0,1000);
335 nretrydma_=(unsigned int)conf.IParam("waitenddma",1,3);
336 first_maxkwedma_=(unsigned int)conf.IParam("waitenddma",2,20*maxkwedma_);
337 first_nretrydma_=(unsigned int)conf.IParam("waitenddma",3,3*nretrydma_);
338
[3674]339 NbFiles=conf.IParam("nbfiles",0,1);
340 NBlocPerFile=conf.IParam("nblocperfile",0,10);
[3671]341 AcqMode =conf.SParam("acqmode",0,"std");
[3674]342 nZones=(uint_4)conf.IParam("memmgr",0,4);
343 nPaqZone=(uint_4)conf.IParam("memmgr",1,128);
344 if (conf.HasKey("reducpaqsz")) { // reduction des tailles de paquets
345 fgreducpsize=true;
346 redpqsize=(uint_4)conf.IParam("reducpaqsz",0,PaqSize/4);
347 reducoffset=(uint_4)conf.IParam("reducpaqsz",1,0);
348 }
[3757]349 // Mot cle pour le mode envoi-reception sur ethernet
350 tcpportid=conf.IParam("tcpportid",0,BRSPORTID);
351 if (conf.HasKey("pci2ethdirect")) pci2eth_fgdirect = true; // Transfer direct DMA -> Ethernet
[3913]352 if (conf.HasKey("ethrtargets")) { // Machines destinations des paquets - memes destinations pour toutes les fibres
[3757]353 for(int it=0; it<conf.NbParam("ethrtargets"); it++)
[3913]354 eths_stargs.push_back(conf.SParam("ethrtargets",it));
[3757]355 }
[3913]356
357 const char* ethtf[9]={"ethrtargetsf1","ethrtargetsf2","ethrtargetsf3","ethrtargetsf4",
358 "ethrtargetsf5","ethrtargetsf6","ethrtargetsf7","ethrtargetsf8"};
359 for(int jj=0;jj<8;jj++) {
360 if (conf.HasKey( ethtf[jj] )) {
361 vector<string> ftargs;
362 int fid=jj+1;
363 for(int it=0; it<conf.NbParam( ethtf[jj] ); it++)
364 ftargs.push_back(conf.SParam( ethtf[jj] ,it));
365 eths_fibtargs[fid]=ftargs;
366 }
367 }
368
[3757]369 ethr_nlink=conf.IParam("ethrnlink",0,0); // Nombre de sources de paquets en reception ethernet
[3897]370 if (conf.HasKey("ethrforcesamefc")) {
371 ethr_forcesamefc_=true; // force SAME FrameCounter on all links
[3901]372 ethr_sfc_maxdpc_=conf.IParam("ethrforcesamefc",0,0);
373 ethr_sfc_maxresync_=conf.IParam("ethrforcesamefc",1,0);
[3897]374 }
[3899]375 if (conf.HasKey("ethrwaitendmsg")) ethr_waitendmsg_=true;
[3757]376
[3876]377 // Parametre de controle du monitoring
[3681]378 if (conf.HasKey("monitor")) {
379 fgdoProc=true;
380 nmeanProc=conf.IParam("monitor",0,512);
381 stepProc=conf.IParam("monitor",1,10);
382 nmaxProc=conf.IParam("monitor",2,0);
383 }
[3876]384 // Parametres pour le calcul des visibilites - le flag fgdoVisiC ne peut etre active
385 // qu'avec l'option de ligne de commande de mfacq
386 if (conf.HasKey("visicalc")) {
387 nmeanVisiC=conf.IParam("visicalc",0,1024);
388 nbcalgrpVisiC=conf.IParam("visicalc",1,1);
389 nthrVisiC=conf.IParam("visicalc",2,1);
390 }
[4012]391 if (conf.HasKey("visitimeint")) {
392 fgtimeintervalVisiC=true;
393 timeintervalVisiC=conf.DParam("visitimeint",0,1.);
394 }
[3920]395 if (conf.HasKey("visidtable")) fgfdtVisiC=true;
[3915]396 if (conf.HasKey("visipairs")) {
397 firstpairVisiC=conf.IParam("visipairs",0,0);
398 nbpairsVisiC=conf.IParam("visipairs",1,999999999);
399 fgpimpVisiC=(conf.IParam("visipairs",2,0)>0)?true:false;
[3876]400 }
[3915]401 if (conf.HasKey("visifreq")) {
402 freqminVisiC=conf.IParam("visifreq",0,0);
403 freqmaxVisiC=conf.IParam("visifreq",1,0);
404 nbinfreqVisiC=conf.IParam("visifreq",2,1);
405 }
[4010]406 if (conf.HasKey("visifitsout")) fgfitsVisiC=true;
407 if (conf.HasKey("visippfout")) fgfitsVisiC=false;
[3876]408
[3681]409 nopciLossRate=conf.DParam("nopcilossrate",0,0.);
[3674]410 fg_hard_ctrlc=conf.HasKey("hard_ctrlc");
[3681]411 if (conf.HasKey("nosavesigfits")) savesigfits=false;
[3883]412 if (conf.HasKey("prtlev")) {
413 prtlevel_=conf.IParam("prtlev",0,0);
414 prtmodulo_=conf.IParam("prtlev",1,50000);
[3923]415 prtmodulo2_=conf.IParam("prtlev",2,50);
[3883]416 }
417
[3671]418 Decode();
419}
420
421/* --Methode-- */
422void BRParList::Decode()
423{
424 vector<string> fiblist;
425 FillVStringFrString(FiberListS, fiblist, ',');
[3913]426 fiberNum_.resize(fiblist.size());
[3671]427 for (int fib=0; fib<fiblist.size(); fib++) {
[3913]428 fiberNum_[fib]=atoi(fiblist[fib].c_str());
[3671]429 }
[3913]430
431 eths_targets.resize(fiberNum_.size());
432 for (int fib=0; fib<fiberNum_.size(); fib++) {
433 map< int, vector<string> >::const_iterator itm=eths_fibtargs.find(fiberNum_[fib]);
434 if (itm != eths_fibtargs.end()) eths_targets[fib]=itm->second;
435 else eths_targets[fib]=eths_stargs;
[3909]436 }
437
[3672]438 if (OutPathName == "/dev/null") {
439 fgnulldev4fits=true;
440 }
441 else {
442 size_t len = OutPathName.length();
443 if ((len>1)&&(OutPathName[len-1]!='/')) OutPathName+='/';
444 fgnulldev4fits=false;
445 }
[3671]446 string acqmode = AcqMode;
[3918]447 fgdatafft=false; fgfftshrink=false; fgsinglechannel=false;
[3674]448 reducneedcopy=false; pqreducmode=BR_TwoChanReduc;
[4010]449 if ((acqmode == "std")||(acqmode=="raw2c")) swapall = BR_Copy ;
[3909]450 if (acqmode=="raw1c") { swapall = BR_Copy ; fgsinglechannel=true; pqreducmode=BR_OneChanReduc; }
451
[3918]452 if (acqmode=="fft2c") { swapall = BR_Copy; fgdatafft=true; }
453 if ((acqmode=="fft2cshrink")||(acqmode=="fftshrink")) { swapall = BR_Copy; fgdatafft=true; fgfftshrink=true; }
454 if (acqmode=="fft1c") { swapall = BR_Copy; fgdatafft=true; fgsinglechannel=true; }
455 if (acqmode=="fft1cshrink") { swapall = BR_Copy; fgdatafft=true; fgfftshrink=true; fgfftshrink=true; }
456
[3671]457 if (acqmode == "nosw") swapall = BR_Copy ;
458 if (acqmode == "nof") { swapall = BR_Copy ; savesigfits = false; }
[3909]459 if (acqmode == "ordfft1c") { swapall = BR_FFTOneChan; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
460 if (acqmode == "ordfft2c") { swapall = BR_FFTTwoChan; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
461
[3674]462 if (acqmode == "fft1cnof")
463 { swapall = BR_FFTOneChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
464 if (acqmode == "fft2cnof")
465 { swapall = BR_FFTTwoChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
[3671]466 if (acqmode == "mono") { monothr = true; swapall = BR_Copy; }
467 if (acqmode == "monodirect") { monothr = true; swapall = BR_CopyHDR;}
468 if (acqmode == "patmonodirect") { monothr = true; swapall = BR_CopyHDR; activate_pattern=true; }
469 if (acqmode == "patmono") { monothr = true; swapall = BR_Copy; activate_pattern=true; }
470 if (acqmode == "patnof") { savesigfits = false; swapall = BR_Copy; activate_pattern=true; }
471 if (acqmode == "pattern") { savesigfits = true; swapall = BR_Copy; activate_pattern=true; }
472
473 if (acqmode == "swapall") swapall = BR_SwapAll;
[3674]474 if (acqmode == "fft1csw")
475 { swapall = BR_FFTOneChanSwapAll; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
476 if (acqmode == "fft2csw")
477 { swapall = BR_FFTTwoChanSwapAll; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
478 if (acqmode == "fft1cswnof")
479 { swapall = BR_FFTOneChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
480 if (acqmode == "fft2cswnof")
481 { swapall = BR_FFTTwoChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
[3671]482 if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") ) swapall = BR_SwapHDR;
483 if ((acqmode == "swapallnof") || (acqmode == "mxs") ) savesigfits = false;
484 if (acqmode == "monoswh") { monothr = true; swapall = BR_SwapHDR;; }
485 if (acqmode == "monosw") { monothr = true; swapall = BR_SwapAll; }
486
487 if (acqmode == "swap32") swapall = BR_Swap32 ;
488 if (acqmode == "nof32") { swapall = BR_Swap32 ; savesigfits = false; }
[3674]489 if (acqmode == "fft1c32")
490 { swapall = BR_FFTOneChanSwap32; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
491 if (acqmode == "fft2c32")
492 { swapall = BR_FFTTwoChanSwap32; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
493 if (acqmode == "fft1cnof32")
494 { swapall = BR_FFTOneChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
495 if (acqmode == "fft2cnof32")
496 { swapall = BR_FFTTwoChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
497
[3681]498 if ((swapall==BR_FFTTwoChan)||(swapall==BR_FFTTwoChanSwapAll)||(swapall==BR_FFTTwoChanSwap32)) {
499 fgdatafft=true;
500 }
501 if ((swapall==BR_FFTOneChan)||(swapall==BR_FFTOneChanSwapAll)||(swapall==BR_FFTOneChanSwap32)) {
502 fgdatafft=true; fgsinglechannel=true;
503 }
504
[3674]505 if (fgreducpsize) {
506 if (redpqsize>=PaqSize) fgreducpsize=false;
507 else {
508 if(reducoffset>(PaqSize-redpqsize)/2) reducoffset=(PaqSize-redpqsize)/2;
509 }
510 }
[3671]511}
512
513/* --Methode-- */
514ostream& BRParList::Print(ostream& os)
515{
516 os << " ------ BRParList::Print() ----- " << endl;
517 os << " FiberListS=" << FiberListS ;
518 os << " PaqSize=" <<PaqSize;
[3909]519 os << " DMA_Size_kb=" <<dmasizekb << " (EndDMA: Maxkw=" << maxkwedma_ << " NRetry=" << nretrydma_
520 << " FirstDMA: Maxkw=" << first_maxkwedma_ << " NRetry=" << first_nretrydma_ << ")" << endl;
[3671]521 os << " AcqMode="<<AcqMode;
522 os << " Type of acquisition :" << BRPaquet::FmtConvToString( swapall) << endl;
[3918]523 os << " Firmware: " << ((fgdatafft)?" FFT_Data ":" RawData ");
524 os << ((fgfftshrink)?" ShrinkFFT ":" FULLFFT ");
525 os << ((fgsinglechannel)?" SingleChannel":" TwoChannels") << endl;
[3674]526 os << " SkySource=" << skysource;
[3671]527 os << " NbFiles="<<NbFiles;
528 os << " NBlocPerFile="<<NBlocPerFile;
529 os << " OutPathName="<<OutPathName << endl;
530 os << " MemMgr: nZones="<<nZones;
[3674]531 os << " nPaqZone="<<nPaqZone<<endl;
532 if (fgreducpsize) {
533 os << " PaquetSize Reduction, ReducedSize=" << redpqsize << " Offset=" << reducoffset << endl;
534 }
[3913]535 if ((eths_stargs.size()>0)||(eths_fibtargs.size()>0)) {
536 os << " DMA->Ethernet Targets=" << eths_targets.size()
537 << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << endl;
538
539 for(size_t fib=0; fib<eths_targets.size(); fib++) {
540 os << " Fiber Num=" << fiberNum_[fib] << " --> eth_targets: ";
541 for(size_t it=0; it<eths_targets[fib].size(); it++)
542 os << eths_targets[fib][it] << " ; ";
543 os << endl;
544 }
[3757]545 }
[3913]546 os << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
[3897]547 if (ethr_forcesamefc_)
[3913]548 os << "EthernetReader mode: ForceSameFrameCounter read mode with Max_PaquetCounterDiff= "
[3899]549 << ethr_sfc_maxdpc_ << " MaxNbResync=" << ethr_sfc_maxresync_
550 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl;
[3897]551 else
[3913]552 os << "EthernetReader mode: AllOKPaquets read mode "
[3899]553 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl;
[3883]554
[3681]555 if (fgdoProc>0)
556 os << " Monitoring NMeanProc=" << nmeanProc << " StepProc=" << stepProc << " NMaxProc=" << nmaxProc << endl;
557 else os << " No monotoring thread " << endl;
[3876]558 if (fgdoVisiC) {
[3920]559 os << " Visibility calculation, nbCalGrp=" << nbcalgrpVisiC << " NThr/VisCal=" << nthrVisiC
560 << ((fgfdtVisiC)?" Fill_VisiDTable":" ") << endl;
[4012]561 if (fgtimeintervalVisiC) os << " ... VisiCalc TimeIntervalMode : " << timeintervalVisiC << " seconds " << endl;
562 else os << " ... VisiCalc NPaq=" << nmeanVisiC << " IntervalMode " << endl;
[3915]563 os << " ... VisiCalc FirstPair= " << firstpairVisiC << " NbPairs= " << nbpairsVisiC
564 << ((fgpimpVisiC)?" (Odd-Even visibilities+AutoCorrel only) ":"") << endl;
[3876]565 os << " ... VisiCalc FrequencyBinning FreqMin= " << freqminVisiC << " FreqMax= " << freqmaxVisiC
566 << " NBinFreq= " << nbinfreqVisiC<< endl;
[4010]567 os << (fgfitsVisiC?" FITS output format for visibility files":" PPF output format for visibility files") << endl;
[3876]568 }
[3671]569 os << " fg_hard_ctrlc=" << ((fg_hard_ctrlc)?"true":"false");
570 os << " Save to fits " << ((savesigfits)?"true":"false") << endl;
571 os << " monothr y(1)/n(0) " << ((monothr)?"true":"false");
572 os << " ActivatePattern " << ((activate_pattern)?"true":"false") << endl;
[3923]573 os << " PrtLevel=" << prtlevel_ << " PrtCntModulo=" << prtmodulo_ << " PrtCntModulo2=" << prtmodulo2_ << endl;
[3883]574
[3671]575 return os;
576}
577
578
[3672]579//-------------------- Classe BRAcqConfig -----------------------
580
[3671]581BRParList* BRAcqConfig::param_=NULL;
[3672]582BRConfList* BRAcqConfig::config_=NULL;
[3671]583
584/* --Methode-- */
585BRAcqConfig::BRAcqConfig()
586{
587 if (param_==NULL) param_ = new BRParList;
[3672]588 if (config_==NULL) config_ = new BRConfList;
[3671]589}
590
591/* --Methode-- */
[3672]592ostream& BRAcqConfig::Print(ostream& os)
593{
594 os << " ------------ BAORadio Acq Run/Configuration -------- " << endl;
595 config_->Print(os);
596 param_->Print(os);
[3913]597 os << " Fibers f: Num->Id ";
598 for(size_t f=0; f<NbFibers(); f++)
599 os << f << ": " << FiberNum(f) << " -> " << FiberId(f) << " ; " ;
600 os << endl;
[3672]601 os << " ----------------------------------------------------- " << endl;
602}
603
604/* --Methode-- */
[3671]605int BRAcqConfig::CreateOutputDirectories()
606{
[3672]607 char cmd[1024];
[3671]608 if (param_->fgnulldev4fits!=true) {
[3672]609 sprintf(cmd,"mkdir %s%s",config_->BaseDirectory().c_str(), param_->OutPathName.c_str());
[3671]610 if (system(cmd) < 0) {
[3672]611 cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
612 << cmd << " -> stop" << endl;
[3671]613 return 2;
614 }
615 cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
616
[3672]617 memset(cmd,0,1024);
[3671]618 for (int i= 0; i< NFibers() ; i++) {
[3913]619 sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->fiberNum_[i]);
[3671]620 if (system(cmd) < 0) {
621 cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
[3672]622 << cmd << " -> stop" << endl;
[3671]623 return 3;
624 }
625 else cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
626 }
627 }
628 else {
629 string ProcPathName = "./XZXZXZX/";
630 cout << " Using " << ProcPathName << " for other processed files ... " << endl;
631 char cmd[512];
632 sprintf(cmd,"mkdir %s",ProcPathName.c_str());
633 if (system(cmd) < 0) {
634 cout << "CreateOutputDirectories()/Error: Can not create subdirectory ./XZXZXZX/"
635 << "-> stop" << endl;
636 return 3;
637 }
638 else cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
639 }
640 return 0;
641}
642
643/* --Methode-- */
644string BRAcqConfig::OutputDirectoryFib(int ifib)
645{
646 char buff[24];
[3913]647 sprintf(buff,"Fiber%d/",param_->fiberNum_[ifib]);
[3672]648 return ( config_->BaseDirectory() + param_->OutPathName + buff );
[3671]649}
Note: See TracBrowser for help on using the repository browser.