Changeset 3672 in Sophya for trunk/AddOn/TAcq/brparam.cc
- Timestamp:
- Nov 13, 2009, 6:39:58 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/brparam.cc
r3671 r3672 3 3 #include "bracqvers.h" 4 4 5 /* --Methode-- */ 6 ADCBoardDesc::ADCBoardDesc(int id, string sbid, string cyc_firmw, string str1_firmw, string str2_firmw) 7 : id_(id), sbid_(sbid), cyclone_firmware_(cyc_firmw), stratix1_firmware_(str1_firmw), stratix2_firmware_(str2_firmw) 8 { 9 10 } 11 12 /* --Methode-- */ 13 ADCBoardDesc::ADCBoardDesc(ADCBoardDesc const& bdes) 14 : id_(bdes.id_), sbid_(bdes.sbid_), cyclone_firmware_(bdes.cyclone_firmware_), 15 stratix1_firmware_(bdes.stratix1_firmware_), stratix2_firmware_(bdes.stratix2_firmware_) 16 { 17 } 18 19 /* --Methode-- */ 20 ADCBoardDesc& ADCBoardDesc::Set(ADCBoardDesc const & bdes) 21 { 22 id_ = bdes.id_; 23 sbid_ = bdes.sbid_; 24 cyclone_firmware_ = bdes.cyclone_firmware_; 25 stratix1_firmware_ = bdes.stratix1_firmware_; 26 stratix2_firmware_ = bdes.stratix2_firmware_; 27 return(*this); 28 } 29 30 /* --Methode-- */ 31 ostream& ADCBoardDesc::Print(ostream& os) 32 { 33 os << "ADCBoard#" << id_ << "(" << sbid_ << ") Cyclone:" << cyclone_firmware_ 34 << " Stratix1: " << stratix1_firmware_ << " Stratix2: " << stratix2_firmware_ << endl; 35 return os; 36 } 37 38 /* --Methode-- */ 39 BRConfList::BRConfList() 40 : basedir_("./") 41 { 42 } 43 44 /* --Methode-- */ 45 BRConfList::BRConfList(string basedir) 46 : basedir_(basedir) 47 { 48 } 49 50 /* --Methode-- */ 51 BRConfList::BRConfList(string basedir, vector<ADCBoardDesc> boards) 52 : basedir_(basedir), boards_(boards) 53 { 54 size_t len = basedir_.length(); 55 if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/'; 56 } 57 58 /* --Methode-- */ 59 BRConfList::BRConfList(BRConfList const & cf) 60 : basedir_(cf.basedir_), boards_(cf.boards_) 61 { 62 } 63 64 /* --Methode-- */ 65 void BRConfList::Set(BRConfList const & cf) 66 { 67 basedir_=cf.basedir_; 68 boards_=cf.boards_; 69 } 70 71 /* --Methode-- */ 72 ostream& BRConfList::Print(ostream& os) 73 { 74 os << " ----- BRConfList:: BaseDir:" << basedir_ << " NBoards= " << boards_.size() << endl; 75 for(size_t k=0; k<boards_.size(); k++) boards_[k].Print(os); 76 return os; 77 } 78 79 /* --Methode-- */ 80 void BRConfList::ReadDCFile(string file) 81 { 82 // A FAIRE 83 } 5 84 6 85 // Classe qui memorise tous les parametres importants de l'acquisition … … 27 106 fgnulldev4fits=false; 28 107 fg_hard_ctrlc=fgcntlc; 29 fgnulldev4fits = (OutPathName == "/dev/null") ? true : false;30 31 108 fgreducpsize=false; 32 109 redpqsize=PaqSize; … … 102 179 for (int fib=0; fib<fiblist.size(); fib++) { 103 180 FiberNum[fib]=atoi(fiblist[fib].c_str()); 181 } 182 if (OutPathName == "/dev/null") { 183 fgnulldev4fits=true; 184 } 185 else { 186 size_t len = OutPathName.length(); 187 if ((len>1)&&(OutPathName[len-1]!='/')) OutPathName+='/'; 188 fgnulldev4fits=false; 104 189 } 105 190 string acqmode = AcqMode; … … 159 244 160 245 246 //-------------------- Classe BRAcqConfig ----------------------- 247 161 248 BRParList* BRAcqConfig::param_=NULL; 249 BRConfList* BRAcqConfig::config_=NULL; 162 250 163 251 /* --Methode-- */ … … 165 253 { 166 254 if (param_==NULL) param_ = new BRParList; 255 if (config_==NULL) config_ = new BRConfList; 256 } 257 258 /* --Methode-- */ 259 ostream& BRAcqConfig::Print(ostream& os) 260 { 261 os << " ------------ BAORadio Acq Run/Configuration -------- " << endl; 262 config_->Print(os); 263 param_->Print(os); 264 os << " ----------------------------------------------------- " << endl; 167 265 } 168 266 … … 170 268 int BRAcqConfig::CreateOutputDirectories() 171 269 { 172 char cmd[ 512];270 char cmd[1024]; 173 271 if (param_->fgnulldev4fits!=true) { 174 sprintf(cmd,"mkdir %s ",param_->OutPathName.c_str());272 sprintf(cmd,"mkdir %s%s",config_->BaseDirectory().c_str(), param_->OutPathName.c_str()); 175 273 if (system(cmd) < 0) { 176 cout << "CreateOutputDirectories()/Error: Can not create 177 << param_->OutPathName<< " -> stop" << endl;274 cout << "CreateOutputDirectories()/Error: Can not create subdirectory " 275 << cmd << " -> stop" << endl; 178 276 return 2; 179 277 } 180 278 cout << "CreateOutputDirectories() - Executed command " << cmd << endl; 181 279 182 memset(cmd,0, 512);280 memset(cmd,0,1024); 183 281 for (int i= 0; i< NFibers() ; i++) { 184 sprintf(cmd,"mkdir %s /Fibre%d",param_->OutPathName.c_str(),param_->FiberNum[i]);282 sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->FiberNum[i]); 185 283 if (system(cmd) < 0) { 186 284 cout << "CreateOutputDirectories()/Error: Can not create subdirectory " 187 << param_->OutPathName << "/FiberII-> stop" << endl;285 << cmd << " -> stop" << endl; 188 286 return 3; 189 287 } … … 202 300 } 203 301 else cout << "CreateOutputDirectories() - Executed command " << cmd << endl; 204 205 sprintf(cmd,"mkdir %s/Fibre1 %s/Fibre2",ProcPathName.c_str(),ProcPathName.c_str());206 if (system(cmd) < 0) {207 cout << "CreateOutputDirectories()/Error: Can not create subdirectory ./XZXZXZX/Fibre1,2"208 << "-> stop" << endl;209 return 4;210 }211 302 } 212 303 return 0; … … 217 308 { 218 309 char buff[24]; 219 sprintf(buff," /Fiber%d",param_->FiberNum[ifib]);220 return ( param_->OutPathName + buff );221 } 310 sprintf(buff,"Fiber%d/",param_->FiberNum[ifib]); 311 return ( config_->BaseDirectory() + param_->OutPathName + buff ); 312 }
Note:
See TracChangeset
for help on using the changeset viewer.