]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/Documentation/examples/manual/ttree/macros/runTTreeFilterOnGrid.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FLOW / Documentation / examples / manual / ttree / macros / runTTreeFilterOnGrid.C
1 void runTTreeFilterOnGrid() {
2     // author: Redmer Alexander Bertens, Utrecht University
3     // rbertens@cern.ch , rbertens@nikhef.nl , r.a.bertens@uu.nl
4     //
5     // example which converts input data (in this case local aod's put into a chain)
6     // to a tree which holds
7     // - AliFlowTTreeEvent : event object
8     // - AliFlowTTreeTrack : track objects
9     // see source of these classes for more details
10     //
11     // note that in this example macro the source classes (AliFlowTTreeEvent, AliFlowTTreeTrack,
12     // AliAnalysisTaskTTreeFilter) are expected to be available in the folder
13     // from which this macro is launched
14
15     // load libraries
16     gSystem->Load("libCore");        
17     gSystem->Load("libGeom");
18     gSystem->Load("libVMC");
19     gSystem->Load("libPhysics");
20     gSystem->Load("libTree");
21     gSystem->Load("libSTEERBase");
22     gSystem->Load("libESD");
23     gSystem->Load("libAOD");
24     gSystem->Load("libANALYSIS");
25     gSystem->Load("libANALYSISalice");
26
27     // create and customize the alien plugin
28     AliAnalysisAlien *alienHandler = new AliAnalysisAlien();
29     alienHandler->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_ROOT/OADB -I$ALICE_ROOT/PWG/FLOW/Base -I$ALICE_ROOT/PWG/FLOW/Tasks -g");
30     alienHandler->SetAdditionalLibs("libGui.so libProof.so libMinuit.so libXMLParser.so libRAWDatabase.so libRAWDatarec.so libCDB.so libSTEERBase.so libSTEER.so libTPCbase.so libTOFbase.so libTRDbase.so libVZERObase.so libVZEROrec.so libT0base.so libT0rec.so libTender.so libTenderSupplies.so libPWGflowBase.so libPWGflowTasks.so AliFlowTTreeEvent.cxx AliFlowTTreeTrack.cxx AliAnalysisTaskTTreeFilter.cxx AliFlowTTreeEvent.h AliFlowTTreeTrack.h AliAnalysisTaskTTreeFilter.h");
31     alienHandler->SetAnalysisSource("AliFlowTTreeEvent.cxx AliFlowTTreeTrack.cxx AliAnalysisTaskTTreeFilter.cxx");
32     alienHandler->SetOverwriteMode();
33     alienHandler->SetRunMode("full");
34     alienHandler->SetNtestFiles(1);
35     alienHandler->SetAPIVersion("V1.1x");
36     alienHandler->SetROOTVersion("v5-34-08-6");
37     alienHandler->SetAliROOTVersion("vAN-20140911");
38     alienHandler->SetFileForTestMode("filelist.txt");
39     alienHandler->SetGridDataDir("/alice/data/2011/LHC11h_2");
40     alienHandler->SetDataPattern("*ESDs/pass2/AOD145/*AOD.root");
41     alienHandler->SetRunPrefix("000");
42     // runs from the 11h data taking period (36 from the 'good' tpc list, 28 from the 'semi good' list
43     Int_t runs[] = {167813, 167988, 168066, 168068, 168069, 168076, 168104, 168212, 168311, 168322, 168325, 168341, 168361, 168362, 168458, 168460, 168461, 168992, 169091, 169094, 169138, 169143, 169167, 169417, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 170027, 170036, 170081, 169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309}; // 36 + 28 runs
44
45     // add the runnnumbers to the handler
46     for(int i = 0; i < 36; i++) alienHandler->AddRunNumber(runs[i]);
47
48     alienHandler->SetDefaultOutputs();
49     alienHandler->SetAnalysisMacro("PhiV2.C");
50     alienHandler->SetSplitMaxInputFileNumber(40);
51     alienHandler->SetExecutable("runTTreeFilterOnGrid.sh");
52     alienHandler->SetTTL(10000);
53     alienHandler->SetInputFormat("xml-single");
54     alienHandler->SetJDLName("runTTreeFilterOnGrid.jdl");
55     alienHandler->SetPrice(1);
56     alienHandler->SetSplitMode("se");
57
58     alienHandler->SetOutputToRunNo(kTRUE);
59     alienHandler->SetKeepLogs(kTRUE);
60     alienHandler->SetMaxMergeStages(1);
61     alienHandler->SetMergeViaJDL(kTRUE);
62
63     // define the output folders
64     alienHandler->SetGridWorkingDir(Form("filteredTTree_runs_%i-%i", runs[0], runs[35]));
65     alienHandler->SetGridOutputDir(Form("filteredTTree_runs_%i-%i", runs[0], runs[35]));
66
67     // create the analysis manager
68     AliAnalysisManager* mgr = new AliAnalysisManager("MyManager");
69     // connect the alien plugin to the manager
70     mgr->SetGridHandler(alienHandler);
71
72     AliVEventHandler* inputH = new AliAODInputHandler();
73     // and connect it to the manager
74     mgr->SetInputEventHandler(inputH);
75
76     // compile the relevant classes
77     gSystem->AddIncludePath("-Wno-deprecated");
78     gSystem->AddIncludePath("-I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/EMCAL");
79     gSystem->AddIncludePath("-I$ALICE_ROOT/PWGDQ/dielectron -I$ALICE_ROOT/PWGHF/hfe");
80     gSystem->AddIncludePath("-I$ALICE_ROOT/JETAN -I$ALICE_ROOT/JETAN/fastjet");
81
82     gROOT->LoadMacro("AliFlowTTreeEvent.cxx+");
83     gROOT->LoadMacro("AliFlowTTreeTrack.cxx+");
84     gROOT->LoadMacro("AliAnalysisTaskTTreeFilter.cxx+");
85
86     // load the addtask
87     gROOT->LoadMacro("AddTaskTTreeFilter.C");
88
89     // launch the task
90     AddTaskTTreeFilter();
91
92     // check if we can initialize the manager
93     if(!mgr->InitAnalysis()) return;   
94     // print the status of the manager to screen 
95     mgr->PrintStatus();
96     // print to screen how the analysis is progressing
97     mgr->SetUseProgressBar(1, 25);
98     // start the analysis locally, reading the events from the tchain
99     mgr->StartAnalysis("grid");
100 }