]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add switch for track TOF checking in case of problems with some data samples, move...
authorgconesab <gustavo.conesa.balbastre@cern.ch>
Sat, 22 Feb 2014 11:56:47 +0000 (12:56 +0100)
committergconesab <gustavo.conesa.balbastre@cern.ch>
Sat, 22 Feb 2014 11:58:21 +0000 (12:58 +0100)
PWG/CaloTrackCorrBase/AliCaloTrackReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackReader.h

index 476795d1048c61a7dd36cdd3d357ab18b9d174a5..c1bfda51ba5dc4ec02e39af43351e4a342bef5a9 100755 (executable)
@@ -74,7 +74,8 @@ fComparePtHardAndJetPt(0),   fPtHardAndJetPtFactor(0),
 fComparePtHardAndClusterPt(0),fPtHardAndClusterPtFactor(0),
 fCTSPtMin(0),                fEMCALPtMin(0),                  fPHOSPtMin(0),
 fCTSPtMax(0),                fEMCALPtMax(0),                  fPHOSPtMax(0),
-fUseEMCALTimeCut(1),         fUseParamTimeCut(0),             fUseTrackTimeCut(0),
+fUseEMCALTimeCut(1),         fUseParamTimeCut(0),
+fUseTrackTimeCut(0),         fAccessTrackTOF(0),
 fEMCALTimeCutMin(-10000),    fEMCALTimeCutMax(10000),
 fEMCALParamTimeCutMin(),     fEMCALParamTimeCutMax(),
 fTrackTimeCutMin(-10000),    fTrackTimeCutMax(10000),
@@ -328,6 +329,30 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
   
   if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass Trigger name rejection \n");
 
+  //-----------------------------------------------------------------
+  // In case of mixing analysis, select here the trigger of the event
+  //-----------------------------------------------------------------
+  
+  if(!fEventTriggerAtSE)
+  {
+    // In case of mixing analysis, accept MB events, not only Trigger
+    // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
+    // via de method in the base class FillMixedEventPool()
+    
+    AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
+    AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
+    
+    if(!inputHandler) return kFALSE ;  // to content coverity
+    
+    UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
+    UInt_t isMB      = inputHandler->IsEventSelected() & fMixEventTriggerMask;
+    
+    if(!isTrigger && !isMB) return kFALSE;
+    
+    //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
+    if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass uninteresting triggered events rejection in case of mixing analysis \n");
+  }
+
   //-------------------------------------------------------------------------------------
   // Reject or accept events depending on the trigger bit
   //-------------------------------------------------------------------------------------
@@ -351,7 +376,6 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
   
   if( IsEventEMCALL1() || IsEventEMCALL0()  )
   {
-
     if(fRejectEMCalTriggerEventsWith2Tresholds)
     {
       // Reject triggered events when there is coincidence on both EMCal trigger thresholds,
@@ -1108,11 +1132,17 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
     return kFALSE;
   }
   
-  // Select the event depending on the trigger type and other event characteristics
+  //-----------------------------------------------
+  // Select the event depending on the trigger type
+  // and other event characteristics
   // like the goodness of the EMCal trigger
+  //-----------------------------------------------
+  
   Bool_t accept = CheckEventTriggers();
   if(!accept) return kFALSE;
   
+  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Event trigger selection \n");
+  
   //---------------------------------------------------------------------------
   // In case of analysis of events with jets, skip those with jet pt > 5 pt hard
   // To be used on for MC data in pT hard bins
@@ -1121,15 +1151,15 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   if(fComparePtHardAndJetPt)
   {
     if(!ComparePtHardAndJetPt()) return kFALSE ;
+    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pt Hard - Jet rejection \n");
   }
   
   if(fComparePtHardAndClusterPt)
   {
     if(!ComparePtHardAndClusterPt()) return kFALSE ;
+    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pt Hard - Cluster rejection \n");
   }
   
-  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Pt Hard rejection \n");
-  
   //------------------------------------------------------
   // Event rejection depending on time stamp
   //------------------------------------------------------
@@ -1146,16 +1176,13 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
       
       if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
     }
-    //printf("\t accept time stamp\n");
+    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Time Stamp rejection \n");
   }
   
-  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Time Stamp rejection \n");
-  
   //------------------------------------------------------
   // Event rejection depending on vertex, pileup, v0and
   //------------------------------------------------------
   
-  //Fill Vertex array
   FillVertexArray();
   
   //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
