Example macro for filtering MC info to the AOD on proof, added comment
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Oct 2008 18:17:56 +0000 (18:17 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Oct 2008 18:17:56 +0000 (18:17 +0000)
ANALYSIS/AliAnalysisTaskMCParticleFilter.cxx
ANALYSIS/runAODFilterMC.C [new file with mode: 0644]

index 870452f..89afc31 100644 (file)
@@ -92,8 +92,15 @@ 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
+
     TClonesArray *tca = new TClonesArray("AliAODMCParticle", 0);
     tca->SetName(AliAODMCParticle::StdBranchName());
     AddAODBranch("TClonesArray",&tca);
diff --git a/ANALYSIS/runAODFilterMC.C b/ANALYSIS/runAODFilterMC.C
new file mode 100644 (file)
index 0000000..091470e
--- /dev/null
@@ -0,0 +1,107 @@
+void runAODFilterMC()
+{
+  // PROOF example
+
+      gSystem->Load("libTree.so");
+      gSystem->Load("libPhysics.so");
+      gSystem->Load("libGeom.so");
+      gSystem->Load("libVMC.so");
+
+      bool bKineFilter = true;
+
+      TProof::Open("alicecaf");
+      char *dataset = "/COMMON/COMMON/LHC08c11_10TeV_0.5T";
+      //      char *dataset = "/PWG4/kleinb/LHC08q_jetjet100";
+      // gProof->ClearPackages();
+      gProof->UploadPackage("${ALICE_ROOT}/STEERBase.par");
+      gProof->EnablePackage("STEERBase");
+      gProof->UploadPackage("${ALICE_ROOT}/ESD.par");
+      gProof->EnablePackage("ESD");
+      gProof->UploadPackage("${ALICE_ROOT}/AOD.par");
+      gProof->EnablePackage("AOD");
+      gProof->UploadPackage("${ALICE_ROOT}/ANALYSIS.par");
+      gProof->EnablePackage("ANALYSIS");
+      gProof->UploadPackage("${ALICE_ROOT}/ANALYSISalice.par");
+      gProof->EnablePackage("ANALYSISalice");
+      
+      //
+      if (gApplication) gApplication->InitializeGraphics();
+      // Create the chain
+      //
+
+
+       /////////////////////////////////////////////////////////////////////////////////// 
+       // Create the analysis manager
+       //
+       // Input 
+      AliESDInputHandler* inpHandler = new AliESDInputHandler();
+      // Output
+      AliAODHandler* aodHandler = new AliAODHandler();
+      aodHandler->SetOutputFileName("aod_ckb2.root");
+      // MC Truth
+      AliMCEventHandler* mcHandler = new AliMCEventHandler();
+      AliAnalysisManager *mgr  = new AliAnalysisManager("Filter Manager", "Filter Manager");
+     if(bKineFilter){
+       mgr->SetMCtruthEventHandler(mcHandler);
+     }
+
+      mgr->SetInputEventHandler  (inpHandler);
+      mgr->SetOutputEventHandler (aodHandler);
+      aodHandler->Dump();
+
+      mgr->SetDebugLevel(10);
+
+      // Filtering of MC particles (decays conversions etc)
+      // this task is also needed to set the MCEventHandler
+      // to the AODHandler, this will not be needed when
+      // AODHandler goes to ANALYSISalice
+      AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter");
+      if(bKineFilter)mgr->AddTask(kinefilter);
+      
+      
+      // 
+      AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
+      esdTrackCutsL->SetMinNClustersTPC(50);
+      esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
+      esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
+      esdTrackCutsL->SetRequireTPCRefit(kTRUE);
+      esdTrackCutsL->SetDCAToVertexZ(3.0);
+      esdTrackCutsL->SetDCAToVertexXY(3.0);
+      esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
+      esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
+      
+      AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
+      trackFilter->AddCuts(esdTrackCutsL);
+      
+      AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
+      esdfilter->SetTrackFilter(trackFilter);
+      
+      mgr->AddTask(esdfilter);
+    
+    
+      //
+      // Create containers for input/output
+      AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
+                                                              AliAnalysisManager::kInputContainer);
+      
+      AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),
+                                                             AliAnalysisManager::kOutputContainer, "default");
+      
+      coutput1->SetSpecialOutput();
+
+      if(bKineFilter){
+       mgr->ConnectInput  (kinefilter,     0, cinput1  );
+       mgr->ConnectOutput (kinefilter,     0, coutput1 );
+      }
+
+       mgr->ConnectInput  (esdfilter,     0, cinput1  );
+       mgr->ConnectOutput (esdfilter,     0, coutput1 );
+      
+      //
+      // Run the analysis
+      //    
+      mgr->InitAnalysis();
+      mgr->PrintStatus();
+      mgr->StartAnalysis("proof",dataset,10000);
+
+}