]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnCutPIDITS.cxx
Recovery ESDpid from InputHandler
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDITS.cxx
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;
+}