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