]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrBaseClass.cxx
coverity, move similar code in several analysis code classes to a single method in...
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliAnaCaloTrackCorrBaseClass.cxx
index 15b097757d66e7fef05564558a06ab56c83bb44d..68429e64d4f52ee69db17fe9f5c30956190aab6e 100755 (executable)
@@ -110,6 +110,35 @@ void AliAnaCaloTrackCorrBaseClass::AddAODParticle(AliAODPWG4Particle pc)
   
 }      
 
+//_______________________________________________________________________________
+Int_t AliAnaCaloTrackCorrBaseClass::CheckMixedEventVertex(const Int_t caloLabel, 
+                                                          const Int_t trackLabel)
+{
+  // Check vertex in mixed events
+  
+  if (!GetMixedEvent()) return 1; // Not mixed event continue normal processing
+  
+  Int_t evt = -1;
+  
+  if     (caloLabel  >= 0 )
+  {
+    evt = GetMixedEvent()->EventIndexForCaloCluster(caloLabel) ;
+  }
+  else if(trackLabel >= 0 )
+  {
+    evt = GetMixedEvent()->EventIndex(trackLabel) ;
+  }
+  else  
+    return 0; // go to next entry in the particle list
+  
+  if(evt == -1) 
+    return 0 ; // to content coverity
+  
+  if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut())  return -1; // Vertex out of range process next event
+  
+  return 1 ; // continue processing normally
+  
+}
 
 //________________________________________________________________
 void AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches()