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

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

amelioration mineures au niveau de l'impression, Reza 03/12/2010

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