Changeset 561


Ignore:
Timestamp:
Oct 8, 2011, 6:42:23 PM (13 years ago)
Author:
campagne
Message:

work on calibration (jec)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BAORadio/AmasNancay/trunk/mergeAnaFiles.cc

    r560 r561  
    5353  int nSliceInFreq_;  //used by reduceSpectra() fnc
    5454  string typeOfCalib_;//type of calibration to be done
     55  string calibFreq_;  //freq. value used for calibration
    5556} para;
    5657//--------------------------------------------------------------
     
    6162}
    6263//---------
    63   class median_of_empty_list_exception:public std::exception{
     64class median_of_empty_list_exception:public std::exception{
    6465    virtual const char* what() const throw() {
    6566    return "Attempt to take the median of an empty list of numbers.  "
     
    8687  }
    8788
     89//-------------
     90void split(const string& str, const string& delimiters , vector<string>& tokens) {
     91    // Skip delimiters at beginning.
     92    string::size_type lastPos = str.find_first_not_of(delimiters, 0);
     93    // Find first "non-delimiter".
     94    string::size_type pos     = str.find_first_of(delimiters, lastPos);
     95
     96    while (string::npos != pos || string::npos != lastPos)
     97    {
     98        // Found a token, add it to the vector.
     99        tokens.push_back(str.substr(lastPos, pos - lastPos));
     100        // Skip delimiters.  Note the "not_of"
     101        lastPos = str.find_first_not_of(delimiters, pos);
     102        // Find next "non-delimiter"
     103        pos = str.find_first_of(delimiters, lastPos);
     104    }
     105}
    88106//--------------------------------------------------------------
    89107char *regexp (const char *string, const char *patrn, int *begin, int *end) {   
     
    211229//Used like:
    212230//
     231// void meanCalibBAODiffOnOffCycles() throw(string) {
     232
     233//   list<string> listOfFiles;
     234//   string directoryName;
     235//   directoryName = para.inPath_ + "/" + para.sourceName_;
     236
     237//   //Make the listing of the directory
     238//   listOfFiles = ListOfFileInDir(directoryName,para.ppfFile_);
     239 
     240//   list<string>::const_iterator iFile, iFileEnd, iSpecOff, iSpecOffEnd, iSpecOn, iSpecOnEnd;
     241//   iFileEnd = listOfFiles.end();
     242 
     243
     244//   //Loop on files
     245//   uint_4 nRuns=0;
     246//   TArray<r_4> tableOfSpectra(NUMBER_OF_FREQ,NUMBER_OF_CHANNELS,TOTAL_NUM_CYCLES); //TOTAL_NUM_CYCLES should be large enough...
     247
     248
     249//   for (iFile = listOfFiles.begin(); iFile != iFileEnd; ++iFile) {
     250//     if (para.debuglev_>90){
     251//       cout << "load file <" << *iFile << ">" << endl;
     252//     }
     253
     254//     vector<string> tokens;
     255//     split(*File,"_",tokens);
     256//     string dateOfRun = tokens[1];
     257//     string srcLower = tokens[2];
     258//     if (para.debuglev_>90){
     259//       cout << "date <" << dateOfRun << ">" << endl;
     260//     }
     261   
     262//     PInPersist fin(*iFile);
     263//     vector<string> vec = fin.GetNameTags();
     264
     265//     if (para.typeOfCalib_ == "perRun") {
     266//       ///////////////////
     267//       //make the calibration of the mean of all Off and On of the run and perform the difference
     268
     269//       vector<string> modeList;
     270//       modeList.push_back("On");
     271//       modeList.push_back("Off");
     272//       vector<string>::const_iterator iMode;
     273//       map<string, TMatrix<r_4> > spectreModeCollect;
     274
     275//       for (iMode = modeList.begin(); iMode!=modeList.end(); ++iMode) {
     276//      ///////////////////
     277//      //
     278//      //Compute the mean of the mode
     279//      //
     280//      list<string> listOfSpectra;
     281//      //Keep only required PPF objects
     282//      string matchstr = "specRaw"+(*iMode)+"[0-9]+";
     283//      std::remove_copy_if(
     284//                          vec.begin(), vec.end(), back_inserter(listOfSpectra),
     285//                          not1(StringMatch(matchstr))
     286//                          );
     287       
     288//      listOfSpectra.sort(stringCompare);
     289//      iSpecEnd = listOfSpectra.end();
     290//      TMatrix<r_4> meanOfSpectra(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
     291//      uint_4 nSpectra=0;
     292//      //Loop of spectra matrix
     293//      for (iSpec = listOfSpectra.begin(); iSpec!=iSpecEnd;  ++iSpec){
     294//        if (para.debuglev_>90){
     295//          cout << " spactra <" << *iSpec << ">" << endl;
     296//        }
     297//        TMatrix<r_4> aSpec(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
     298//        fin.GetObject(aSpec,*iSpec);
     299//        //How to see if the GetObject is ok?? Ask Reza
     300//        nSpectra++;
     301//        meanOfSpectra+=aSpec;
     302//      }//end loop Off
     303//      //Mean
     304//      if(nSpectra>0)meanOfSpectra=(r_4)(nSpectra);
     305
     306//      //BAO Calibrator
     307//      string calibFileName = directoryName + "/"
     308//        + "calib_" + dateOfRun + "_" + srcLower + "_"+(*iMode)+"_"
     309//        + para.calibFreq_ +"MHz-All.txt";
     310//      if(debuglev_>0) cout << "Read Calib file " << calibFileName << endl;
     311//      ifstream ifs(calibFileName.c_str());
     312//      if ( ! ifs.is_open() ) {
     313//        rc = 999;
     314//        throw calibFileName + " cannot be opened...";
     315//      }       
     316//      TVector<r_4> calibBAOfactors;
     317//      sa_size_t nr,nc; //values read
     318//      calibBAOfactorsOff.ReadASCII(ifs,nr,nc);
     319//      if(debuglev_>9){
     320//        cout << "(nr,nc): "<< nr << "," << nc << endl;
     321//        calibBAOfactors.Print(cout);
     322//      }
     323       
     324//      for (sa_size_t iCh=0;iCh<NUMBER_OF_CHANNELS;++iCh){
     325//        meanOfSpectra(Range(iCh), Range::all()) /=calibBAOfactors(iCh);
     326//      }
     327//      //storage
     328//      spectreModeCollect.insert(pair<string, TMatrix<r_4> >(*iMode,TMatrix<r_4>(meanOfSpectra,false))); //do not share data (cf. SOPHYA)
     329//       }//end of mode
     330
     331//       //Take the difference ON-OFF in current run
     332//       TMatrix<r_4>diffOnOff = spectreModeCollect["On"]-spectreModeCollect["Off"];
     333
     334
     335//     } else if (para.typeOfCalib_ == "perCycle") {
     336//       //perform the calibration of the OFF and ON per cycle, then make the mean and take the diff
     337//     } else {
     338//       string msg="FATAL (meanCalibBAODiffOnOffCycles); unknown calibration mode "
     339//      + para.typeOfCalib_ ;
     340//       throw(msg);
     341//     } 
     342
     343
     344//     nRuns++;
     345   
     346//   }//eo loop on spectra in a file
     347// }
    213348void meanCalibBAODiffOnOffCycles() throw(string) {
    214349
     
    220355  listOfFiles = ListOfFileInDir(directoryName,para.ppfFile_);
    221356 
    222   list<string>::const_iterator iFile, iFileEnd, iSpecOff, iSpecOffEnd, iSpecOn, iSpecOnEnd;
     357  list<string>::const_iterator iFile, iFileEnd, iSpec, iSpecEnd;
    223358  iFileEnd = listOfFiles.end();
    224  
    225   //Loop on files
     359
     360  //Loop on files/run
     361  uint_4 totalNumberCycles=0; //total number of cycles for normalisation
    226362  for (iFile = listOfFiles.begin(); iFile != iFileEnd; ++iFile) {
    227363    if (para.debuglev_>90){
    228364      cout << "load file <" << *iFile << ">" << endl;
    229365    }
     366
     367    vector<string> tokens;
     368    split(*iFile,"_",tokens);
     369    string dateOfRun = tokens[1];
     370    if (para.debuglev_>90){
     371      cout << "date <" << dateOfRun << ">" << endl;
     372    }
     373    vector<string> tokens2;
     374    split(tokens[2],".",tokens2);
     375    string srcLower = tokens2[0];
     376
     377
     378   
    230379    PInPersist fin(*iFile);
    231380    vector<string> vec = fin.GetNameTags();
    232381
    233     if (para.typeOfCalib_ == "perRun") {
    234       ///////////////////
    235       //make the calibration of the mean of all Off and On of the run and perform the difference
    236       ///////////////////
    237       //
    238       //Compute the mean of the Off
    239       //
    240       list<string> listOfSpectraOff;
     382    vector<string> modeList;
     383    modeList.push_back("On");
     384    modeList.push_back("Off");
     385    vector<string>::const_iterator iMode;
     386   
     387    map<string, list<int> > cycleModeCollect;
     388   
     389    for (iMode = modeList.begin(); iMode!=modeList.end(); ++iMode) {
     390      list<string> listOfSpectra;
    241391      //Keep only required PPF objects
     392      string matchstr = "specRaw"+(*iMode)+"[0-9]+";
    242393      std::remove_copy_if(
    243394                          vec.begin(), vec.end(), back_inserter(listOfSpectra),
    244                           not1(match)
     395                          not1(StringMatch(matchstr))
    245396                          );
    246397     
    247       listOfSpectraOff.sort(stringCompare);
    248       iSpecOffEnd = listOfSpectraOff.end();
    249       TMatrix<r_4> meanOfSpectraOff(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
    250       uint_4 nSpectraOff=0;
     398      listOfSpectra.sort(stringCompare);
     399      iSpecEnd = listOfSpectra.end();
     400     
     401      matchstr = "[0-9]+";
    251402      //Loop of spectra matrix
    252       for (iSpecOff = listOfSpectraOff.begin(); iSpecOff !=iSpecOffEnd;  ++iSpecOff){
     403      list<int> listOfCycles;
     404      for (iSpec = listOfSpectra.begin(); iSpec!=iSpecEnd;  ++iSpec){
     405        int b,e;
     406        regexp(iSpec->c_str(),matchstr.c_str(),&b,&e);
    253407        if (para.debuglev_>90){
    254           cout << " spactra <" << *iSpecOff << ">" << endl;
     408          cout << " spactra <" << *iSpec << ">" << endl;
     409          cout << " cycle " << iSpec->substr(b) << endl;
    255410        }
    256         TMatrix<r_4> aSpec(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
    257         fin.GetObject(aSpec,*iSpecOff);
    258         //How to see if the GetObject is ok?? Ask Reza
    259         nSpectraOff++;
    260         meanOfSpectraOff+=aSpec;
    261       }//end loop Off
    262       //Normalisation
    263       if(nSpectraOff>0)meanOfSpectraOff/=(r_4)(nSpectraOff);
    264       //
    265       //Compute the mean of the On
    266       //
    267       list<string> listOfSpectraOn;
    268       //Keep only required PPF objects
    269       std::remove_copy_if(
    270                           vec.begin(), vec.end(), back_inserter(listOfSpectra),
    271                           not1(match)
    272                           );
     411        listOfCycles.push_back(atoi((iSpec->substr(b)).c_str()));
     412      }//end loop spectra
     413      cycleModeCollect[*iMode] = listOfCycles;
     414    }//end of mode   
     415
     416    //Take the Intersection of the list Of cycles in mode Off and On   
     417    list<int> commonCycles;
     418    set_intersection(cycleModeCollect["On"].begin(),
     419                     cycleModeCollect["On"].end(),
     420                     cycleModeCollect["Off"].begin(),
     421                     cycleModeCollect["Off"].end(),
     422                     back_inserter(commonCycles)
     423                     );
     424   
     425    if (para.debuglev_>90){
     426      cout << "Liste of cycles common to On & Off: <";
     427      for (list<int>::iterator i=commonCycles.begin(); i!=commonCycles.end(); ++i){
     428        cout << *i << " ";
     429      }
     430      cout << ">" << endl;
     431    }
     432   
     433    //
     434    //Load BAO Calibration factors "per Cycle and Channels"
     435    //Compute the mean per Cycle to
     436    //  fill factors "per Run and Channels" with the same cycle list
     437    //
     438    //
     439    //TODO improve the code....
     440
     441    TMatrix<r_4> calibBAOfactors_Off_Cycle_Ch0;
     442    TMatrix<r_4> calibBAOfactors_Off_Cycle_Ch1;
     443    TMatrix<r_4> calibBAOfactors_On_Cycle_Ch0;
     444    TMatrix<r_4> calibBAOfactors_On_Cycle_Ch1;
     445   
     446    string calibFileName;
     447    ifstream ifs;
     448    sa_size_t nr,nc; //values read
     449
     450    //OFF Cycle per Channel
     451    calibFileName = directoryName + "/"
     452      + "calib_" + dateOfRun + "_" + srcLower + "_Off_"
     453      + para.calibFreq_ +"MHz-Ch0Cycles.txt";
     454    if(para.debuglev_>0) cout << "Read Calib file " << calibFileName << endl;
     455    ifs.open(calibFileName.c_str());
     456    if ( ! ifs.is_open() ) {
     457
     458      throw calibFileName + " cannot be opened...";
     459    }   
     460    calibBAOfactors_Off_Cycle_Ch0.ReadASCII(ifs,nr,nc);
     461    if(para.debuglev_>9){
     462      cout << "(nr,nc): "<< nr << "," << nc << endl;
     463      calibBAOfactors_Off_Cycle_Ch0.Print(cout);
     464    }
     465
     466    TMatrix<r_4> calibBAOfactors_Off_Run_Ch0(nr,nc);
     467    calibBAOfactors_Off_Run_Ch0.Column(0) = calibBAOfactors_Off_Cycle_Ch0.Column(0);
     468    {//Compute the mean
     469      TVector<r_4> coef(calibBAOfactors_Off_Cycle_Ch0(Range::all(),Range::last()),false);
     470      double mean,sigma;
     471      MeanSigma(coef,mean,sigma);
     472      cout << "Mean: " << mean << " sigma " << sigma << endl;
     473      calibBAOfactors_Off_Run_Ch0.Column(1).SetCst(mean);
     474    }
     475    if(para.debuglev_>9){
     476      cout << "Fill calib. with mean value " << endl;
     477      calibBAOfactors_Off_Run_Ch0.Print(cout);
     478    }
     479    ifs.close();
     480
     481    //
     482    calibFileName = directoryName + "/"
     483      + "calib_" + dateOfRun + "_" + srcLower + "_Off_"
     484      + para.calibFreq_ +"MHz-Ch1Cycles.txt";
     485    if(para.debuglev_>0) cout << "Read Calib file " << calibFileName << endl;
     486    ifs.open(calibFileName.c_str());
     487    if ( ! ifs.is_open() ) {
     488
     489      throw calibFileName + " cannot be opened...";
     490    }   
     491    calibBAOfactors_Off_Cycle_Ch1.ReadASCII(ifs,nr,nc);
     492    if(para.debuglev_>9){
     493      cout << "(nr,nc): "<< nr << "," << nc << endl;
     494      calibBAOfactors_Off_Cycle_Ch1.Print(cout);
     495    }
     496    TMatrix<r_4> calibBAOfactors_Off_Run_Ch1(nr,nc);
     497    calibBAOfactors_Off_Run_Ch1.Column(0) = calibBAOfactors_Off_Cycle_Ch1.Column(0);
     498    {//Compute the mean
     499      TVector<r_4> coef(calibBAOfactors_Off_Cycle_Ch1(Range::all(),Range::last()),false);
     500      double mean,sigma;
     501      MeanSigma(coef,mean,sigma);
     502      cout << "Mean: " << mean << " sigma " << sigma << endl;
     503      calibBAOfactors_Off_Run_Ch1.Column(1).SetCst(mean);
     504    }
     505    if(para.debuglev_>9){
     506      cout << "Fill calib. with mean value " << endl;
     507      calibBAOfactors_Off_Run_Ch1.Print(cout);
     508    }
     509    ifs.close();
     510
     511    //ON Cycle per Channel
     512    calibFileName = directoryName + "/"
     513      + "calib_" + dateOfRun + "_" + srcLower + "_On_"
     514      + para.calibFreq_ +"MHz-Ch0Cycles.txt";
     515    if(para.debuglev_>0) cout << "Read Calib file " << calibFileName << endl;
     516    ifs.open(calibFileName.c_str());
     517    if ( ! ifs.is_open() ) {
     518
     519      throw calibFileName + " cannot be opened...";
     520    }   
     521    calibBAOfactors_On_Cycle_Ch0.ReadASCII(ifs,nr,nc);
     522    if(para.debuglev_>9){
     523      cout << "(nr,nc): "<< nr << "," << nc << endl;
     524      calibBAOfactors_On_Cycle_Ch0.Print(cout);
     525       
     526    }
     527
     528    TMatrix<r_4> calibBAOfactors_On_Run_Ch0(nr,nc);
     529    calibBAOfactors_On_Run_Ch0.Column(0) = calibBAOfactors_On_Cycle_Ch0.Column(0);
     530    {//Compute the mean
     531      TVector<r_4> coef(calibBAOfactors_On_Cycle_Ch0(Range::all(),Range::last()),false);
     532      double mean,sigma;
     533      MeanSigma(coef,mean,sigma);
     534      cout << "Mean: " << mean << " sigma " << sigma << endl;
     535      calibBAOfactors_On_Run_Ch0.Column(1).SetCst(mean);
     536    }
     537    if(para.debuglev_>9){
     538      cout << "Fill calib. with mean value " << endl;
     539      calibBAOfactors_On_Run_Ch0.Print(cout);
     540    }
     541    ifs.close();
     542
     543   
     544    calibFileName = directoryName + "/"
     545      + "calib_" + dateOfRun + "_" + srcLower + "_On_"
     546      + para.calibFreq_ +"MHz-Ch1Cycles.txt";
     547    if(para.debuglev_>0) cout << "Read Calib file " << calibFileName << endl;
     548    ifs.open(calibFileName.c_str());
     549    if ( ! ifs.is_open() ) {
     550      throw calibFileName + " cannot be opened...";
     551    }   
     552    calibBAOfactors_On_Cycle_Ch1.ReadASCII(ifs,nr,nc);
     553    if(para.debuglev_>9){
     554      cout << "(nr,nc): "<< nr << "," << nc << endl;
     555      calibBAOfactors_On_Cycle_Ch1.Print(cout);
     556    }
     557    TMatrix<r_4> calibBAOfactors_On_Run_Ch1(nr,nc);
     558    calibBAOfactors_On_Run_Ch1.Column(0) = calibBAOfactors_On_Cycle_Ch1.Column(0);
     559    {//Compute the mean
     560      TVector<r_4> coef(calibBAOfactors_On_Cycle_Ch1(Range::all(),Range::last()),false);
     561      double mean,sigma;
     562      MeanSigma(coef,mean,sigma);
     563      cout << "Mean: " << mean << " sigma " << sigma << endl;
     564      calibBAOfactors_On_Run_Ch1.Column(1).SetCst(mean);
     565    }
     566    if(para.debuglev_>9){
     567      cout << "Fill calib. with mean value " << endl;
     568      calibBAOfactors_On_Run_Ch1.Print(cout);
     569    }
     570
     571    ifs.close();
     572   
     573    //link <cycle> - <calibration coefficient>
     574    map<int,r_4> calibBAO_Off_Ch0;
     575    map<int,r_4> calibBAO_Off_Ch1;
     576    map<int,r_4> calibBAO_On_Ch0;
     577    map<int,r_4> calibBAO_On_Ch1;
     578    if (para.typeOfCalib_ == "perRun") {
     579      sa_size_t nr = calibBAOfactors_Off_Run_Ch0.NRows();
     580      for (sa_size_t ir=0; ir<nr; ++ir){
     581        calibBAO_Off_Ch0[(int)calibBAOfactors_Off_Run_Ch0(0,ir)]
     582          = calibBAOfactors_Off_Run_Ch0(1,ir);
     583      }
     584      nr = calibBAOfactors_Off_Run_Ch1.NRows();
     585      for (sa_size_t ir=0; ir<nr; ++ir){
     586        calibBAO_Off_Ch1[(int)calibBAOfactors_Off_Run_Ch1(0,ir)]
     587          = calibBAOfactors_Off_Run_Ch1(1,ir);
     588      }
     589
     590      nr = calibBAOfactors_On_Run_Ch0.NRows();
     591      for (sa_size_t ir=0; ir<nr; ++ir){
     592        calibBAO_On_Ch0[(int)calibBAOfactors_On_Run_Ch0(0,ir)]
     593          = calibBAOfactors_On_Run_Ch0(1,ir);
     594      }
     595      nr = calibBAOfactors_On_Run_Ch1.NRows();
     596      for (sa_size_t ir=0; ir<nr; ++ir){
     597        calibBAO_On_Ch1[(int)calibBAOfactors_On_Run_Ch1(0,ir)]
     598          = calibBAOfactors_On_Run_Ch1(1,ir);
     599      }
    273600     
    274       listOfSpectraOn.sort(stringCompare);
    275       iSpecOnEnd = listOfSpectraOn.end();
    276       TMatrix<r_4> meanOfSpectraOn(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
    277       uint_4 nSpectraOn=0;
    278       //Loop of spectra matrix
    279       for (iSpecOn = listOfSpectraOn.begin(); iSpecOn !=iSpecOnEnd;  ++iSpecOn){
    280         if (para.debuglev_>90){
    281           cout << " spactra <" << *iSpecOn << ">" << endl;
    282         }
    283         TMatrix<r_4> aSpec(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
    284         fin.GetObject(aSpec,*iSpecOn);
    285         //How to see if the GetObject is ok?? Ask Reza
    286         nSpectraOn++;
    287         meanOfSpectraOn+=aSpec;
    288       }//end loop On
    289       //Normalisation
    290       if(nSpectraOn>0)meanOfSpectraOn/=(r_4)(nSpectraOn);
    291       //
    292       //Get the calibration file
    293       //
     601    } else if (para.typeOfCalib_ == "perCycle") {
     602
     603      sa_size_t nr = calibBAOfactors_Off_Cycle_Ch0.NRows();
     604      for (sa_size_t ir=0; ir<nr; ++ir){
     605        calibBAO_Off_Ch0[(int)calibBAOfactors_Off_Cycle_Ch0(0,ir)]
     606          = calibBAOfactors_Off_Cycle_Ch0(1,ir);
     607      }
     608      nr = calibBAOfactors_Off_Cycle_Ch1.NRows();
     609      for (sa_size_t ir=0; ir<nr; ++ir){
     610        calibBAO_Off_Ch1[(int)calibBAOfactors_Off_Cycle_Ch1(0,ir)]
     611          = calibBAOfactors_Off_Cycle_Ch1(1,ir);
     612      }
     613
     614      nr = calibBAOfactors_On_Cycle_Ch0.NRows();
     615      for (sa_size_t ir=0; ir<nr; ++ir){
     616        calibBAO_On_Ch0[(int)calibBAOfactors_On_Cycle_Ch0(0,ir)]
     617          = calibBAOfactors_On_Cycle_Ch0(1,ir);
     618      }
     619      nr = calibBAOfactors_On_Cycle_Ch1.NRows();
     620      for (sa_size_t ir=0; ir<nr; ++ir){
     621        calibBAO_On_Ch1[(int)calibBAOfactors_On_Cycle_Ch1(0,ir)]
     622          = calibBAOfactors_On_Cycle_Ch1(1,ir);
     623      }
     624
     625    } else {
     626      throw "Unknow calibration type: " + para.typeOfCalib_;
     627    }
     628
     629
     630   
     631//      for (sa_size_t iCh=0;iCh<NUMBER_OF_CHANNELS;++iCh){
     632//        meanOfSpectra(Range(iCh), Range::all()) /=calibBAOfactors(iCh);
     633//      }
     634
     635    //Loop on cyles
     636    for (list<int>::iterator ic=commonCycles.begin(); ic!=commonCycles.end(); ++ic){
     637      string ppftag;
     638      //load ON phase
     639      stringstream cycle;
     640      cycle << *ic;
    294641     
    295 
    296 
    297     } else if {para.typeOfCalib_ == "perCycle") {
    298       //perform the calibration of the OFF and ON per cycle, then make the mean and take the diff
    299     } else {
    300       string msg="FATAL (meanCalibBAODiffOnOffCycles); unknown calibration mode "
    301         + para.typeOfCalib_ ;
    302       throw(msg);
    303     }
    304 
    305    
    306     }//eo loop on spectra in a file
    307   }//eo loop on files
    308  
     642      ppftag = "specRawOn"+cycle.str();
     643      TMatrix<r_4> aSpecON(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
     644      fin.GetObject(aSpecON,ppftag);
     645
     646     
     647
     648
     649
     650      ppftag = "specRawOff"+cycle.str();
     651      TMatrix<r_4> aSpecOFF(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
     652      fin.GetObject(aSpecOFF,ppftag);
     653     
     654      totalNumberCycles++;
     655       
     656    }//eo loop on cycles
     657
     658  }//eo loop on spectra in a file
    309659}
    310660//-------------------------------------------------------
     
    545895  string nSliceInFreq = "32";
    546896  string typeOfCalib="perRun";
     897  string calibFreq = "1346";
    547898 
    548899  //  bool okarg=false;
     
    551902    if (strcmp(arg[ka],"-h")==0) {
    552903      cout << "Usage:  -act [meanRawDiffOnOff]|medianRawDiffOnOff|meanCalibBAODiffOnOff\n"
    553            << " -calibopt [perRun]|perCcyle (cf. in case of calibration to be done)"
     904           << " -calibopt [perRun]|perCcyle (cf. in case of calibration to be done)\n"
     905           << " -calibfreq <number> (cf. freq. used by calibration operation)\n"
    554906           << " -src [Abell85]\n -inPath [.]|<top_root_dir of the ppf file>\n"
    555907           << " (ex. /sps/baoradio/AmasNancay/JEC/\n "
    556908           << " -outPath [.]|<dir of the output> \n"
    557909           << " -nSliceInFreq [32]|<number of bin in freq. to cumulate>\n"
    558            << " -ppfFile <generic name of the input ppf files> (ex. diffOnOffRaw)"
     910           << " -ppfFile <generic name of the input ppf files> (ex. diffOnOffRaw)\n"
    559911           << " -debug <level> "
    560912           << endl;
     
    571923    else if (strcmp(arg[ka],"-calibopt")==0) {
    572924      typeOfCalib=arg[ka+1];
     925      ka+=2;
     926    }   
     927    else if (strcmp(arg[ka],"-calibfreq")==0) {
     928      calibFreq=arg[ka+1];
    573929      ka+=2;
    574930    }   
     
    602958  para.ppfFile_    = ppfFile;
    603959  para.nSliceInFreq_ = atoi(nSliceInFreq.c_str());
     960  para.typeOfCalib_ = typeOfCalib;
     961  para.calibFreq_   = calibFreq;
    604962
    605963  cout << "Dump Initial parameters ............" << endl;
     
    610968       << " ppfFile = " <<  para.ppfFile_ << "\n"
    611969       << " nSliceInFreq = " << para.nSliceInFreq_  << "\n"
     970       << " typeOfCalib = " << para.typeOfCalib_ << "\n"
     971       << " calibFreq = " <<  para.calibFreq_ << "\n"
    612972       << " debuglev = "  << para.debuglev_   << "\n";
    613973  cout << "...................................." << endl;
Note: See TracChangeset for help on using the changeset viewer.