[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-- */
|
---|
| 12 | ADCBoardDesc::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-- */
|
---|
| 19 | ADCBoardDesc::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-- */
|
---|
| 26 | ADCBoardDesc& 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-- */
|
---|
| 37 | ostream& 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-- */
|
---|
| 45 | BRConfList::BRConfList()
|
---|
| 46 | : basedir_("./")
|
---|
| 47 | {
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | /* --Methode-- */
|
---|
| 51 | BRConfList::BRConfList(string basedir)
|
---|
| 52 | : basedir_(basedir)
|
---|
| 53 | {
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | /* --Methode-- */
|
---|
| 57 | BRConfList::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-- */
|
---|
| 65 | BRConfList::BRConfList(BRConfList const & cf)
|
---|
| 66 | : basedir_(cf.basedir_), boards_(cf.boards_)
|
---|
| 67 | {
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | /* --Methode-- */
|
---|
[3674] | 71 | void 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] | 79 | void BRConfList::Set(BRConfList const & cf)
|
---|
| 80 | {
|
---|
| 81 | basedir_=cf.basedir_;
|
---|
| 82 | boards_=cf.boards_;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | /* --Methode-- */
|
---|
| 86 | ostream& 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-- */
|
---|
| 94 | void BRConfList::ReadDCFile(string file)
|
---|
| 95 | {
|
---|
| 96 | // A FAIRE
|
---|
| 97 | }
|
---|
| 98 |
|
---|
[3671] | 99 | // Classe qui memorise tous les parametres importants de l'acquisition
|
---|
| 100 |
|
---|
| 101 | /* --Methode-- */
|
---|
[3681] | 102 | BRParList::BRParList(string acqmod, string fibres,unsigned int paqsz,
|
---|
| 103 | unsigned int dmaszkb, int nfiles, int nblocfile,
|
---|
| 104 | string outpath, uint_4 nzon , uint_4 npaqzon)
|
---|
[3671] | 105 | {
|
---|
[3681] | 106 | AcqMode=acqmod;
|
---|
| 107 | fgdatafft=false;
|
---|
| 108 | fgsinglechannel=false;
|
---|
| 109 |
|
---|
[3671] | 110 | FiberListS=fibres;
|
---|
| 111 | NbFibers=0;
|
---|
| 112 | for (int fib=0; fib<PMAXNBFIBRES;fib++) FiberNum[fib]=0;
|
---|
| 113 | PaqSize=paqsz;
|
---|
[3674] | 114 | dmasizekb=dmaszkb;
|
---|
[3681] | 115 |
|
---|
[3671] | 116 | NbFiles=nfiles;
|
---|
| 117 | NBlocPerFile=nblocfile;
|
---|
| 118 | OutPathName=outpath;
|
---|
[3681] | 119 |
|
---|
[3671] | 120 | nZones=nzon;
|
---|
| 121 | nPaqZone=npaqzon;
|
---|
[3681] | 122 |
|
---|
[3671] | 123 | swapall=BR_Copy;
|
---|
| 124 | savesigfits=true;
|
---|
| 125 | fgnulldev4fits=false;
|
---|
[3674] | 126 |
|
---|
[3681] | 127 | fg_hard_ctrlc=false;
|
---|
[3674] | 128 |
|
---|
[3671] | 129 | fgreducpsize=false;
|
---|
[3674] | 130 | reducneedcopy=false;
|
---|
[3673] | 131 | pqreducmode=BR_CopyRA;
|
---|
[3671] | 132 | redpqsize=PaqSize;
|
---|
| 133 | reducoffset=0;
|
---|
| 134 |
|
---|
[3757] | 135 | tcpportid=BRSPORTID;
|
---|
[3760] | 136 | eth_transfer_blksz=1024;
|
---|
[3757] | 137 | pci2eth_fgdirect=false;
|
---|
| 138 | ethr_nlink = 0;
|
---|
| 139 |
|
---|
[3674] | 140 | skysource="";
|
---|
[3681] | 141 |
|
---|
| 142 | fgdoProc=false;
|
---|
| 143 | nmeanProc=512;
|
---|
| 144 | stepProc=5;
|
---|
| 145 | nmaxProc=0;
|
---|
| 146 |
|
---|
[3671] | 147 | monothr=false;
|
---|
| 148 | activate_pattern=false;
|
---|
[3681] | 149 | nopciLossRate=0.;
|
---|
[3671] | 150 |
|
---|
| 151 | Decode(); // On decode et on complete les parametres
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | /* --Methode-- */
|
---|
| 155 | BRParList::BRParList(BRParList const & p)
|
---|
| 156 | {
|
---|
| 157 | Set(p);
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | /* --Methode-- */
|
---|
| 161 | void BRParList::Set(BRParList const & p)
|
---|
| 162 | {
|
---|
[3681] | 163 | AcqMode=p.AcqMode;
|
---|
| 164 | fgdatafft=p.fgdatafft;
|
---|
| 165 | fgsinglechannel=p.fgsinglechannel;
|
---|
| 166 |
|
---|
[3671] | 167 | FiberListS=p.FiberListS;
|
---|
| 168 | NbFibers=p.NbFibers;
|
---|
| 169 | for (int fib=0; fib<PMAXNBFIBRES;fib++) FiberNum[fib]=p.FiberNum[fib];
|
---|
[3681] | 170 |
|
---|
[3671] | 171 | PaqSize=p.PaqSize;
|
---|
[3674] | 172 | dmasizekb=p.dmasizekb;
|
---|
[3681] | 173 |
|
---|
[3671] | 174 | NbFiles=p.NbFiles;
|
---|
| 175 | NBlocPerFile=p.NBlocPerFile;
|
---|
| 176 | OutPathName=p.OutPathName;
|
---|
[3681] | 177 |
|
---|
[3671] | 178 | nZones=p.nZones;
|
---|
| 179 | nPaqZone=p.nPaqZone;
|
---|
[3681] | 180 |
|
---|
[3671] | 181 | swapall=p.swapall;
|
---|
| 182 | savesigfits=p.savesigfits;
|
---|
| 183 | fgnulldev4fits=p.fgnulldev4fits;
|
---|
| 184 | fg_hard_ctrlc=p.fg_hard_ctrlc;
|
---|
| 185 | fgnulldev4fits=p.fgnulldev4fits;
|
---|
| 186 |
|
---|
| 187 | fgreducpsize=p.fgreducpsize;
|
---|
[3674] | 188 | reducneedcopy=p.reducneedcopy;
|
---|
[3673] | 189 | pqreducmode=p.pqreducmode;
|
---|
[3671] | 190 | redpqsize=p.redpqsize;
|
---|
| 191 | reducoffset=p.reducoffset;
|
---|
| 192 |
|
---|
[3760] | 193 | tcpportid=p.tcpportid;
|
---|
| 194 | eth_transfer_blksz=p.eth_transfer_blksz;
|
---|
[3757] | 195 | pci2eth_fgdirect=p.pci2eth_fgdirect;
|
---|
| 196 | eths_targets=p.eths_targets;
|
---|
| 197 | ethr_nlink=p.ethr_nlink;
|
---|
| 198 |
|
---|
[3674] | 199 | skysource=p.skysource;
|
---|
[3681] | 200 |
|
---|
| 201 | fgdoProc=p.fgdoProc;
|
---|
| 202 | nmeanProc=p.nmeanProc;
|
---|
| 203 | stepProc=p.stepProc;
|
---|
| 204 | nmaxProc=p.nmaxProc;
|
---|
[3674] | 205 |
|
---|
[3671] | 206 | monothr=p.monothr;
|
---|
| 207 | activate_pattern=p.activate_pattern;
|
---|
[3681] | 208 |
|
---|
| 209 | nopciLossRate=p.nopciLossRate;
|
---|
[3671] | 210 | return;
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | /* --Methode-- */
|
---|
| 214 | void BRParList::ReadDCFile(string file)
|
---|
| 215 | {
|
---|
| 216 | DataCards conf(file);
|
---|
[3674] | 217 | FiberListS= conf.SParam("fibres",0,"1");
|
---|
| 218 | OutPathName= conf.SParam("outpathname",0,"TstAcq");
|
---|
| 219 | skysource= conf.SParam("skysource",0,"");
|
---|
| 220 | PaqSize=(uint_4)conf.IParam("paqsize",0,16424);
|
---|
| 221 | dmasizekb =(uint_4) conf.IParam("dmasizekb",0,32);
|
---|
| 222 | NbFiles=conf.IParam("nbfiles",0,1);
|
---|
| 223 | NBlocPerFile=conf.IParam("nblocperfile",0,10);
|
---|
[3671] | 224 | AcqMode =conf.SParam("acqmode",0,"std");
|
---|
[3674] | 225 | nZones=(uint_4)conf.IParam("memmgr",0,4);
|
---|
| 226 | nPaqZone=(uint_4)conf.IParam("memmgr",1,128);
|
---|
| 227 | if (conf.HasKey("reducpaqsz")) { // reduction des tailles de paquets
|
---|
| 228 | fgreducpsize=true;
|
---|
| 229 | redpqsize=(uint_4)conf.IParam("reducpaqsz",0,PaqSize/4);
|
---|
| 230 | reducoffset=(uint_4)conf.IParam("reducpaqsz",1,0);
|
---|
| 231 | }
|
---|
[3757] | 232 | // Mot cle pour le mode envoi-reception sur ethernet
|
---|
| 233 | tcpportid=conf.IParam("tcpportid",0,BRSPORTID);
|
---|
[3760] | 234 | eth_transfer_blksz=(size_t)conf.IParam("ethtrbsz",0,1024);
|
---|
[3757] | 235 | if (conf.HasKey("pci2ethdirect")) pci2eth_fgdirect = true; // Transfer direct DMA -> Ethernet
|
---|
| 236 | if (conf.HasKey("ethrtargets")) { // Machines destinations des paquets
|
---|
| 237 | for(int it=0; it<conf.NbParam("ethrtargets"); it++)
|
---|
| 238 | eths_targets.push_back(conf.SParam("ethrtargets",it));
|
---|
| 239 | }
|
---|
| 240 | ethr_nlink=conf.IParam("ethrnlink",0,0); // Nombre de sources de paquets en reception ethernet
|
---|
| 241 |
|
---|
| 242 |
|
---|
[3681] | 243 | if (conf.HasKey("monitor")) {
|
---|
| 244 | fgdoProc=true;
|
---|
| 245 | nmeanProc=conf.IParam("monitor",0,512);
|
---|
| 246 | stepProc=conf.IParam("monitor",1,10);
|
---|
| 247 | nmaxProc=conf.IParam("monitor",2,0);
|
---|
| 248 | }
|
---|
| 249 | nopciLossRate=conf.DParam("nopcilossrate",0,0.);
|
---|
[3674] | 250 | fg_hard_ctrlc=conf.HasKey("hard_ctrlc");
|
---|
[3681] | 251 | if (conf.HasKey("nosavesigfits")) savesigfits=false;
|
---|
[3671] | 252 | Decode();
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | /* --Methode-- */
|
---|
| 256 | void BRParList::Decode()
|
---|
| 257 | {
|
---|
| 258 | vector<string> fiblist;
|
---|
| 259 | FillVStringFrString(FiberListS, fiblist, ',');
|
---|
| 260 | NbFibers=fiblist.size();
|
---|
| 261 | for (int fib=0; fib<fiblist.size(); fib++) {
|
---|
| 262 | FiberNum[fib]=atoi(fiblist[fib].c_str());
|
---|
| 263 | }
|
---|
[3672] | 264 | if (OutPathName == "/dev/null") {
|
---|
| 265 | fgnulldev4fits=true;
|
---|
| 266 | }
|
---|
| 267 | else {
|
---|
| 268 | size_t len = OutPathName.length();
|
---|
| 269 | if ((len>1)&&(OutPathName[len-1]!='/')) OutPathName+='/';
|
---|
| 270 | fgnulldev4fits=false;
|
---|
| 271 | }
|
---|
[3671] | 272 | string acqmode = AcqMode;
|
---|
[3681] | 273 | fgdatafft=false; fgsinglechannel=false;
|
---|
[3674] | 274 | reducneedcopy=false; pqreducmode=BR_TwoChanReduc;
|
---|
[3681] | 275 | if ((acqmode == "std")||(acqmode=="raw2c")) swapall = BR_Copy ;
|
---|
[3671] | 276 | if (acqmode == "nosw") swapall = BR_Copy ;
|
---|
| 277 | if (acqmode == "nof") { swapall = BR_Copy ; savesigfits = false; }
|
---|
[3674] | 278 | if (acqmode == "fft1c") { swapall = BR_FFTOneChan; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
|
---|
| 279 | if (acqmode == "fft2c") { swapall = BR_FFTTwoChan; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
|
---|
| 280 | if (acqmode == "fft1cnof")
|
---|
| 281 | { swapall = BR_FFTOneChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
|
---|
| 282 | if (acqmode == "fft2cnof")
|
---|
| 283 | { swapall = BR_FFTTwoChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
|
---|
[3671] | 284 | if (acqmode == "mono") { monothr = true; swapall = BR_Copy; }
|
---|
| 285 | if (acqmode == "monodirect") { monothr = true; swapall = BR_CopyHDR;}
|
---|
| 286 | if (acqmode == "patmonodirect") { monothr = true; swapall = BR_CopyHDR; activate_pattern=true; }
|
---|
| 287 | if (acqmode == "patmono") { monothr = true; swapall = BR_Copy; activate_pattern=true; }
|
---|
| 288 | if (acqmode == "patnof") { savesigfits = false; swapall = BR_Copy; activate_pattern=true; }
|
---|
| 289 | if (acqmode == "pattern") { savesigfits = true; swapall = BR_Copy; activate_pattern=true; }
|
---|
| 290 |
|
---|
| 291 | if (acqmode == "swapall") swapall = BR_SwapAll;
|
---|
[3674] | 292 | if (acqmode == "fft1csw")
|
---|
| 293 | { swapall = BR_FFTOneChanSwapAll; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
|
---|
| 294 | if (acqmode == "fft2csw")
|
---|
| 295 | { swapall = BR_FFTTwoChanSwapAll; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
|
---|
| 296 | if (acqmode == "fft1cswnof")
|
---|
| 297 | { swapall = BR_FFTOneChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
|
---|
| 298 | if (acqmode == "fft2cswnof")
|
---|
| 299 | { swapall = BR_FFTTwoChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
|
---|
[3671] | 300 | if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") ) swapall = BR_SwapHDR;
|
---|
| 301 | if ((acqmode == "swapallnof") || (acqmode == "mxs") ) savesigfits = false;
|
---|
| 302 | if (acqmode == "monoswh") { monothr = true; swapall = BR_SwapHDR;; }
|
---|
| 303 | if (acqmode == "monosw") { monothr = true; swapall = BR_SwapAll; }
|
---|
| 304 |
|
---|
| 305 | if (acqmode == "swap32") swapall = BR_Swap32 ;
|
---|
| 306 | if (acqmode == "nof32") { swapall = BR_Swap32 ; savesigfits = false; }
|
---|
[3674] | 307 | if (acqmode == "fft1c32")
|
---|
| 308 | { swapall = BR_FFTOneChanSwap32; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
|
---|
| 309 | if (acqmode == "fft2c32")
|
---|
| 310 | { swapall = BR_FFTTwoChanSwap32; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
|
---|
| 311 | if (acqmode == "fft1cnof32")
|
---|
| 312 | { swapall = BR_FFTOneChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; }
|
---|
| 313 | if (acqmode == "fft2cnof32")
|
---|
| 314 | { swapall = BR_FFTTwoChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; }
|
---|
| 315 |
|
---|
[3681] | 316 | if ((swapall==BR_FFTTwoChan)||(swapall==BR_FFTTwoChanSwapAll)||(swapall==BR_FFTTwoChanSwap32)) {
|
---|
| 317 | fgdatafft=true;
|
---|
| 318 | }
|
---|
| 319 | if ((swapall==BR_FFTOneChan)||(swapall==BR_FFTOneChanSwapAll)||(swapall==BR_FFTOneChanSwap32)) {
|
---|
| 320 | fgdatafft=true; fgsinglechannel=true;
|
---|
| 321 | }
|
---|
| 322 |
|
---|
[3674] | 323 | if (fgreducpsize) {
|
---|
| 324 | if (redpqsize>=PaqSize) fgreducpsize=false;
|
---|
| 325 | else {
|
---|
| 326 | if(reducoffset>(PaqSize-redpqsize)/2) reducoffset=(PaqSize-redpqsize)/2;
|
---|
| 327 | }
|
---|
| 328 | }
|
---|
[3671] | 329 | }
|
---|
| 330 |
|
---|
| 331 | /* --Methode-- */
|
---|
| 332 | ostream& BRParList::Print(ostream& os)
|
---|
| 333 | {
|
---|
| 334 | os << " ------ BRParList::Print() ----- " << endl;
|
---|
| 335 | os << " FiberListS=" << FiberListS ;
|
---|
| 336 | os << " PaqSize=" <<PaqSize;
|
---|
[3674] | 337 | os << " DMA_Size_kb=" <<dmasizekb << endl;
|
---|
[3671] | 338 | os << " AcqMode="<<AcqMode;
|
---|
| 339 | os << " Type of acquisition :" << BRPaquet::FmtConvToString( swapall) << endl;
|
---|
[3674] | 340 | os << " SkySource=" << skysource;
|
---|
[3671] | 341 | os << " NbFiles="<<NbFiles;
|
---|
| 342 | os << " NBlocPerFile="<<NBlocPerFile;
|
---|
| 343 | os << " OutPathName="<<OutPathName << endl;
|
---|
| 344 | os << " MemMgr: nZones="<<nZones;
|
---|
[3674] | 345 | os << " nPaqZone="<<nPaqZone<<endl;
|
---|
| 346 | if (fgreducpsize) {
|
---|
| 347 | os << " PaquetSize Reduction, ReducedSize=" << redpqsize << " Offset=" << reducoffset << endl;
|
---|
| 348 | }
|
---|
[3757] | 349 | if (eths_targets.size()>0) {
|
---|
| 350 | cout << " DMA->Ethernet NbTargets=" << eths_targets.size() << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << " :" << endl;
|
---|
| 351 | for(size_t it=0; it<eths_targets.size(); it++) cout << eths_targets[it] << " , ";
|
---|
| 352 | cout << endl;
|
---|
| 353 | }
|
---|
| 354 | cout << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
|
---|
[3681] | 355 | if (fgdoProc>0)
|
---|
| 356 | os << " Monitoring NMeanProc=" << nmeanProc << " StepProc=" << stepProc << " NMaxProc=" << nmaxProc << endl;
|
---|
| 357 | else os << " No monotoring thread " << endl;
|
---|
[3671] | 358 | os << " fg_hard_ctrlc=" << ((fg_hard_ctrlc)?"true":"false");
|
---|
| 359 | os << " Save to fits " << ((savesigfits)?"true":"false") << endl;
|
---|
| 360 | os << " monothr y(1)/n(0) " << ((monothr)?"true":"false");
|
---|
| 361 | os << " ActivatePattern " << ((activate_pattern)?"true":"false") << endl;
|
---|
| 362 |
|
---|
| 363 | return os;
|
---|
| 364 | }
|
---|
| 365 |
|
---|
| 366 |
|
---|
[3672] | 367 | //-------------------- Classe BRAcqConfig -----------------------
|
---|
| 368 |
|
---|
[3671] | 369 | BRParList* BRAcqConfig::param_=NULL;
|
---|
[3672] | 370 | BRConfList* BRAcqConfig::config_=NULL;
|
---|
[3671] | 371 |
|
---|
| 372 | /* --Methode-- */
|
---|
| 373 | BRAcqConfig::BRAcqConfig()
|
---|
| 374 | {
|
---|
| 375 | if (param_==NULL) param_ = new BRParList;
|
---|
[3672] | 376 | if (config_==NULL) config_ = new BRConfList;
|
---|
[3671] | 377 | }
|
---|
| 378 |
|
---|
| 379 | /* --Methode-- */
|
---|
[3672] | 380 | ostream& BRAcqConfig::Print(ostream& os)
|
---|
| 381 | {
|
---|
| 382 | os << " ------------ BAORadio Acq Run/Configuration -------- " << endl;
|
---|
| 383 | config_->Print(os);
|
---|
| 384 | param_->Print(os);
|
---|
| 385 | os << " ----------------------------------------------------- " << endl;
|
---|
| 386 | }
|
---|
| 387 |
|
---|
| 388 | /* --Methode-- */
|
---|
[3671] | 389 | int BRAcqConfig::CreateOutputDirectories()
|
---|
| 390 | {
|
---|
[3672] | 391 | char cmd[1024];
|
---|
[3671] | 392 | if (param_->fgnulldev4fits!=true) {
|
---|
[3672] | 393 | sprintf(cmd,"mkdir %s%s",config_->BaseDirectory().c_str(), param_->OutPathName.c_str());
|
---|
[3671] | 394 | if (system(cmd) < 0) {
|
---|
[3672] | 395 | cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
|
---|
| 396 | << cmd << " -> stop" << endl;
|
---|
[3671] | 397 | return 2;
|
---|
| 398 | }
|
---|
| 399 | cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
|
---|
| 400 |
|
---|
[3672] | 401 | memset(cmd,0,1024);
|
---|
[3671] | 402 | for (int i= 0; i< NFibers() ; i++) {
|
---|
[3672] | 403 | sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->FiberNum[i]);
|
---|
[3671] | 404 | if (system(cmd) < 0) {
|
---|
| 405 | cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
|
---|
[3672] | 406 | << cmd << " -> stop" << endl;
|
---|
[3671] | 407 | return 3;
|
---|
| 408 | }
|
---|
| 409 | else cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
|
---|
| 410 | }
|
---|
| 411 | }
|
---|
| 412 | else {
|
---|
| 413 | string ProcPathName = "./XZXZXZX/";
|
---|
| 414 | cout << " Using " << ProcPathName << " for other processed files ... " << endl;
|
---|
| 415 | char cmd[512];
|
---|
| 416 | sprintf(cmd,"mkdir %s",ProcPathName.c_str());
|
---|
| 417 | if (system(cmd) < 0) {
|
---|
| 418 | cout << "CreateOutputDirectories()/Error: Can not create subdirectory ./XZXZXZX/"
|
---|
| 419 | << "-> stop" << endl;
|
---|
| 420 | return 3;
|
---|
| 421 | }
|
---|
| 422 | else cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
|
---|
| 423 | }
|
---|
| 424 | return 0;
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | /* --Methode-- */
|
---|
| 428 | string BRAcqConfig::OutputDirectoryFib(int ifib)
|
---|
| 429 | {
|
---|
| 430 | char buff[24];
|
---|
[3672] | 431 | sprintf(buff,"Fiber%d/",param_->FiberNum[ifib]);
|
---|
| 432 | return ( config_->BaseDirectory() + param_->OutPathName + buff );
|
---|
[3671] | 433 | }
|
---|