]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Recovery ESDpid from InputHandler
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Feb 2011 12:44:54 +0000 (12:44 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Feb 2011 12:44:54 +0000 (12:44 +0000)
PWG2/RESONANCES/AliRsnCutPIDITS.cxx
PWG2/RESONANCES/AliRsnCutPIDITS.h
PWG2/RESONANCES/AliRsnCutPIDTOF.cxx
PWG2/RESONANCES/AliRsnCutPIDTOF.h
PWG2/RESONANCES/AliRsnCutPIDTPC.cxx
PWG2/RESONANCES/AliRsnCutPIDTPC.h

index 60085ba9711846340c177f0b888ad5f307f69574..ddec49ae1ed5080e87722c971ecb4c6108911e66 100644 (file)
 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
-#include <Riostream.h>
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
 
-#include "AliESDpid.h"
-#include "AliTOFT0maker.h"
-#include "AliTOFcalib.h"
-#include "AliCDBManager.h"
-#include "AliITSPIDResponse.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnDaughter.h"
 #include "AliRsnCutPIDITS.h"
 
 ClassImp(AliRsnCutPIDITS)
@@ -34,6 +27,7 @@ ClassImp(AliRsnCutPIDITS)
 AliRsnCutPIDITS::AliRsnCutPIDITS
 (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectOutside) :
   AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+  fInitialized(kFALSE),
   fRejectOutside(rejectOutside),
   fMomMin(0.0),
   fMomMax(1E+20),
@@ -50,6 +44,7 @@ AliRsnCutPIDITS::AliRsnCutPIDITS
 AliRsnCutPIDITS::AliRsnCutPIDITS
 (const AliRsnCutPIDITS& copy) :
   AliRsnCut(copy),
+  fInitialized(kFALSE),
   fRejectOutside(copy.fRejectOutside),
   fMomMin(copy.fMomMin),
   fMomMax(copy.fMomMax),
@@ -71,6 +66,7 @@ AliRsnCutPIDITS& AliRsnCutPIDITS::operator=(const AliRsnCutPIDITS& copy)
 
   AliRsnCut::operator=(copy);
 
+  fInitialized   = kFALSE;
   fRejectOutside = copy.fRejectOutside;
   fMomMin        = copy.fMomMin;
   fMomMax        = copy.fMomMax;
@@ -101,6 +97,9 @@ Bool_t AliRsnCutPIDITS::IsSelected(TObject *object)
 // Cut checker.
 //
 
+  // initialize if needed
+  if (!fInitialized) Initialize();
+
   // coherence check
   if (!TargetOK(object)) return kFALSE;
   
@@ -182,3 +181,21 @@ void AliRsnCutPIDITS::Print(const Option_t *) const
   AliInfo(Form("--> momentum range          : %.3f %.3f", fMomMin, fMomMax));
   AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));
 }
+
+//_________________________________________________________________________________________________
+void AliRsnCutPIDITS::Initialize()
+{
+//
+// Initialize ESD pid object from global one
+//
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+  if (handler)
+  {
+    AliESDpid *pid = handler->GetESDpid();
+    fESDpid = (*pid);
+  }
+  
+  fInitialized = kTRUE;
+}
index d784150d2fd065d8b0002c9ccdf0997788107362..207cee891d943551bffc1947f617dd883d65adf2 100644 (file)
@@ -54,6 +54,9 @@ class AliRsnCutPIDITS : public AliRsnCut
 
   private:
 
+    void Initialize();
+
+    Bool_t          fInitialized;    // a mono-usage flag which initializes the ESD pid object
     Bool_t          fRejectOutside;  // choose if tracks outside momentum range are rejected or not
     Double_t        fMomMin;         // min p in range where this cut is checked
     Double_t        fMomMax;         // max p in range where this cut is checked
index 8e1113d5f86d8c9c7a1392ba97bd82058a304feb..6b47b272a3e5548217cc0f9e67f010744e856867 100644 (file)
@@ -11,7 +11,9 @@
 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
-#include "AliRsnEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
+
 #include "AliRsnCutPIDTOF.h"
 
 ClassImp(AliRsnCutPIDTOF)
@@ -20,6 +22,7 @@ ClassImp(AliRsnCutPIDTOF)
 AliRsnCutPIDTOF::AliRsnCutPIDTOF
 (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectUnmatched) :
   AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+  fInitialized(kFALSE),
   fRejectUnmatched(rejectUnmatched),
   fRefType(AliPID::kUnknown),
   fRefMass(0.0),
@@ -38,6 +41,7 @@ AliRsnCutPIDTOF::AliRsnCutPIDTOF
 //_________________________________________________________________________________________________
 AliRsnCutPIDTOF::AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy) :
   AliRsnCut(copy),
+  fInitialized(kFALSE),
   fRejectUnmatched(copy.fRejectUnmatched),
   fRefType(AliPID::kUnknown),
   fRefMass(0.0),
@@ -62,9 +66,10 @@ AliRsnCutPIDTOF& AliRsnCutPIDTOF::operator=(const AliRsnCutPIDTOF& copy)
 // which sets the mass accordingly and coherently.
 //
 
+  fInitialized     = kFALSE;
   fRejectUnmatched = copy.fRejectUnmatched;
-  fESDpid = copy.fESDpid;
-  fAODpid = copy.fAODpid;
+  fESDpid          = copy.fESDpid;
+  fAODpid          = copy.fAODpid;
 
   SetRefType(copy.fRefType);
   
