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

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

1/ Correction de gestion de changement de timeout DMA ( racqueth.cc , racqurw.cc)
2/ Amelioration de la gestion des arguments de ligne de commande et

datacard - introduction de variables d'environnement
BRACQ_TMPDIR TMPDIR BRACQ_BASEDIR BRACQ_FIBERIDS

3/ possibilite de specifier des cibles ethernet pour chaque fibre

Reza 26/11/2010

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