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