]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
mc handler should not be set in the analysis task, but in the startup analysis macro...
authorgustavo <gustavo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 17 Nov 2007 16:41:07 +0000 (16:41 +0000)
committergustavo <gustavo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 17 Nov 2007 16:41:07 +0000 (16:41 +0000)
PWG4/AliAnalysisTaskGamma.cxx
PWG4/AliGammaMCReader.cxx

index 94337cea98de975e5f1946f9b4d3783e322fce2b..9ba3bd4183f352c43113f0a567697ca24e0e7ca0 100644 (file)
@@ -24,6 +24,7 @@
 // analysis
 #include "AliAnalysisTaskGamma.h"
 #include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
 #include "AliMCEventHandler.h"
 #include "AliMCEvent.h"
 #include "AliAnaGamma.h"
@@ -89,7 +90,7 @@ void AliAnalysisTaskGamma::CreateOutputObjects()
   // Create the output container
   
   //AODs
-  OpenFile(0);
+//  OpenFile(0);
   AliAODHandler* handler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
   fAOD   = handler->GetAOD();
   fTreeG = handler->GetTree();
@@ -124,12 +125,14 @@ void AliAnalysisTaskGamma::Init()
   fAna->Init();
   
   //In case of MC analysis
+/*
+  // NOT ALLOWED TO SET MC HANDLER FROM WITHIN AN ANALYSIS TASK !!! (MG)
   Int_t  datatype = fAna->GetReader()->GetDataType();
   if(datatype == AliGammaReader::kMC || datatype == AliGammaReader::kMCData ){
     AliMCEventHandler * mc = new AliMCEventHandler();
     (AliAnalysisManager::GetAnalysisManager())->SetMCtruthEventHandler(mc);
   }
-  
+*/  
   AliDebug(1,"End");
   
 }
@@ -140,10 +143,9 @@ void AliAnalysisTaskGamma::ConnectInputData(Option_t */*option*/)
   // Connect the input data
   //
   AliDebug(1,"ConnectInputData() ");
+  AliESDInputHandler* esdH = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+  fESD = esdH->GetEvent();
   fChain = (TChain*)GetInputData(0);
-  fESD = new AliESDEvent();
-  fESD->ReadFromTree(fChain);
-  
 }
 
 //_____________________________________________________
index 14633e4df41a14fd08ebe420eef571a6b140a9c0..616345d44d57b374dc21e1a39375fb20477fa580 100644 (file)
@@ -17,6 +17,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.4  2007/10/29 13:48:42  gustavo
+ * Corrected coding violations
+ *
  *
  */
 
@@ -203,7 +206,6 @@ void AliGammaMCReader::CreateParticleList(TObject * data, TObject *,
     
   for (iParticle=0 ; iParticle <  stack->GetNprimary() ; iParticle++) {
     TParticle * particle = stack->Particle(iParticle); 
-    
 
     //Keep partons
     if(particle->GetStatusCode() == 21 && iParticle>=2){//All partons, not nucleus
@@ -236,7 +238,7 @@ void AliGammaMCReader::CreateParticleList(TObject * data, TObject *,
          }
          else{
            //Take out some particles like neutrinos
-           if(!SkipNeutralParticles(particle->GetPdgCode())){
+           if(!SkipNeutralParticles(particle->GetPdgCode()) && !particle->IsPrimary()){ // protection added (MG)
              TParticle * pmother =stack->Particle(particle->GetFirstMother());                
              if(IsInPHOS(particle->Phi(),particle->Eta())){
                if(particle->GetPdgCode()==22)SetPhotonStatus(particle,pmother);