TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / runJetAna.C
... / ...
CommitLineData
1// $Id$
2
3void runJetAna(
4 const char *datatype = "aod", // aod, esd, sesd
5 const char *runtype = "local", // local or grid (when local gridmode specifies input txt file)
6 const char *gridmode = "aod_files.txt", // grid mode (can be "full", "test", "offline", "submit" or "terminate")
7 const char *taskname = "JetAna") // name of grid generated macros
8{
9
10 enum eDataType { kAod, kEsd, kSesd };
11 enum eRunType { kLocal, kGrid };
12
13 eRunType rType = kLocal;
14 if (strcmp(runtype, "grid")==0)
15 rType = kGrid;
16 eDataType dType = kAod;
17 if (strcmp(datatype, "esd")==0)
18 dType = kEsd;
19 else if (strcmp(datatype, "sesd")==0)
20 dType = kSesd;
21
22 // load the libraries
23 LoadLibs();
24
25 // analysis manager
26 AliAnalysisManager* mgr = new AliAnalysisManager(taskname);
27
28 if (dType == kAod) {
29 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C");
30 AliAODInputHandler* inH = AddAODHandler();
31 } else {
32 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C");
33 AliESDInputHandler* inH = AddESDHandler();
34 }
35
36 if (0) {
37 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODOutputHandler.C");
38 AliAODHandler* aodoutHandler = AddAODOutputHandler();
39 }
40
41 // PSel task
42 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C");
43 AliPhysicsSelectionTask *physSelTask = AddTaskEmcalPhysicsSelection(kTRUE, kTRUE,
44 AliVEvent::kAnyINT /*| AliVEvent::kCentral| AliVEvent::kSemiCentral*/,
45 10,10);
46
47 // Setup task
48 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
49 AliEmcalSetupTask *setupTask = AddTaskEmcalSetup();
50
51 // Compatibility task (for skimmed ESD)
52 if (dType == kSesd) {
53 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalCompat.C");
54 AliEmcalCompatTask *comptask = AddTaskEmcalCompat();
55 }
56
57 // Centrality task
58 if (dType == kEsd) {
59 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
60 AliCentralitySelectionTask *centralityTask = AddTaskCentrality();
61 }
62
63 TString inputTracks("tracks");
64 if (dType == kEsd) {
65 inputTracks = "HybridTracks";
66
67 // Hybrid tracks maker for ESD
68 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalEsdTpcTrack.C");
69 AliEmcalEsdTpcTrackTask *hybTask = AddTaskEmcalEsdTpcTrack(inputTracks);
70
71 // Track propagator
72 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalTrackPropagator.C");
73 AliEmcalTrackPropagatorTask *propTask = AddTaskEmcalTrackPropagator(inputTracks);
74 }
75 else if (dType == kSesd) {
76 inputTracks = "Tracks";
77 }
78
79 // PicoTracks maker
80 TString tracksName("PicoTracks");
81 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C");
82 AliEmcalPicoTrackMaker *pTrackTask = AddTaskEmcalPicoTrackMaker(tracksName, inputTracks, "LHC11h");
83
84 TString clusName("CaloClusters");
85 if (dType == kAod)
86 clusName = "caloClusters";
87
88 // EmcalParticle maker
89 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalParticleMaker.C");
90 AliEmcalParticleMaker *emcalParts =
91 AddTaskEmcalParticleMaker(tracksName,clusName,"EmcalTracks","EmcalClusters");
92
93 // Cluster-track matcher
94 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalClusTrackMatcher.C");
95 AliEmcalClusTrackMatcherTask *matcherTask = AddTaskEmcalClusTrackMatcher("EmcalTracks","EmcalClusters");
96
97 // Hadronic correction task
98 TString clusNameCorr(Form("%sCorr",clusName.Data()));
99 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskHadCorr.C");
100 AliHadCorrTask *hcorr = AddTaskHadCorr("EmcalTracks","EmcalClusters",clusNameCorr);
101
102 if (0) {
103 // Embedding task
104 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskJetEmbedding.C");
105 AliJetEmbeddingTask* jemb = AddTaskJetEmbedding(tracksName, clusNameCorr, "JetEmbeddingTask", 10, 10, -0.9, 0.9);
106
107 // Jet finder
108 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
109 AliEmcalJetTask *jetTask = AddTaskEmcalJet(tracksName, clusNameCorr);
110
111 // Scale task
112 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskScale.C");
113 AliAnalysisTaskScale *scaleTask = AddTaskScale(tracksName, clusNameCorr);
114 }
115 if (1) {
116 UInt_t val = AliVEvent::kAny;
117 //val = AliVEvent::kAnyINT | AliVEvent::kCentral| AliVEvent::kSemiCentral;
118 //val = AliVEvent::kEMCEGA;
119 //val = AliVEvent::kEMCEJE;
120 val = AliEmcalPhysicsSelection::kEmcalHT;
121
122 TObjArray *toptasks = mgr->GetTasks();
123 for (Int_t i=0; i<toptasks->GetEntries(); ++i) {
124 AliAnalysisTaskSE *task = dynamic_cast<AliAnalysisTaskSE*>(toptasks->At(i));
125 if (!task)
126 continue;
127 TString name(task->ClassName());
128 if (name.Contains("PhysicsSelection"))
129 continue;
130 ::Info("setPSel", "Set physics selection for %s (%s)", task->GetName(), task->ClassName());
131 task->SelectCollisionCandidates(val);
132 }
133 }
134
135 mgr->SetDebugLevel(0);
136 mgr->SetUseProgressBar(1, 25);
137
138 if (!mgr->InitAnalysis())
139 return;
140 mgr->PrintStatus();
141
142 if (rType == kGrid) {
143 mgr->StartAnalysis(gridmode);
144 } else {
145 const char *txtfile = gridmode;
146 if (dType == kAod) {
147 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/CreateAODChain.C");
148 chain = CreateAODChain(txtfile, 5);
149 } else {
150 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/CreateESDChain.C");
151 TChain* chain = CreateESDChain(txtfile, 5);
152 }
153 mgr->StartAnalysis("local", chain);
154 }
155
156 return;
157}
158
159void LoadLibs()
160{
161 // load root libraries
162 gSystem->Load("libTree");
163 gSystem->Load("libVMC");
164 gSystem->Load("libGui");
165 gSystem->Load("libXMLParser");
166 gSystem->Load("libMinuit");
167 gSystem->Load("libMinuit2");
168 gSystem->Load("libProof");
169 gSystem->Load("libGeom");
170 gSystem->Load("libPhysics");
171
172 // load aliroot libraries
173 gSystem->Load("libSTEERBase");
174 gSystem->Load("libESD");
175 gSystem->Load("libAOD");
176 gSystem->Load("libOADB");
177 gSystem->Load("libANALYSIS");
178 gSystem->Load("libANALYSISalice");
179 gSystem->Load("libCDB");
180 gSystem->Load("libRAWDatabase");
181 gSystem->Load("libSTEER");
182 gSystem->Load("libCORRFW");
183 gSystem->Load("libEMCALUtils");
184 gSystem->Load("libPHOSUtils");
185 gSystem->Load("libPWGCaloTrackCorrBase");
186 gSystem->Load("libPWGGACaloTrackCorrelations");
187 gSystem->Load("libPWGGACaloTasks");
188 gSystem->Load("libEMCALraw");
189 gSystem->Load("libEMCALbase");
190 gSystem->Load("libEMCALrec");
191 gSystem->Load("libTRDbase");
192 gSystem->Load("libVZERObase");
193 gSystem->Load("libVZEROrec");
194 gSystem->Load("libTender");
195 gSystem->Load("libTenderSupplies");
196
197 // load fastjet libraries
198 gSystem->Load("libJETAN");
199 gSystem->Load("/usr/lib64/libCGAL.so");
200 gSystem->Load("$FASTJET/lib/libfastjet");
201 gSystem->Load("$FASTJET/lib/libsiscone");
202 gSystem->Load("$FASTJET/lib/libSISConePlugin");
203 gSystem->Load("libFASTJETAN");
204 gSystem->Load("libPWGEMCAL");
205 gSystem->Load("libPWGGAEMCALTasks");
206 gSystem->Load("libPWGJEEMCALJetTasks");
207}
208
209AliAnalysisGrid* CreateAlienHandler(const char *taskname,
210 const char *gridmode,
211 const char *proofcluster,
212 const char *proofdataset)
213{
214 // TODO
215 return 0;
216}
217