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

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

1/ Mise en place d'informations auxiliaires au niveau de RAcqMemZoneMgr ,

FillTime (DATEOBS) pour chaque zone et identificateur des fibres

2/ remplissage de FillTime(DATEOBS) Et FiberId's de MemZoneMgr par

les classes PCIEMultiReader et EthernetReader

3/ Ajout de mots-cle (ds les datacards) pour numeros d'identification des

fibres et parametres de controles du DMA (@fiberids @waitenddma)
et corrections/ameliorations des modes acq (raw1c ordfft2c ...)

4/ Parametrage des WaitEndDMA ds PCIEWrapperInterface et implementation

au niveau de DMAMgrV6 (dmamgrv6.h .cc)

5/ Gestion d'echec DMA -> arret acquisition ds PCIEMultiReader,EthernetReader

modification TimeOut DMA entre le premier DMA et les suivants pour permettre
un arret propre rapide

6/ Adaptation de la classe BRVisibilityCalculator pour utilisation

FillTime (DATEOBS) et FiberIds de MemZoneMgr - amelioration de
l'identification des numeros de canaux pour les matrices de visibilites

7/ Petites ameliorations (ecriture mot-cles) pour MultiDataSaver et

amelioration classe BRMultiFitsReader pour lecture FillTime (DATEOBS)
et FiberIds depuis les fichiers FITS et remplissage de RAcqMemZoneMgr

Reza, 21/11/2010

