]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSPIDv1.cxx
Introduced option for the first and last event to process
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv1.cxx
index f571de571a76c9bc485170f113e29dc4dc96af9a..0fdb8d90101c8dc2136d3d9a692278c6115d8055 100644 (file)
@@ -173,13 +173,16 @@ void AliPHOSPIDv1::InitParameters()
   fNEvent            = 0 ;            
   fRecParticlesInRun = 0 ;
   SetParameters() ; // fill the parameters matrix from parameters file
+  SetEventRange(0,-1) ;
 }
 
 //________________________________________________________________________
-void  AliPHOSPIDv1::Exec(Option_t * option) 
+void  AliPHOSPIDv1::Exec(Option_t *option)
 {
-  //Steering method
-  
+  // Steering method to perform particle reconstruction and identification
+  // for the event range from fFirstEvent to fLastEvent.
+  // This range is optionally set by SetEventRange().
+  // if fLastEvent=-1 (by default), then process events until the end.
 
   if(strstr(option,"tim"))
     gBenchmark->Start("PHOSPID");
@@ -192,11 +195,14 @@ void  AliPHOSPIDv1::Exec(Option_t * option)
 
   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
  
-  Int_t nevents = gime->MaxEvent() ;       
-  Int_t ievent ;
-
-
-  for(ievent = 0; ievent < nevents; ievent++){
+  if (fLastEvent == -1) 
+    fLastEvent = gime->MaxEvent() - 1 ;
+  else 
+    fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent());
+  Int_t nEvents   = fLastEvent - fFirstEvent + 1;
+
+  Int_t ievent ; 
+  for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
     gime->Event(ievent,"TR") ;
     if(gime->TrackSegments() && //Skip events, where no track segments made
        gime->TrackSegments()->GetEntriesFast()) {
@@ -212,7 +218,7 @@ void  AliPHOSPIDv1::Exec(Option_t * option)
     gBenchmark->Stop("PHOSPID");
     Info("Exec", "took %f seconds for PID %f seconds per event", 
         gBenchmark->GetCpuTime("PHOSPID"),  
-        gBenchmark->GetCpuTime("PHOSPID")/nevents) ;
+        gBenchmark->GetCpuTime("PHOSPID")/nEvents) ;
   }
  
   Unload();
