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