From Francesco: Now I pass the MC event handler with a method avoiding to call AliAna...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 8 Jul 2012 17:11:53 +0000 (17:11 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 8 Jul 2012 17:11:53 +0000 (17:11 +0000)
ANALYSIS/AliAnalysisTaskPIDResponse.cxx
STEER/ESD/AliESDpid.cxx
STEER/ESD/AliESDpid.h

index 853c67c..4ff0d91 100644 (file)
@@ -25,6 +25,8 @@
 #include <AliVTrack.h>
 #include <AliLog.h>
 #include <AliPIDResponse.h>
+#include <AliESDpid.h>
+
 
 #include "AliAnalysisTaskPIDResponse.h"
 
@@ -79,9 +81,8 @@ void AliAnalysisTaskPIDResponse::UserCreateOutputObjects()
   //
   // Create the output QA objects
   //
-  
+    
   AliLog::SetClassDebugLevel("AliAnalysisTaskPIDResponse",10);
-  
   //input hander
   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
   AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
@@ -113,6 +114,10 @@ void AliAnalysisTaskPIDResponse::UserExec(Option_t */*option*/)
   }
 
   fPIDResponse->InitialiseEvent(event,fRecoPass);
+  AliESDpid *pidresp = dynamic_cast<AliESDpid*>(fPIDResponse);
+  if(pidresp && AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()){
+      pidresp->SetEventHandler(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  }
 }
 
 //______________________________________________________________________________
index 8bf4d56..79ceba1 100644 (file)
@@ -34,8 +34,6 @@
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
 #include "AliMCEvent.h"
-#include "AliMCEventHandler.h"
-#include "AliAnalysisManager.h"
 
 
 ClassImp(AliESDpid)
@@ -83,8 +81,7 @@ Float_t AliESDpid::GetTPCsignalTunedOnData(const AliVTrack *t) const {
 
     AliPID::EParticleType type = AliPID::kPion;
 
-    AliMCEventHandler* eventHandler=NULL;
-    eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    AliMCEventHandler* eventHandler=dynamic_cast<AliMCEventHandler*>(fEventHandler);
     if (eventHandler) {
        AliMCEvent* mcEvent = eventHandler->MCEvent();
        if(mcEvent){
index 50c8043..4d272fd 100644 (file)
@@ -13,6 +13,7 @@
 //-------------------------------------------------------
 #include <Rtypes.h>
 #include "AliESDtrack.h" // Needed for inline functions
+#include "AliMCEventHandler.h"
 
 //#include "HMPID/AliHMPID.h"
 //#include "TRD/AliTRDpidESD.h"
@@ -25,7 +26,9 @@ class AliVParticle;
 
 class AliESDpid : public AliPIDResponse  {
 public:
-  AliESDpid(Bool_t forMC=kFALSE): AliPIDResponse(forMC), fRangeTOFMismatch(5.) {;}
+  AliESDpid(Bool_t forMC=kFALSE): AliPIDResponse(forMC), fRangeTOFMismatch(5.), fEventHandler(NULL) {;}
+AliESDpid(const AliESDpid&a): AliPIDResponse(a), fRangeTOFMismatch(a.fRangeTOFMismatch), fEventHandler(NULL){;};
+    AliESDpid& operator=(const AliESDpid& a){AliPIDResponse::operator=(a); fRangeTOFMismatch=a.fRangeTOFMismatch; fEventHandler=NULL; return *this;};
   virtual ~AliESDpid() {}
   
   Int_t MakePID(AliESDEvent *event, Bool_t TPCOnly = kFALSE, Float_t timeZeroTOF=9999) const;
@@ -45,10 +48,14 @@ public:
 
   Float_t GetTPCsignalTunedOnData(const AliVTrack *t) const;
 
+  void SetEventHandler(AliVEventHandler *event){fEventHandler=event;};
+
 private:
-  Float_t           fRangeTOFMismatch; // nSigma max for TOF matching with TPC
 
-  ClassDef(AliESDpid,6)  // PID calculation class
+  Float_t           fRangeTOFMismatch; // nSigma max for TOF matching with TPC
+  AliVEventHandler *fEventHandler; //! MC event handler
+  
+  ClassDef(AliESDpid,7)  // PID calculation class
 };