]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/FLOW/Documentation/examples/manual/ttree/macros/runTTreeFilter.C
remove redundant check from run macro
[u/mrichter/AliRoot.git] / PWGCF / FLOW / Documentation / examples / manual / ttree / macros / runTTreeFilter.C
index d690facc3e591ef78bbc0ee93627ed34e5d5b4b6..065f255ee92f82ecec3a552c13b154cf29e1705c 100644 (file)
@@ -34,27 +34,15 @@ void runTTreeFilter() {
     chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0007/AliAOD.root");
     chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0008/AliAOD.root");
     chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0009/AliAOD.root");
-    chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0010/AliAOD.root"); 
+    chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0010/AliAOD.root");
     // create an input handler
     AliVEventHandler* inputH = new AliAODInputHandler();
     // and connect it to the manager
     mgr->SetInputEventHandler(inputH);
 
-     // the manager is static, so get the existing manager via the static method
-    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-    if (!mgr) {
-        printf("No analysis manager to connect to!\n");
-        return NULL;
-    }
-        
-    // just to see if all went well, check if the input event handler has been connected
-    if (!mgr->GetInputEventHandler()) {
-        printf("This task requires an input event handler!\n");
-        return NULL;
-      }
-
     // compile the relevant classes
-      // include paths, necessary for compilation
+
+    // include paths, necessary for compilation
     gSystem->AddIncludePath("-Wno-deprecated");
     gSystem->AddIncludePath("-I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/EMCAL");
     gSystem->AddIncludePath("-I$ALICE_ROOT/PWGDQ/dielectron -I$ALICE_ROOT/PWGHF/hfe");
@@ -64,24 +52,11 @@ void runTTreeFilter() {
     gROOT->LoadMacro("../objects/AliFlowTTreeTrack.cxx+");
     gROOT->LoadMacro("../objects/AliAnalysisTaskTTreeFilter.cxx+");
 
-    AliAnalysisTaskTTreeFilter* filter = new AliAnalysisTaskTTreeFilter("filter");
-    // add the task to the manager
-    mgr->AddTask(filter);
-    // set the trigger selection
-    filter->SelectCollisionCandidates(AliVEvent::kAnyINT);
+    // load the addtask
+    gROOT->LoadMacro("AddTaskTTreeFilter.C");
 
-    // get the common input container from the analysis manager
-    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-  
-    AliAnalysisDataContainer *coutput = mgr->CreateContainer(
-        "Tree",
-        TTree::Class(),
-        AliAnalysisManager::kOutputContainer,
-        "myFilteredTree.root");
-    // connect the input data to the flow event task
-    mgr->ConnectInput(filter, 0, cinput);
-    // and connect the output to the flow event task
-    mgr->ConnectOutput(filter, 1, coutput);
+    // launch the task
+    AddTaskTTreeFilter();
 
     // check if we can initialize the manager
     if(!mgr->InitAnalysis()) return;