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

beamtime/tof-tdctest/go4/PADRPC/TPadRpcProc.cxx (r4864/r4678)

Go to the documentation of this file.
00001 #include "TPadRpcProc.h"
00002 
00003 #include "TProfile.h"
00004 #include "TF1.h"
00005 #include "TMath.h"
00006 
00007 TPadRpcProc::TPadRpcProc(const char* name) : TCBMBeamtimeProc(name),
00008 fCrateInputEvent(0),
00009 fTriglogInputEvent(0),
00010 fVftxInputEvent(0),
00011 fOutputEvent(0)
00012 {
00013    TGo4Log::Info("**** TPadRpcProc: Create instance %s" , name );
00014 
00015    // Making a new parameter object for this RPC
00016    TString sName = name;
00017    UInt_t uIndexRpc =((TString)sName( sName.Length()-2, 2 ) ).Atoi();
00018    fPar = (TPadRpcParam*) MakeParameter( Form("PadRpcPar_%02d", uIndexRpc), "TPadRpcParam");
00019 
00020    if( 1 == fPar->uTdcTypePad || 2 == fPar->uTdcTypePad )
00021    {
00022       fVftxPar = (TVftxParam*) GetParameter("VftxPar");
00023       if( 0 == fVftxPar )
00024          fVftxPar = (TVftxParam*) MakeParameter("VftxPar", "TVftxParam");
00025    }
00026 
00027    fParAnalysis = (TGsiAug12Param*) GetParameter("GsiAug12Par");
00028 
00029    //~ cout<<name<<endl;
00030 
00031    // To be put as preprocessor somewhere ? (T1290Data.h?)
00032    dCaenBinSize     = 25000.0/1024.0;
00033    dRpcCenterOffsetX   = (Double_t)(fPar->uNbPadsX)                 / 2.0;
00034    dRpcCenterOffsetY   = (Double_t)(fPar->uNbPadsY)                 / 2.0;
00035    dRpcCenterOffsetCmX = (Double_t)(fPar->uNbPadsX)*fPar->dPadSizeX / 2.0;
00036    dRpcCenterOffsetCmY = (Double_t)(fPar->uNbPadsY)*fPar->dPadSizeY / 2.0;
00037    cout<<dRpcCenterOffsetX<<"/"<<dRpcCenterOffsetY<<" "<<dRpcCenterOffsetCmX<<"/"<<dRpcCenterOffsetCmY<<endl;
00038 
00039    // Create histograms only if at least one pad define!
00040    if( 0 < fPar->uNbPadsX && 0 < fPar->uNbPadsY )
00041    {
00042       fBeamProfilePadRpcCm =
00043          MakeTH2('D', Form("Rpc/%s/BeamProfileCm%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00044             Form("Beam profile for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00045             fPar->uNbPadsX, -dRpcCenterOffsetCmX, dRpcCenterOffsetCmX,
00046             fPar->uNbPadsY, -dRpcCenterOffsetCmY, dRpcCenterOffsetCmY,
00047             "Pad X [cm]", "Pad Y [cm]" );
00048 
00049       fBeamProfilePadRpc =
00050          MakeTH2('D', Form("Rpc/%s/BeamProfile%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00051             Form("Beam profile for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00052             fPar->uNbPadsX, 0, fPar->uNbPadsX,
00053             fPar->uNbPadsY, 0, fPar->uNbPadsY,
00054             "Pad X []", "Pad Y []" );
00055 
00056       // Multiplicity plots
00057       fMultiplicityPadRpc =
00058             MakeTH1('I', Form("Rpc/%s/Multiplicity%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00059             Form("Pad Multiplicity for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00060             fPar->uNbPadsX*fPar->uNbPadsY, -0.5, fPar->uNbPadsX*fPar->uNbPadsY - 0.5,
00061             "Multiplicity (Number of pads fired simultaneously/event) [pads]" ) ;
00062 
00063       // Cluster multiplicity plots
00064       fClusterMultPadRpc =
00065             MakeTH1('I', Form("Rpc/%s/ClusterMult%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00066             Form("Cluster multiplicity for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00067             (fPar->uNbPadsX*fPar->uNbPadsY)/2 + 1, -0.5, (fPar->uNbPadsX*fPar->uNbPadsY)/2 + 1 - 0.5,
00068             "Cluster multiplicity [clusters]" ) ;
00069 
00070       // Cluster size plots
00071       fClusterSizePadRpc =
00072             MakeTH1('I', Form("Rpc/%s/ClusterSize%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00073             Form("Cluster size for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00074             fPar->uNbPadsX*fPar->uNbPadsY -1, 0.5, fPar->uNbPadsX*fPar->uNbPadsY - 0.5,
00075             "Cluster size [strips]" ) ;
00076 
00077       // Cluster position
00078       if( 1 == fPar->uOrientation )
00079          fClusterProfilePadRpc =
00080                MakeTH2('D', Form("Rpc/%s/BeamProfClusters%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00081                Form("Beam profile using clusters center for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00082                fPar->uNbPadsY, -dRpcCenterOffsetCmY, dRpcCenterOffsetCmY,
00083                fPar->uNbPadsX, -dRpcCenterOffsetCmX, dRpcCenterOffsetCmX,
00084                "X [cm]", "Y [cm]" );
00085          else fClusterProfilePadRpc =
00086                MakeTH2('D', Form("Rpc/%s/BeamProfClusters%s", fPar->sPadRpcName.Data(), fPar->sPadRpcName.Data()),
00087                Form("Beam profile using clusters center for %s, Pad map in option file", fPar->sPadRpcName.Data()) ,
00088                fPar->uNbPadsX, -dRpcCenterOffsetCmX, dRpcCenterOffsetCmX,
00089                fPar->uNbPadsY, -dRpcCenterOffsetCmY, dRpcCenterOffsetCmY,
00090                "X [cm]", "Y [cm]" );
00091    } // if( 0 < fPar->uNbPadsX && 0 < fPar->uNbPadsY )
00092 
00093    TGo4Log::Info("**** TPadRpcProc: Instance %s created", name );
00094 }
00095 
00096 
00097 TPadRpcProc::~TPadRpcProc()
00098 {
00099    cout << "**** TPadRpcProc: Delete instance " << endl;
00100 }
00101 
00102 void TPadRpcProc::InitEvent(TGo4EventElement* outevnt)
00103 {
00104    // first assign input event:
00105    // since input event object is never discarded within processor lifetime,
00106    // we just search for subevent by name once to speed up processing
00107 
00108    if(fCrateInputEvent==0 && ( 0 == fPar->uTdcTypePad || 2 == fPar->uTdcTypePad ))
00109    {
00110      TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetOutputEvent("Unpack"));
00111           if(btevent)
00112           {
00113                  fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE"));
00114           }
00115           else
00116           {
00117                  fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(GetInputEvent());
00118           }
00119           if(fCrateInputEvent==0) {
00120        GO4_STOP_ANALYSIS_MESSAGE("**** TPadRpcProc: Fatal error: Unpack output event has no TMbsCrateEvent!!! STOP GO4");
00121           }
00122    } // if(fCrateInputEvent==0 && ( 0 == fPar->uTdcTypePad || 2 == fPar->uTdcTypePad ))
00123    if(fTriglogInputEvent==0 && kTRUE == fParAnalysis->bWithTriglog)
00124    {
00125      TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetOutputEvent("Unpack"));
00126           if(btevent)
00127           {
00128                  fTriglogInputEvent=dynamic_cast<TTriglogEvent*>(btevent->GetSubEvent("TRIGLOG"));
00129           }
00130 
00131           if(fTriglogInputEvent==0) {
00132                  GO4_STOP_ANALYSIS_MESSAGE("**** TPadRpcProc: Fatal error: Unpack output event is/has not a TTriglogEvent!!! STOP GO4");
00133           }
00134    } // if(fTriglogInputEvent==0)
00135    if(fVftxInputEvent==0 && ( 1 == fPar->uTdcTypePad || 2 == fPar->uTdcTypePad ))
00136    {
00137           TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00138           if(btevent)
00139           {
00140                  fVftxInputEvent=dynamic_cast<TVftxEvent*>(btevent->GetSubEvent("VFTX"));
00141           }
00142 
00143           if(fVftxInputEvent==0) {
00144                  GO4_STOP_ANALYSIS_MESSAGE("**** TPadRpcProc: Fatal error: input event has no TVftxEvent!!! STOP GO4");
00145           }
00146    } // if(fVftxInputEvent==0 && ( 1 == fPar->uTdcTypePad || 2 == fPar->uTdcTypePad ))
00147 
00148    // then assign output event
00149    // since output event object is never discarded within processor lifetime,
00150    // we just search for subevent by name once to speed up processing
00151    if(fOutputEvent==0)
00152    {
00153       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00154       if(btevent)
00155       {
00156          TString sName = GetName();
00157          if ( sName.Contains("PADRPC_") )
00158          {
00159             fOutputEvent=dynamic_cast<TPadRpcEvent*>(btevent->GetSubEvent(
00160                   (TString)(sName(sName.Index("PADRPC_"), sName.Length() ) ) ) );
00161          }
00162             else fOutputEvent=dynamic_cast<TPadRpcEvent*>(btevent->GetSubEvent("PADRPC"));
00163       }
00164       else
00165       {
00166           fOutputEvent=dynamic_cast<TPadRpcEvent*>(btevent->GetSubEvent("PADRPC"));
00167       }
00168       if(fOutputEvent==0) {
00169          GO4_STOP_ANALYSIS_MESSAGE("**** TPadRpcProc: Fatal error: output event is not a TPadRpcEvent!!! STOP GO4");
00170       }
00171       else {
00172          //     BuildEvent(dynamic_cast<TGo4MbsSubEvent*>(btevent->GetSubEvent("MBSCRATE")));
00173       }
00174    }
00175 
00176 }
00177 
00178 void TPadRpcProc::FinalizeEvent()
00179 {
00180    hitCurrent.Clear();
00181    clusterCurrent.Clear();
00182    uLastFiredPadX = fPar->uNbPadsX; // To be sure it's out of range for dead strips on startup
00183    uMultiplicityPadRpc = 0;
00184 
00185    if( -1 < fParAnalysis->iTriggerRejection && kTRUE == fParAnalysis->bWithTriglog)
00186        if( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>fParAnalysis->iTriggerRejection)&0x1 )  )
00187       {
00188           // The trigger Rejection is active and we have rejected trigger
00189          return;
00190       }
00191 
00192    if(  fPar->uTdcTypePad < 3 )
00193    {
00194       // The trigger selection is active and we have another trigger or no Pad is defined => skip processing
00195       if( kTRUE == fParAnalysis->bWithTriglog )
00196          if( !( ( -1 == fPar->iTriggerSelection) ||
00197              ( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>fPar->iTriggerSelection)&0x1 )  ) ) ||
00198                0 == fPar->uNbPadsX || 0 == fPar->uNbPadsY )
00199          {
00200             return;
00201          }
00202 
00203       if( 2 == fPar->uTdcTypePad )
00204       {
00205          (fOutputEvent->fEvents).resize(1);
00206          // Check that both tdc data are valid and calibrated
00207          if(fCrateInputEvent && fCrateInputEvent->IsValid() &&
00208                fVftxInputEvent && fVftxInputEvent->IsValid() )
00209          {
00210             Double_t dCaenVftxOffset =  0.;
00211             if( -1 < fVftxPar->iMainReferenceTdc )
00212             {
00213                if( -1 < fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] )
00214                {
00215                   Bool_t bOffsetOk = kFALSE;
00216                   if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00217                   {
00218                      if( -1 < (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen ]).lead_multi[ fPar->iOffsetChannelCaen ][0] &&
00219                          -1 < (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00220                                      fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] ][0] &&
00221                         -1 < (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00222                                      fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] ][0])
00223                      {
00224                         dCaenVftxOffset =  dCaenBinSize*( (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen ]).lead_multi[ fPar->iOffsetChannelCaen ][0] )
00225                                          - ( (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00226                                                     fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] ][0]
00227                                             +(fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00228                                                     fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc ] ][0])/2.;
00229                         bOffsetOk = kTRUE;
00230                      } // if all times OK
00231                   } // if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00232                   if( kFALSE == bOffsetOk )
00233                      if( -1 < (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen ]).lead_multi[ fPar->iOffsetChannelCaen ][0] &&
00234                          -1 < (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00235                                      fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] ][0] )
00236                         dCaenVftxOffset =  dCaenBinSize*( (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen ]).lead_multi[ fPar->iOffsetChannelCaen ][0] )
00237                                          - (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00238                                                     fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] ][0];
00239                } // if( -1 < fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] )
00240                   else if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00241                      if( -1 < (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen ]).lead_multi[ fPar->iOffsetChannelCaen ][0] &&
00242                          -1 < (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00243                                      fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] ][0] )
00244                         dCaenVftxOffset =  dCaenBinSize*( (fCrateInputEvent->fMtdc[ fPar->iOffsetTdcCaen ]).lead_multi[ fPar->iOffsetChannelCaen ][0] )
00245                                          - (fVftxInputEvent->fVftxBoards[ fVftxPar->iMainReferenceTdc ] ).dTimeCorr[
00246                                                     fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] ][0];
00247             } // if( -1 < fVftxPar->iMainReferenceTdc )
00248 
00249             for(UInt_t temp_indexY = 0; temp_indexY < fPar->uNbPadsY; temp_indexY++)
00250                for(UInt_t temp_indexX = 0; temp_indexX < fPar->uNbPadsX; temp_indexX++)
00251                {
00252                   hitCurrent.Clear();
00253                   if( 1 == fPar->uTdcPadType[temp_indexY][temp_indexX])
00254                      ProcessVftxPad( temp_indexX, temp_indexY );
00255                      else ProcessCaenPad( temp_indexX, temp_indexY, dCaenVftxOffset );
00256                } //  for( temp_indexY, temp_indexX)
00257          } // if(fCrateInputEvent && fCrateInputEvent->IsValid() && fVftxInputEvent && fVftxInputEvent->IsValid() )
00258       } // if( 2 == fPar->uTdcTypePad )
00259       else if( 1 == fPar->uTdcTypePad )
00260       {
00261          // Check that the VFTX data are valid after calibration
00262          if(fVftxInputEvent && fVftxInputEvent->IsValid())
00263          {
00264             for(UInt_t temp_indexY = 0; temp_indexY < fPar->uNbPadsY; temp_indexY++)
00265                for(UInt_t temp_indexX = 0; temp_indexX < fPar->uNbPadsX; temp_indexX++)
00266                {
00267                   hitCurrent.Clear();
00268 
00269                   ProcessVftxPad( temp_indexX, temp_indexY );
00270                } //  for( temp_indexY, temp_indexX )
00271          } // if(fVftxInputEvent && fVftxInputEvent->IsValid())
00272       } // if( 2 == fPar->uTdcTypePad ) else if( 1 == fPar->uTdcTypePad )
00273       else
00274       {
00275          // Check that the MBS unpack event is valid
00276          if(fCrateInputEvent && fCrateInputEvent->IsValid())
00277          {
00278             for(UInt_t temp_indexY = 0; temp_indexY < fPar->uNbPadsY; temp_indexY++)
00279                for(UInt_t temp_indexX = 0; temp_indexX < fPar->uNbPadsX; temp_indexX++)
00280                {
00281                   hitCurrent.Clear();
00282 
00283                   ProcessCaenPad( temp_indexX, temp_indexY );
00284                } //  for( temp_indexY, temp_indexX )
00285          } // if(fCrateInputEvent && fCrateInputEvent->IsValid())
00286       } // else of if( 2 == fPar->uTdcTypePad )else if( 1 == fPar->uTdcTypePad )
00287 
00288       if( 0 < (clusterCurrent.fHits).size() )
00289       {
00290          clusterCurrent.PositionCalculation( dRpcCenterOffsetCmX, dRpcCenterOffsetCmY,
00291                   fPar->uOrientation,
00292                   fPar->dPadSizeX, fPar->dPadSizeY );
00293          (eventCurrent.fClusters).push_back( clusterCurrent );
00294          clusterCurrent.Clear();
00295       } // if( 0 < (clusterCurrent.fHits).size() )
00296 
00297       // Multiplicity graph with Pad RPCs
00298       fMultiplicityPadRpc->Fill( uMultiplicityPadRpc );
00299       // Cluster multiplicity graph with Pad RPCs
00300       fClusterMultPadRpc->Fill( (eventCurrent.fClusters).size() );
00301       // Cluster size graph with Pad RPCs
00302       for(UInt_t uCluster = 0; uCluster < (eventCurrent.fClusters).size(); uCluster++)
00303       {
00304          fClusterSizePadRpc->Fill( ( ( (eventCurrent.fClusters)[uCluster] ).fHits ).size() );
00305          fClusterProfilePadRpc->Fill( ( (eventCurrent.fClusters)[uCluster] ).dX,
00306                                         ( (eventCurrent.fClusters)[uCluster] ).dY);
00307       } // for(UInt_t uCluster = 0; uCluster < (eventCurrent.fClusters).size(); uCluster++)
00308 
00309       // Push event object to the output event
00310       (fOutputEvent->fEvents).push_back( eventCurrent );
00311    } // if(  fPar->uTdcTypePad < 3 )
00312 
00313    fOutputEvent->SetValid(kTRUE);
00314 }
00315 
00316 /**************************************************************************************************/
00317 void TPadRpcProc::ProcessCaenPad( UInt_t uPadIndexX, UInt_t uPadIndexY, Double_t dCaenOtherOffset )
00318 {
00319    // Test if both time are there
00320    if( -1 < (fCrateInputEvent->fMtdc[
00321                fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ]).lead_multi[
00322                      fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0] )
00323    {
00324       fBeamProfilePadRpcCm->Fill( fPar->dPadSizeX*uPadIndexX - dRpcCenterOffsetCmX,
00325                                   fPar->dPadSizeY*uPadIndexY - dRpcCenterOffsetCmY );
00326       fBeamProfilePadRpc->Fill( uPadIndexX, uPadIndexY );
00327 
00328       if( -1 < (fCrateInputEvent->fMtdc[
00329                   fPar->uTdcPadTot[uPadIndexY][uPadIndexX] ]).lead_multi[
00330                      fPar->uChannelPadTot[uPadIndexY][uPadIndexX] ][0] )
00331       {
00332          uMultiplicityPadRpc ++;
00333 
00334          hitCurrent.iPadIndexX     = uPadIndexX ;
00335          hitCurrent.iPadIndexY     = uPadIndexY ;
00336          // Store time including offset!
00337          hitCurrent.dTime  = dCaenBinSize*(
00338                (fCrateInputEvent->fMtdc[ fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ]).lead_multi[
00339                                        fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0] )
00340                                  + fPar->dOffsetList[uPadIndexY][uPadIndexX]
00341                                  - dCaenOtherOffset;
00342          // Store tot including offset and gain!
00343          hitCurrent.dTot   =
00344             ( (fCrateInputEvent->fMtdc[ fPar->uTdcPadTot[uPadIndexY][uPadIndexX] ]).trail_multi[
00345                                     fPar->uChannelPadTot[uPadIndexY][uPadIndexX]][0]
00346              -(fCrateInputEvent->fMtdc[ fPar->uTdcPadTime[uPadIndexY][uPadIndexX]  ]).lead_multi[
00347                                     fPar->uChannelPadTot[uPadIndexY][uPadIndexX] ][0]
00348             )*fPar->dToTGainList[uPadIndexY][uPadIndexX]*dCaenBinSize
00349             - fPar->dTotOffsetList[uPadIndexY][uPadIndexX];
00350 
00351          (clusterCurrent.fHits).push_back(hitCurrent);
00352          clusterCurrent.PositionCalculation( dRpcCenterOffsetCmX, dRpcCenterOffsetCmY,
00353                   fPar->uOrientation,
00354                   fPar->dPadSizeX, fPar->dPadSizeY );
00355          (eventCurrent.fClusters).push_back( clusterCurrent );
00356          clusterCurrent.Clear();
00357       }// if valid Tot
00358    } // if( valid on both ends!)
00359    return;
00360 }
00361 void TPadRpcProc::ProcessVftxPad( UInt_t uPadIndexX, UInt_t uPadIndexY, Double_t dVftxOtherOffset )
00362 {
00363    // Test if both time are there
00364    if( -1 < (fVftxInputEvent->fVftxBoards[
00365                fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ] ).dTimeCorr[
00366                   fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0] )
00367    {
00368       fBeamProfilePadRpcCm->Fill( fPar->dPadSizeX*uPadIndexX - dRpcCenterOffsetCmX,
00369                                   fPar->dPadSizeY*uPadIndexY - dRpcCenterOffsetCmY );
00370       fBeamProfilePadRpc->Fill( uPadIndexX, uPadIndexY );
00371 
00372       // Check Right tot is there
00373       if( -1 < (fVftxInputEvent->fVftxBoards[
00374                      fPar->uTdcPadTot[uPadIndexY][uPadIndexX] ] ).dTimeCorr[
00375                         fPar->uChannelPadTot[uPadIndexY][uPadIndexX] ][0] )
00376       {
00377          uMultiplicityPadRpc ++;
00378 
00379          hitCurrent.iPadIndexX     = uPadIndexX ;
00380          hitCurrent.iPadIndexY     = uPadIndexY ;
00381          // Store time including offset!
00382          hitCurrent.dTime  = (fVftxInputEvent->fVftxBoards[
00383                                      fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ] ).dTimeCorr[
00384                                        fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0]
00385                               + fPar->dOffsetList[uPadIndexY][uPadIndexX]
00386                               - dVftxOtherOffset
00387                               - CLOCK_TIME*( 1 == fVftxPar->uTdcOffsetEnable?
00388                                     fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ] : 0.0);
00389 
00390          // Store tot including offset and gain!
00391          // Missing the offset for the coarse counter overflow!!!!
00392          hitCurrent.dTot   =
00393                (fVftxInputEvent->fVftxBoards[ fPar->uTdcPadTot[uPadIndexY][uPadIndexX] ] ).dTimeCorr[
00394                   fPar->uChannelPadTot[uPadIndexY][uPadIndexX]  ][0]
00395              - (fVftxInputEvent->fVftxBoards[ fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ] ).dTimeCorr[
00396                   fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0];
00397          if( 1000 < (fVftxInputEvent->fVftxBoards[ fPar->uTdcPadTot[uPadIndexY][uPadIndexX] ]).iCoarseTime[
00398                         fPar->uChannelPadTot[uPadIndexY][uPadIndexX] ][0]
00399                   - (fVftxInputEvent->fVftxBoards[ fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ]).iCoarseTime[
00400                         fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0] )
00401             hitCurrent.dTot -= ((TDC_FIFO_COARSE_CT>>TDC_FIFO_COARSE_CT_SHIFT)+1)*(Double_t)CLOCK_TIME;
00402 
00403          if( (fVftxInputEvent->fVftxBoards[ fPar->uTdcPadTot[uPadIndexY][uPadIndexX] ]).iCoarseTime[
00404                         fPar->uChannelPadTot[uPadIndexY][uPadIndexX] ][0]
00405             - (fVftxInputEvent->fVftxBoards[ fPar->uTdcPadTime[uPadIndexY][uPadIndexX] ]).iCoarseTime[
00406                   fPar->uChannelPadTime[uPadIndexY][uPadIndexX] ][0]  < 1000)
00407             hitCurrent.dTot += ((TDC_FIFO_COARSE_CT>>TDC_FIFO_COARSE_CT_SHIFT)+1)*(Double_t)CLOCK_TIME;
00408 
00409          hitCurrent.dTot *= fPar->dToTGainList[uPadIndexY][uPadIndexX];
00410          hitCurrent.dTot -= fPar->dTotOffsetList[uPadIndexY][uPadIndexX];
00411 
00412          (clusterCurrent.fHits).push_back(hitCurrent);
00413          clusterCurrent.PositionCalculation( dRpcCenterOffsetCmX, dRpcCenterOffsetCmY,
00414                   fPar->uOrientation,
00415                   fPar->dPadSizeX, fPar->dPadSizeY );
00416          (eventCurrent.fClusters).push_back( clusterCurrent );
00417          clusterCurrent.Clear();
00418       }// if valid tot
00419    } // if( valid on both ends!)
00420 
00421    return;
00422 }
00423 /**************************************************************************************************/

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