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