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

Last change on this file since 3918 was 3918, checked in by ansari, 15 years ago

Amelioration code thread monitoring pour tenir compte du mode fftshrink + calcul matrice saturation, cmv+Reza

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