Changeset 3672 in Sophya for trunk/AddOn/TAcq/brparam.cc


Ignore:
Timestamp:
Nov 13, 2009, 6:39:58 PM (16 years ago)
Author:
ansari
Message:

Corrections diverses - mfacq.cc OK, Reza

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/brparam.cc

    r3671 r3672  
    33#include "bracqvers.h"
    44
     5/* --Methode-- */
     6ADCBoardDesc::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-- */
     13ADCBoardDesc::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-- */
     20ADCBoardDesc& 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-- */
     31ostream& 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-- */
     39BRConfList::BRConfList()
     40  : basedir_("./")
     41{
     42}
     43
     44/* --Methode-- */
     45BRConfList::BRConfList(string basedir)
     46  : basedir_(basedir)
     47{
     48}
     49
     50/* --Methode-- */
     51BRConfList::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-- */
     59BRConfList::BRConfList(BRConfList const & cf)
     60  : basedir_(cf.basedir_), boards_(cf.boards_)
     61{
     62}
     63
     64/* --Methode-- */
     65void BRConfList::Set(BRConfList const & cf)
     66{
     67  basedir_=cf.basedir_;
     68  boards_=cf.boards_;
     69}
     70
     71/* --Methode-- */
     72ostream& 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-- */
     80void BRConfList::ReadDCFile(string file)
     81{
     82  //  A FAIRE
     83}
    584
    685// Classe qui memorise tous les parametres importants de l'acquisition
     
    27106  fgnulldev4fits=false;
    28107  fg_hard_ctrlc=fgcntlc;
    29   fgnulldev4fits = (OutPathName == "/dev/null") ? true : false;
    30 
    31108  fgreducpsize=false;
    32109  redpqsize=PaqSize;
     
    102179  for (int fib=0; fib<fiblist.size(); fib++) {
    103180    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;
    104189  }
    105190  string acqmode = AcqMode;
     
    159244
    160245
     246//-------------------- Classe BRAcqConfig -----------------------
     247
    161248BRParList* BRAcqConfig::param_=NULL;
     249BRConfList* BRAcqConfig::config_=NULL;
    162250
    163251/* --Methode-- */
     
    165253{
    166254  if (param_==NULL)  param_ = new BRParList; 
     255  if (config_==NULL) config_ = new BRConfList;
     256}
     257
     258/* --Methode-- */
     259ostream& BRAcqConfig::Print(ostream& os)
     260{
     261  os << " ------------  BAORadio Acq Run/Configuration -------- " << endl;
     262  config_->Print(os);
     263  param_->Print(os);
     264  os << " ----------------------------------------------------- " << endl;
    167265}
    168266
     
    170268int BRAcqConfig::CreateOutputDirectories()
    171269{
    172   char cmd[512];
     270  char cmd[1024];
    173271  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());
    175273    if (system(cmd) < 0) {
    176       cout << "CreateOutputDirectories()/Error: Can not create  subdirectory "
    177            << param_->OutPathName << " -> stop" << endl;
     274      cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
     275           << cmd << " -> stop" << endl;
    178276      return 2;
    179277    }
    180278    cout << "CreateOutputDirectories() - Executed command " << cmd << endl;
    181279   
    182     memset(cmd,0,512);
     280    memset(cmd,0,1024);
    183281    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]);
    185283      if (system(cmd) < 0) {
    186284        cout << "CreateOutputDirectories()/Error: Can not create subdirectory "
    187              << param_->OutPathName << "/FiberII -> stop" << endl;
     285             << cmd << " -> stop" << endl;
    188286        return 3;
    189287      }
     
    202300    }
    203301    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     }
    211302  }
    212303  return 0;
     
    217308{
    218309  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.