]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisTaskMCParticleFilter.cxx
Analysis train macro. Can run locally, in proof or in grid mode (using the AliEn...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskMCParticleFilter.cxx
index 870452f9ddd1d86e4eba89b3167a9870d4c54a89..59544ff361425489677f25d6e777b87db9e92ab8 100644 (file)
@@ -32,6 +32,7 @@
 #include "AliMCEventHandler.h"
 #include "AliAODEvent.h"
 #include "AliAODHeader.h"
+#include "AliAODMCHeader.h"
 #include "AliAODHandler.h"
 #include "AliAODVertex.h"
 #include "AliAODMCParticle.h"
@@ -92,20 +93,38 @@ void AliAnalysisTaskMCParticleFilter::UserCreateOutputObjects()
   // Create the output container
     if (OutputTree()&&fTrackFilterMother) 
        OutputTree()->GetUserInfo()->Add(fTrackFilterMother);
-    // how is this is reset cleared in the UserExec....
-    // Can this be handled by the framework?
+
+    // this part is mainly needed to set the MCEventHandler
+    // to the AODHandler, this will not be needed when
+    // AODHandler goes to ANALYSISalice
+    // setting in the steering macro will not work on proof :(
+    // so we have to do it in a task
+
+    // the branch booking can also go into the AODHandler then
+
+
+    // mcparticles
     TClonesArray *tca = new TClonesArray("AliAODMCParticle", 0);
     tca->SetName(AliAODMCParticle::StdBranchName());
     AddAODBranch("TClonesArray",&tca);
-    AliMCEventHandler *mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); 
 
+    // MC header...
+    AliAODMCHeader *mcHeader = new AliAODMCHeader();
+    Printf("AODMCHeader %p",mcHeader);
+    Printf("AODMCHeader ** %p",&mcHeader);
+    mcHeader->SetName(AliAODMCHeader::StdBranchName());
+    AddAODBranch("AliAODMCHeader",&mcHeader);    
+
+    
+
+    AliMCEventHandler *mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); 
     AliAODHandler *aodH = dynamic_cast<AliAODHandler*> ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     if(!aodH){
       Printf("%s:&d Could not get AODHandler",(char*)__FILE__,__LINE__);
       return;
     }
     aodH->SetMCEventHandler(mcH);
-    // TODO ADD MC VERTEX
+
     
 }
 
@@ -165,8 +184,6 @@ void AliAnalysisTaskMCParticleFilter::UserExec(Option_t */*option*/)
     Float_t rv = TMath::Sqrt(xv * xv + yv * yv);
       
     Bool_t write = kFALSE;
-    Int_t flag = 0;
-
 
     if (ip < nprim) {
       // Select the primary event