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