@@ -1169,7 +1196,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
         TMath::Abs(fVertex[0][2] ) < 1.e-6    ) return kFALSE;
   }
   
-  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass primary vertex rejection \n");
+  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass primary vertex rejection \n");
   
   //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
   
@@ -1213,30 +1240,6 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
     
     if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass centrality rejection \n");
   }
-
-  //-----------------------------------------------------------------
-  // In case of mixing analysis, select here the trigger of the event
-  //-----------------------------------------------------------------
-
-  if(!fEventTriggerAtSE)
-  {
-    // In case of mixing analysis, accept MB events, not only Trigger
-    // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
-    // via de method in the base class FillMixedEventPool()
-    
-    AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
-    AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
-    
-    if(!inputHandler) return kFALSE ;  // to content coverity
-    
-    UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
-    UInt_t isMB      = inputHandler->IsEventSelected() & fMixEventTriggerMask;
-    
-    if(!isTrigger && !isMB) return kFALSE;
-    
-    //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass uninteresting triggered events rejection in case of mixing analysis \n");
-  }
   
   //---------------------------------------------------------------------------
   // In case of MC analysis, set the range of interest in the MC particles list
@@ -1246,15 +1249,16 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   
   //printf("N min %d, N max %d\n",fNMCProducedMin,fNMCProducedMax);
   
-  //-----------------------------------------------
-  // Fill the arrays with cluster/tracks/cells data
-  //-----------------------------------------------
-  
+  //-------------------------------------------------------
   // Get the main vertex BC, in case not available
   // it is calculated in FillCTS checking the BC of tracks
-  // with DCA small (if cut applied, if open)
+  //------------------------------------------------------
   fVertexBC = fInputEvent->GetPrimaryVertex()->GetBC();
   
+  //-----------------------------------------------
+  // Fill the arrays with cluster/tracks/cells data
+  //-----------------------------------------------
+  
   if(fFillCTS)
   {
     FillInputCTS();
@@ -1266,7 +1270,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   
   if(fDoVertexBCEventSelection)
   {
-    if(fVertexBC!=0 && fVertexBC!=AliVTrack::kTOFBCNA) return kFALSE ;
+    if(fVertexBC != 0 && fVertexBC != AliVTrack::kTOFBCNA) return kFALSE ;
     
     if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass rejection of events with vertex at BC!=0 \n");
   }
@@ -1466,7 +1470,7 @@ void AliCaloTrackReader::FillInputCTS()
   }
   
   Bool_t   bc0  = kFALSE;
-  if(fRecalculateVertexBC) fVertexBC=AliVTrack::kTOFBCNA;
+  if(fRecalculateVertexBC) fVertexBC = AliVTrack::kTOFBCNA;
   
   for (Int_t itrack =  0; itrack <  nTracks; itrack++)
   {////////////// track loop
@@ -1589,20 +1593,41 @@ void AliCaloTrackReader::FillInputCTS()
       
     } // AOD
     
-    TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
-    
+    // TOF cuts
     Bool_t okTOF  = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
     Double_t tof  = -1000;
     Int_t trackBC = -1000 ;
     
-    if(okTOF)
+    if(fAccessTrackTOF)
     {
-      trackBC = track->GetTOFBunchCrossing(bz);
-      SetTrackEventBC(trackBC+9);
-      
-      tof = track->GetTOFsignal()*1e-3;
+      if(okTOF)
+      {
+        trackBC = track->GetTOFBunchCrossing(bz);
+        SetTrackEventBC(trackBC+9);
+        
+        tof = track->GetTOFsignal()*1e-3;
+        
+        //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
+        if(fRecalculateVertexBC)
+        {
+          if     (trackBC != 0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
+          else if(trackBC == 0)                                   bc0       = kTRUE;
+        }
+        
+        //In any case, the time should to be larger than the fixed window ...
+        if( fUseTrackTimeCut && (trackBC !=0 || tof < fTrackTimeCutMin  || tof > fTrackTimeCutMax) )
+        {
+          //printf("Remove track time %f and bc = %d\n",tof,trackBC);
+          continue ;
+        }
+        //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
+      }
     }
     
+    TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
+    
+    // DCA cuts
+    
     if(fUseTrackDCACut)
     {
       //normal way to get the dca, cut on dca_xy
@@ -1614,40 +1639,20 @@ void AliCaloTrackReader::FillInputCTS()
         if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]);
         if(!okDCA)
         {
-          //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f, BC %d\n",momentum.Pt(),dca[0],trackBC);
+          //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",momentum.Pt(),dca[0]);
           continue ;
         }
       }
     }// DCA cuts
     
