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