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

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

Go to the documentation of this file.
00001 #include "TBeamMonitorProc.h"
00002 #include "TGo4Version.h"
00003 #if __GO4BUILDVERSION__ > 40502
00004    #include "go4iostream.h"
00005 #else
00006    #include "Riostream.h"
00007 #endif
00008 #include "TTimeStamp.h"
00009 #include "TSystem.h"
00010 #include "TROOT.h"
00011 #include "TGo4Log.h"
00012 
00013 #include "TGo4UserException.h"
00014 #include "TGo4MbsEvent.h"
00015 #include "roc/Message.h"
00016 #include "roc/Board.h"
00017 #include "TProfile.h"
00018 
00019 
00020 TBeamMonitorProc::TBeamMonitorProc(const char* name) :
00021    TCBMBeamtimeProc(name),
00022    fCrateInputEvent(0),
00023    fTriglogInputEvent(0),
00024 #if defined(ROOTCONV_WITHGET4) || defined(ROOTCONV_WITHHODO)
00025    fRocInputEvent(0),
00026 #endif
00027    fEpicsInputEvent(0),
00028    fVftxInputEvent(0),
00029    fOutputEvent(0)
00030 {
00031    TGo4Log::Info("TBeamMonitorProc: Create instance %s", name);
00032    TString obname, obtitle;
00033 
00034    fPar = (TBeamMonitorParam*) MakeParameter("BeamMonitorPar", "TBeamMonitorParam");
00035    fPar->ConvertChToTdcAndCh( T1290Data::NumChan, FPGA_TDC_NBCHAN );
00036 /*
00037    TString setupmacro = "set_BeamMonitorPar.C";
00038    if (!gSystem->AccessPathName(setupmacro.Data())) {
00039       TGo4Log::Info("Executing beam monitor condition setup script %s", setupmacro.Data());
00040       gROOT->ProcessLine(Form(".x %s", setupmacro.Data()));
00041 
00042    } else {
00043       TGo4Log::Info("NO beam monitor  setup script %s. Use previous values!", setupmacro.Data());
00044    }
00045 */
00046    // fCh_Pb = MakeTH2('I', "BeamMonitor/Ch1_Pb", "Cherenkov - Pb", 512, 0., 4096., 512, 0., 4096., "Cherenkov1", "Pb");
00047 
00048    fPmtDiff = MakeTH1('I', "BeamMonitor/PmtDiff", "Time difference between TDC[5][2] and TDC[5][3]", 4096, -2048, +2048, "bin []");
00049 
00050    // following is for slow control display:
00051    //   fMotorPos = MakeTH2('I', Form("EPICS/MotorPosition"), Form("GEM Motor"),
00052    //         60, 0, 300, 60, 0, 300, "X (mm)", "Y (mm)");
00053    //   fRoluPos = MakeTH2('I', Form("EPICS/ROLUPosition"), Form("Rolu positions"),
00054    //         35, 0, 35, 35, 0, 35, "X (mm)", "Y (mm)");
00055    
00056    // RPC monitor
00057 
00058       // Offset to use when comparing times from CAEN and from VFTX TDCs
00059    dCaenVftxOffset = 0;
00060 
00061       // Rate plots
00062    if( -1 < fPar->iRateIntegrationDuration && -1 < fPar->iRateIntegrationStep )
00063    {
00064       uFirstMbsTimeIntegration = 0;
00065       uLastMbsTimeStep = 0;
00066       // Vector to hold the counts per strip since last step
00067       //vStepStripCounts.resize(fPar->iNbStripRpcs);
00068    } // If rate parameters defined
00069 
00070       // Strip RPCs
00071    Int_t iDualMultHistoIndex = 0;
00072    for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00073    {
00074       fBeamProfileStripRpc[iStripRpcIndex] =  
00075             MakeTH2('D', Form("BeamMonitor/BeamProfile/Srpc%d", iStripRpcIndex),
00076             Form("Attempt to get beam profile for %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data()) ,
00077             2*fPar->iBeamProfileSize[iStripRpcIndex], -(fPar->iBeamProfileSize[iStripRpcIndex]/2.0) -0.5, (fPar->iBeamProfileSize[iStripRpcIndex]/2.0) -0.5,
00078             fPar->uNbStrips[iStripRpcIndex], 
00079             -((Double_t)fPar->uNbStrips[iStripRpcIndex]*fPar->dStripWidth[iStripRpcIndex]/2.0), 
00080              ((Double_t)fPar->uNbStrips[iStripRpcIndex]*fPar->dStripWidth[iStripRpcIndex]/2.0),
00081             "Left right dt [cm]", "Strip index [cm]" ); 
00082             
00083       // Maybe put the size of thez Tot histo in time as an option in parameter file
00084       fTotLeftStripRpc[iStripRpcIndex] = 
00085             MakeTH2('D', Form("BeamMonitor/TotProfile/TotLeftSrpc%d", iStripRpcIndex),
00086             Form("Attempt to get Left Tot profile for %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data()) ,
00087             2000, -50, 50,
00088             fPar->uNbStrips[iStripRpcIndex],
00089             -((Double_t)fPar->uNbStrips[iStripRpcIndex]/2.0),
00090              ((Double_t)fPar->uNbStrips[iStripRpcIndex]/2.0),
00091             "Left Tot [ns]", "Strip index []" ) ; ;
00092 
00093       // Maybe put the size of thez Tot histo in time as an option in parameter file
00094       fTotRightStripRpc[iStripRpcIndex] =
00095             MakeTH2('D', Form("BeamMonitor/TotProfile/TotRightSrpc%d", iStripRpcIndex),
00096             Form("Attempt to get Right Tot profile for %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data()) ,
00097             2000, -50, 50,
00098             fPar->uNbStrips[iStripRpcIndex], 
00099             -((Double_t)fPar->uNbStrips[iStripRpcIndex]/2.0), 
00100              ((Double_t)fPar->uNbStrips[iStripRpcIndex]/2.0),
00101             "Right Tot [ns]", "Strip index []" ) ;
00102 
00103       // Multiplicity plots
00104       fMultiplicityStripRpc[iStripRpcIndex] =
00105             MakeTH1('I', Form("BeamMonitor/Multiplicity/MultipSrpc%d", iStripRpcIndex),
00106             Form("Attempt to get Multiplicity for %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data()) ,
00107             fPar->uNbStrips[iStripRpcIndex], -0.5, fPar->uNbStrips[iStripRpcIndex] - 0.5,
00108             "Multiplicity (Number of strip fired simultaneously/event) [strips]" ) ;
00109 
00110       // Rate plots
00111       if( -1 < fPar->iRateIntegrationDuration && -1 < fPar->iRateIntegrationStep )
00112       {
00113          fStripRateStripRpc[iStripRpcIndex] =
00114                MakeTH2('D', Form("BeamMonitor/Rate/StripRateSrpc%d", iStripRpcIndex),
00115                Form("Attempt to get rate profile for %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data()) ,
00116                2000, 0, 20000,
00117                fPar->uNbStrips[iStripRpcIndex],
00118                -0.5,
00119                fPar->uNbStrips[iStripRpcIndex]-0.5,
00120                "Rate [Hz]", "Strip index []" ) ;
00121          fCounterRateStripRpc[iStripRpcIndex] =
00122                MakeTH1('D', Form("BeamMonitor/Rate/CounterRateSrpc%d", iStripRpcIndex),
00123                Form("Attempt to get total rate vs time for %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data()) ,
00124                3600, 0, 7200,
00125                "Time [s]", "Rate [Hz]" ) ;
00126          // Vector to hold the counts per strip since last reset
00127          //(vStepStripCounts[iStripRpcIndex]).resize(fPar->uNbStrips[iStripRpcIndex]);
00128       } // If rate parameters defined
00129       if( iStripRpcIndex < fPar->iNbStripRpcs -1)
00130          for( Int_t iStripRpcIndex2 = iStripRpcIndex+1; iStripRpcIndex2 < fPar->iNbStripRpcs; iStripRpcIndex2++)
00131          {
00132             fDualMultiplicityStripRpc[iDualMultHistoIndex] =
00133                MakeTH2('I', Form("BeamMonitor/Multip2D/MultipSrpc%d_%d", iStripRpcIndex, iStripRpcIndex2),
00134                Form("Multiplicity for %s vs %s, Strip map in option file", fPar->sStripRpcName[iStripRpcIndex].Data(),
00135                                                                            fPar->sStripRpcName[iStripRpcIndex2].Data()) ,
00136                fPar->uNbStrips[iStripRpcIndex], -0.5, fPar->uNbStrips[iStripRpcIndex] - 0.5,
00137                fPar->uNbStrips[iStripRpcIndex2], -0.5, fPar->uNbStrips[iStripRpcIndex2] - 0.5,
00138                "Strip Multiplicity Rpc #1 [strips]",
00139                "Strip Multiplicity Rpc #2 [strips]"  ) ;
00140             iDualMultHistoIndex++;
00141          }
00142    } // for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00143 
00144       // Pad RPCs
00145    for( Int_t iPadRpcIndex = 0; iPadRpcIndex < fPar->iNbPadRpcs; iPadRpcIndex++)
00146    {
00147       fBeamProfilePadRpc[iPadRpcIndex] = 
00148             MakeTH2('D', Form("BeamMonitor/BeamProfile/Prpc%d", iPadRpcIndex),
00149             Form("Attempt to get beam profile for %s, Pad map in option file", fPar->sPadRpcName[iPadRpcIndex].Data()),
00150             fPar->uNbPadsX[iPadRpcIndex], 
00151             -((Double_t)fPar->uNbPadsX[iPadRpcIndex]*fPar->dPadSizeX[iPadRpcIndex]/2.0), 
00152              ((Double_t)fPar->uNbPadsX[iPadRpcIndex]*fPar->dPadSizeX[iPadRpcIndex]/2.0),
00153             fPar->uNbPadsY[iPadRpcIndex], 
00154             -((Double_t)fPar->uNbPadsY[iPadRpcIndex]*fPar->dPadSizeY[iPadRpcIndex]/2.0), 
00155              ((Double_t)fPar->uNbPadsY[iPadRpcIndex]*fPar->dPadSizeY[iPadRpcIndex]/2.0),
00156             "X [cm]", "Y [cm]" ) ;
00157    } // for( Int_t iPadRpcIndex = 0; iPadRpcIndex < fPar->iNbPadRpcs; iPadRpcIndex++)
00158 
00159    // TDCs offset test
00160    fTdcOffsetTestSameCV = MakeTH1('D', "BeamMonitor/SyncTest/offsetTestSameCV",
00161          "Test of the offset between CAEN and VFTX, ref in same tdcs" ,
00162          10000, -10000, 10000,
00163          "dT [ps]" ) ;
00164    fTdcOffsetTestDiffCV = MakeTH1('D', "BeamMonitor/SyncTest/offsetTestDiffCV",
00165          "Test of the offset between CAEN and VFTX, ref in diff tdcs" ,
00166          10000, -10000, 10000,
00167          "dT [ps]" ) ;
00168    fTdcOffsetTestDiffC = MakeTH1('D', "BeamMonitor/SyncTest/offsetTestDiffC",
00169          "Test of the offset between CAEN and VFTX, ref in diff caen" ,
00170          10000, -10000, 10000,
00171          "dT [ps]" ) ;
00172    fTdcOffsetTestDiffV = MakeTH1('D', "BeamMonitor/SyncTest/offsetTestDiffV",
00173          "Test of the offset between CAEN and VFTX, ref in diff vftx" ,
00174          10000, -10000, 10000,
00175          "dT [ps]" ) ;
00176 
00177    // To be put as preprocessor/enum somewhere (T1290Data.h?)
00178    Double_t dCaenBinSize = 25.0/1024.0;
00179 
00180    fTdcResolutionTestSameC = MakeTH1('D', "BeamMonitor/SyncTest/resTestSameC",
00181          "Test of the resolution between CAEN and CAEN, same board" ,
00182          800, -400*dCaenBinSize*1000, 400*dCaenBinSize*1000,
00183          "dT [ps]" ) ;
00184    fTdcResolutionTestDiffC = MakeTH1('D', "BeamMonitor/SyncTest/resTestDiffC",
00185          "Test of the resolution between CAEN and CAEN, diff board" ,
00186          800, -400*dCaenBinSize*1000, 400*dCaenBinSize*1000,
00187          "dT [ps]" ) ;
00188    fTdcResolutionTestSameV = MakeTH1('D', "BeamMonitor/SyncTest/resTestSameV",
00189          "Test of the resolution between VFTX and VFTX, same board" ,
00190          10000, -10000, 10000,
00191          "dT [ps]" ) ;
00192    fTdcResolutionTestDiffV = MakeTH1('D', "BeamMonitor/SyncTest/resTestDiffV",
00193          "Test of the resolution between VFTX and VFTX, diff board" ,
00194          10000, -10000, 10000,
00195          "dT [ps]" ) ;
00196 
00197    // ScalOrMu histograms
00198   // if( 1 == fPar->uQFWHistosEnabled )
00199    {
00200       uInitialMbsTime = 0;
00201       uInitialMilliTime = 0;
00202       for( Int_t iScalerInd = 0; iScalerInd < SCALORMU_NB_SCAL; iScalerInd++)
00203       {
00204          uLastScalerScalOrMu[iScalerInd] = 0;
00205          uLastMbsMilliTime[iScalerInd] = 0;
00206          uLastMbsTime[iScalerInd] = 0;
00207          fScalOrMu[iScalerInd] = MakeTH1('D', Form("ScalOrMu/SOM_Scal%d",iScalerInd),
00208                                   Form("Evolution of rate on scaler %d in ScalOrMu", iScalerInd),
00209                                   6000, 0, 1200., "Time [s]", "Rate [Hz]");
00210       }
00211       iScaler2BinNb  = 12000;
00212       dScaler2BinMax = 1200.;
00213       uInitialScaler1_16 = 0;
00214       for( Int_t iScalerInd = 0; iScalerInd < N_SCALERS_CH; iScalerInd++)
00215       {
00216          uLastScaler2[iScalerInd] = 0;
00217          uLastScaler1_16[iScalerInd] = 0;
00218          //uLastMbsMilliTimeScal2[iScalerInd] = 0;
00219          //uLastMbsTimeScal2[iScalerInd] = 0;
00220          fScaler2[iScalerInd] = MakeTH1('D', Form("Triglog/trlo_ScalTrigg%d",iScalerInd),
00221                                   Form("Evolution of rate on scaler2 for trigg %d in Triglog", iScalerInd),
00222                                   iScaler2BinNb, 0, dScaler2BinMax, "Time [s]", "Rate [Hz]");
00223       }
00224       cout<<dScaler2BinMax/(Double_t)iScaler2BinNb<<endl;
00225    }
00226 
00227    TGo4Log::Info("TBeamMonitorProc Histograms created");
00228 }
00229 
00230 
00231 TBeamMonitorProc::~TBeamMonitorProc()
00232 {   
00233    /*
00234    TGo4Log::Info("Proc  %p", this);
00235    TGo4Log::Info("Mbs e %p", &fCrateInputEvent);
00236    TGo4Log::Info("Trl e %p", &fTriglogInputEvent);
00237    TGo4Log::Info("Epi e %p", &fEpicsInputEvent);
00238    TGo4Log::Info("Vft e %p", &fVftxInputEvent);
00239    TGo4Log::Info("Out e %p", &fOutputEvent);
00240    TGo4Log::Info("Offse %p", &dCaenVftxOffset);
00241    TGo4Log::Info("Param %p", fPar);
00242    */
00243    // Getting mean values for each strip in the Beam profile (offset)
00244    for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00245    {
00246 //      TGo4Log::Info("Step %p", vStepStripCounts[iStripRpcIndex]);
00247 
00248       if( fBeamProfileStripRpc[iStripRpcIndex]->GetEntries() )
00249       {
00250          Double_t offset = 0;
00251          TString sFormattedOut = "stripsoffs  ";
00252          TGo4Log::Info("*********** Offset Map %-20s ************", fPar->sStripRpcName[iStripRpcIndex].Data());
00253          for( UInt_t uBin = 0; uBin < fPar->uNbStrips[iStripRpcIndex]; uBin++)
00254          {
00255             offset = ( (TProfile*)fBeamProfileStripRpc[iStripRpcIndex]->ProfileX(
00256                   Form("%s_pfx%d",fPar->sStripRpcName[iStripRpcIndex].Data(), uBin), uBin+1, uBin+1) )->GetMean();
00257             TGo4Log::Info("Offset of strip %2u is %3.2f cm, while option is %3.2f", uBin, offset, fPar->dOffsetList[iStripRpcIndex][uBin]);
00258             sFormattedOut += Form(" %6.2f", offset + fPar->dOffsetList[iStripRpcIndex][uBin] );
00259          } // for( UInt_t uBin = 0; uBin < fPar->uNbStrips[iStripRpcIndex]; uBin++)
00260          TGo4Log::Info("%s", sFormattedOut.Data());
00261          TGo4Log::Info("********************************************************");
00262       } // if( fBeamProfileStripRpc[iStripRpcIndex]->GetEntries() )
00263    } // for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00264 
00265    /*
00266    TGo4Log::Info("S %p %p %p %p %p %p",
00267                   fBeamProfileStripRpc,
00268                   fTotLeftStripRpc,
00269                   fTotRightStripRpc,
00270                   fMultiplicityStripRpc,
00271                   fStripRateStripRpc,
00272                   fCounterRateStripRpc
00273                   );
00274    TGo4Log::Info("P %p",fBeamProfilePadRpc );
00275 
00276    TGo4Log::Info("Scal %p",fScalOrMu );
00277    */
00278 
00279    /*
00280    if( -1 < fPar->iRateIntegrationDuration && -1 < fPar->iRateIntegrationStep )
00281    {
00282       //for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00283       //   vStepStripCounts[iStripRpcIndex].clear();
00284       //vStepStripCounts.clear();
00285       vStepStripCounts.resize(0);
00286    }
00287    */
00288    
00289    cout << "**** TBeamMonitorProc: Delete instance " << endl;
00290 }
00291 
00292 
00293 void TBeamMonitorProc::InitEvent(TGo4EventElement* outevnt)
00294 {
00295    // first assign input event:
00296    // since input event object is never discarded within processor lifetime,
00297    // we just search for subevent by name once to speed up processing
00298    if(fCrateInputEvent==0)
00299    {
00300       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Detector"));
00301       if(btevent)
00302       {
00303          fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE"));
00304 #if defined(ROOTCONV_WITHGET4) || defined(ROOTCONV_WITHHODO)
00305          fRocInputEvent=dynamic_cast<TRocEvent*>(btevent->GetSubEvent("ROC"));
00306 #endif
00307 //         fEpicsInputEvent=dynamic_cast<TEpicsEvent*>(btevent->GetSubEvent("EPICS"));
00308       }
00309       else
00310       {
00311          fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(GetInputEvent());
00312       }
00313       if(fCrateInputEvent==0) {
00314          GO4_STOP_ANALYSIS_MESSAGE("**** TBeamMonitorProc: Fatal error: no input event TMbsCrateEvent!!! STOP GO4");
00315       }
00316 #if defined(ROOTCONV_WITHGET4) || defined(ROOTCONV_WITHHODO)
00317       if(fRocInputEvent==0) {
00318          GO4_STOP_ANALYSIS_MESSAGE("**** TBeamMonitorProc: Fatal error: no input event TRocEvent!!! STOP GO4");
00319       }
00320 #endif
00321 //      if(fEpicsInputEvent==0) {
00322 //         Message(2,"**** TBeamMonitorProc: could not find TEpicsEvent!"); // but do not stop...
00323 //      }
00324 
00325    } // if(fCrateInputEvent==0)
00326    if(fTriglogInputEvent==0)
00327    {
00328       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Detector"));
00329       if(btevent)
00330       {
00331          fTriglogInputEvent=dynamic_cast<TTriglogEvent*>(btevent->GetSubEvent("TRIGLOG"));
00332       }
00333 
00334       if(fTriglogInputEvent==0) {
00335          GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TTriglogEvent!!! STOP GO4");
00336       }
00337    } // if(fTriglogInputEvent==0)
00338    if(fVftxInputEvent==0)
00339    {
00340       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00341       if(btevent)
00342       {
00343          fVftxInputEvent=dynamic_cast<TVftxEvent*>(btevent->GetSubEvent("VFTX"));
00344       }
00345 
00346       if(fVftxInputEvent==0) {
00347          GO4_STOP_ANALYSIS_MESSAGE("**** TBeamMonitorProc: Fatal error: input event has no TVftxEvent!!! STOP GO4");
00348       }
00349    } // if(fVftxInputEvent==0)
00350    // then assign output event
00351    // since output event object is never discarded within processor lifetime,
00352    // we just search for subevent by name once to speed up processing
00353    if(fOutputEvent==0)
00354    {
00355       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00356       if(btevent)
00357       {
00358          fOutputEvent=dynamic_cast<TBeamMonitorEvent*>(btevent->GetSubEvent("BEAM"));
00359       }
00360       else
00361       {
00362          fOutputEvent= dynamic_cast<TBeamMonitorEvent*>(outevnt);
00363       }
00364       if(fOutputEvent==0) {
00365          GO4_STOP_ANALYSIS_MESSAGE("**** TBeamMonitorProc: Fatal error: output event is not a TBeamMonitorEvent!!! STOP GO4");
00366       }
00367    } // if(fOutputEvent==0)
00368 }
00369 
00370 
00371 
00372 void TBeamMonitorProc::FinalizeEvent()
00373 {
00374    // Approximate Factor to convert ns in cm in time difference => To be in option file
00375 //   Double_t dTimeToDistanceFactor = 10.0;
00376    // To be put as preprocessor/enum somewhere (T1290Data.h?)
00377    Double_t dCaenBinSize = 25.0/1024.0;
00378    UInt_t uMultiplicityStripRpc[fPar->iNbStripRpcs];
00379 
00380    if( -1 < fPar->iRateIntegrationDuration && -1 < fPar->iRateIntegrationStep &&
00381          fTriglogInputEvent && fTriglogInputEvent->IsValid() &&
00382        0 == uFirstMbsTimeIntegration && 0 == uLastMbsTimeStep )
00383    {
00384       uFirstMbsTimeIntegration = fTriglogInputEvent->fMbsTimeSecs;
00385       uFirstMbsTimeStep        = fTriglogInputEvent->fMbsTimeSecs;
00386       uLastMbsTimeStep         = fTriglogInputEvent->fMbsTimeSecs;
00387       for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++ )
00388          for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00389             vStepStripCounts[iStripRpcIndex][iStripRpcIndex] = 0;
00390    } // if rate parameters set && triglog event OK && rate variables uninitialized
00391    
00392    if(fCrateInputEvent && fCrateInputEvent->IsValid())
00393    {
00394       fPmtDiff->Fill(fCrateInputEvent->fMtdc[0].lead[20] - fCrateInputEvent->fMtdc[0].lead[22]);
00395 
00396       // fCh_Pb->Fill(fCrateInputEvent->fData1182[1][0], fCrateInputEvent->fData1182[1][5]);
00397 
00398       // fOutputEvent->fIsPion = fPionCond->Test(fCrateInputEvent->fData1182[1][0], fCrateInputEvent->fData1182[1][5]);
00399 
00400       for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00401          if( 0 == fPar->uTdcTypeStrip[iStripRpcIndex] )
00402          {
00403             // Tdc range check
00404             //   if( MAX_1290 <= uTdcStripLeftList[iStripRpcIndex][uStripIndex] )
00405             //   if( MAX_1290 <= uTdcStripRightList[iStripRpcIndex][uStripIndex] )
00406             uMultiplicityStripRpc[iStripRpcIndex] = 0;
00407                
00408             Double_t dRpcCenterOffset = (Double_t)fPar->uNbStrips[iStripRpcIndex] / 2.0;
00409             for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00410             {
00411                if( -1 < (fCrateInputEvent->fMtdc[
00412                                  fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex]  ]).lead_multi[ 
00413                                     fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] ][0] &&
00414                    -1 < (fCrateInputEvent->fMtdc[ 
00415                                  fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ]).lead_multi[ 
00416                                     fPar->uChannelStripRight[iStripRpcIndex][uStripIndex]][0] )
00417                {
00418                   // Beam profile for strip RPC: X = left right Dt - offset, Y = size index * strip size
00419                   fBeamProfileStripRpc[iStripRpcIndex]->Fill(
00420                         fPar->dTimeConv[iStripRpcIndex]*( (fCrateInputEvent->fMtdc[ 
00421                                                    fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ]).lead_multi[ 
00422                                                       fPar->uChannelStripRight[iStripRpcIndex][uStripIndex]][0]
00423                                                -(fCrateInputEvent->fMtdc[
00424                                                    fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex]  ]).lead_multi[ 
00425                                                       fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] ][0]
00426                                               )*dCaenBinSize
00427                         - fPar->dOffsetList[iStripRpcIndex][uStripIndex],
00428                         ((Double_t)uStripIndex - dRpcCenterOffset )*fPar->dStripWidth[iStripRpcIndex] );
00429                         
00430                   if( -1 < (fCrateInputEvent->fMtdc[
00431                                     fPar->uTotTdcStripLeftList[iStripRpcIndex][uStripIndex]  ]).trail_multi[
00432                                        fPar->uTotChannelStripLeft[iStripRpcIndex][uStripIndex] ][0] )
00433                   {
00434                      fTotLeftStripRpc[iStripRpcIndex]->Fill(
00435                         ( (fCrateInputEvent->fMtdc[ 
00436                               fPar->uTotTdcStripLeftList[iStripRpcIndex][uStripIndex] ]).trail_multi[
00437                                  fPar->uTotChannelStripLeft[iStripRpcIndex][uStripIndex]][0]
00438                           -(fCrateInputEvent->fMtdc[
00439                               fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex]  ]).lead_multi[ 
00440                                  fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] ][0]
00441                         )*dCaenBinSize,
00442                         (Double_t)uStripIndex - dRpcCenterOffset  );
00443 
00444                      if( -1 < (fCrateInputEvent->fMtdc[
00445                                        fPar->uTotTdcStripRightList[iStripRpcIndex][uStripIndex]  ]).trail_multi[
00446                                           fPar->uTotChannelStripRight[iStripRpcIndex][uStripIndex] ][0] )
00447                         uMultiplicityStripRpc[iStripRpcIndex] ++;
00448                   } // if valid Tot on left side 
00449 
00450                   if( -1 < (fCrateInputEvent->fMtdc[
00451                                     fPar->uTotTdcStripRightList[iStripRpcIndex][uStripIndex]  ]).trail_multi[
00452                                        fPar->uTotChannelStripRight[iStripRpcIndex][uStripIndex] ][0] )
00453                   {
00454                      fTotRightStripRpc[iStripRpcIndex]->Fill(
00455                         ( (fCrateInputEvent->fMtdc[
00456                               fPar->uTotTdcStripRightList[iStripRpcIndex][uStripIndex] ]).trail_multi[
00457                                  fPar->uTotChannelStripRight[iStripRpcIndex][uStripIndex]][0]
00458                           -(fCrateInputEvent->fMtdc[
00459                               fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex]  ]).lead_multi[
00460                                  fPar->uChannelStripRight[iStripRpcIndex][uStripIndex] ][0]
00461                         )*dCaenBinSize,
00462                         (Double_t)uStripIndex - dRpcCenterOffset  );
00463                   } // if valid Tot on left side
00464                } // if( valid on both ends!)
00465             } //  for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00466             fMultiplicityStripRpc[iStripRpcIndex]->Fill( uMultiplicityStripRpc[iStripRpcIndex] );
00467          } // if( 0 == fPar->uTdcTypeStrip[iStripRpcIndex] )
00468       for( Int_t iPadRpcIndex = 0; iPadRpcIndex < fPar->iNbPadRpcs; iPadRpcIndex++)
00469          if( 0 == fPar->uTdcTypePad[iPadRpcIndex] )
00470          {
00471             Double_t dRpcCenterPadOffsetX = (Double_t)fPar->uNbPadsX[iPadRpcIndex]*fPar->dPadSizeX[iPadRpcIndex]/2.0;
00472             Double_t dRpcCenterPadOffsetY = (Double_t)fPar->uNbPadsY[iPadRpcIndex]*fPar->dPadSizeY[iPadRpcIndex]/2.0;
00473             
00474             for(UInt_t uPadIndexY = 0; uPadIndexY < fPar->uNbPadsY[iPadRpcIndex]; uPadIndexY++)
00475                for(UInt_t uPadIndexX = 0; uPadIndexX < fPar->uNbPadsX[iPadRpcIndex]; uPadIndexX++)
00476             {
00477                if( -1 < (fCrateInputEvent->fMtdc[ 
00478                                     fPar->uPadsTdc[iPadRpcIndex][uPadIndexY][uPadIndexX] ]).lead[ 
00479                                           fPar->uPadsChan[iPadRpcIndex][uPadIndexY][uPadIndexX] ] )
00480                {
00481                   fBeamProfilePadRpc[iPadRpcIndex]->Fill( (Double_t)uPadIndexX*fPar->dPadSizeX[iPadRpcIndex] - dRpcCenterPadOffsetX, 
00482                                                           (Double_t)uPadIndexY*fPar->dPadSizeY[iPadRpcIndex] - dRpcCenterPadOffsetY);
00483                } // if valid hit on this pad
00484             } // for uPadIndexY uPadIndexX
00485          } // if( 0 == fPar->uTdcTypeStrip[iStripRpcIndex] )
00486 
00487 
00488       if( fTriglogInputEvent && fTriglogInputEvent->IsValid() )
00489       {
00490          if( 0 == uInitialMilliTime && 0 == uInitialMilliTime )
00491          {
00492             uInitialMilliTime = fTriglogInputEvent->fMbsTimeMillisec;
00493             uInitialMbsTime      = fTriglogInputEvent->fMbsTimeSecs;
00494             for( Int_t iScalerInd = 0; iScalerInd < SCALORMU_NB_SCAL; iScalerInd++)
00495             {
00496                uLastScalerScalOrMu[iScalerInd] = fCrateInputEvent->fScalOrMu.uScaler[iScalerInd];
00497                uLastMbsMilliTime[iScalerInd]  = fTriglogInputEvent->fMbsTimeMillisec;
00498                uLastMbsTime[iScalerInd]       = fTriglogInputEvent->fMbsTimeSecs;
00499             }
00500          }
00501          else
00502          {
00503             for( Int_t iScalerInd = 0; iScalerInd < SCALORMU_NB_SCAL; iScalerInd++)
00504             {
00505                if( 0 != uLastScalerScalOrMu[iScalerInd] && 0 != fCrateInputEvent->fScalOrMu.uScaler[iScalerInd] &&
00506                      uLastScalerScalOrMu[iScalerInd] < fCrateInputEvent->fScalOrMu.uScaler[iScalerInd] &&
00507                      uLastMbsTime[iScalerInd]+ uLastMbsMilliTime[iScalerInd]/1000.0 <
00508                         fTriglogInputEvent->fMbsTimeSecs + fTriglogInputEvent->fMbsTimeMillisec/1000.0 )
00509                   fScalOrMu[iScalerInd]->Fill( (Double_t)fTriglogInputEvent->fMbsTimeSecs + (Double_t)fTriglogInputEvent->fMbsTimeMillisec/1000.0
00510                                               - ( (Double_t)uInitialMbsTime - (Double_t)uInitialMilliTime/1000.0),
00511                         ( (Double_t)fCrateInputEvent->fScalOrMu.uScaler[iScalerInd] - (Double_t)uLastScalerScalOrMu[iScalerInd] ) /
00512                         ( ((Double_t)fTriglogInputEvent->fMbsTimeSecs + (Double_t)fTriglogInputEvent->fMbsTimeMillisec/1000.0)
00513                               - ((Double_t)uLastMbsTime[iScalerInd] + (Double_t)uLastMbsMilliTime[iScalerInd]/1000.0 ) + 0.0)
00514                         );
00515                   else  fScalOrMu[iScalerInd]->Fill(
00516                         (Double_t)fTriglogInputEvent->fMbsTimeSecs + (Double_t)fTriglogInputEvent->fMbsTimeMillisec/1000.0
00517                         - ( (Double_t)uInitialMbsTime - (Double_t)uInitialMilliTime/1000.0), 0.0);
00518                uLastScalerScalOrMu[iScalerInd] = fCrateInputEvent->fScalOrMu.uScaler[iScalerInd];
00519                uLastMbsMilliTime[iScalerInd] = fTriglogInputEvent->fMbsTimeMillisec;
00520                uLastMbsTime[iScalerInd]      = fTriglogInputEvent->fMbsTimeSecs;
00521             }
00522          }
00523          if( 0 == uInitialScaler1_16 || fTriglogInputEvent->fVulomScaler[0][15] < uInitialScaler1_16)
00524          {
00525             uInitialScaler1_16 = fTriglogInputEvent->fVulomScaler[0][15];
00526             for( Int_t iScalerInd = 0; iScalerInd < N_SCALERS_CH; iScalerInd++)
00527             {
00528                uLastScaler2[iScalerInd]            = fTriglogInputEvent->fVulomScaler[1][iScalerInd];
00529                uLastScaler1_16[iScalerInd]         = fTriglogInputEvent->fVulomScaler[0][15];
00530             }
00531          }
00532          else
00533          {
00534             Double_t dDt = 0.0;
00535             Double_t dDtInit = 0.0;
00536             Double_t dPulserFreq = 781250.0;
00537             for( Int_t iScalerInd = 0; iScalerInd < N_SCALERS_CH; iScalerInd++)
00538             {
00539                dDt     = ((Double_t)fTriglogInputEvent->fVulomScaler[0][15] - (Double_t)uLastScaler1_16[iScalerInd]) / dPulserFreq;
00540                dDtInit = ((Double_t)fTriglogInputEvent->fVulomScaler[0][15] - (Double_t)uInitialScaler1_16) / dPulserFreq;
00541                if( 0 != uLastScaler2[iScalerInd] && 0 != fTriglogInputEvent->fVulomScaler[1][iScalerInd] &&
00542                      uLastScaler2[iScalerInd] < fTriglogInputEvent->fVulomScaler[1][iScalerInd] &&
00543                      0. <= dDt  )
00544                {
00545                   if( (0.9 * dScaler2BinMax)/(Double_t)iScaler2BinNb <= dDt)
00546                   fScaler2[iScalerInd]->Fill( dDtInit,
00547                         ( (Double_t)fTriglogInputEvent->fVulomScaler[1][iScalerInd] - (Double_t)uLastScaler2[iScalerInd] ) / dDt);
00548                }
00549                   else
00550                      fScaler2[iScalerInd]->Fill( dDtInit, 0.0);
00551 
00552                uLastScaler2[iScalerInd]           = fTriglogInputEvent->fVulomScaler[1][iScalerInd];
00553                uLastScaler1_16[iScalerInd]        = fTriglogInputEvent->fVulomScaler[0][15];
00554             }
00555          }
00556       }
00557    } // if(fCrateInputEvent && fCrateInputEvent->IsValid())
00558 
00559    if( 0 && fEpicsInputEvent && fEpicsInputEvent->IsValid()) // check if new update has been done
00560    {
00561       // TODO: put reasonable display of interesting slow control variables here
00562 
00563 
00564 
00565       // the following is example from cosy december 2010 beamtime
00566       // note access to EPICS process variables by full name here
00567       /*     int motorx = fEpicsInputEvent->GetDouble("CBM:MOTOR:GETPOSX");
00568      int motory = fEpicsInputEvent->GetDouble("CBM:MOTOR:GETPOSY");
00569      int rolu_left = fEpicsInputEvent->GetDouble("CBM:rolu:step_to_mm_L");
00570      int rolu_right = fEpicsInputEvent->GetDouble("CBM:rolu:step_to_mm_R");
00571      int rolu_up = fEpicsInputEvent->GetDouble("CBM:rolu:step_to_mm_O");
00572      int rolu_down = fEpicsInputEvent->GetDouble("CBM:rolu:step_to_mm_U");
00573 
00574      fMotorPos->SetTitle(
00575            Form("Motor position, EPICS Time:%s -",
00576                  fEpicsInputEvent->GetUpdateTimeString()));
00577      fMotorPos->Fill(motorx, motory);
00578 
00579      fRoluPos->SetTitle(
00580            Form("ROLU positions, EPICS Time:%s -",
00581                  fEpicsInputEvent->GetUpdateTimeString()));
00582      Int_t roludim = 35;
00583      Int_t middle = roludim / 2;
00584      Int_t displaywidth = 6;
00585      for (int i = 0; i < 2 * displaywidth; ++i) {
00586         fRoluPos->Fill(middle - rolu_left, middle - displaywidth + i);
00587         fRoluPos->Fill(middle + rolu_right, middle - displaywidth + i);
00588         fRoluPos->Fill(middle - displaywidth + i, middle - rolu_down);
00589         fRoluPos->Fill(middle - displaywidth + i, rolu_up + middle);
00590      }
00591        */
00592 
00593    } // end EPICS block
00594    
00595    if(fVftxInputEvent && fVftxInputEvent->IsValid())
00596    {
00597       for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00598          if( 1 == fPar->uTdcTypeStrip[iStripRpcIndex] )
00599          {
00600             uMultiplicityStripRpc[iStripRpcIndex] = 0;
00601             // Tdc range check
00602             // if( MAX_FPGA_TDC <= uTdcStripLeftList[iStripRpcIndex][uStripIndex] )
00603             // if( MAX_FPGA_TDC <= uTdcStripRightList[iStripRpcIndex][uStripIndex] )
00604             
00605             Double_t dRpcCenterOffset = (Double_t)fPar->uNbStrips[iStripRpcIndex] / 2.0;
00606             for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00607             {
00608                if( -1 < (fVftxInputEvent->fVftxBoards[
00609                                           fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00610                                              fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] ][0] &&
00611                    -1 < (fVftxInputEvent->fVftxBoards[
00612                                           fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00613                                              fPar->uChannelStripRight[iStripRpcIndex][uStripIndex] ][0] )
00614                {
00615                   // Beam profile for strip RPC: X = left right Dt - offset, Y = size index * strip size
00616                   fBeamProfileStripRpc[iStripRpcIndex]->Fill(
00617                         fPar->dTimeConv[iStripRpcIndex]*( (fVftxInputEvent->fVftxBoards[
00618                                                    fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00619                                                       fPar->uChannelStripRight[iStripRpcIndex][uStripIndex]][0]
00620                                                -(fVftxInputEvent->fVftxBoards[
00621                                                    fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00622                                                       fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] ][0]
00623                                               )/1000.0
00624                         - fPar->dOffsetList[iStripRpcIndex][uStripIndex],
00625                         ((Double_t)uStripIndex - dRpcCenterOffset )*fPar->dStripWidth[iStripRpcIndex] );
00626                         
00627                   // Channel nb for trailing edge depends whether the leading edge channel is even or uneven
00628                   UInt_t uTrailingEdgeChannelLeft;
00629                   UInt_t uTrailingEdgeChannelRight;
00630                   if( 1 == fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex]%2 )
00631                      uTrailingEdgeChannelLeft = fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] - 1;
00632                      else uTrailingEdgeChannelLeft = fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] + 1;
00633                   if( 1 == fPar->uChannelStripRight[iStripRpcIndex][uStripIndex]%2 )
00634                      uTrailingEdgeChannelRight = fPar->uChannelStripRight[iStripRpcIndex][uStripIndex] - 1;
00635                      else uTrailingEdgeChannelRight = fPar->uChannelStripRight[iStripRpcIndex][uStripIndex] + 1;
00636                      
00637                   if( -1 < (fVftxInputEvent->fVftxBoards[
00638                                           fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00639                                              uTrailingEdgeChannelLeft ][0] )
00640                   {
00641                      fTotLeftStripRpc[iStripRpcIndex]->Fill(
00642                         ( (fVftxInputEvent->fVftxBoards[
00643                               fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00644                                  uTrailingEdgeChannelLeft ][0]
00645                           -(fVftxInputEvent->fVftxBoards[
00646                               fPar->uTdcStripLeftList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00647                                  fPar->uChannelStripLeft[iStripRpcIndex][uStripIndex] ][0]
00648                          )/1000.0, 
00649                         (Double_t)uStripIndex - dRpcCenterOffset );
00650                      if( -1 < (fVftxInputEvent->fVftxBoards[
00651                                              fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00652                                                 uTrailingEdgeChannelRight ][0] )
00653                      {
00654                         uMultiplicityStripRpc[iStripRpcIndex]++;
00655 
00656                         vStepStripCounts[iStripRpcIndex][uStripIndex]++;
00657                      }// if valid trailing edge also on right side
00658                   } // if valid trailing edge on left side
00659 
00660                   if( -1 < (fVftxInputEvent->fVftxBoards[
00661                                           fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00662                                              uTrailingEdgeChannelRight ][0] )
00663                   {
00664                      fTotRightStripRpc[iStripRpcIndex]->Fill(
00665                         ( (fVftxInputEvent->fVftxBoards[
00666                               fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00667                                  uTrailingEdgeChannelRight ][0]
00668                           -(fVftxInputEvent->fVftxBoards[
00669                               fPar->uTdcStripRightList[iStripRpcIndex][uStripIndex] ] ).dTimeCorr[
00670                                  fPar->uChannelStripRight[iStripRpcIndex][uStripIndex] ][0]
00671                          )/1000.0,
00672                         (Double_t)uStripIndex - dRpcCenterOffset );
00673                   } // if valid trailing edge on right side
00674                } // if( valid on both ends!)
00675             } //  for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00676             fMultiplicityStripRpc[iStripRpcIndex]->Fill( uMultiplicityStripRpc[iStripRpcIndex] );
00677          } // if( 1 == fPar->uTdcTypeStrip[iStripRpcIndex] )
00678       for( Int_t iPadRpcIndex = 0; iPadRpcIndex < fPar->iNbPadRpcs; iPadRpcIndex++)
00679          if( 1 == fPar->uTdcTypePad[iPadRpcIndex] )
00680          {
00681             Double_t dRpcCenterPadOffsetX = (Double_t)fPar->uNbPadsX[iPadRpcIndex]*fPar->dPadSizeX[iPadRpcIndex]/2.0;
00682             Double_t dRpcCenterPadOffsetY = (Double_t)fPar->uNbPadsY[iPadRpcIndex]*fPar->dPadSizeY[iPadRpcIndex]/2.0;
00683             
00684             for(UInt_t uPadIndexY = 0; uPadIndexY < fPar->uNbPadsY[iPadRpcIndex]; uPadIndexY++)
00685                for(UInt_t uPadIndexX = 0; uPadIndexX < fPar->uNbPadsX[iPadRpcIndex]; uPadIndexX++)
00686             {
00687                if( -1 < (fVftxInputEvent->fVftxBoards[ 
00688                                     fPar->uPadsTdc[iPadRpcIndex][uPadIndexY][uPadIndexX] ]).dTimeCorr[
00689                                           fPar->uPadsChan[iPadRpcIndex][uPadIndexY][uPadIndexX] ][0] )
00690                {
00691                   fBeamProfilePadRpc[iPadRpcIndex]->Fill( (Double_t)uPadIndexX*fPar->dPadSizeX[iPadRpcIndex] - dRpcCenterPadOffsetX, 
00692                                                           (Double_t)uPadIndexY*fPar->dPadSizeY[iPadRpcIndex] - dRpcCenterPadOffsetY);
00693                } // if valid hit on this pad
00694             } // for uPadIndexY uPadIndexX
00695          } // if( 0 == fPar->uTdcTypeStrip[iStripRpcIndex] )
00696    } // if(fVftxInputEvent && fVftxInputEvent->IsValid())
00697 
00698    if( -1 < fPar->iRateIntegrationDuration && -1 < fPar->iRateIntegrationStep &&
00699          fTriglogInputEvent && fTriglogInputEvent->IsValid() )
00700    {
00701 
00702       if( fPar->iRateIntegrationStep <= (Int_t)fTriglogInputEvent->fMbsTimeSecs - (Int_t)uLastMbsTimeStep)
00703       {
00704          for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00705          {
00706             UInt_t uCounterStepCounts =0;
00707             for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00708             {
00709                /*
00710                // Reset the strip rate histogram when the Intergration duration is reached
00711                if( fPar->iRateIntegrationDuration <= (Int_t)fTriglogInputEvent->fMbsTimeSecs - (Int_t)uFirstMbsTimeIntegration)
00712                {
00713                   fStripRateStripRpc[iStripRpcIndex]->Reset();
00714                   uFirstMbsTimeIntegration = fTriglogInputEvent->fMbsTimeSecs;
00715                }
00716                */
00717                // Fill strip rate histo
00718                fStripRateStripRpc[iStripRpcIndex]->Fill(
00719                      vStepStripCounts[iStripRpcIndex][uStripIndex] / ((Int_t)fTriglogInputEvent->fMbsTimeSecs - (Int_t)uLastMbsTimeStep),
00720                      uStripIndex);
00721                // Compute counter counts in the step
00722                uCounterStepCounts += vStepStripCounts[iStripRpcIndex][uStripIndex];
00723                // Reset Strip counts in the step
00724                vStepStripCounts[iStripRpcIndex][uStripIndex] = 0;
00725             } // for( UInt_t uStripIndex = 0; uStripIndex < fPar->uNbStrips[iStripRpcIndex]; uStripIndex++)
00726             // Fill counter rate versus time histo
00727             fCounterRateStripRpc[iStripRpcIndex]->Fill( fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTimeStep,
00728                   uCounterStepCounts / (fTriglogInputEvent->fMbsTimeSecs - uLastMbsTimeStep) );
00729          } // for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs; iStripRpcIndex++)
00730          uLastMbsTimeStep = fTriglogInputEvent->fMbsTimeSecs;
00731       } // if time since last update more than step value
00732    } // if rate parameters set && triglog event OK
00733 
00734    if( fCrateInputEvent && fCrateInputEvent->IsValid() && fVftxInputEvent && fVftxInputEvent->IsValid() )
00735    {
00736       if( -1 < fPar->iOffsetFullChannelCaen && -1 < fPar->iOffsetFullChannelVFTX )
00737       {
00738          // Offset to use when comparing times from CAEN and from VFTX TDCs
00739          dCaenVftxOffset = ( (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen  ]).lead_multi[
00740                                         fPar->iOffsetChannelCaen ][0] )*dCaenBinSize*1000
00741                            - (fVftxInputEvent->fVftxBoards[ fPar->iOffsetTdcVFTX ]).dTimeCorr[
00742                                         fPar->iOffsetChannelVFTX][0];
00743 
00744          // Now you can do stuff with times from both TDCs
00745             // Test of the offset between CAEN and VFTX, ref in same tdcs
00746          fTdcOffsetTestSameCV->Fill( ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[29][0] )*dCaenBinSize*1000
00747                                      - (fVftxInputEvent->fVftxBoards[ 6 ]).dTimeCorr[1][0]
00748                                      - dCaenVftxOffset);
00749             // Test of the offset between CAEN and VFTX, ref in diff tdcs
00750          fTdcOffsetTestDiffCV->Fill( ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[29][0] )*dCaenBinSize*1000
00751                                      - (fVftxInputEvent->fVftxBoards[ 6 ]).dTimeCorr[1][0]
00752                                      - dCaenVftxOffset);
00753             // Test of the offset between CAEN and VFTX, ref in diff caen
00754          fTdcOffsetTestDiffC->Fill(  ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[29][0] )*dCaenBinSize*1000
00755                                      - (fVftxInputEvent->fVftxBoards[ 6 ]).dTimeCorr[1][0]
00756                                      - dCaenVftxOffset);
00757             // Test of the offset between CAEN and VFTX, ref in diff vftx
00758          fTdcOffsetTestDiffV->Fill(  ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[29][0] )*dCaenBinSize*1000
00759                                      - (fVftxInputEvent->fVftxBoards[ 6 ]).dTimeCorr[1][0]
00760                                      - dCaenVftxOffset);
00761 
00762             // Test of the resolution between CAEN and CAEN, same board
00763          fTdcResolutionTestSameC->Fill( ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[29][0] )*dCaenBinSize*1000
00764                                       - ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[22][0] )*dCaenBinSize*1000);
00765             // Test of the resolution between CAEN and CAEN, diff board
00766          fTdcResolutionTestDiffC->Fill( ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[29][0] )*dCaenBinSize*1000
00767                                       - ( (fCrateInputEvent->fMtdc[ 0 ]).lead_multi[22][0] )*dCaenBinSize*1000);
00768             // Test of the resolution between CAEN and CAEN, same board
00769          fTdcResolutionTestSameV->Fill( ( fVftxInputEvent->fVftxBoards[ 6 ]).dTimeCorr[ 1][0]
00770                                       - ( fVftxInputEvent->fVftxBoards[ 4 ]).dTimeCorr[51][0] );
00771             // Test of the resolution between CAEN and CAEN, diff board
00772          fTdcResolutionTestDiffV->Fill(  ( fVftxInputEvent->fVftxBoards[ 6 ]).dTimeCorr[ 1][0]
00773                                        - ( fVftxInputEvent->fVftxBoards[ 4 ]).dTimeCorr[51][0] );
00774       } //if( -1 < fPar->iOffsetFullChannelCaen && -1 < fPar->iOffsetFullChannelVFTX )
00775 
00776       Int_t iDualMultHistoIndex = 0;
00777       for( Int_t iStripRpcIndex = 0; iStripRpcIndex < fPar->iNbStripRpcs - 1; iStripRpcIndex++)
00778          for( Int_t iStripRpcIndex2 = iStripRpcIndex+1; iStripRpcIndex2 < fPar->iNbStripRpcs; iStripRpcIndex2++)
00779          {
00780             /*
00781             cout<<iStripRpcIndex<<" "<<iStripRpcIndex2<<" "<<" "<<iDualMultHistoIndex<<" "<<
00782                   (NB_STRIP_RPC_MAX-1)*(NB_STRIP_RPC_MAX-2)/2<<endl;
00783                   */
00784             fDualMultiplicityStripRpc[iDualMultHistoIndex]->Fill( uMultiplicityStripRpc[iStripRpcIndex],
00785                                                                   uMultiplicityStripRpc[iStripRpcIndex2]);
00786             iDualMultHistoIndex++;
00787          }
00788    } // if( fCrateInputEvent && fCrateInputEvent->IsValid() && fVftxInputEvent && fVftxInputEvent->IsValid() )
00789 }

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