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

beamtime/gsi-aug12/hd/go4/TMbsCrateParam.cxx (r4864/r3207)

Go to the documentation of this file.
00001 /* Generated by Together */
00002 
00003 #include "TMbsCrateParam.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 CAEN_DEBUG               kFALSE
00015 #define CAEN_TRIGGER_HISTO       kFALSE
00016 #define CAEN_COINC_MAP           0
00017 #define CAEN_TDC_ENABLE          1
00018 #define CAEN_QDC_ENABLE          1
00019 #define LECROY_QDC_ENABLE        1
00020 #define VFTX_TDC_ENABLE          1
00021 #define QFW_ENABLE               1
00022 
00023 TMbsCrateParam::TMbsCrateParam(const char* name) : TGo4Parameter(name)
00024 {
00025    ReadOptions();
00026 }
00027 
00028 //***********************************************************
00029 TMbsCrateParam::~TMbsCrateParam()
00030 {
00031 }
00032 
00033 Bool_t TMbsCrateParam::ReadOptions(){
00034    // Loading default values
00035    uDebug           = DEBUG_OPTION;
00036       // CAEN TDC v1290
00037    bCaenDebug       = CAEN_DEBUG;
00038    bCaenTriggerTime = CAEN_TRIGGER_HISTO;
00039    uCaenCoincidenceMap = CAEN_COINC_MAP;
00040    for( Int_t iIndex1290 = 0; iIndex1290 < MAX_1290; iIndex1290++)
00041       uCaenTdcHistosEnabled[iIndex1290] = CAEN_TDC_ENABLE;
00042       // CAEN QDC v965
00043    for( Int_t iIndex965 = 0; iIndex965 < MAX_965; iIndex965++)
00044       uCaenQdcHistosEnabled[iIndex965] = CAEN_QDC_ENABLE; 
00045       // Lecroy QDC 1182
00046    for( Int_t iIndex1182 = 0; iIndex1182 < MAX_1182; iIndex1182++)
00047       uLecroyQdcHistosEnabled[iIndex1182] = LECROY_QDC_ENABLE;
00048       // VFTX FPGA TDC
00049    for( Int_t iIndexVftx = 0; iIndexVftx < MAX_FPGA_TDC; iIndexVftx++)
00050       uVftxHistosEnabled[iIndexVftx] = VFTX_TDC_ENABLE;
00051       // QFW
00052    uQFWHistosEnabled = QFW_ENABLE;
00053    
00054    // Read the option file
00055    fstream setupFile("./mbsUnpack_options.txt", ios::in);
00056    
00057    // Testing if the option does exist. If not I use default values.
00058    if( setupFile.fail() == true)
00059    {
00060       cout<<"Error: Setup file TMbsCrate_options.txt can not be opened or is missing."<<endl;
00061       cout<<"=> Using default values!"<<endl;
00062    }
00063    else
00064    {
00065       TString line;
00066       line.ReadLine(setupFile, kFALSE); // Read a line of the option file and set the iterator automatically to the next line
00067       
00068       // Goes through all lines
00069       while( !setupFile.eof() )
00070       {
00071          if(line(0) == '#' || line(0) == '*')
00072          {
00073             //Comment in the text file
00074             ;
00075          }
00076          else if(line.Contains("unpackdebug")==kTRUE)
00077          {
00078             uDebug = ((TString)line(13,10)).Atoi();
00079             if(1 == uDebug)
00080                cout<<"Debug ON!!!!!!"<<endl;
00081          }
00082          else if(line.Contains("caentdcdebug")==kTRUE)
00083          {
00084             bCaenDebug = ( 1 == ((TString)line(13,10)).Atoi() ) ;
00085          }
00086          else if(line.Contains("caentrigtime")==kTRUE)
00087          {
00088             bCaenTriggerTime = ( 1 == ((TString)line(13,10)).Atoi() );
00089          }
00090          else if(line.Contains("caencoincmap")==kTRUE)
00091          {
00092             uCaenCoincidenceMap = ((TString)line(13,10)).Atoi() ;
00093          }
00094          else if(line.Contains("caentdcena")==kTRUE)
00095          {
00096             line = line(11,3*MAX_1290);
00097             if( 0 != line.Sizeof() )
00098             {
00099                for(UInt_t temp_index = 0; temp_index < MAX_1290 && 0 != line.Sizeof(); temp_index++)
00100                {
00101                   uCaenTdcHistosEnabled[temp_index] = ((TString)line(0,3)).Atoi();
00102                   line = line(3,3*MAX_1290);
00103                } // for(UInt_t temp_index = 0; temp_index < MAX_1290 && 0 != line.Sizeof(); temp_index++)
00104             } // if( 0 != line.Sizeof() )
00105          }
00106          else if(line.Contains("caenqdcena")==kTRUE)
00107          {
00108             line = line(11,3*MAX_965);
00109             if( 0 != line.Sizeof() )
00110             {
00111                for(UInt_t temp_index = 0; temp_index < MAX_965 && 0 != line.Sizeof(); temp_index++)
00112                {
00113                   uCaenQdcHistosEnabled[temp_index] = ((TString)line(0,3)).Atoi();
00114                   line = line(3,3*MAX_965);
00115                } // for(UInt_t temp_index = 0; temp_index < MAX_965 && 0 != line.Sizeof(); temp_index++)
00116             } // if( 0 != line.Sizeof() )
00117          }
00118          else if(line.Contains("qdc1182ena")==kTRUE)
00119          {
00120             line = line(11,3*MAX_1182);
00121             if( 0 != line.Sizeof() )
00122             {
00123                for(UInt_t temp_index = 0; temp_index < MAX_1182 && 0 != line.Sizeof(); temp_index++)
00124                {
00125                   uLecroyQdcHistosEnabled[temp_index] = ((TString)line(0,3)).Atoi();
00126                   line = line(3,3*MAX_1182);
00127                } // for(UInt_t temp_index = 0; temp_index < MAX_1182 && 0 != line.Sizeof(); temp_index++)
00128             } // if( 0 != line.Sizeof() )
00129          }
00130          else if(line.Contains("vftxrawena")==kTRUE)
00131          {
00132             line = line(11,3*MAX_FPGA_TDC);
00133             if( 0 != line.Sizeof() )
00134             {
00135                for(UInt_t temp_index = 0; temp_index < MAX_FPGA_TDC && 0 != line.Sizeof(); temp_index++)
00136                {
00137                   uVftxHistosEnabled[temp_index] = ((TString)line(0,3)).Atoi();
00138                   line = line(3,3*MAX_FPGA_TDC);
00139                } // for(UInt_t temp_index = 0; temp_index < MAX_FPGA_TDC && 0 != line.Sizeof(); temp_index++)
00140             } // if( 0 != line.Sizeof() )
00141          }
00142          else if(line.Contains("qfwhistena")==kTRUE)
00143          {
00144             uQFWHistosEnabled = ((TString)line(11,10)).Atoi();
00145          }
00146          line.ReadLine(setupFile, kFALSE);
00147          if(1 == uDebug)
00148             cout<<line<<endl;
00149       }
00150    }
00151    
00152    this->PrintOptions(); //print out all values to see, if the setting has worked correctly
00153    return kTRUE;
00154 }
00155 
00156 
00157 Int_t TMbsCrateParam::PrintOptions(){
00158    cout<<"******************** MBS crate unpacker parameters *********************"<<endl;
00159    if(1 == uDebug)
00160       cout<<"Debug ON!!!!!!"<<endl;
00161       else cout<<"Debug OFF"<<endl;
00162       
00163    // CAEN TDC v1290
00164    cout<<"------------------------------------------------------------------------"<<endl;
00165    cout<<"CAEN v1290 debug Histograms:        "<<bCaenDebug<<endl; 
00166    cout<<"CAEN v1290 trigger time Histograms: "<<bCaenTriggerTime<<endl; 
00167    cout<<"Caen v1290 tdc index:      |-       ";
00168    for( Int_t iIndex1290 = 0; iIndex1290 < MAX_1290; iIndex1290++)
00169    {
00170       cout.width(2);
00171       cout<<iIndex1290<<" ";
00172    }
00173    cout<<endl<<"Unpacking histo. enabled   |->      ";
00174    for( Int_t iIndex1290 = 0; iIndex1290 < MAX_1290; iIndex1290++)
00175    {
00176       cout.width(2);
00177       cout<<uCaenTdcHistosEnabled[iIndex1290]<<" ";
00178    }
00179    cout<<endl;
00180    
00181    // CAEN QDC v965
00182    cout<<"------------------------------------------------------------------------"<<endl;
00183    cout<<"Caen v965 qdc index:       |-       ";
00184    for( Int_t iIndex965 = 0; iIndex965 < MAX_965; iIndex965++)
00185    {
00186       cout.width(2);
00187       cout<<iIndex965<<" ";
00188    }
00189    cout<<endl<<"Unpacking histo. enabled   |->      ";
00190    for( Int_t iIndex965 = 0; iIndex965 < MAX_965; iIndex965++)
00191    {
00192       cout.width(2);
00193       cout<<uCaenQdcHistosEnabled[iIndex965]<<" ";
00194    }
00195    cout<<endl;
00196    
00197    // Lecroy QDC 1182
00198    cout<<"------------------------------------------------------------------------"<<endl;
00199    cout<<"Lecroy 1182 qdc index:     |-       ";
00200    for( Int_t iIndex1182 = 0; iIndex1182 < MAX_1182; iIndex1182++)
00201    {
00202       cout.width(2);
00203       cout<<iIndex1182<<" ";
00204    }
00205    cout<<endl<<"Unpacking histo. enabled   |->      ";
00206    for( Int_t iIndex1182 = 0; iIndex1182 < MAX_1182; iIndex1182++)
00207    {
00208       cout.width(2);
00209       cout<<uLecroyQdcHistosEnabled[iIndex1182] <<" ";
00210    }
00211    cout<<endl;
00212    
00213    // VFTX FPGA TDC
00214    cout<<"------------------------------------------------------------------------"<<endl;
00215    cout<<"VFTX FPGA TDC index:       |-       ";
00216    for( Int_t iIndexVftx = 0; iIndexVftx < MAX_FPGA_TDC; iIndexVftx++)
00217    {
00218       cout.width(2);
00219       cout<<iIndexVftx<<" ";
00220    }
00221    cout<<endl<<"Unpacking histo. enabled   |->      ";
00222    for( Int_t iIndexVftx = 0; iIndexVftx < MAX_FPGA_TDC; iIndexVftx++)
00223    {
00224       cout.width(2);
00225       cout<<uVftxHistosEnabled[iIndexVftx] <<" ";
00226    }
00227    cout<<endl;
00228    
00229    // QFW
00230    cout<<"------------------------------------------------------------------------"<<endl;
00231    if( 1 == uQFWHistosEnabled )
00232       cout<<"QFW histograms:                     ON"<<endl;
00233       else cout<<"QFW histograms:                     OFF"<<endl;
00234    cout<<"************************************************************************"<<endl;
00235    return 0;
00236 }

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