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

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

MAJ et adaptation (sauvegarde visibilites en FITS) prog acq pour tests correlateur soft FAN a Nancay debut juillet Reza 29/06/2011

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