@@ -78,6 +83,9 @@ Bool_t AliRsnCutPIDTOF::IsSelected(TObject *object)
 // Cut checker.
 //
 
+  // initialize if needed
+  if (!fInitialized) Initialize();
+
   // coherence check
   if (!TargetOK(object)) return kFALSE;
   
@@ -152,3 +160,21 @@ void AliRsnCutPIDTOF::Print(const Option_t *) const
   AliInfo(Form("TOF PID cut range (sigmas): %.3f %.3f", fMinD, fMaxD));
   AliInfo(Form("Unmatched tracks are      : %s", (fRejectUnmatched ? "rejected" : "accepted")));
 }
+
+//_________________________________________________________________________________________________
+void AliRsnCutPIDTOF::Initialize()
+{
+//
+// Initialize ESD pid object from global one
+//
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+  if (handler)
+  {
+    AliESDpid *pid = handler->GetESDpid();
+    fESDpid = (*pid);
+  }
+  
+  fInitialized = kTRUE;
+}
index 8f64e11caa2cfd3e868c8b75208d2b5bc4eddae7..1c92c3b2274cc321d513439fb9104dd2c1999e89 100644 (file)
@@ -48,8 +48,11 @@ class AliRsnCutPIDTOF : public AliRsnCut
     virtual Bool_t  IsSelected(TObject *object);
     virtual void    Print(const Option_t *option = "") const;
 
-  protected:
-  
+  private:
+
+    void Initialize();
+
+    Bool_t            fInitialized;      // a mono-usage flag which initializes the ESD pid object
     Bool_t            fRejectUnmatched;  //  decide if non TOF matched tracks pass the cut or not
     EPARTYPE          fRefType;          //  particle type for which PID is checked   
     Double_t          fRefMass;          //  reference mass used for computations
index 906e0007118c8c7bbd0856f973935403f76eb13a..5e9aa7e52e8e5643b755707d6130c840963f04be 100644 (file)
 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
-#include <Riostream.h>
-
-#include "AliESDpid.h"
-#include "AliTOFT0maker.h"
-#include "AliTOFcalib.h"
-#include "AliCDBManager.h"
-#include "AliITSPIDResponse.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnDaughter.h"
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
 #include "AliRsnCutPIDTPC.h"
 
 ClassImp(AliRsnCutPIDTPC)
@@ -34,6 +26,7 @@ ClassImp(AliRsnCutPIDTPC)
 AliRsnCutPIDTPC::AliRsnCutPIDTPC
 (const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) :
   AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+  fInitialized(kFALSE),
   fRejectOutside(rejectOutside),
   fMomMin(0.0),
   fMomMax(1E+20),
@@ -50,6 +43,7 @@ AliRsnCutPIDTPC::AliRsnCutPIDTPC
 AliRsnCutPIDTPC::AliRsnCutPIDTPC
 (const AliRsnCutPIDTPC& copy) :
   AliRsnCut(copy),
+  fInitialized(kFALSE),
   fRejectOutside(copy.fRejectOutside),
   fMomMin(copy.fMomMin),
   fMomMax(copy.fMomMax),
@@ -71,12 +65,13 @@ AliRsnCutPIDTPC& AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC& copy)
 
   AliRsnCut::operator=(copy);
 
+  fInitialized   = kFALSE;
   fRejectOutside = copy.fRejectOutside;
-  fMomMin  = copy.fMomMin;
-  fMomMax  = copy.fMomMax;
-  fRefType = copy.fRefType;
-  fESDpid  = copy.fESDpid;
-  fAODpid  = copy.fAODpid;
+  fMomMin        = copy.fMomMin;
+  fMomMax        = copy.fMomMax;
+  fRefType       = copy.fRefType;
+  fESDpid        = copy.fESDpid;
+  fAODpid        = copy.fAODpid;
   
   return (*this);
 }
@@ -99,6 +94,9 @@ Bool_t AliRsnCutPIDTPC::IsSelected(TObject *object)
 // Cut checker.
 //
 
+  // initialize if needed
+  if (!fInitialized) Initialize();
+
   // coherence check
   if (!TargetOK(object)) return kFALSE;
   
@@ -156,3 +154,21 @@ void AliRsnCutPIDTPC::Print(const Option_t *) const
   AliInfo(Form("--> momentum range          : %.3f %.3f", fMomMin, fMomMax));
   AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));
 }
+
+//_________________________________________________________________________________________________
+void AliRsnCutPIDTPC::Initialize()
+{
+//
+// Initialize ESD pid object from global one
+//
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+  if (handler)
+  {
+    AliESDpid *pid = handler->GetESDpid();
+    fESDpid = (*pid);
+  }
+
+  fInitialized = kTRUE;
+}
index 00c4251d2103ae9e63047d97a865fe1cf5fa855d..1d80f7e9d1f536e4d6a54c181931b9cd40c167cc 100644 (file)
@@ -54,6 +54,9 @@ class AliRsnCutPIDTPC : public AliRsnCut
 
   private:
 
+    void Initialize();
+
+    Bool_t          fInitialized;    // a mono-usage flag which initializes the ESD pid object
     Bool_t          fRejectOutside;  // choose if tracks outside momentum range are rejected or not
     Double_t        fMomMin;         // min p in range where this cut is checked
     Double_t        fMomMax;         // max p in range where this cut is checked