fix from Salvatore
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / macros / runJetAna.C
CommitLineData
e7a7072a 1// $Id$
2
3void runJetAna(const char *datatype = "aod", // aod, esd, sesd
4 const char *runtype = "local", // local or grid
5 const char *gridmode = "test", // run mode (can be "full", "test", "offline", "submit" or "terminate")
6 const char *txtfile = "ifiles.txt", // text file with input files for local mode
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"))
15 rType = kGrid;
16 eDataType dType = kAod;
17 if (!strcmp(runtype, "esd"))
18 dType = kEsd;
19 else if (!strcmp(runtype, "sesd"))
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/PWGGA/EMCALTasks/macros/AddTaskEmcalPhysicsSelection.C");
43 AliPhysicsSelectionTask *physSelTask = AddTaskEmcalPhysicsSelelection(kTRUE);
44
45 // Centrality task
46 if (dType == kEsd) {
47 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
48 AliCentralitySelectionTask *centralityTask = AddTaskCentrality();
49 }
50
51 // Setup task
52 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalSetup.C");
53 AliEmcalSetupTask *setupTask = AddTaskEmcalSetup();
54
55 // Track maker
56 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalPicoTrackMaker.C");
57 AliEmcalPicoTrackMaker *pTrackTask = AddTaskEmcalPicoTrackMaker("PicoTracks", "tracks", "LHC11h");
58
59 // Cluster-track matcher
60 if (0) {
61 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalClusTrackMatcher.C");
62 AliEmcalClusTrackMatcherTask *matcherTask = AddTaskEmcalClusTrackMatcher("PicoTracks", "caloClusters");
63 }
64
65 // Hadronic correction task
66 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskHadCorr.C");
67 AliHadCorrTask *hcorr = AddTaskHadCorr("PicoTracks", "caloClusters", "caloClustersCorr");
68
69 // Jet finder
70 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskEmcalJet.C");
71 AliEmcalJetTask *jetTask = AddTaskEmcalJet("PicoTracks", "caloClustersCorr");
72
e61400a6 73 // Scale task
74 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskScale.C");
75 AliAnalysisTaskScale *scaleTask = AddTaskScale("PicoTracks", "caloClustersCorr");
76
e7a7072a 77 if (1) {
78 UInt_t val = AliVEvent::kAny;
79 val = AliVEvent::kAnyINT | AliVEvent::kCentral| AliVEvent::kSemiCentral;
80 //val = AliVEvent::kEMCEGA;
81 //val = AliVEvent::kEMCEJE;
82
83 TObjArray *toptasks = mgr->GetTasks();
84 for (Int_t i=0; i<toptasks->GetEntries(); ++i) {
85 AliAnalysisTaskSE *task = dynamic_cast<AliAnalysisTaskSE*>(toptasks->At(i));
86 if (!task)
87 continue;
88 TString name(task->GetName());
89 if (name.Contains("PhysicsSelection"))
90 continue;
91 ::Info("setPSel", "Set physics selection for %s (%s)", task->GetName(), task->ClassName());
92 task->SelectCollisionCandidates(val);
93 }
94 }
95
96 mgr->SetDebugLevel(0);
97 mgr->SetUseProgressBar(1, 25);
98
99 if (!mgr->InitAnalysis())
100 return;
101 mgr->PrintStatus();
102
103 if (rType == kGrid) {
104 mgr->StartAnalysis(gridmode);
105 } else {
106 if (dType == kAod) {
107 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/CreateAODChain.C");
108 chain = CreateAODChain("files_aod95.txt", 50);
109 } else {
110 gROOT->LoadMacro("$ALICE_ROOT/PWGUD/macros/CreateESDChain.C");
111 TChain* chain = CreateESDChain(ifiles.txt, 50);
112 }
113 mgr->StartAnalysis("local", chain);
114 }
115
116 return;
117}
118
119/*
120 //Tracks maker
121 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalAodTrackFilter.C");
122 //AliEmcalAodTrackFilterTask *eTask = AddTaskEmcalAodTrackFilter(tracksName, "tracks", "LHC11h");
123
124 //Tender Supplies
125 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalAodTender.C");
126 //geometry EMCAL_COMPLETEV1 or EMCAL_FIRSTYEARV1; data pp or PbPb
127 AliEmcalTenderTask *tender = AddTaskEmcalAodTender("EMCAL_COMPLETEV1", "PbPb");
128 /*
129 if (runtype == "grid") {
130 tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid
131 }
132 else if (runtype == "local") {
133 tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local
134 }
135 */
136 /*
137 //V1unfold Clusterizer
138 TString AODbranchName;
139 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C");
140 AliAnalysisTaskEMCALClusterize *v1UnfoldClusTask = AddTaskEMCALClusterize(AODbranchName);
141
142 //L0-L1 Clusterizer
143 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskClusterizerFW.C");
144 //AliAnalysisTaskEMCALClusterizeFast *L0ClusTask = AddTaskClusterizerFW("L0");
145 AliAnalysisTaskEMCALClusterizeFast *L0ClusTask = AddTaskClusterizerFW("L1GAMMA");
146 //Hadronic correction task
147 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskHadCorr.C");
148 //AliHadCorrTask *hcorr = AddTaskHadCorr(tracksName, clustersName, corrClusName);
149
150 //Cluster Track matcher
151 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalClusTrackMatcher.C");
152 //AliEmcalClusTrackMatcherTask *matcherTask = AddTaskEmcalClusTrackMatcher(tracksName, corrClusName, 1, 1);
153
154 //Jet finder
155 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskEmcalJet.C");
156 //AliEmcalJetTask *jetTask = AddTaskEmcalJet(tracksName, corrClusName);
157
158 // create task
159 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalIsolatedPhotons.C");
160 //AliEmcalIsolatedPhotonsTask *task = AddTaskEmcalIsolatedPhotons(tracksName, corrClusName, jetsName);
161 //task->SelectCollisionCandidates(AliVEvent::kAnyINT); // Any MB trigger
162 //task->SelectCollisionCandidates(AliVEvent::kEMCEGA); // Gamma trigger
163 //task->SelectCollisionCandidates(AliVEvent::kEMCEJE); // Jet trigger
164 */
165
166void LoadLibs()
167{
168 // load root libraries
169 gSystem->Load("libTree");
170 gSystem->Load("libVMC");
171 gSystem->Load("libGui");
172 gSystem->Load("libXMLParser");
173 gSystem->Load("libMinuit");
174 gSystem->Load("libMinuit2");
175 gSystem->Load("libProof");
176 gSystem->Load("libGeom");
177 gSystem->Load("libPhysics");
178
179 // load aliroot libraries
180 gSystem->Load("libSTEERBase");
181 gSystem->Load("libESD");
182 gSystem->Load("libAOD");
183 gSystem->Load("libOADB");
184 gSystem->Load("libANALYSIS");
185 gSystem->Load("libANALYSISalice");
186 gSystem->Load("libCDB");
187 gSystem->Load("libRAWDatabase");
188 gSystem->Load("libSTEER");
189 gSystem->Load("libCORRFW");
190 gSystem->Load("libEMCALUtils");
191 gSystem->Load("libPHOSUtils");
192 gSystem->Load("libPWGCaloTrackCorrBase");
193 gSystem->Load("libPWGGACaloTrackCorrelations");
194 gSystem->Load("libPWGGACaloTasks");
195 gSystem->Load("libPWGGAEMCALTasks");
196 gSystem->Load("libEMCALraw");
197 gSystem->Load("libEMCALbase");
198 gSystem->Load("libEMCALrec");
199 gSystem->Load("libTRDbase");
200 gSystem->Load("libVZERObase");
201 gSystem->Load("libVZEROrec");
202 gSystem->Load("libTENDER");
203 gSystem->Load("libTENDERSupplies");
204
205 // load fastjet libraries
206 gSystem->Load("libJETAN");
207 gSystem->Load("$FASTJET/lib/libfastjet");
208 gSystem->Load("$FASTJET/lib/libsiscone");
209 gSystem->Load("$FASTJET/lib/libSISConePlugin");
210 gSystem->Load("libFASTJETAN");
211 gSystem->Load("libPWGGAEMCALJetTasks");
212}
213
214AliAnalysisGrid* CreateAlienHandler(const char *taskname,
215 const char *gridmode,
216 const char *proofcluster,
217 const char *proofdataset)
218{
219 // TODO
220 return 0;
221}
222