]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
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 853c67caa7804889beb68cbd2544bf06be272656..4ff0d91cd976e11c889d9d67d87f451c74a2d5ac 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 8bf4d56f4e4c680ca778896e378f7a3be4f53e23..79ceba141f02564545b8398d43643c3dc6827b7d 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 50c8043bd0056f408948f197d5741f4721fbe8f6..4d272fd528ef24bc992f10e65e5242e669047ba5 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
 };