#include #include "brparam.h" #include "strutilxx.h" #include "bracqvers.h" #ifndef BRSPORTID #define BRSPORTID 6912 #endif /* --Methode-- */ ADCBoardDesc::ADCBoardDesc(int id, string sbid, string cyc_firmw, string str1_firmw, string str2_firmw) : id_(id), sbid_(sbid), cyclone_firmware_(cyc_firmw), stratix1_firmware_(str1_firmw), stratix2_firmware_(str2_firmw) { } /* --Methode-- */ ADCBoardDesc::ADCBoardDesc(ADCBoardDesc const& bdes) : id_(bdes.id_), sbid_(bdes.sbid_), cyclone_firmware_(bdes.cyclone_firmware_), stratix1_firmware_(bdes.stratix1_firmware_), stratix2_firmware_(bdes.stratix2_firmware_) { } /* --Methode-- */ ADCBoardDesc& ADCBoardDesc::Set(ADCBoardDesc const & bdes) { id_ = bdes.id_; sbid_ = bdes.sbid_; cyclone_firmware_ = bdes.cyclone_firmware_; stratix1_firmware_ = bdes.stratix1_firmware_; stratix2_firmware_ = bdes.stratix2_firmware_; return(*this); } /* --Methode-- */ ostream& ADCBoardDesc::Print(ostream& os) { os << "ADCBoard#" << id_ << "(" << sbid_ << ") Cyclone:" << cyclone_firmware_ << " Stratix1: " << stratix1_firmware_ << " Stratix2: " << stratix2_firmware_ << endl; return os; } /* --Methode-- */ BRConfList::BRConfList() : basedir_("./") { } /* --Methode-- */ BRConfList::BRConfList(string basedir) : basedir_(basedir) { } /* --Methode-- */ BRConfList::BRConfList(string basedir, vector boards) : basedir_(basedir), boards_(boards) { size_t len = basedir_.length(); if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/'; } /* --Methode-- */ BRConfList::BRConfList(BRConfList const & cf) : basedir_(cf.basedir_), boards_(cf.boards_) { } /* --Methode-- */ void BRConfList::SetBaseDirectory(string basedir) { basedir_=basedir; size_t len = basedir_.length(); if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/'; } /* --Methode-- */ void BRConfList::Set(BRConfList const & cf) { basedir_=cf.basedir_; boards_=cf.boards_; } /* --Methode-- */ ostream& BRConfList::Print(ostream& os) { os << " ----- BRConfList:: BaseDir:" << basedir_ << " NBoards= " << boards_.size() << endl; for(size_t k=0; k Ethernet if (conf.HasKey("ethrtargets")) { // Machines destinations des paquets for(int it=0; it fiblist; FillVStringFrString(FiberListS, fiblist, ','); for (int fib=0; fib fibids; FillVStringFrString(FiberIdsS, fibids, ','); for (int fib=0; fib1)&&(OutPathName[len-1]!='/')) OutPathName+='/'; fgnulldev4fits=false; } string acqmode = AcqMode; fgdatafft=false; fgsinglechannel=false; reducneedcopy=false; pqreducmode=BR_TwoChanReduc; if ((acqmode == "std")||(acqmode=="raw2c")) swapall = BR_Copy ; if (acqmode=="raw1c") { swapall = BR_Copy ; fgsinglechannel=true; pqreducmode=BR_OneChanReduc; } if ((acqmode == "fft2c")||(acqmode == "fft1c")) swapall = BR_Copy ; if (acqmode == "nosw") swapall = BR_Copy ; if (acqmode == "nof") { swapall = BR_Copy ; savesigfits = false; } if (acqmode == "ordfft1c") { swapall = BR_FFTOneChan; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; } if (acqmode == "ordfft2c") { swapall = BR_FFTTwoChan; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; } if (acqmode == "fft1cnof") { swapall = BR_FFTOneChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; } if (acqmode == "fft2cnof") { swapall = BR_FFTTwoChan; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; } if (acqmode == "mono") { monothr = true; swapall = BR_Copy; } if (acqmode == "monodirect") { monothr = true; swapall = BR_CopyHDR;} if (acqmode == "patmonodirect") { monothr = true; swapall = BR_CopyHDR; activate_pattern=true; } if (acqmode == "patmono") { monothr = true; swapall = BR_Copy; activate_pattern=true; } if (acqmode == "patnof") { savesigfits = false; swapall = BR_Copy; activate_pattern=true; } if (acqmode == "pattern") { savesigfits = true; swapall = BR_Copy; activate_pattern=true; } if (acqmode == "swapall") swapall = BR_SwapAll; if (acqmode == "fft1csw") { swapall = BR_FFTOneChanSwapAll; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; } if (acqmode == "fft2csw") { swapall = BR_FFTTwoChanSwapAll; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; } if (acqmode == "fft1cswnof") { swapall = BR_FFTOneChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; } if (acqmode == "fft2cswnof") { swapall = BR_FFTTwoChanSwapAll; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; } if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") ) swapall = BR_SwapHDR; if ((acqmode == "swapallnof") || (acqmode == "mxs") ) savesigfits = false; if (acqmode == "monoswh") { monothr = true; swapall = BR_SwapHDR;; } if (acqmode == "monosw") { monothr = true; swapall = BR_SwapAll; } if (acqmode == "swap32") swapall = BR_Swap32 ; if (acqmode == "nof32") { swapall = BR_Swap32 ; savesigfits = false; } if (acqmode == "fft1c32") { swapall = BR_FFTOneChanSwap32; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; } if (acqmode == "fft2c32") { swapall = BR_FFTTwoChanSwap32; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; } if (acqmode == "fft1cnof32") { swapall = BR_FFTOneChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_OneChanReducK0; } if (acqmode == "fft2cnof32") { swapall = BR_FFTTwoChanSwap32; savesigfits = false; reducneedcopy=true; pqreducmode=BR_TwoChanReducK0; } if ((swapall==BR_FFTTwoChan)||(swapall==BR_FFTTwoChanSwapAll)||(swapall==BR_FFTTwoChanSwap32)) { fgdatafft=true; } if ((swapall==BR_FFTOneChan)||(swapall==BR_FFTOneChanSwapAll)||(swapall==BR_FFTOneChanSwap32)) { fgdatafft=true; fgsinglechannel=true; } if (fgreducpsize) { if (redpqsize>=PaqSize) fgreducpsize=false; else { if(reducoffset>(PaqSize-redpqsize)/2) reducoffset=(PaqSize-redpqsize)/2; } } } /* --Methode-- */ ostream& BRParList::Print(ostream& os) { os << " ------ BRParList::Print() ----- " << endl; os << " FiberListS=" << FiberListS ; os << " FiberIdsS=" << FiberIdsS ; os << " Fibers (Num->Id): "; for(size_t f=0; f " << FiberIds[f] << " ; " ; os << endl; os << " PaqSize=" <Ethernet NbTargets=" << eths_targets.size() << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << " :"; for(size_t it=0; it0) os << " Monitoring NMeanProc=" << nmeanProc << " StepProc=" << stepProc << " NMaxProc=" << nmaxProc << endl; else os << " No monotoring thread " << endl; if (fgdoVisiC) { os << " Visibility calculation, nbCalGrp=" << nbcalgrpVisiC << " NThr/VisCal=" << nthrVisiC << endl; os << " ... VisiCalc FrequencyBinning FreqMin= " << freqminVisiC << " FreqMax= " << freqmaxVisiC << " NBinFreq= " << nbinfreqVisiC<< endl; } os << " fg_hard_ctrlc=" << ((fg_hard_ctrlc)?"true":"false"); os << " Save to fits " << ((savesigfits)?"true":"false") << endl; os << " monothr y(1)/n(0) " << ((monothr)?"true":"false"); os << " ActivatePattern " << ((activate_pattern)?"true":"false") << endl; os << " PrtLevel=" << prtlevel_ << " PrtCntModulo=" << prtmodulo_ << endl; return os; } //-------------------- Classe BRAcqConfig ----------------------- BRParList* BRAcqConfig::param_=NULL; BRConfList* BRAcqConfig::config_=NULL; /* --Methode-- */ BRAcqConfig::BRAcqConfig() { if (param_==NULL) param_ = new BRParList; if (config_==NULL) config_ = new BRConfList; } /* --Methode-- */ ostream& BRAcqConfig::Print(ostream& os) { os << " ------------ BAORadio Acq Run/Configuration -------- " << endl; config_->Print(os); param_->Print(os); os << " ----------------------------------------------------- " << endl; } /* --Methode-- */ int BRAcqConfig::CreateOutputDirectories() { char cmd[1024]; if (param_->fgnulldev4fits!=true) { sprintf(cmd,"mkdir %s%s",config_->BaseDirectory().c_str(), param_->OutPathName.c_str()); if (system(cmd) < 0) { cout << "CreateOutputDirectories()/Error: Can not create subdirectory " << cmd << " -> stop" << endl; return 2; } cout << "CreateOutputDirectories() - Executed command " << cmd << endl; memset(cmd,0,1024); for (int i= 0; i< NFibers() ; i++) { sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->FiberNum[i]); if (system(cmd) < 0) { cout << "CreateOutputDirectories()/Error: Can not create subdirectory " << cmd << " -> stop" << endl; return 3; } else cout << "CreateOutputDirectories() - Executed command " << cmd << endl; } } else { string ProcPathName = "./XZXZXZX/"; cout << " Using " << ProcPathName << " for other processed files ... " << endl; char cmd[512]; sprintf(cmd,"mkdir %s",ProcPathName.c_str()); if (system(cmd) < 0) { cout << "CreateOutputDirectories()/Error: Can not create subdirectory ./XZXZXZX/" << "-> stop" << endl; return 3; } else cout << "CreateOutputDirectories() - Executed command " << cmd << endl; } return 0; } /* --Methode-- */ string BRAcqConfig::OutputDirectoryFib(int ifib) { char buff[24]; sprintf(buff,"Fiber%d/",param_->FiberNum[ifib]); return ( config_->BaseDirectory() + param_->OutPathName + buff ); }