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