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

beamtime/gsi-aug12/hd/go4/MONITOR/TBeamMonitorParam.cxx (r4864/r3218)

Go to the documentation of this file.
00001 #include "TBeamMonitorParam.h"
00002 #include "TGo4Version.h"
00003 #if __GO4BUILDVERSION__ > 40502
00004    #include "go4iostream.h"
00005 #else
00006    #include "Riostream.h"
00007 #endif
00008 
00009 #include "TMbsCrateEvent.h"
00010 
00011 /***** Default values definition *****/
00012 #define DEBUG                 0
00013 #define CH_FOR_OFFSET_CAEN    -1
00014 #define CH_FOR_OFFSET_VFTX    -1
00015 #define RATE_INT_DURATION     -1
00016 #define RATE_INT_STEP         -1
00017 
00018 #define NB_SRPC               0
00019 #define TDC_STRIP             0
00020 #define RPC_NAME_STRIP        ""
00021 #define RPC_POSX_STRIP        0.0
00022 #define RPC_POSY_STRIP        0.0
00023 #define RPC_POSZ_STRIP        0.0
00024 #define NB_STRIPS             0 // Nb of strips for the beam profile monitor
00025 #define STRIP_WIDTH           0
00026 #define TIME_CONV            10.0
00027 /*
00028          //                      0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23
00029          //                      |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |
00030 #define STRIPS_LEFT_LIST      {  23,  22,  21,  20,  19,  18,  17,  16,  15,  14,  13,  12,  11,  10,   9,   8,   7,   6,   5,   4,   3,   2,   1,   0 }
00031 #define STRIPS_RIGHT_LIST     {  31,  30,  29,  28,  27,  26,  25,  24,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47 }
00032 #define STRIPS_OFFSET_LIST    { 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 3.0, 3.0,-3.6,-5.3,-2.3,-4.0,-6.0,-7.0,-5.1,-3.2, 0.0, 9.9, 5.2, 4.5, 3.5, 4.8, 7.2, 5.3 }
00033 * */
00034 #define STRIPS_LEFT           0
00035 #define STRIPS_RIGHT          0
00036 #define STRIPS_OFFSET         0
00037 #define BEAM_PROFILE_SIZE     0
00038 
00039 #define NB_PRPC               0
00040 #define TDC_PAD               0
00041 #define RPC_NAME_PAD          ""
00042 #define RPC_POSX_PAD          0.0
00043 #define RPC_POSY_PAD          0.0
00044 #define RPC_POSZ_PAD          0.0
00045 #define NB_PADS_X             0 // Nb of pads in X direction for the beam profile monitor
00046 #define NB_PADS_Y             0 // Nb of pads in Y direction for the beam profile monitor
00047 #define PADS_INDEX            0
00048 /*
00049          //                      0    1    2    3    4    5
00050          //                      |    |    |    |    |    |
00051 #define PADS_LIST            {{  57,  58,  59,  60,  61,  62 }, \
00052                               {  65,  66,  67,  68,  69,  71 } }
00053 * */
00054 /*************************************/
00055 
00056 //***********************************************************                          
00057                               
00058 TBeamMonitorParam::TBeamMonitorParam(const char* name) : TGo4Parameter(name)
00059 {
00060 //   Dummy = 0;
00061    
00062    uDebug             = 0;
00063    iOffsetFullChannelCaen = -1;
00064    iOffsetFullChannelVFTX = -1;
00065    iRateIntegrationDuration = -1;
00066    iRateIntegrationStep = -1;
00067 
00068    iNbStripRpcs = 0; // Nb of strip RPC for the beam profile monitor
00069    iNbPadRpcs = 0;   // Nb of pad RPC for the beam profile monitor
00070    
00071    ReadOptions();
00072    this->PrintOptions();
00073 }
00074 //***********************************************************   
00075 
00076 Bool_t TBeamMonitorParam::UpdateFrom(TGo4Parameter *pp)
00077 {
00078   if(pp->InheritsFrom("TBeamMonitorParam")) {
00079      TBeamMonitorParam * from = (TBeamMonitorParam *) pp;      
00080      cout << "**** TBeamMonitorParam " << GetName() << " updated from source parameter" << endl;
00081   } else
00082      cout << "Wrong parameter object: " << pp->ClassName() << endl;
00083   return kTRUE;
00084 }
00085 //***********************************************************  
00086 
00087 TBeamMonitorParam::~TBeamMonitorParam()
00088 {
00089    /*
00090    cout<<Form("Par Strip        %p %p %p %p %p %p %p %p",
00091          uTdcTypeStrip, sStripRpcName, dStripRpcPosX, dStripRpcPosY, dStripRpcPosZ, uNbStrips, dStripWidth, dTimeConv
00092                            )<<endl;
00093 
00094    cout<<Form("Par Strip ch     %p %p %p %p %p %p",
00095          uStripLeftList, uStripRightList, uTdcStripLeftList, uTdcStripRightList, uChannelStripLeft, uChannelStripRight
00096                            )<<endl;
00097    cout<<Form("Par Strip ch tot %p %p %p %p %p %p",
00098          uTotStripLeftList, uTotStripRightList, uTotTdcStripLeftList, uTotTdcStripRightList, uTotChannelStripLeft, uTotChannelStripRight
00099                            )<<endl;
00100 
00101    cout<<Form("Par Strip beam   %p %p",
00102          dOffsetList, iBeamProfileSize
00103                            )<<endl;
00104 
00105    // Pad RPCs settings
00106 
00107    cout<<Form("Par Pad          %p %p %p %p %p %p %p %p %p %p %p %p",
00108          uTdcTypePad, sPadRpcName, dPadRpcPosX, dPadRpcPosY, dPadRpcPosZ, uNbPadsX,
00109          uNbPadsY, dPadSizeX, dPadSizeY, uPadsList, uPadsTdc, uPadsChan
00110                            )<<endl;
00111    */
00112    cout << "**** TBeamMonitorParam: Delete instance " << endl;
00113 }
00114 //-----------------------------------------------------------
00115 
00116 Bool_t TBeamMonitorParam::ReadOptions()
00117 {
00118    // Loading default values for safety
00119    uDebug             = DEBUG;
00120    iOffsetFullChannelCaen = CH_FOR_OFFSET_CAEN;
00121    iOffsetFullChannelVFTX = CH_FOR_OFFSET_VFTX;
00122    iNbStripRpcs = NB_SRPC;
00123    iNbPadRpcs   = NB_PRPC;
00124    iRateIntegrationDuration = RATE_INT_DURATION;
00125    iRateIntegrationStep     = RATE_INT_STEP;
00126 
00127    // Reading out parameters from the option file
00128    fstream setupFile("./Monitor_options.txt", ios::in);
00129    if( setupFile.fail() == true)
00130    {
00131       cout<<"Error opening setup file rocget4_options.txt"<<endl;
00132       cout<<"=> Using default values!"<<endl;
00133       
00134       for(UInt_t temp_index = 0; temp_index < NB_STRIP_RPC_MAX; temp_index++)
00135       {
00136          iBeamProfileSize[temp_index]     = BEAM_PROFILE_SIZE;
00137       }
00138 
00139    }
00140    else
00141    {
00142       TString line;
00143       Int_t iStripRpcIndex = -1;
00144       Int_t iPadRpcIndex = -1;
00145       line.ReadLine(setupFile, kFALSE);
00146       while( !setupFile.eof() )
00147       {
00148          if(line(0) == '#' || line(0) == '*')
00149          {
00150             //Comment
00151             ;
00152          }
00153          else if(line.Contains("debug")==kTRUE)
00154          {
00155             uDebug = ((TString)line(6,10)).Atoi();
00156          }
00157          else if(line.Contains("choffscaen")==kTRUE)
00158          {
00159             iOffsetFullChannelCaen = ((TString)line(11,10)).Atoi();
00160             if( iOffsetFullChannelCaen > MAX_1290*T1290Data::NumChan)
00161             {
00162                cout<<"Error: CAEN channel for offset higher than max allowed -> replaced by default value: ";
00163                cout<<CH_FOR_OFFSET_CAEN<<endl;
00164                iOffsetFullChannelCaen = CH_FOR_OFFSET_CAEN;
00165             }
00166          }
00167          else if(line.Contains("choffsvftx")==kTRUE)
00168          {
00169             iOffsetFullChannelVFTX = ((TString)line(11,10)).Atoi();
00170             if( iOffsetFullChannelCaen > MAX_FPGA_TDC*FPGA_TDC_NBCHAN)
00171             {
00172                cout<<"Error: VFTX channel for offset higher than max allowed -> replaced by default value: ";
00173                cout<<CH_FOR_OFFSET_VFTX<<endl;
00174                iOffsetFullChannelVFTX = CH_FOR_OFFSET_VFTX;
00175             }
00176          }
00177          else if(line.Contains("rateintdur")==kTRUE)
00178          {
00179             iRateIntegrationDuration = ((TString)line(11,10)).Atoi();
00180          }
00181          else if(line.Contains("ratestep")==kTRUE)
00182          {
00183             iRateIntegrationStep = ((TString)line(11,10)).Atoi();
00184             if( iRateIntegrationStep < 2 )
00185             {
00186                cout<<"Rate step size smaller than Go4 minimal Hist. update step of 2s, set step size to 2s"<<endl;
00187                iRateIntegrationStep = 2;
00188             }
00189             if( iRateIntegrationDuration < iRateIntegrationStep )
00190             {
00191                cout<<"Rate step size smaller than rate integration size, set step size to integration size"<<endl;
00192                iRateIntegrationStep = iRateIntegrationDuration;
00193             }
00194          }
00195          else if(line.Contains("nbstriprpc")==kTRUE)
00196          {
00197             iNbStripRpcs = ((TString)line(11,10)).Atoi();
00198             if( iNbStripRpcs > NB_STRIP_RPC_MAX)
00199             {
00200                 cout<<"Error: nb strip RPC higher than max allowed -> replaced by max value: ";
00201                 cout<<NB_STRIP_RPC_MAX<<endl;
00202                 iNbStripRpcs = NB_STRIP_RPC_MAX;
00203             }
00204          }
00205          else if(line.Contains("tdctypestrip")==kTRUE)
00206          {
00207             iStripRpcIndex ++;
00208             if( iNbStripRpcs <= iStripRpcIndex )
00209             {
00210                if( 1 == uDebug )
00211                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00212             }
00213             else
00214             {
00215                uTdcTypeStrip[iStripRpcIndex] = ((TString)line(13,10)).Atoi();
00216             }
00217          }
00218          else if(line.Contains("striprpcname")==kTRUE)
00219          {
00220             if( -1 == iStripRpcIndex )
00221             {
00222                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00223             }
00224             else if( iNbStripRpcs <= iStripRpcIndex )
00225             {
00226                if( 1 == uDebug )
00227                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00228             }
00229             else
00230             {
00231                sStripRpcName[iStripRpcIndex] = ((TString)line(13,20));
00232             }
00233          }
00234          else if(line.Contains("striprpcposx")==kTRUE)
00235          {
00236             if( -1 == iStripRpcIndex )
00237             {
00238                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00239             }
00240             else if( iNbStripRpcs <= iStripRpcIndex )
00241             {
00242                if( 1 == uDebug )
00243                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00244             }
00245             else
00246             {
00247                dStripRpcPosX[iStripRpcIndex] = ((TString)line(12,10)).Atof();
00248             }
00249          }
00250          else if(line.Contains("striprpcposy")==kTRUE)
00251          {
00252             if( -1 == iStripRpcIndex )
00253             {
00254                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00255             }
00256             else if( iNbStripRpcs <= iStripRpcIndex )
00257             {
00258                if( 1 == uDebug )
00259                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00260             }
00261             else
00262             {
00263                dStripRpcPosY[iStripRpcIndex] = ((TString)line(12,10)).Atof();
00264             }
00265          }
00266          else if(line.Contains("striprpcposz")==kTRUE)
00267          {
00268             if( -1 == iStripRpcIndex )
00269             {
00270                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00271             }
00272             else if( iNbStripRpcs <= iStripRpcIndex )
00273             {
00274                if( 1 == uDebug )
00275                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00276             }
00277             else
00278             {
00279                dStripRpcPosZ[iStripRpcIndex] = ((TString)line(12,10)).Atof();
00280             }
00281          }
00282          else if(line.Contains("nbstrips")==kTRUE)
00283          {
00284             if( -1 == iStripRpcIndex )
00285             {
00286                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00287             }
00288             else if( iNbStripRpcs <= iStripRpcIndex )
00289             {
00290                if( 1 == uDebug )
00291                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00292             }
00293             else
00294             {
00295                uNbStrips[iStripRpcIndex] = ((TString)line(9,10)).Atoi();
00296                if( uNbStrips[iStripRpcIndex] > NB_STRIPS_MAX)
00297                {
00298                   cout<<"Error: nb strips higher than max allowed for RPC "<<uNbStrips[iStripRpcIndex];
00299                   cout<<" -> replaced by max value: ";
00300                   cout<<NB_STRIPS_MAX<<endl;
00301                   uNbStrips[iStripRpcIndex] = NB_STRIPS_MAX;
00302                }
00303             }
00304          }
00305          else if(line.Contains("stripwidth")==kTRUE)
00306          {
00307             if( -1 == iStripRpcIndex )
00308             {
00309                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00310             }
00311             else if( iNbStripRpcs <= iStripRpcIndex )
00312             {
00313                if( 1 == uDebug )
00314                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00315             }
00316             else
00317             {
00318                dStripWidth[iStripRpcIndex] = ((TString)line(12,10)).Atof();
00319             }
00320          }
00321          else if(line.Contains("timeconvcm")==kTRUE)
00322          {
00323             if( -1 == iStripRpcIndex )
00324             {
00325                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00326             }
00327             else if( iNbStripRpcs <= iStripRpcIndex )
00328             {
00329                if( 1 == uDebug )
00330                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00331             }
00332             else
00333             {
00334                dTimeConv[iStripRpcIndex] = ((TString)line(12,10)).Atof();
00335             }
00336          }
00337          else if(line.Contains("stripsleft")==kTRUE)
00338          {
00339             line = line(12,5*NB_STRIPS_MAX);
00340             if( -1 == iStripRpcIndex )
00341             {
00342                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00343             }
00344             else if( iNbStripRpcs <= iStripRpcIndex )
00345             {
00346                if( 1 == uDebug )
00347                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00348             }
00349             else if( uNbStrips[iStripRpcIndex] == 0 && line.Sizeof() )
00350             {
00351                if( 1 == uDebug )
00352                {
00353                cout<<"Warning: nbStrips is 0 and left strips array not empty: skip filling"<<line<<endl;
00354                cout<<"(if line were inverted in the option file, it could be the error)"<<endl;
00355                }
00356             }
00357             else
00358             {
00359                for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00360                {
00361                   uStripLeftList[iStripRpcIndex][temp_index] = ((TString)line(0,5)).Atoi();
00362                   line = line(5,5*NB_STRIPS_MAX);
00363                }
00364             }
00365          }
00366          else if(line.Contains("stripsright")==kTRUE)
00367          {
00368             line = line(12,5*NB_STRIPS_MAX);
00369             if( -1 == iStripRpcIndex )
00370             {
00371                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channel index!"<<endl;
00372             }
00373             else if( iNbStripRpcs <= iStripRpcIndex )
00374             {
00375                if( 1 == uDebug )
00376                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00377             }
00378             else if( uNbStrips[iStripRpcIndex] == 0 && line.Sizeof() )
00379             {
00380                if( 1 == uDebug )
00381                {
00382                cout<<"Warning: nbStrips is 0 and right strips array not empty: skip filling"<<line<<endl;
00383                cout<<"(if line were inverted in the option file, it could be the error)"<<endl;
00384                }
00385             }
00386             else
00387             {
00388                for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00389                {
00390                   uStripRightList[iStripRpcIndex][temp_index] = ((TString)line(0,5)).Atoi();
00391                   line = line(5,5*NB_STRIPS_MAX);
00392                }
00393             }
00394          }
00395          else if(line.Contains("stripsoffs")==kTRUE)
00396          {
00397 #define OFFSET_DIGITS 7
00398             line = line(12,OFFSET_DIGITS*NB_STRIPS_MAX);
00399             if( -1 == iStripRpcIndex )
00400             {
00401                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channel index!"<<endl;
00402             }
00403             else if( iNbStripRpcs <= iStripRpcIndex )
00404             {
00405                if( 1 == uDebug )
00406                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00407             }
00408             else if( uNbStrips[iStripRpcIndex] == 0 && line.Sizeof() )
00409             {
00410                if( 1 == uDebug )
00411                {
00412                cout<<"Warning: nbStrips is 0 and strips offsets array not empty: skip filling"<<line<<endl;
00413                cout<<"(if line were inverted in the option file, it could be the error)"<<endl;
00414                }
00415             }
00416             else
00417             {
00418                for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00419                {
00420                   dOffsetList[iStripRpcIndex][temp_index] = ((TString)line(0,OFFSET_DIGITS)).Atof();
00421                   line = line(OFFSET_DIGITS,OFFSET_DIGITS*NB_STRIPS_MAX);
00422                }
00423             }
00424          }
00425          else if(line.Contains("strtotleft")==kTRUE)
00426          {
00427             line = line(12,5*NB_STRIPS_MAX);
00428             if( -1 == iStripRpcIndex )
00429             {
00430                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channels!"<<endl;
00431             }
00432             else if( iNbStripRpcs <= iStripRpcIndex )
00433             {
00434                if( 1 == uDebug )
00435                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00436             }
00437             else if( uNbStrips[iStripRpcIndex] == 0 && line.Sizeof() )
00438             {
00439                if( 1 == uDebug )
00440                {
00441                cout<<"Warning: nbStrips is 0 and left strips array not empty: skip filling"<<line<<endl;
00442                cout<<"(if line were inverted in the option file, it could be the error)"<<endl;
00443                }
00444             }
00445             else
00446             {
00447                for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00448                {
00449                   uTotStripLeftList[iStripRpcIndex][temp_index] = ((TString)line(0,5)).Atoi();
00450                   line = line(5,5*NB_STRIPS_MAX);
00451                }
00452             }
00453          }
00454          else if(line.Contains("strtotright")==kTRUE)
00455          {
00456             line = line(12,5*NB_STRIPS_MAX);
00457             if( -1 == iStripRpcIndex )
00458             {
00459                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channel index!"<<endl;
00460             }
00461             else if( iNbStripRpcs <= iStripRpcIndex )
00462             {
00463                if( 1 == uDebug )
00464                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00465             }
00466             else if( uNbStrips[iStripRpcIndex] == 0 && line.Sizeof() )
00467             {
00468                if( 1 == uDebug )
00469                {
00470                cout<<"Warning: nbStrips is 0 and right strips array not empty: skip filling"<<line<<endl;
00471                cout<<"(if line were inverted in the option file, it could be the error)"<<endl;
00472                }
00473             }
00474             else
00475             {
00476                for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00477                {
00478                   uTotStripRightList[iStripRpcIndex][temp_index] = ((TString)line(0,5)).Atoi();
00479                   line = line(5,5*NB_STRIPS_MAX);
00480                }
00481             }
00482          }
00483          else if(line.Contains("beamsize")==kTRUE)
00484          {
00485             if( -1 == iStripRpcIndex )
00486             {
00487                cout<<" Index for the strip RPCs is -1 => please declare number of strips in this RPC before channel index!"<<endl;
00488             }
00489             else if( iNbStripRpcs <= iStripRpcIndex )
00490             {
00491                if( 1 == uDebug )
00492                   cout<<" Index for the strip RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00493             }
00494             else
00495                iBeamProfileSize[iStripRpcIndex] = ((TString)line(9,10)).Atoi();
00496          }
00497          
00498          else if(line.Contains("nbpadsrpc")==kTRUE)
00499          {
00500             iNbPadRpcs = ((TString)line(11,10)).Atoi();
00501             if( iNbPadRpcs > NB_PAD_RPC_MAX)
00502             {
00503                 cout<<"Error: nb strip RPC higher than max allowed -> replaced by max value: ";
00504                 cout<<NB_PAD_RPC_MAX<<endl;
00505                 iNbPadRpcs = NB_PAD_RPC_MAX;
00506             }
00507          }
00508          else if(line.Contains("tdctypepad")==kTRUE)
00509          {
00510             iPadRpcIndex ++;
00511             if( iNbPadRpcs <= iPadRpcIndex )
00512             {
00513                if( 1 == uDebug )
00514                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00515             }
00516             else
00517             {
00518                uTdcTypePad[iPadRpcIndex] = ((TString)line(12,10)).Atoi();
00519             }
00520          }
00521          else if(line.Contains("padrpcname")==kTRUE)
00522          {
00523             if( -1 == iPadRpcIndex )
00524             {
00525                cout<<" Index for the pad RPCs is -1 => please declare tdc type for this RPC before other caracs!"<<endl;
00526             }
00527             else if( iNbPadRpcs <= iPadRpcIndex )
00528             {
00529                if( 1 == uDebug )
00530                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00531             }
00532             else
00533             {
00534                sPadRpcName[iPadRpcIndex] = ((TString)line(11,20));
00535             }
00536          }
00537          else if(line.Contains("padrpcposx")==kTRUE)
00538          {
00539             if( -1 == iPadRpcIndex )
00540             {
00541                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00542             }
00543             else if( iNbPadRpcs <= iPadRpcIndex )
00544             {
00545                if( 1 == uDebug )
00546                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00547             }
00548             else
00549             {
00550                dPadRpcPosX[iPadRpcIndex] = ((TString)line(12,10)).Atof();
00551             }
00552          }
00553          else if(line.Contains("padrpcposy")==kTRUE)
00554          {
00555             if( -1 == iPadRpcIndex )
00556             {
00557                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00558             }
00559             else if( iNbPadRpcs <= iPadRpcIndex )
00560             {
00561                if( 1 == uDebug )
00562                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00563             }
00564             else
00565             {
00566                dPadRpcPosY[iPadRpcIndex] = ((TString)line(12,10)).Atof();
00567             }
00568          }
00569          else if(line.Contains("padrpcposz")==kTRUE)
00570          {
00571             if( -1 == iPadRpcIndex )
00572             {
00573                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00574             }
00575             else if( iNbPadRpcs <= iPadRpcIndex )
00576             {
00577                if( 1 == uDebug )
00578                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00579             }
00580             else
00581             {
00582                dPadRpcPosZ[iPadRpcIndex] = ((TString)line(12,10)).Atof();
00583             }
00584          }
00585          else if(line.Contains("nbpadsx")==kTRUE)
00586          {
00587             if( -1 == iPadRpcIndex )
00588             {
00589                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00590             }
00591             else if( iNbPadRpcs <= iPadRpcIndex )
00592             {
00593                if( 1 == uDebug )
00594                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00595             }
00596             else
00597             {
00598                uNbPadsX[iPadRpcIndex] = ((TString)line(9,10)).Atoi();
00599                if( uNbPadsX[iPadRpcIndex] > NB_PADS_X_MAX)
00600                {
00601                   cout<<"Error: nb pads on X axis higher than max allowed -> replaced by max value ";
00602                   cout<<NB_PADS_X_MAX<<endl;
00603                   uNbPadsX[iPadRpcIndex] = NB_PADS_X_MAX;
00604                }
00605             }
00606          }
00607          else if(line.Contains("nbpadsy")==kTRUE)
00608          {
00609             if( -1 == iPadRpcIndex )
00610             {
00611                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00612             }
00613             else if( iNbPadRpcs <= iPadRpcIndex )
00614             {
00615                if( 1 == uDebug )
00616                   cout<<" Index for the pad RPCs out of bound => Please check the number of pad RPC declared"<<endl;
00617             }
00618             else 
00619             {
00620                uNbPadsY[iPadRpcIndex] = ((TString)line(9,10)).Atoi();
00621                if( uNbPadsY[iPadRpcIndex] > NB_PADS_Y_MAX)
00622                {
00623                   cout<<"Error: nb pads on Y axis higher than max allowed -> replaced by max value ";
00624                   cout<<NB_PADS_Y_MAX<<endl;
00625                   uNbPadsY[iPadRpcIndex] = NB_PADS_Y_MAX;
00626                }
00627             }
00628          }
00629          else if(line.Contains("sizepadx")==kTRUE)
00630          {
00631             if( -1 == iPadRpcIndex )
00632             {
00633                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00634             }
00635             else if( iNbPadRpcs <= iPadRpcIndex )
00636             {
00637                if( 1 == uDebug )
00638                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00639             }
00640             else
00641             {
00642                dPadSizeX[iPadRpcIndex] = ((TString)line(9,10)).Atof();
00643             }
00644          }
00645          else if(line.Contains("sizepady")==kTRUE)
00646          {
00647             if( -1 == iPadRpcIndex )
00648             {
00649                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00650             }
00651             else if( iNbPadRpcs <= iPadRpcIndex )
00652             {
00653                if( 1 == uDebug )
00654                   cout<<" Index for the pad RPCs out of bound => Please check the number of strip RPC declared"<<endl;
00655             }
00656             else
00657             {
00658                dPadSizeY[iPadRpcIndex] = ((TString)line(9,10)).Atof();
00659             }
00660          }
00661          else if(line.Contains("padsrow")==kTRUE)
00662          {
00663             if( -1 == iPadRpcIndex )
00664             {
00665                cout<<" Index for the pad RPCs is -1 => please declaretdc type for this RPC before other caracs!"<<endl;
00666             }
00667             else if( iNbPadRpcs <= iPadRpcIndex )
00668             {
00669                if( 1 == uDebug )
00670                   cout<<" Index for the pad RPCs out of bound => Please check the number of pad RPC declared"<<endl;
00671             }
00672             else 
00673             {
00674                for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY[iPadRpcIndex]; temp_indexY++)
00675                {
00676                   if( line.Contains( Form("padsrow%u", temp_indexY+1)) ==kTRUE)
00677                   {
00678                      line = line(12,280);
00679                      for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX[iPadRpcIndex]; temp_indexX++)
00680                      {
00681                         uPadsList[iPadRpcIndex][temp_indexY][temp_indexX] = ((TString)line(0,5)).Atoi();
00682                         line = line(5,280);
00683                      }
00684                   }
00685                   line.ReadLine(setupFile, kFALSE);
00686                }
00687             }
00688          }
00689          
00690          line.ReadLine(setupFile, kFALSE);
00691       }
00692    }
00693    
00694    setupFile.close();
00695    
00696    return kTRUE;
00697 }
00698 //-----------------------------------------------------------
00699 
00700 Int_t TBeamMonitorParam::PrintOptions()
00701 {   
00702    cout<<"*********************** Beam monitor Parameters ************************"<<endl;
00703    if( 1 == uDebug) 
00704       cout<<"Debug output:               ON"<<endl;
00705    if( -1 < iOffsetChannelCaen && -1 < iOffsetChannelVFTX )
00706    {
00707       cout<<"Chan. used for time offset: "<<iOffsetChannelCaen;
00708       cout<<" in CAEN and "<<iOffsetChannelVFTX<<" in VFTX"<<endl;
00709    }
00710    if( -1 < iRateIntegrationDuration && -1 < iRateIntegrationStep)
00711    {
00712       cout<<"Rate hist. reset spacing:   "<<iRateIntegrationDuration<<" s"<<endl;
00713       cout<<"Rate hist. update spacing:  "<<iRateIntegrationStep<<" s"<<endl;
00714    }
00715    cout<<"-------------------------------------------------"<<endl;
00716    cout<<"Nb of strip RPC monitored: "<<iNbStripRpcs<<endl;
00717    for( Int_t iStripRpcIndex = 0; iStripRpcIndex < iNbStripRpcs; iStripRpcIndex++)
00718    {
00719       cout<<"-> Options for strip RPC "<<sStripRpcName[iStripRpcIndex]<<endl;
00720       if( 1 == uTdcTypeStrip[iStripRpcIndex] )
00721          cout<<"   TDC type:                  VFTX"<<endl;
00722          else cout<<"   TDC type:                  CAEN"<<endl;
00723       cout<<"   Position:                  X= "<<dStripRpcPosX[iStripRpcIndex];
00724       cout<<" Y= "<<dStripRpcPosY[iStripRpcIndex]<<" Z= "<<dStripRpcPosZ[iStripRpcIndex];
00725       cout<<endl;
00726       cout<<"   Nb strips in beam profile: "<<uNbStrips[iStripRpcIndex]<<endl;
00727       cout<<"   Strip width (incl gap.):   "<<dStripWidth[iStripRpcIndex]<<" cm"<<endl;
00728       cout<<"   Time Convertion factor:    "<<dTimeConv[iStripRpcIndex]<<" cm/ns"<<endl;
00729       cout<<"   Strip channel:    |-      ";
00730       for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00731       {
00732          cout.width(3);
00733          cout<<temp_index<<" ";
00734       }
00735       cout<<endl<<"   Left              |->     ";
00736       for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00737       {
00738          cout.width(3);
00739          cout<<uStripLeftList[iStripRpcIndex][temp_index]<<" ";
00740       }
00741       cout<<endl<<"   Right             |->     ";
00742       for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00743       {
00744          cout.width(3);
00745          cout<<uStripRightList[iStripRpcIndex][temp_index]<<" ";
00746       }
00747       cout<<endl;
00748       cout<<"   Strip offset:     |-      ";
00749       for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00750       {
00751          cout.width(OFFSET_DIGITS -1);
00752          cout<<temp_index<<" ";
00753       }
00754       cout<<endl<<"                     |->     ";
00755       for(UInt_t temp_index = 0; temp_index < uNbStrips[iStripRpcIndex]; temp_index++)
00756       {
00757          cout.width(OFFSET_DIGITS -1);
00758          cout<<dOffsetList[iStripRpcIndex][temp_index]<<" ";
00759       }
00760       cout<<endl;
00761       cout<<"   Size of beam profile in X: "<<iBeamProfileSize[iStripRpcIndex]<<" cm "<<endl;
00762       if( iStripRpcIndex + 1 < iNbStripRpcs )
00763          cout<<"              ...................                "<<endl;
00764    } // for( Int_t iStripRpcIndex = 0; iNbStripRpcs < iStripRpcIndex; iStripRpcIndex++)
00765    cout<<"-------------------------------------------------"<<endl;
00766    cout<<"Nb of pad RPC monitored:   "<<iNbPadRpcs<<endl;
00767    for( Int_t iPadRpcIndex = 0; iPadRpcIndex < iNbPadRpcs; iPadRpcIndex++)
00768    {
00769       cout<<"-> Options for pad RPC "<<sPadRpcName[iPadRpcIndex]<<endl;
00770       if( 1 == uTdcTypePad[iPadRpcIndex] )
00771          cout<<"   TDC type:                  VFTX"<<endl;
00772          else cout<<"   TDC type:                  CAEN"<<endl;
00773       cout<<"   Position:                  X= "<<dPadRpcPosX[iPadRpcIndex];
00774       cout<<" Y= "<<dPadRpcPosY[iPadRpcIndex]<<" Z= "<<dPadRpcPosZ[iPadRpcIndex];
00775       cout<<endl;
00776       cout<<"   Nb pads in X axis in beam profile: "<<uNbPadsX[iPadRpcIndex]<<endl;
00777       cout<<"   Nb pads in Y axis in beam profile: "<<uNbPadsY[iPadRpcIndex]<<endl;
00778       cout<<"   Pad size in X dir. (incl gap.):    "<<dPadSizeX[iPadRpcIndex]<<endl;
00779       cout<<"   Pad size in Y dir. (incl gap.):    "<<dPadSizeY[iPadRpcIndex]<<endl;
00780       cout<<"   Pad channel:      |-      ";
00781       for(UInt_t temp_index = 0; temp_index < uNbPadsX[iPadRpcIndex]; temp_index++)
00782       {
00783          cout.width(2);
00784          cout<<temp_index<<" ";
00785       }
00786       for(UInt_t temp_indexY = 0; temp_indexY < uNbPadsY[iPadRpcIndex]; temp_indexY++)
00787       {
00788          cout<<endl<<"   Row ";
00789          cout.width(2);
00790          cout<<temp_indexY<<"            |->     ";
00791          for(UInt_t temp_indexX = 0; temp_indexX < uNbPadsX[iPadRpcIndex]; temp_indexX++)
00792          {
00793             cout.width(2);
00794             cout<<uPadsList[iPadRpcIndex][temp_indexY][temp_indexX]<<" ";
00795          }
00796       }
00797       cout<<endl;
00798       if( iPadRpcIndex + 1 < iNbPadRpcs )
00799          cout<<"              ...................                "<<endl;
00800    } // for( Int_t iPadRpcIndex = 0; iNbPadRpcs < iPadRpcIndex; iPadRpcIndex++)
00801    cout<<"************************************************************************"<<endl;
00802    
00803    return 0;
00804 }
00805 
00806 Int_t   TBeamMonitorParam::ConvertChToTdcAndCh( Int_t iChannelNumberCaenTdc, Int_t iChannelNumberVftxTdc )
00807 {
00808    // Time offset between CAEN and VFTX
00809    iOffsetTdcCaen     = iOffsetFullChannelCaen / iChannelNumberCaenTdc;
00810    iOffsetChannelCaen = iOffsetFullChannelCaen % iChannelNumberCaenTdc;
00811    iOffsetTdcVFTX     = iOffsetFullChannelVFTX / iChannelNumberVftxTdc;
00812    iOffsetChannelVFTX = iOffsetFullChannelVFTX % iChannelNumberVftxTdc;
00813 
00814    // Strip RPCs
00815    for( Int_t iStripRpcIndex = 0; iStripRpcIndex < iNbStripRpcs; iStripRpcIndex++)
00816    {
00817       if( 1 == uTdcTypeStrip[iStripRpcIndex] )
00818       {
00819          for( UInt_t uStripIndex = 0; uStripIndex < uNbStrips[iStripRpcIndex]; uStripIndex++)
00820          {
00821             uTdcStripLeftList[iStripRpcIndex][uStripIndex]  = uStripLeftList[iStripRpcIndex][uStripIndex]  / iChannelNumberVftxTdc;
00822             uChannelStripLeft[iStripRpcIndex][uStripIndex]  = uStripLeftList[iStripRpcIndex][uStripIndex]  % iChannelNumberVftxTdc;
00823             uTdcStripRightList[iStripRpcIndex][uStripIndex] = uStripRightList[iStripRpcIndex][uStripIndex] / iChannelNumberVftxTdc;
00824             uChannelStripRight[iStripRpcIndex][uStripIndex] = uStripRightList[iStripRpcIndex][uStripIndex] % iChannelNumberVftxTdc;
00825          } // for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00826       } // if( 1 == uTdcTypeStrip[iStripRpcIndex] )
00827          else
00828          {
00829             for( UInt_t uStripIndex = 0; uStripIndex < uNbStrips[iStripRpcIndex]; uStripIndex++)
00830             {
00831                uTdcStripLeftList[iStripRpcIndex][uStripIndex]  = uStripLeftList[iStripRpcIndex][uStripIndex]  / iChannelNumberCaenTdc;
00832                uChannelStripLeft[iStripRpcIndex][uStripIndex]  = uStripLeftList[iStripRpcIndex][uStripIndex]  % iChannelNumberCaenTdc;
00833                uTdcStripRightList[iStripRpcIndex][uStripIndex] = uStripRightList[iStripRpcIndex][uStripIndex] / iChannelNumberCaenTdc;
00834                uChannelStripRight[iStripRpcIndex][uStripIndex] = uStripRightList[iStripRpcIndex][uStripIndex] % iChannelNumberCaenTdc;
00835 
00836                uTotTdcStripLeftList[iStripRpcIndex][uStripIndex]  = uTotStripLeftList[iStripRpcIndex][uStripIndex]  / iChannelNumberCaenTdc;
00837                uTotChannelStripLeft[iStripRpcIndex][uStripIndex]  = uTotStripLeftList[iStripRpcIndex][uStripIndex]  % iChannelNumberCaenTdc;
00838                uTotTdcStripRightList[iStripRpcIndex][uStripIndex] = uTotStripRightList[iStripRpcIndex][uStripIndex] / iChannelNumberCaenTdc;
00839                uTotChannelStripRight[iStripRpcIndex][uStripIndex] = uTotStripRightList[iStripRpcIndex][uStripIndex] % iChannelNumberCaenTdc;
00840             } // for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00841          } // else of if( 1 == uTdcTypeStrip[iStripRpcIndex] )
00842    } // for( Int_t iStripRpcIndex = 0; iStripRpcIndex < iNbStripRpcs; iStripRpcIndex++)
00843    
00844    // Pad RPCs
00845    for( Int_t iPadRpcIndex = 0; iPadRpcIndex < iNbPadRpcs; iPadRpcIndex++)
00846    {
00847       if( 1 == uTdcTypePad[iPadRpcIndex] )
00848       {
00849          for(UInt_t uPadIndexY = 0; uPadIndexY < uNbPadsY[iPadRpcIndex]; uPadIndexY++)
00850             for(UInt_t uPadIndexX = 0; uPadIndexX < uNbPadsX[iPadRpcIndex]; uPadIndexX++)
00851          {      
00852             uPadsTdc[iPadRpcIndex][uPadIndexY][uPadIndexX]  = uPadsList[iPadRpcIndex][uPadIndexY][uPadIndexX] / iChannelNumberVftxTdc;
00853             uPadsChan[iPadRpcIndex][uPadIndexY][uPadIndexX] = uPadsList[iPadRpcIndex][uPadIndexY][uPadIndexX] % iChannelNumberVftxTdc;
00854          } // for uPadIndexY uPadIndexX
00855       } // if( 1 == uTdcTypePad[iPadRpcIndex] )
00856          else
00857          {
00858             for(UInt_t uPadIndexY = 0; uPadIndexY < uNbPadsY[iPadRpcIndex]; uPadIndexY++)
00859                for(UInt_t uPadIndexX = 0; uPadIndexX < uNbPadsX[iPadRpcIndex]; uPadIndexX++)
00860             { 
00861                uPadsTdc[iPadRpcIndex][uPadIndexY][uPadIndexX]  = uPadsList[iPadRpcIndex][uPadIndexY][uPadIndexX] / iChannelNumberCaenTdc;
00862                uPadsChan[iPadRpcIndex][uPadIndexY][uPadIndexX] = uPadsList[iPadRpcIndex][uPadIndexY][uPadIndexX] % iChannelNumberCaenTdc;
00863             } // for uPadIndexY uPadIndexX
00864          }// else of if( 1 == uTdcTypePad[iPadRpcIndex] )
00865    } //for( Int_t iPadRpcIndex = 0; iPadRpcIndex < iNbPadRpcs; iPadRpcIndex++)
00866    
00867    return 0;
00868 }

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