-    if(okTOF)
-    {
-      //SetTrackEventBCcut(bc);
-      SetTrackEventBCcut(trackBC+9);
-      
-      //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
-      if(fRecalculateVertexBC)
-      {
-        if     (trackBC !=0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
-        else if(trackBC == 0)                                  bc0 = kTRUE;
-      }
-      
-      //In any case, the time should to be larger than the fixed window ...
-      if( fUseTrackTimeCut && (trackBC!=0 || tof < fTrackTimeCutMin  || tof > fTrackTimeCutMax) )
-      {
-        //printf("Remove track time %f and bc = %d\n",tof,trackBC);
-        continue ;
-      }
-      //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
-      
-    }
-
     //Count the tracks in eta < 0.9
-    //printf("Eta %f cut  %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
     if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
     
     if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ;
     
+    // Check effect of cuts on track BC
+    if(fAccessTrackTOF && okTOF) SetTrackEventBCcut(trackBC+9);
+    
     if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
     
     if(fDebug > 2 && momentum.Pt() > 0.1)
@@ -1662,13 +1667,12 @@ void AliCaloTrackReader::FillInputCTS()
     
   }// track loop
        
-  if(fVertexBC ==0 || fVertexBC == AliVTrack::kTOFBCNA)
+  if( fRecalculateVertexBC && (fVertexBC == 0 || fVertexBC == AliVTrack::kTOFBCNA))
   {
     if( bc0 ) fVertexBC = 0 ;
     else      fVertexBC = AliVTrack::kTOFBCNA ;
   }
   
-  
   if(fDebug > 1)
     printf("AliCaloTrackReader::FillInputCTS()   - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
   
index 405a7b52a42c7ae145338d9e1272d119955cba99..24df3f4534565ceafbc936bad2375b00a5cde36a 100755 (executable)
@@ -145,8 +145,13 @@ public:
   void             SetTrackTimeCut(Double_t a, Double_t b) { fTrackTimeCutMin = a ;
                                                              fTrackTimeCutMax = b          ; } // ns
   
-  void             SwitchOnUseTrackTimeCut()               { fUseTrackTimeCut = kTRUE      ; }
+  void             SwitchOnUseTrackTimeCut()               { fUseTrackTimeCut = kTRUE      ;  fAccessTrackTOF  = kTRUE ; }
   void             SwitchOffUseTrackTimeCut()              { fUseTrackTimeCut = kFALSE     ; }
+
+  void             SwitchOnAccessTrackTimeCut()            { fAccessTrackTOF  = kTRUE      ; }
+  void             SwitchOffAccessTrackTimeCut()           { fAccessTrackTOF  = kFALSE     ; }
+  Bool_t           IsAccessToTrackTimeOn()           const { return fAccessTrackTOF        ; }
+
   
   Double_t         GetEMCALTimeCutMin()              const { return fEMCALTimeCutMin       ; }
   Double_t         GetEMCALTimeCutMax()              const { return fEMCALTimeCutMax       ; } 
@@ -406,7 +411,7 @@ public:
 
   Int_t            GetVertexBC(const AliVVertex * vtx);
   Int_t            GetVertexBC()                  const    { return fVertexBC              ; }
-  void             SwitchOnRecalculateVertexBC()           { fRecalculateVertexBC = kTRUE  ; }
+  void             SwitchOnRecalculateVertexBC()           { fRecalculateVertexBC = kTRUE  ; fAccessTrackTOF  = kTRUE ; }
   void             SwitchOffRecalculateVertexBC()          { fRecalculateVertexBC = kFALSE ; }
   
   // Track selection
@@ -636,6 +641,7 @@ public:
   Bool_t           fUseEMCALTimeCut;           // Do time cut selection
   Bool_t           fUseParamTimeCut;           // Use simple or parametrized time cut
   Bool_t           fUseTrackTimeCut;           // Do time cut selection
+  Bool_t           fAccessTrackTOF;            // Access the track TOF, in case of problems when accessing GetTOFBunchCrossing
   Double_t         fEMCALTimeCutMin;           // Remove clusters/cells with time smaller than this value, in ns
   Double_t         fEMCALTimeCutMax;           // Remove clusters/cells with time larger than this value, in ns
   Float_t          fEMCALParamTimeCutMin[4];   // Remove clusters/cells with time smaller than parametrized value, in ns