File size: 16.9 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
44/* --Methode-- */
45BRConfList::BRConfList()
46 : basedir_("./")
47{
48}
49
50/* --Methode-- */
51BRConfList::BRConfList(string basedir)
52 : basedir_(basedir)
53{
54}
55
56/* --Methode-- */
57BRConfList::BRConfList(string basedir, vector<ADCBoardDesc> boards)
58 : basedir_(basedir), boards_(boards)
59{
60 size_t len = basedir_.length();
61 if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/';
62}
63
64/* --Methode-- */
65BRConfList::BRConfList(BRConfList const & cf)
66 : basedir_(cf.basedir_), boards_(cf.boards_)
67{
68}
69
70/* --Methode-- */
[3674]71void BRConfList::SetBaseDirectory(string basedir)
72{
73 basedir_=basedir;
74 size_t len = basedir_.length();
75 if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/';
76}
77
78/* --Methode-- */
[3672]79void BRConfList::Set(BRConfList const & cf)
80{
81 basedir_=cf.basedir_;
82 boards_=cf.boards_;
83}
84
85/* --Methode-- */
86ostream& BRConfList::Print(ostream& os)
87{
88 os << " ----- BRConfList:: BaseDir:" << basedir_ << " NBoards= " << boards_.size() << endl;
89 for(size_t k=0; k<boards_.size(); k++) boards_[k].Print(os);
90 return os;
91}
92
93/* --Methode-- */
94void BRConfList::ReadDCFile(string file)
95{
96 // A FAIRE
97}
98
[3671]99// Classe qui memorise tous les parametres importants de l'acquisition
[3909]100#define PMAXNBFIBRES 64
[3671]101
102/* --Methode-- */
[3681]103BRParList::BRParList(string acqmod, string fibres,unsigned int paqsz,
104 unsigned int dmaszkb, int nfiles, int nblocfile,
105 string outpath, uint_4 nzon , uint_4 npaqzon)
[3671]106{
[3681]107 AcqMode=acqmod;
108 fgdatafft=false;
109 fgsinglechannel=false;
110
[3671]111 FiberListS=fibres;
[3909]112 FiberIdsS="1,2,3,4,5,6,7,8";
113
[3671]114 PaqSize=paqsz;
[3909]115
[3674]116 dmasizekb=dmaszkb;
[3909]117 maxkwedma_=1000;
118 nretrydma_=3;
119 first_maxkwedma_=20000;
120 first_nretrydma_=9;
[3681]121
[3671]122 NbFiles=nfiles;
123 NBlocPerFile=nblocfile;
124 OutPathName=outpath;
[3681]125
[3671]126 nZones=nzon;
127 nPaqZone=npaqzon;
[3681]128
[3671]129 swapall=BR_Copy;
130 savesigfits=true;
131 fgnulldev4fits=false;
[3674]132
[3681]133 fg_hard_ctrlc=false;
[3674]134
[3671]135 fgreducpsize=false;
[3674]136 reducneedcopy=false;
[3673]137 pqreducmode=BR_CopyRA;
[3671]138 redpqsize=PaqSize;
139 reducoffset=0;
140
[3757]141 tcpportid=BRSPORTID;
142 pci2eth_fgdirect=false;
[3897]143 ethr_nlink=0;
144 ethr_forcesamefc_=false;
[3901]145 ethr_sfc_maxdpc_=0;
146 ethr_sfc_maxresync_=0;
[3899]147 ethr_waitendmsg_=false;
[3757]148
[3674]149 skysource="";
[3681]150
[3876]151// --- variables de controle pour le monitoring
[3681]152 fgdoProc=false;
153 nmeanProc=512;
154 stepProc=5;
155 nmaxProc=0;
[3876]156// --- variables de controle pour le calcul des visibilites
157 fgdoVisiC = false;
158 nmeanVisiC=1024;
159 nbcalgrpVisiC=1;
160 nthrVisiC=1;
161 freqminVisiC=freqmaxVisiC=0;
162 nbinfreqVisiC=1;
[3681]163
[3876]164// Autres variables / variables speciales
[3671]165 monothr=false;
166 activate_pattern=false;
[3681]167 nopciLossRate=0.;
[3671]168
[3883]169// niveau d'impression,debug ...
170 prtlevel_=0;
171 prtmodulo_=50000;
[3671]172 Decode(); // On decode et on complete les parametres
173}
174
175/* --Methode-- */
176BRParList::BRParList(BRParList const & p)
177{
178 Set(p);
179}
180
181/* --Methode-- */
182void BRParList::Set(BRParList const & p)
183{
[3681]184 AcqMode=p.AcqMode;
185 fgdatafft=p.fgdatafft;
186 fgsinglechannel=p.fgsinglechannel;
187
[3671]188 FiberListS=p.FiberListS;
[3909]189 FiberNum=p.FiberNum;
190 FiberIdsS=p.FiberIdsS;
191 FiberIds=p.FiberIds;
[3681]192
[3671]193 PaqSize=p.PaqSize;
[3909]194
[3674]195 dmasizekb=p.dmasizekb;
[3909]196 maxkwedma_=p.maxkwedma_;
197 nretrydma_=p.nretrydma_;
198 first_maxkwedma_=p.first_maxkwedma_;
199 first_nretrydma_=p.first_nretrydma_;
[3681]200
[3671]201 NbFiles=p.NbFiles;
202 NBlocPerFile=p.NBlocPerFile;
203 OutPathName=p.OutPathName;
[3681]204
[3671]205 nZones=p.nZones;
206 nPaqZone=p.nPaqZone;
[3681]207
[3671]208 swapall=p.swapall;
209 savesigfits=p.savesigfits;
210 fgnulldev4fits=p.fgnulldev4fits;
211 fg_hard_ctrlc=p.fg_hard_ctrlc;
212 fgnulldev4fits=p.fgnulldev4fits;
213
214 fgreducpsize=p.fgreducpsize;
[3674]215 reducneedcopy=p.reducneedcopy;
[3673]216 pqreducmode=p.pqreducmode;
[3671]217 redpqsize=p.redpqsize;
218 reducoffset=p.reducoffset;
219
[3760]220 tcpportid=p.tcpportid;
[3757]221 pci2eth_fgdirect=p.pci2eth_fgdirect;
222 eths_targets=p.eths_targets;
223 ethr_nlink=p.ethr_nlink;
[3883]224 ethr_forcesamefc_=p.ethr_forcesamefc_;
[3897]225 ethr_sfc_maxdpc_=p.ethr_sfc_maxdpc_;
226 ethr_sfc_maxresync_=p.ethr_sfc_maxresync_;
[3899]227 ethr_waitendmsg_=p.ethr_waitendmsg_;
[3757]228
[3674]229 skysource=p.skysource;
[3681]230
231 fgdoProc=p.fgdoProc;
232 nmeanProc=p.nmeanProc;
233 stepProc=p.stepProc;
234 nmaxProc=p.nmaxProc;
[3674]235
[3671]236 monothr=p.monothr;
237 activate_pattern=p.activate_pattern;
[3681]238
239 nopciLossRate=p.nopciLossRate;
[3883]240
241 prtlevel_=p.prtlevel_;
242 prtmodulo_=p.prtlevel_;
243
[3671]244 return;
245}
246
247/* --Methode-- */
248void BRParList::ReadDCFile(string file)
249{
250 DataCards conf(file);
[3909]251 if(conf.HasKey("fibres"))
252 FiberListS= conf.SParam("fibres",0,"1");
253 else if(conf.HasKey("fibers"))
254 FiberListS= conf.SParam("fibers",0,"1");
255 if(conf.HasKey("fiberids"))
256 FiberIdsS= conf.SParam("fiberids",0,"1");
257
[3674]258 OutPathName= conf.SParam("outpathname",0,"TstAcq");
259 skysource= conf.SParam("skysource",0,"");
260 PaqSize=(uint_4)conf.IParam("paqsize",0,16424);
[3909]261
[3674]262 dmasizekb =(uint_4) conf.IParam("dmasizekb",0,32);
[3909]263 maxkwedma_=(unsigned int)conf.IParam("waitenddma",0,1000);
264 nretrydma_=(unsigned int)conf.IParam("waitenddma",1,3);
265 first_maxkwedma_=(unsigned int)conf.IParam("waitenddma",2,20*maxkwedma_);
266 first_nretrydma_=(unsigned int)conf.IParam("waitenddma",3,3*nretrydma_);
267
[3674]268 NbFiles=conf.IParam("nbfiles",0,1);
269 NBlocPerFile=conf.IParam("nblocperfile",0,10);
[3671]270 AcqMode =conf.SParam("acqmode",0,"std");
[3674]271 nZones=(uint_4)conf.IParam("memmgr",0,4);
272 nPaqZone=(uint_4)conf.IParam("memmgr",1,128);
273 if (conf.HasKey("reducpaqsz")) { // reduction des tailles de paquets
274 fgreducpsize=true;
275 redpqsize=(uint_4)conf.IParam("reducpaqsz",0,PaqSize/4);
276 reducoffset=(uint_4)conf.IParam("reducpaqsz",1,0);
277 }
[3757]278 // Mot cle pour le mode envoi-reception sur ethernet
279 tcpportid=conf.IParam("tcpportid",0,BRSPORTID);
280 if (conf.HasKey("pci2ethdirect")) pci2eth_fgdirect = true; // Transfer direct DMA -> Ethernet
281 if (conf.HasKey("ethrtargets")) { // Machines destinations des paquets
282 for(int it=0; it<conf.NbParam("ethrtargets"); it++)
283 eths_targets.push_back(conf.SParam("ethrtargets",it));
284 }
285 ethr_nlink=conf.IParam("ethrnlink",0,0); // Nombre de sources de paquets en reception ethernet
[3897]286 if (conf.HasKey("ethrforcesamefc")) {
287 ethr_forcesamefc_=true; // force SAME FrameCounter on all links
[3901]288 ethr_sfc_maxdpc_=conf.IParam("ethrforcesamefc",0,0);
289 ethr_sfc_maxresync_=conf.IParam("ethrforcesamefc",1,0);
[3897]290 }
[3899]291 if (conf.HasKey("ethrwaitendmsg")) ethr_waitendmsg_=true;
[3757]292
[3876]293 // Parametre de controle du monitoring
[3681]294 if (conf.HasKey("monitor")) {
295 fgdoProc=true;
296 nmeanProc=conf.IParam("monitor",0,512);
297 stepProc=conf.IParam("monitor",1,10);
298 nmaxProc=conf.IParam("monitor",2,0);
299 }
[3876]300 // Parametres pour le calcul des visibilites - le flag fgdoVisiC ne peut etre active
301 // qu'avec l'option de ligne de commande de mfacq
302 if (conf.HasKey("visicalc")) {
303 nmeanVisiC=conf.IParam("visicalc",0,1024);
304 nbcalgrpVisiC=conf.IParam("visicalc",1,1);
305 nthrVisiC=conf.IParam("visicalc",2,1);
306 }
307 if (conf.HasKey("visicfreq")) {
308 freqminVisiC=conf.IParam("visicfreq",0,0);
309 freqmaxVisiC=conf.IParam("visicfreq",1,0);
310 nbinfreqVisiC=conf.IParam("visicfreq",2,1);
311 }
312
[3681]313 nopciLossRate=conf.DParam("nopcilossrate",0,0.);
[3674]314 fg_hard_ctrlc=conf.HasKey("hard_ctrlc");
[3681]315 if (conf.HasKey("nosavesigfits")) savesigfits=false;
[3883]316 if (conf.HasKey("prtlev")) {
317 prtlevel_=conf.IParam("prtlev",0,0);
318 prtmodulo_=conf.IParam("prtlev",1,50000);
319 }
320
[3671]321 Decode();
322}
323
324/* --Methode-- */
325void BRParList::Decode()
326{
327 vector<string> fiblist;
328 FillVStringFrString(FiberListS, fiblist, ',');
329 for (int fib=0; fib<fiblist.size(); fib++) {
[3909]330 FiberNum.push_back(atoi(fiblist[fib].c_str()));
[3671]331 }
[3909]332 vector<string> fibids;
333 FillVStringFrString(FiberIdsS, fibids, ',');
334 for (int fib=0; fib<fibids.size(); fib++) {
335 FiberIds.push_back(atoi(fibids[fib].c_str()));
336 }
337
[3672]338 if (OutPathName == "/dev/null") {
339 fgnulldev4fits=true;
340 }
341 else {
342 size_t len = OutPathName.length();
343 if ((len>1)&&(OutPathName[len-1]!='/')) OutPathName+='/';
344 fgnulldev4fits=false;
345 }
[3671]346 string acqmode = AcqMode;
[3681]347 fgdatafft=false; fgsinglechannel=false;
[3674]348 reducneedcopy=false; pqreducmode=BR_TwoChanReduc;
[3909]349 if ((acqmode == "std")||(acqmode=="raw2c")) swapall = BR_Copy ;
350 if (acqmode=="raw1c") { swapall = BR_Copy ; fgsinglechannel=true; pqreducmode=BR_OneChanReduc; }
351
352 if ((acqmode == "fft2c")||(acqmode == "fft1c")) swapall = BR_Copy ;
[3671]353 if (acqmode == "nosw") swapall = BR_Copy ;
354 if (acqmode == "nof") { swapall = BR_Copy ; savesigfits = false; }
[3909]355 if (acqmode == "ordfft1c") { swapall = BR_FFTOneChan; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
356 if (acqmode == "ordfft2c") { swapall = BR_FFTTwoChan; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
357
[3674]358 if (acqmode == "fft1cnof")
359 { swapall = BR_FFTOneChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
360 if (acqmode == "fft2cnof")
361 { swapall = BR_FFTTwoChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
[3671]362 if (acqmode == "mono") { monothr = true; swapall = BR_Copy; }
363 if (acqmode == "monodirect") { monothr = true; swapall = BR_CopyHDR;}
364 if (acqmode == "patmonodirect") { monothr = true; swapall = BR_CopyHDR; activate_pattern=true; }
365 if (acqmode == "patmono") { monothr = true; swapall = BR_Copy; activate_pattern=true; }
366 if (acqmode == "patnof") { savesigfits = false; swapall = BR_Copy; activate_pattern=true; }
367 if (acqmode == "pattern") { savesigfits = true; swapall = BR_Copy; activate_pattern=true; }
368
369 if (acqmode == "swapall") swapall = BR_SwapAll;
[3674]370 if (acqmode == "fft1csw")
371 { swapall = BR_FFTOneChanSwapAll; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
372 if (acqmode == "fft2csw")
373 { swapall = BR_FFTTwoChanSwapAll; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
374 if (acqmode == "fft1cswnof")
375 { swapall = BR_FFTOneChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
376 if (acqmode == "fft2cswnof")
377 { swapall = BR_FFTTwoChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
[3671]378 if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") ) swapall = BR_SwapHDR;
379 if ((acqmode == "swapallnof") || (acqmode == "mxs") ) savesigfits = false;
380 if (acqmode == "monoswh") { monothr = true; swapall = BR_SwapHDR;; }
381 if (acqmode == "monosw") { monothr = true; swapall = BR_SwapAll; }
382
383 if (acqmode == "swap32") swapall = BR_Swap32 ;
384 if (acqmode == "nof32") { swapall = BR_Swap32 ; savesigfits = false; }
[3674]385 if (acqmode == "fft1c32")
386 { swapall = BR_FFTOneChanSwap32; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
387 if (acqmode == "fft2c32")
388 { swapall = BR_FFTTwoChanSwap32; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
389 if (acqmode == "fft1cnof32")
390 { swapall = BR_FFTOneChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
391 if (acqmode == "fft2cnof32")
392 { swapall = BR_FFTTwoChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
393
[3681]394 if ((swapall==BR_FFTTwoChan)||(swapall==BR_FFTTwoChanSwapAll)||(swapall==BR_FFTTwoChanSwap32)) {
395 fgdatafft=true;
396 }
397 if ((swapall==BR_FFTOneChan)||(swapall==BR_FFTOneChanSwapAll)||(swapall==BR_FFTOneChanSwap32)) {
398 fgdatafft=true; fgsinglechannel=true;
399 }
400
[3674]401 if (fgreducpsize) {
402 if (redpqsize>=PaqSize) fgreducpsize=false;
403 else {
404 if(reducoffset>(PaqSize-redpqsize)/2) reducoffset=(PaqSize-redpqsize)/2;
405 }
406 }
[3671]407}
408
409/* --Methode-- */
410ostream& BRParList::Print(ostream& os)
411{
412 os << " ------ BRParList::Print() ----- " << endl;
413 os << " FiberListS=" << FiberListS ;
[3909]414 os << " FiberIdsS=" << FiberIdsS ;
415 os << " Fibers (Num->Id): ";
416 for(size_t f=0; f<NbFibers(); f++) cout << FiberNum[f] << " -> " << FiberIds[f] << " ; " ;
417 os << endl;
[3671]418 os << " PaqSize=" <<PaqSize;
[3909]419 os << " DMA_Size_kb=" <<dmasizekb << " (EndDMA: Maxkw=" << maxkwedma_ << " NRetry=" << nretrydma_
420 << " FirstDMA: Maxkw=" << first_maxkwedma_ << " NRetry=" << first_nretrydma_ << ")" << endl;
[3671]421 os << " AcqMode="<<AcqMode;
422 os << " Type of acquisition :" << BRPaquet::FmtConvToString( swapall) << endl;
[3674]423 os << " SkySource=" << skysource;
[3671]424 os << " NbFiles="<<NbFiles;
425 os << " NBlocPerFile="<<NBlocPerFile;
426 os << " OutPathName="<<OutPathName << endl;
427 os << " MemMgr: nZones="<<nZones;
[3674]428 os << " nPaqZone="<<nPaqZone<<endl;
429 if (fgreducpsize) {
430 os << " PaquetSize Reduction, ReducedSize=" << redpqsize << " Offset=" << reducoffset << endl;
431 }
[3757]432 if (eths_targets.size()>0) {
[3764]433 cout << " DMA->Ethernet NbTargets=" << eths_targets.size()
434 << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << " :";
[3757]435 for(size_t it=0; it<eths_targets.size(); it++) cout << eths_targets[it] << " , ";
436 cout << endl;
437 }
[3897]438 cout << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
439 if (ethr_forcesamefc_)
440 cout << "EthernetReader mode: ForceSameFrameCounter read mode with Max_PaquetCounterDiff= "
[3899]441 << ethr_sfc_maxdpc_ << " MaxNbResync=" << ethr_sfc_maxresync_
442 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl;
[3897]443 else
[3899]444 cout << "EthernetReader mode: AllOKPaquets read mode "
445 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl;
[3883]446
[3681]447 if (fgdoProc>0)
448 os << " Monitoring NMeanProc=" << nmeanProc << " StepProc=" << stepProc << " NMaxProc=" << nmaxProc << endl;
449 else os << " No monotoring thread " << endl;
[3876]450 if (fgdoVisiC) {
451 os << " Visibility calculation, nbCalGrp=" << nbcalgrpVisiC << " NThr/VisCal=" << nthrVisiC << endl;
452 os << " ... VisiCalc FrequencyBinning FreqMin= " << freqminVisiC << " FreqMax= " << freqmaxVisiC
453 << " NBinFreq= " << nbinfreqVisiC<< endl;
454 }
[3671]455 os << " fg_hard_ctrlc=" << ((fg_hard_ctrlc)?"true":"false");
456 os << " Save to fits " << ((savesigfits)?"true":"false") << endl;
457 os << " monothr y(1)/n(0) " << ((monothr)?"true":"false");
458 os << " ActivatePattern " << ((activate_pattern)?"true":"false") << endl;
[3883]459 os << " PrtLevel=" << prtlevel_ << " PrtCntModulo=" << prtmodulo_ << endl;
460
[3671]461 return os;
462}
463
464
[3672]465//-------------------- Classe BRAcqConfig -----------------------
466
[3671]467BRParList* BRAcqConfig::param_=NULL;
[3672]468BRConfList* BRAcqConfig::config_=NULL;
[3671]469
470/* --Methode-- */
471BRAcqConfig::BRAcqConfig()
472{
473 if (param_==NULL) param_ = new BRParList;
[3672]474 if (config_==NULL) config_ = new BRConfList;
[3671]475}
476
477/* --Methode-- */
[3672]478ostream& BRAcqConfig::Print(ostream& os)
479{
480 os << " ------------ BAORadio Acq Run/Configuration -------- " << endl;
481 config_->Print(os);
482 param_->Print(os);
483 os << " ----------------------------------------------------- " << endl;
484}
485
486/* --Methode-- */
[3671]487int BRAcqConfig::CreateOutputDirectories()
488{
[3672]489 char cmd[1024];
[3671]490 if (param_->fgnulldev4fits!=true) {
[3672]491 sprintf(cmd,"mkdir %s%s",config_->BaseDirectory().c_str(), param_->OutPathName.c_str());
[3671]492 if (system(cmd) < 0) {
[3672]493 cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
494 << cmd << " -> stop" << endl;
[3671]495 return 2;
496 }
497 cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
498
[3672]499 memset(cmd,0,1024);
[3671]500 for (int i= 0; i< NFibers() ; i++) {
[3672]501 sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->FiberNum[i]);
[3671]502 if (system(cmd) < 0) {
503 cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
[3672]504 << cmd << " -> stop" << endl;
[3671]505 return 3;
506 }
507 else cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
508 }
509 }
510 else {
511 string ProcPathName = "./XZXZXZX/";
512 cout << " Using " << ProcPathName << " for other processed files ... " << endl;
513 char cmd[512];
514 sprintf(cmd,"mkdir %s",ProcPathName.c_str());
515 if (system(cmd) < 0) {
516 cout << "CreateOutputDirectories()/Error: Can not create subdirectory ./XZXZXZX/"
517 << "-> stop" << endl;
518 return 3;
519 }
520 else cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
521 }
522 return 0;
523}
524
525/* --Methode-- */
526string BRAcqConfig::OutputDirectoryFib(int ifib)
527{
528 char buff[24];
[3672]529 sprintf(buff,"Fiber%d/",param_->FiberNum[ifib]);
530 return ( config_->BaseDirectory() + param_->OutPathName + buff );
[3671]531}
Note: See TracBrowser for help on using the repository browser.