example macro
[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
73 if (1) {
74 UInt_t val = AliVEvent::kAny;
75 val = AliVEvent::kAnyINT | AliVEvent::kCentral| AliVEvent::kSemiCentral;
76 //val = AliVEvent::kEMCEGA;
77 //val = AliVEvent::kEMCEJE;
78
79 TObjArray *toptasks = mgr->GetTasks();
80 for (Int_t i=0; i<toptasks->GetEntries(); ++i) {
81 AliAnalysisTaskSE *task = dynamic_cast<AliAnalysisTaskSE*>(toptasks->At(i));
82 if (!task)
83 continue;
84 TString name(task->GetName());
85 if (name.Contains("PhysicsSelection"))
86 continue;
87 ::Info("setPSel", "Set physics selection for %s (%s)", task->GetName(), task->ClassName());
88 task->SelectCollisionCandidates(val);
89 }
90 }
91
92 mgr->SetDebugLevel(0);
93 mgr->SetUseProgressBar(1, 25);
94
95 if (!mgr->InitAnalysis())
96 return;
97 mgr->PrintStatus();
98
99 if (rType == kGrid) {
100 mgr->StartAnalysis(gridmode);
101 } else {
102 if (dType == kAod) {
103 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/CreateAODChain.C");
104 chain = CreateAODChain("files_aod95.txt", 50);
105 } else {
106 gROOT->LoadMacro("$ALICE_ROOT/PWGUD/macros/CreateESDChain.C");
107 TChain* chain = CreateESDChain(ifiles.txt, 50);
108 }
109 mgr->StartAnalysis("local", chain);
110 }
111
112 return;
113}
114
115/*
116 //Tracks maker
117 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalAodTrackFilter.C");
118 //AliEmcalAodTrackFilterTask *eTask = AddTaskEmcalAodTrackFilter(tracksName, "tracks", "LHC11h");
119
120 //Tender Supplies
121 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalAodTender.C");
122 //geometry EMCAL_COMPLETEV1 or EMCAL_FIRSTYEARV1; data pp or PbPb
123 AliEmcalTenderTask *tender = AddTaskEmcalAodTender("EMCAL_COMPLETEV1", "PbPb");
124 /*
125 if (runtype == "grid") {
126 tender->SetDefaultCDBStorage("raw://"); //uncomment if you work on grid
127 }
128 else if (runtype == "local") {
129 tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //uncomment if you work local
130 }
131 */
132 /*
133 //V1unfold Clusterizer
134 TString AODbranchName;
135 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C");
136 AliAnalysisTaskEMCALClusterize *v1UnfoldClusTask = AddTaskEMCALClusterize(AODbranchName);
137
138 //L0-L1 Clusterizer
139 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskClusterizerFW.C");
140 //AliAnalysisTaskEMCALClusterizeFast *L0ClusTask = AddTaskClusterizerFW("L0");
141 AliAnalysisTaskEMCALClusterizeFast *L0ClusTask = AddTaskClusterizerFW("L1GAMMA");
142 //Hadronic correction task
143 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskHadCorr.C");
144 //AliHadCorrTask *hcorr = AddTaskHadCorr(tracksName, clustersName, corrClusName);
145
146 //Cluster Track matcher
147 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalClusTrackMatcher.C");
148 //AliEmcalClusTrackMatcherTask *matcherTask = AddTaskEmcalClusTrackMatcher(tracksName, corrClusName, 1, 1);
149
150 //Jet finder
151 //gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALJetTasks/macros/AddTaskEmcalJet.C");
152 //AliEmcalJetTask *jetTask = AddTaskEmcalJet(tracksName, corrClusName);
153
154 // create task
155 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEmcalIsolatedPhotons.C");
156 //AliEmcalIsolatedPhotonsTask *task = AddTaskEmcalIsolatedPhotons(tracksName, corrClusName, jetsName);
157 //task->SelectCollisionCandidates(AliVEvent::kAnyINT); // Any MB trigger
158 //task->SelectCollisionCandidates(AliVEvent::kEMCEGA); // Gamma trigger
159 //task->SelectCollisionCandidates(AliVEvent::kEMCEJE); // Jet trigger
160 */
161
162void LoadLibs()
163{
164 // load root libraries
165 gSystem->Load("libTree");
166 gSystem->Load("libVMC");
167 gSystem->Load("libGui");
168 gSystem->Load("libXMLParser");
169 gSystem->Load("libMinuit");
170 gSystem->Load("libMinuit2");
171 gSystem->Load("libProof");
172 gSystem->Load("libGeom");
173 gSystem->Load("libPhysics");
174
175 // load aliroot libraries
176 gSystem->Load("libSTEERBase");
177 gSystem->Load("libESD");
178 gSystem->Load("libAOD");
179 gSystem->Load("libOADB");
180 gSystem->Load("libANALYSIS");
181 gSystem->Load("libANALYSISalice");
182 gSystem->Load("libCDB");
183 gSystem->Load("libRAWDatabase");
184 gSystem->Load("libSTEER");
185 gSystem->Load("libCORRFW");
186 gSystem->Load("libEMCALUtils");
187 gSystem->Load("libPHOSUtils");
188 gSystem->Load("libPWGCaloTrackCorrBase");
189 gSystem->Load("libPWGGACaloTrackCorrelations");
190 gSystem->Load("libPWGGACaloTasks");
191 gSystem->Load("libPWGGAEMCALTasks");
192 gSystem->Load("libEMCALraw");
193 gSystem->Load("libEMCALbase");
194 gSystem->Load("libEMCALrec");
195 gSystem->Load("libTRDbase");
196 gSystem->Load("libVZERObase");
197 gSystem->Load("libVZEROrec");
198 gSystem->Load("libTENDER");
199 gSystem->Load("libTENDERSupplies");
200
201 // load fastjet libraries
202 gSystem->Load("libJETAN");
203 gSystem->Load("$FASTJET/lib/libfastjet");
204 gSystem->Load("$FASTJET/lib/libsiscone");
205 gSystem->Load("$FASTJET/lib/libSISConePlugin");
206 gSystem->Load("libFASTJETAN");
207 gSystem->Load("libPWGGAEMCALJetTasks");
208}
209
210AliAnalysisGrid* CreateAlienHandler(const char *taskname,
211 const char *gridmode,
212 const char *proofcluster,
213 const char *proofdataset)
214{
215 // TODO
216 return 0;
217}
218