@@ -231,7 +237,7 @@ const TString AliPHOSPIDv1::GetFileNamePrincipal(TString particle) const
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetParameterCalibration(Int_t i) const 
+Float_t  AliPHOSPIDv1::GetParameterCalibration(Int_t i) const 
 {
   // Get the i-th parameter "Calibration"
   Float_t param = 0.;
@@ -243,7 +249,7 @@ const Float_t  AliPHOSPIDv1::GetParameterCalibration(Int_t i) const
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetCalibratedEnergy(const Float_t e) const
+Float_t  AliPHOSPIDv1::GetCalibratedEnergy(Float_t e) const
 {
 //      It calibrates Energy depending on the recpoint energy.
 //      The energy of the reconstructed cluster is corrected with 
@@ -259,7 +265,7 @@ const Float_t  AliPHOSPIDv1::GetCalibratedEnergy(const Float_t e) const
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetParameterCpv2Emc(Int_t i, TString axis) const 
+Float_t  AliPHOSPIDv1::GetParameterCpv2Emc(Int_t i, TString axis) const 
 {
   // Get the i-th parameter "CPV-EMC distance" for the specified axis
   Float_t param = 0.;
@@ -275,7 +281,7 @@ const Float_t  AliPHOSPIDv1::GetParameterCpv2Emc(Int_t i, TString axis) const
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetCpv2EmcDistanceCut(TString axis, Float_t e) const
+Float_t  AliPHOSPIDv1::GetCpv2EmcDistanceCut(TString axis, Float_t e) const
 {
   // Get CpvtoEmcDistance Cut depending on the cluster energy, axis and 
   // Purity-Efficiency point 
@@ -288,7 +294,7 @@ const Float_t  AliPHOSPIDv1::GetCpv2EmcDistanceCut(TString axis, Float_t e) cons
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetEllipseParameter(TString particle, TString param, Float_t e) const 
+Float_t  AliPHOSPIDv1::GetEllipseParameter(TString particle, TString param, Float_t e) const 
 {
   // Calculates the parameter param of the ellipse
 
@@ -308,7 +314,7 @@ const Float_t  AliPHOSPIDv1::GetEllipseParameter(TString particle, TString param
 }
 
 //_____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetParameterPhotonBoundary (Int_t i) const
+Float_t  AliPHOSPIDv1::GetParameterPhotonBoundary (Int_t i) const
 { 
   // Get the parameter "i" to calculate the boundary on the moment M2x
   // for photons at high p_T
@@ -321,7 +327,7 @@ const Float_t  AliPHOSPIDv1::GetParameterPhotonBoundary (Int_t i) const
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetParameterPi0Boundary (Int_t i) const
+Float_t  AliPHOSPIDv1::GetParameterPi0Boundary (Int_t i) const
 { 
   // Get the parameter "i" to calculate the boundary on the moment M2x
   // for pi0 at high p_T
@@ -334,7 +340,7 @@ const Float_t  AliPHOSPIDv1::GetParameterPi0Boundary (Int_t i) const
 }
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetParameterTimeGate(Int_t i) const
+Float_t  AliPHOSPIDv1::GetParameterTimeGate(Int_t i) const
 {
   // Get TimeGate parameter depending on Purity-Efficiency i:
   // i=0 - Low purity, i=1 - Medium purity, i=2 - High purity
@@ -347,7 +353,7 @@ const Float_t  AliPHOSPIDv1::GetParameterTimeGate(Int_t i) const
 }
 
 //_____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const
+Float_t  AliPHOSPIDv1::GetParameterToCalculateEllipse(TString particle, TString param, Int_t i) const
 { 
   // Get the parameter "i" that is needed to calculate the ellipse 
   // parameter "param" for the particle "particle" ("photon" or "pi0")
@@ -381,7 +387,7 @@ const Float_t  AliPHOSPIDv1::GetParameterToCalculateEllipse(TString particle, TS
 
 
 //____________________________________________________________________________
-const Float_t  AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t *  axis)const
+Float_t  AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t *  axis)const
 {
   // Calculates the distance between the EMC RecPoint and the PPSD RecPoint
   
@@ -408,7 +414,7 @@ const Float_t  AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoin
   return 100000000 ;
 }
 //____________________________________________________________________________
-const Int_t  AliPHOSPIDv1::GetCPVBit(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv,const Int_t effPur, Float_t e) const
+Int_t  AliPHOSPIDv1::GetCPVBit(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Int_t effPur, Float_t e) const
 {
   if(effPur>2 || effPur<0)
     Error("GetCPVBit","Invalid Efficiency-Purity choice %d",effPur);
@@ -426,7 +432,7 @@ const Int_t  AliPHOSPIDv1::GetCPVBit(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint *
 }
 
 //____________________________________________________________________________
-const Int_t  AliPHOSPIDv1::GetPrincipalBit(TString particle, const Double_t* p,const Int_t effPur, Float_t e)const
+Int_t  AliPHOSPIDv1::GetPrincipalBit(TString particle, const Double_t* p, Int_t effPur, Float_t e)const
 {
   //Is the particle inside de PCA ellipse?
   
@@ -453,7 +459,7 @@ const Int_t  AliPHOSPIDv1::GetPrincipalBit(TString particle, const Double_t* p,c
 
 }
 //____________________________________________________________________________
-const Int_t  AliPHOSPIDv1::GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const
+Int_t  AliPHOSPIDv1::GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const
 {
   // Set bit for identified hard photons (E > 30 GeV)
   // if the second moment M2x is below the boundary
@@ -473,7 +479,7 @@ const Int_t  AliPHOSPIDv1::GetHardPhotonBit(AliPHOSEmcRecPoint * emc) const
 }
 
 //____________________________________________________________________________
-const Int_t  AliPHOSPIDv1::GetHardPi0Bit(AliPHOSEmcRecPoint * emc) const
+Int_t  AliPHOSPIDv1::GetHardPi0Bit(AliPHOSEmcRecPoint * emc) const
 {
   // Set bit for identified hard pi0  (E > 30 GeV)
   // if the second moment M2x is above the boundary