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