• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

beamtime/tof-tdctest/go4/MATCHING/TMatchingParam.cxx (r4864/r4745)

Go to the documentation of this file.
00001 /* Generated by Together */
00002 
00003 #include "TMatchingParam.h"
00004 
00005 #include "TGo4Version.h"
00006 #if __GO4BUILDVERSION__ > 40502
00007    #include "go4iostream.h"
00008 #else
00009    #include "Riostream.h"
00010 #endif
00011  
00012 // define default values
00013 #define DEBUG_OPTION             0
00014 #define TRIGGER_SELECTION       -1
00015 #define TRIGGER_SEL_DEBUG_HIST   0
00016 #define NB_EV_AVERAGE_EFFICIENCY 0
00017 #define DETECTOR_OFFSET_TO_USE   1
00018 #define HISTOS_ENABLE            0
00019 
00020 TMatchingParam::TMatchingParam(const char* name) : TGo4Parameter(name)
00021 {
00022    ReadOptions();
00023 }
00024 
00025 //***********************************************************
00026 TMatchingParam::~TMatchingParam()
00027 {
00028 }
00029 
00030 Bool_t TMatchingParam::ReadOptions(){
00031    // Loading default values
00032    uDebug           = DEBUG_OPTION;
00033    iTriggerSelection = TRIGGER_SELECTION;                 // Trigger to be required for the matching
00034    uTriggerSelDebugHistos = TRIGGER_SEL_DEBUG_HIST;       // Disable/Enable the debug ;ode for trigger selection: 1 matching per trigger
00035    uNbEventAverageEfficiency = NB_EV_AVERAGE_EFFICIENCY;  // Number of event over which the efficiency of HD counter vs Rate is evaluated
00036    uDetectorOffsetToUse = DETECTOR_OFFSET_TO_USE;         // Select from which detector the offset for the dt matching should be taken: 0 = HD, 1 = Buc Ref
00037 
00038    uEnableSingleRpcHistos = HISTOS_ENABLE;            // Generic Single RPC <- Big switch, Disable also all other single RPC histos!!!
00039    uEnableRpcLeftRightTot = HISTOS_ENABLE;            // Enable all Histos comparing TOT on left and right side of fired strips
00040    uEnableMultiRpcHistos = HISTOS_ENABLE;             // Generic RPC - RPC  <- Big switch, Disable also all other RPC-RPC histos!!!
00041    uEnableMul1Mul1Histos = HISTOS_ENABLE;             // Enable all RPC-RPC histos on Multiplicity 1-1 events
00042    uEnableMul1MulXHistos = HISTOS_ENABLE;             // Enable all RPC-RPC histos on Multiplicity 1-X, X-1 events
00043    uEnableMul2Mul2Histos = HISTOS_ENABLE;             // Enable all RPC-RPC histos on Multiplicity 1-1, 2-1, 1-2, 2-2 events
00044    uEnableMul1Mul2Histos = HISTOS_ENABLE;             // Enable all RPC-RPC histos on Multiplicity 2-1, 1-2 events
00045    uEnableMulXMulYHistos = HISTOS_ENABLE;             // Enable all RPC-RPC histos on Multiplicity X-Y events
00046 
00047    uEnableSinglePlasticsHistos = HISTOS_ENABLE;       // Generic Single Plastic <- Big switch, Disable also all other single plastic histos!!!
00048    uEnablePlasticLeftRightTot = HISTOS_ENABLE;        // Enable all Histos comapring TOT on left and right side of Plastic hit
00049    uEnableMultiPlasticsHistos = HISTOS_ENABLE;        // Generic Plastic - Plastic <- Big switch, Disable also all other plastic-plastic histos!!!
00050 
00051    // Try to read the option filename from the general option files text file
00052    TString sOptionFileName = "./Matching_options.txt";
00053    Bool_t bFilenameFound = kFALSE;
00054    fstream optionFilenameFile("./Option_files.txt", ios::in);
00055    // Testing if the file does exist. If not I use default values
00056    if( optionFilenameFile.fail() == true)
00057    {
00058       cout<<"************************************************************************"<<endl;
00059       cout<<" File with option filename for Matching not found: using the default value ";
00060       cout<<sOptionFileName<<endl;
00061    } // if( optionFilenameFile.fail() == true)
00062       else
00063       {
00064          TString line;
00065 
00066          // Goes through all lines
00067          while( !optionFilenameFile.eof() )
00068          {
00069            line.ReadLine(optionFilenameFile, kFALSE); // Read a line of the option file and set the iterator automatically to the next line
00070 
00071            if(line(0) == '#' || line(0) == '*'||
00072                (line(0) == '/' && line(1) == '/') )
00073            {
00074               //Comment in the text file
00075               ;
00076            }
00077            else if(line.Contains("matching")==kTRUE)
00078            {
00079               sOptionFileName = ((TString)line(11, line.Sizeof()-11 ));
00080               cout<<"************************************************************************"<<endl;
00081               cout<<"Using "<<sOptionFileName<<" as source for the options of Matching step"<<endl;
00082               bFilenameFound = kTRUE;
00083               break;
00084            }
00085          } // while( !optionFilenameFile.eof() )
00086          if( optionFilenameFile.eof() && kFALSE == bFilenameFound )
00087          {
00088             cout<<"************************************************************************"<<endl;
00089             cout<<"Field for Matching step not found in File with option filename => Using "<<sOptionFileName<<endl;
00090          } // if( optionFilenameFile.eof() && kFALSE == bFilenameFound )
00091       } // else of if( optionFilenameFile.fail() == true)
00092 
00093    // Read the option file
00094    fstream setupFile(sOptionFileName, ios::in);
00095    
00096    // Testing if the option does exist. If not I use default values.
00097    if( setupFile.fail() == true)
00098    {
00099       cout<<"Error for TMatching: Setup file "<<sOptionFileName<<" can not be opened or is missing."<<endl;
00100       cout<<"=> Using default values!"<<endl;
00101    }
00102    else
00103    {
00104       TString line;
00105       
00106       // Goes through all lines
00107       while( !setupFile.eof() )
00108       {
00109          line.ReadLine(setupFile, kFALSE); // Read a line of the option file and set the iterator automatically to the next line
00110          if(1 == uDebug)
00111             cout<<line<<endl;
00112 
00113          if(line(0) == '#' || line(0) == '*')
00114          {
00115             //Comment in the text file
00116             ;
00117          }
00118          else if(line.Contains("debug")==kTRUE)
00119          {
00120             uDebug = ((TString)line(5,10)).Atoi();
00121             if(1 == uDebug)
00122                cout<<"Debug ON!!!!!!"<<endl;
00123          }
00124          else if(line.Contains("triggersel")==kTRUE)
00125          {
00126             iTriggerSelection = ((TString)line(11,10)).Atoi();
00127             if(1 == uDebug)
00128             {
00129                if( -1 == iTriggerSelection)
00130                   cout<<"Trigger used for matching selection: OFF"<<endl;
00131                   else cout<<"Trigger used for matching selection: "<<iTriggerSelection<<endl;
00132             } // if(1 == uDebug)
00133          }
00134          else if(line.Contains("trigseldeb")==kTRUE)
00135          {
00136             uTriggerSelDebugHistos = ((TString)line(11,10)).Atoi();
00137             if(1 == uDebug)
00138             {
00139                if( 1 == uTriggerSelDebugHistos)
00140                   cout<<"Trigger selection debug histograms:  ON"<<endl;
00141                   else cout<<"Trigger selection debug histograms:  OFF"<<endl;
00142             } // if(1 == uDebug)
00143          }
00144          else if(line.Contains("nbevaveffy")==kTRUE)
00145          {
00146             uNbEventAverageEfficiency = ((TString)line(11,10)).Atoi();
00147             if(1 == uDebug)
00148             {
00149                cout<<"Nb of event averaging HD efficiency: "<<uNbEventAverageEfficiency<<endl;
00150             }
00151          }
00152          else if(line.Contains("matoffsdet")==kTRUE)
00153          {
00154             uDetectorOffsetToUse = ((TString)line(11,10)).Atoi();
00155             if(1 == uDebug)
00156             {
00157                if( 1 == uDetectorOffsetToUse)
00158                   cout<<"Offset for dt in matching from:      Bucarest Reference counter"<<endl;
00159                   else cout<<"Offset for dt in matching from:      Heidelberg counter"<<endl;
00160             }
00161          }
00162          else if(line.Contains("hsinglerpc")==kTRUE)
00163          {
00164             uEnableSingleRpcHistos = ((TString)line(11,10)).Atoi();
00165             if(1 == uDebug)
00166             {
00167                if( 1 == uEnableSingleRpcHistos)
00168                   cout<<"Single RPC Histograms:               ON"<<endl;
00169                   else cout<<"Single RPC Histograms:               OFF"<<endl;
00170             } // if(1 == uDebug)
00171          }
00172          else if(line.Contains("htotrpclr")==kTRUE)
00173          {
00174             uEnableRpcLeftRightTot = ((TString)line(11,10)).Atoi();
00175             if(1 == uDebug)
00176             {
00177                if( 1 == uEnableRpcLeftRightTot)
00178                   cout<<"Rpc Left-Right Tot Histograms:       ON"<<endl;
00179                   else cout<<"Rpc Left-Right Tot Histograms:       OFF"<<endl;
00180             } // if(1 == uDebug)
00181          } // else if(line.Contains("htotrpclr")==kTRUE)
00182          else if(line.Contains("hrpcrpc")==kTRUE)
00183          {
00184             uEnableMultiRpcHistos = ((TString)line(11,10)).Atoi();
00185             if(1 == uDebug)
00186             {
00187                if( 1 == uEnableMultiRpcHistos)
00188                   cout<<"RPC-RPC Histograms:                  ON"<<endl;
00189                   else cout<<"RPC-RPC Histograms:                  OFF"<<endl;
00190             } // if(1 == uDebug)
00191          } // else if(line.Contains("hrpcrpc")==kTRUE)
00192          else if(line.Contains("hrpcm1m1")==kTRUE)
00193          {
00194             uEnableMul1Mul1Histos = ((TString)line(11,10)).Atoi();
00195             if(1 == uDebug)
00196             {
00197                if( 1 == uEnableMul1Mul1Histos)
00198                   cout<<"Rpc1-Mul1 Rpc2-Mul1 Histograms:      ON"<<endl;
00199                   else cout<<"Rpc1-Mul1 Rpc2-Mul1 Histograms:      OFF"<<endl;
00200             } // if(1 == uDebug)
00201          } // else if(line.Contains("hrpcm1m1")==kTRUE)
00202          else if(line.Contains("hrpcm1mx")==kTRUE)
00203          {
00204             uEnableMul1MulXHistos = ((TString)line(11,10)).Atoi();
00205             if(1 == uDebug)
00206             {
00207                if( 1 == uEnableMul1MulXHistos)
00208                   cout<<"Rpc1-Mul1 Rpc2-MulX Histograms:      ON"<<endl;
00209                   else cout<<"Rpc1-Mul1 Rpc2-MulX Histograms:      OFF"<<endl;
00210             } // if(1 == uDebug)
00211          } // else if(line.Contains("hrpcm1mx")==kTRUE)
00212          else if(line.Contains("hrpcm2m2")==kTRUE)
00213          {
00214             uEnableMul2Mul2Histos = ((TString)line(11,10)).Atoi();
00215             if(1 == uDebug)
00216             {
00217                if( 1 == uEnableMul2Mul2Histos)
00218                   cout<<"Rpc1-Mul<=2 Rpc2-Mul<=2 Histograms:  ON"<<endl;
00219                   else cout<<"Rpc1-Mul<=2 Rpc2-Mul<=2 Histograms:  OFF"<<endl;
00220             } // if(1 == uDebug)
00221          } // else if(line.Contains("hrpcm2m2")==kTRUE)
00222          else if(line.Contains("hrpcm1m2")==kTRUE)
00223          {
00224             uEnableMul1Mul2Histos = ((TString)line(11,10)).Atoi();
00225             if(1 == uDebug)
00226             {
00227                if( 1 == uEnableMul1Mul2Histos)
00228                   cout<<"Rpc1-Mul1 Rpc2-Mul2 Histograms:      ON"<<endl;
00229                   else cout<<"Rpc1-Mul1 Rpc2-Mul2 Histograms:      OFF"<<endl;
00230             } // if(1 == uDebug)
00231          } // else if(line.Contains("hrpcm1m2")==kTRUE)
00232          else if(line.Contains("hrpcmxmy")==kTRUE)
00233          {
00234             uEnableMulXMulYHistos = ((TString)line(11,10)).Atoi();
00235             if(1 == uDebug)
00236             {
00237                if( 1 == uEnableMulXMulYHistos)
00238                   cout<<"Rpc1-Mul X Rpc2-Mul Y Histograms:    ON"<<endl;
00239                   else cout<<"Rpc1-Mul X Rpc2-Mul Y Histograms:    OFF"<<endl;
00240             } // if(1 == uDebug)
00241          } // else if(line.Contains("hrpcmxmy")==kTRUE)
00242          else if(line.Contains("hsinglepla")==kTRUE)
00243          {
00244             uEnableSinglePlasticsHistos = ((TString)line(11,10)).Atoi();
00245             if(1 == uDebug)
00246             {
00247                if( 1 == uEnableSinglePlasticsHistos)
00248                   cout<<"Single Plastic Histograms:           ON"<<endl;
00249                   else cout<<"Single Plastic Histograms:           OFF"<<endl;
00250             } // if(1 == uDebug)
00251          } // else if(line.Contains("hsinglepla")==kTRUE)
00252          else if(line.Contains("htotplalr")==kTRUE)
00253          {
00254             uEnablePlasticLeftRightTot = ((TString)line(11,10)).Atoi();
00255             if(1 == uDebug)
00256             {
00257                if( 1 == uEnablePlasticLeftRightTot)
00258                   cout<<"Plastic Left-Right Tot Histograms:   ON"<<endl;
00259                   else cout<<"Plastic Left-Right Tot Histograms:   OFF"<<endl;
00260             } // if(1 == uDebug)
00261          } // else if(line.Contains("htotplalr")==kTRUE)
00262          else if(line.Contains("hplapla")==kTRUE)
00263          {
00264             uEnableMultiPlasticsHistos = ((TString)line(11,10)).Atoi();
00265             if(1 == uDebug)
00266             {
00267                if( 1 == uEnableMultiPlasticsHistos)
00268                   cout<<"Plastic-Plastic Histograms:          ON"<<endl;
00269                   else cout<<"Plastic-Plastic Histograms:          OFF"<<endl;
00270             } // if(1 == uDebug)
00271          } // else if(line.Contains("hplapla")==kTRUE)
00272       } // while( !setupFile.eof() )
00273    } //  else of if( setupFile.fail() == true)
00274    
00275    PrintOptions(); //print out all values to see, if the setting has worked correctly
00276    return kTRUE;
00277 }
00278 
00279 
00280 Int_t TMatchingParam::PrintOptions(){
00281    cout<<"********************* MATCHING calibration parameters **********************"<<endl;
00282    if(1 == uDebug)
00283       cout<<"Debug ON!!!!!!"<<endl;
00284       else cout<<"Debug OFF"<<endl;
00285    if( -1 == iTriggerSelection)
00286       cout<<"Trigger used for matching selection: OFF"<<endl;
00287       else cout<<"Trigger used for matching selection: "<<iTriggerSelection<<endl;
00288    if( 1 == uTriggerSelDebugHistos)
00289       cout<<"Trigger selection debug histograms:  ON"<<endl;
00290       else cout<<"Trigger selection debug histograms:  OFF"<<endl;
00291    cout<<"Nb of event averaging HD efficiency: "<<uNbEventAverageEfficiency<<endl;
00292    if( 1 == uDetectorOffsetToUse)
00293       cout<<"Offset for dt in matching from:      Bucarest Reference counter"<<endl;
00294       else cout<<"Offset for dt in matching from:      Heidelberg counter"<<endl;
00295    if( 1 == uEnableSingleRpcHistos )
00296    {
00297       cout<<"Single RPC Histograms:               ON"<<endl;
00298       if( 1 == uEnableRpcLeftRightTot)
00299          cout<<"Rpc Left-Right Tot Histograms:       ON"<<endl;
00300    }
00301       else cout<<"Single RPC Histograms:               OFF"<<endl;
00302    if( 1 == uEnableMultiRpcHistos )
00303    {
00304       cout<<"RPC-RPC Histograms:                  ON"<<endl;
00305       if( 1 == uEnableMul1Mul1Histos)
00306          cout<<"Rpc1-Mul1 Rpc2-Mul1 Histograms:      ON"<<endl;
00307       if( 1 == uEnableMul1MulXHistos)
00308          cout<<"Rpc1-Mul1 Rpc2-MulX Histograms:      ON"<<endl;
00309       if( 1 == uEnableMul2Mul2Histos)
00310          cout<<"Rpc1-Mul<=2 Rpc2-Mul<=2 Histograms:  ON"<<endl;
00311       if( 1 == uEnableMul1Mul2Histos)
00312          cout<<"Rpc1-Mul1 Rpc2-Mul2 Histograms:      ON"<<endl;
00313       if( 1 == uEnableMulXMulYHistos)
00314          cout<<"Rpc1-Mul X Rpc2-Mul Y Histograms:    ON"<<endl;
00315    }
00316       else cout<<"RPC-RPC Histograms:                  OFF"<<endl;
00317    if( 1 == uEnableSinglePlasticsHistos )
00318    {
00319       cout<<"Single Plastic Histograms:           ON"<<endl;
00320       if( 1 == uEnablePlasticLeftRightTot)
00321          cout<<"Plastic Left-Right Tot Histograms:   ON"<<endl;
00322    }
00323       else cout<<"Single Plastic Histograms:           OFF"<<endl;
00324    if( 1 == uEnableMultiPlasticsHistos )
00325       cout<<"Plastic-Plastic Histograms:          ON"<<endl;
00326       else cout<<"Plastic-Plastic Histograms:          OFF"<<endl;
00327    cout<<"************************************************************************"<<endl;
00328    
00329    return 0;
00330 }

Generated on Tue Dec 10 2013 04:52:20 for ROCsoft by  doxygen 1.7.1