classes AliITSSortTrkl and AliITSTracklPairs temporarily removed from compilation
[u/mrichter/AliRoot.git] / PWG4 / macros / AnalysisTrainCAF.C
CommitLineData
e989c76a 1//______________________________________________________________________________
36f622dd 2void AnalysisTrainCAF(Int_t nEvents = 10000, Int_t nOffset = 10000)
e989c76a 3{
4// Example of running analysis train in CAF. To run in debug mode:
5// - export ROOTSYS=debug on your local client
6// - un-comment gProof->ClearPackages()
cfff6259 7// - un-comment lines with debugging info
e989c76a 8
9// WHY AOD is not a exchange container when running from ESD->AOD
10
11 Bool_t debug = kTRUE;
12 Bool_t useMC = kTRUE;
13 Bool_t readTR = kFALSE;
36f622dd 14 Bool_t bPROOF = kTRUE;
cfff6259 15
16
e989c76a 17
18 Int_t iAODanalysis = 0;
19 Int_t iAODhandler = 1;
20 Int_t iESDfilter = 1; // Only active if iAODanalysis=0
21 Int_t iJETAN = 1;
cfff6259 22 Int_t iJETANAOD = 0;
23 Int_t iJETANMC = 0;
24 Int_t iDIJETAN = 0;
25 Int_t iPWG4SPECTRUM = 1;
26 Int_t iPWG4UE = 0;
e989c76a 27
28 if (iAODanalysis) {
29 useMC = kFALSE;
30 readTR = kFALSE;
31 iESDfilter = 0;
32 iMUONfilter = 0;
33 }
cfff6259 34 if (iJETANAOD) iESDfilter=1;
e989c76a 35 if (iESDfilter) iAODhandler=1;
36
37 // Dataset from CAF
38 TString dataset = "/PWG4/arian/jetjet15-50";
cfff6259 39 // CKB quick hack
40 gROOT->LoadMacro("CreateESDChain.C");
41 TChain *chain = CreateESDChain("jetjet15-50.txt",10);
42
43
e989c76a 44 printf("==================================================================\n");
45 printf("=========== RUNNING ANALYSIS TRAIN IN CAF MODE =============\n");
46 printf("==================================================================\n");
47 if (iAODanalysis) printf("= AOD analysis on dataset: %s\n", dataset.Data());
48 else printf("= ESD analysis on dataset: %s\n", dataset.Data());
49 if (iESDfilter) printf("= ESD filter =\n");
50 if (iJETAN) printf("= Jet analysis =\n");
cfff6259 51 if (iJETANAOD) printf("= Jet analysis from AOD =\n");
52 if (iJETANMC) printf("= Jet analysis from Kinematics =\n");
53 if (iDIJETAN) printf("= DiJet analysis =\n");
54 if (iPWG4SPECTRUM)printf("= PWG4 Jet spectrum analysis =\n");
55 if (iPWG4UE) printf("= PWG4 UE =\n");
e989c76a 56 printf("==================================================================\n");
57 if (useMC) printf(":: use MC TRUE\n");
58 else printf(":: use MC FALSE\n");
59 if (readTR) printf(":: read TR TRUE\n");
60 else printf(":: read TR FALSE\n");
61 if (debug) printf(":: debugging TRUE\n");
62 else printf(":: debugging FALSE\n");
63
64 // Load common libraries
65 gSystem->Load("libTree.so");
66 gSystem->Load("libGeom.so");
67 gSystem->Load("libVMC.so");
68 gSystem->Load("libPhysics.so");
69
70
71 // Reset user processes if CAF if not responding anymore
72 //TProof::Reset("lxb6046");
73 // One may enable a different ROOT version on CAF
74
75 const char* proofNode = "lxb6046";
76 // const char* proofNode = "kleinb@localhost";
77
cfff6259 78
79
e989c76a 80
81 // Connect to proof
cfff6259 82 if(bPROOF){
83 TProof::Mgr(proofNode)->ShowROOTVersions();
84 TProof::Mgr(proofNode)->SetROOTVersion("v5-21-01-alice_dbg");
85 TProof::Open(proofNode);
86
87 // Clear packages if changing ROOT version on CAF or local
88 // gProof->ClearPackages();
89 // Enable proof debugging if needed
90 // gProof->SetLogLevel(5);
91 // To debug the train in PROOF mode, type in a root session:
92 // root[0] TProof::Mgr("lxb6064")->GetSessionLogs()->Display("*",0,10000);
93 // Common packages
94 // --- Enable the STEERBase Package
95 gProof->UploadPackage("${ALICE_ROOT}/STEERBase.par");
96 gProof->EnablePackage("STEERBase");
97 // --- Enable the ESD Package
98 gProof->UploadPackage("${ALICE_ROOT}/ESD.par");
99 gProof->EnablePackage("ESD");
100 // --- Enable the AOD Package
101 gProof->UploadPackage("${ALICE_ROOT}/AOD.par");
102 gProof->EnablePackage("AOD");
103 // --- Enable the ANALYSIS Package
104 gProof->UploadPackage("${ALICE_ROOT}/ANALYSIS.par");
105 gProof->EnablePackage("ANALYSIS");
106 // --- Enable the ANALYSISalice Package
107 gProof->UploadPackage("${ALICE_ROOT}/ANALYSISalice.par");
108 gProof->EnablePackage("ANALYSISalice");
109
110
111 // --- Enable the JETAN Package
112 if (iJETAN||iJETANMC) {
113 gProof->UploadPackage("${ALICE_ROOT}/JETAN.par");
114 gProof->EnablePackage("JETAN");
115 }
116 // --- Enable particle correlation analysis
117 if (iPWG4UE||iPWG4SPECTRUM) {
118 gProof->UploadPackage("${ALICE_ROOT}/PWG4JetTasks.par");
119 gProof->EnablePackage("PWG4JetTasks");
120 }
121
122 }
123 else{
124 gSystem->Load("libSTEERBase");
125 gSystem->Load("libESD");
126 gSystem->Load("libAOD");
127 gSystem->Load("libANALYSIS");
128 gSystem->Load("libANALYSISalice");
129
130
131 // --- Enable the JETAN Package
36f622dd 132 if (iJETAN||iJETANMC||iJETANAOD) gSystem->Load("libJETAN");
cfff6259 133 // --- Enable particle correlation analysis
134 if (iPWG4UE||iPWG4SPECTRUM)gSystem->Load("libPWG4JetTasks");
135 }
e989c76a 136
e989c76a 137
138 // Make the analysis manager
139 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
140 // Top container for input
141 AliAnalysisDataContainer *cinput = mgr->CreateContainer("cInput",TChain::Class(),
142 AliAnalysisManager::kInputContainer);
143 if (iAODanalysis) {
144 // AOD input handler
145 AliAODInputHandler *aodH = new AliAODInputHandler();
146 mgr->SetInputEventHandler(aodH);
147 } else {
148 // ESD input handler
149 AliESDInputHandler *esdHandler = new AliESDInputHandler();
150 mgr->SetInputEventHandler(esdHandler);
151// esdHandler->SetInactiveBranches("FMD CaloCluster");
152 }
153 // Monte Carlo handler
154 if (useMC && !iAODanalysis) {
155 AliMCEventHandler* mcHandler = new AliMCEventHandler();
156 mgr->SetMCtruthEventHandler(mcHandler);
157 mcHandler->SetReadTR(readTR);
158 }
159
160 // This container is managed by the AOD handler
161 AliAnalysisDataContainer *cout_aod = 0;
162 if (iAODhandler) {
163 // AOD output handler
164 AliAODHandler* aodHandler = new AliAODHandler();
165 mgr->SetOutputEventHandler(aodHandler);
cfff6259 166 aodHandler->SetOutputFileName(Form("AliAODs_CKB_%07d-%07d.root",nOffset,nOffset+nEvents));
167 // aodHandler->SetSelectAll(kFALSE);
168 // aodHandler->SetCreateNonStandardAOD();
e989c76a 169 cout_aod = mgr->CreateContainer("cAOD", TTree::Class(),
cfff6259 170 AliAnalysisManager::kOutputContainer, "default");
e989c76a 171 cout_aod->SetSpecialOutput();
172 }
173
174 // Debugging if needed
cfff6259 175 if (debug) mgr->SetDebugLevel(0);
e989c76a 176// AliLog::EnableDebug(kTRUE);
cfff6259 177 AliLog::SetGlobalLogLevel(0);
e989c76a 178
179
180 if (iESDfilter && !iAODanalysis) {
181 // Set of cuts plugged into the ESD filter
182 //
183 // standard
184 AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
185 esdTrackCutsL->SetMinNClustersTPC(50);
186 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
187 esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
188 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
189 esdTrackCutsL->SetMinNsigmaToVertex(3);
190 esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
191 esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
192 //
193 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
194 trackFilter->AddCuts(esdTrackCutsL);
195 //
196 // ESD filter task putting standard info to output AOD (with cuts)
197 AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
198 esdfilter->SetTrackFilter(trackFilter);
199 esdfilter->SetDebugLevel(10);
200 mgr->AddTask(esdfilter);
201 // Connect to data containers
202 mgr->ConnectInput (esdfilter, 0, cinput );
203 mgr->ConnectOutput (esdfilter, 0, cout_aod );
204 }
205 // Jet analysis
206 AliAnalysisDataContainer *c_aodjet = 0;
207 if (iJETAN && !iAODanalysis) {
208 AliAnalysisTaskJets *jetana = new AliAnalysisTaskJets("JetAnalysis");
209 jetana->SetDebugLevel(10);
210 jetana->SetConfigFile("${ALICE_ROOT}/JETAN/ConfigJetAnalysis.C");
211 mgr->AddTask(jetana);
212 // Output histograms list for jet analysis
213 AliAnalysisDataContainer *cout_jet = mgr->CreateContainer("jethist", TList::Class(),
214 AliAnalysisManager::kOutputContainer, "jethist.root");
215 // Dummy AOD output container for jet analysis (no client yet)
216 c_aodjet = mgr->CreateContainer("cAODjet", TTree::Class(),
217 AliAnalysisManager::kExchangeContainer);
218 // Connect to data containers
219 mgr->ConnectInput (jetana, 0, cinput );
220 mgr->ConnectOutput (jetana, 0, c_aodjet );
221 // mgr->ConnectOutput (jetana, 0, cout_aod );
222 mgr->ConnectOutput (jetana, 1, cout_jet );
223 }
cfff6259 224 // JETANALYSIS from the AOD
225 if (iJETANAOD) {
226 AliAnalysisTaskJets *jetanaAOD = new AliAnalysisTaskJets("AODJetAnalysis");
227 jetanaAOD->SetDebugLevel(10);
228 jetanaAOD->SetNonStdBranch("jetsAOD");
229 jetanaAOD->SetConfigFile("${ALICE_ROOT}/JETAN/ConfigJetAnalysisAOD.C");
230 mgr->AddTask(jetanaAOD);
231 // Output histograms list for jet analysis
232 AliAnalysisDataContainer *cout_jetAOD = mgr->CreateContainer("jethistAOD", TList::Class(),
233 AliAnalysisManager::kOutputContainer, "jethistAOD.root");
234 // Dummy AOD output container for jet analysis (no client yet)
235 c_aodjet0 = mgr->CreateContainer("cAODjet0", TTree::Class(),
236 AliAnalysisManager::kExchangeContainer);
237 // Connect to data containers
238 mgr->ConnectInput (jetanaAOD, 0, cout_aod );
239 mgr->ConnectOutput (jetanaAOD, 0, c_aodjet0 );
240 // mgr->ConnectOutput (jetana, 0, cout_aod );
241 mgr->ConnectOutput (jetanaAOD, 1, cout_jetAOD );
242 }
e989c76a 243 // Jet analysisMC
244 AliAnalysisDataContainer *c_aodjetMC = 0;
245 if (iJETANMC && useMC) {
246 AliAnalysisTaskJets *jetanaMC = new AliAnalysisTaskJets("JetAnalysisMC");
247 jetanaMC->SetDebugLevel(10);
248 jetanaMC->SetConfigFile("${ALICE_ROOT}/JETAN/ConfigJetAnalysisMC.C");
249 jetanaMC->SetNonStdBranch("jetsMC");
250 mgr->AddTask(jetanaMC);
251 // Output histograms list for jet analysis
252 AliAnalysisDataContainer *cout_jetMC = mgr->CreateContainer("jethistMC", TList::Class(),
253 AliAnalysisManager::kOutputContainer, "jethistMC.root");
254 // Dummy AOD output container for jet analysis (no client yet)
255 c_aodjetMC = mgr->CreateContainer("cAODjetMC", TTree::Class(),
256 AliAnalysisManager::kExchangeContainer);
257 // Connect to data containers
258 mgr->ConnectInput (jetanaMC, 0, cinput );
259 mgr->ConnectOutput (jetanaMC, 0, c_aodjetMC );
260 // mgr->ConnectOutput (jetanaMC, 0, cout_aod );
261 mgr->ConnectOutput (jetanaMC, 1, cout_jetMC );
262 }
cfff6259 263 // Dijet analysis
264 if(iDIJETAN){
265 AliAnalysisTaskDiJets *dijetana = new AliAnalysisTaskDiJets("DiJetAnalysis");
266 dijetana->SetDebugLevel(2);
267
268 mgr->AddTask(dijetana);
269
270 //
271 // Create containers for input/output
272 AliAnalysisDataContainer *c_aod_dijet = mgr->CreateContainer("cAODdijet", TTree::Class(),
273 AliAnalysisManager::kExchangeContainer);
274 mgr->ConnectInput (dijetana, 0, cinput );
275 mgr->ConnectOutput (dijetana, 0, c_aod_dijet);
276 }
277
278
279 if (iPWG4SPECTRUM) {
280 AliAnalysisTaskJetSpectrum* pwg4spec = new AliAnalysisTaskJetSpectrum("Jet Spectrum");
281
282 // default parameters use a switch via iPWGSPECTRUM
283 // or a config file
284 pwg4spec->SetAnalysisType(AliAnalysisTaskJetSpectrum::kAnaMC);
285 // if(iAODanalysis)pwg4spec->SetAODInput(kTRUE);
286 pwg4spec->SetDebugLevel(11);
287 // pwg4spec->SetBranchRec("jetsMC");
288 // pwg4spec->SetBranchGen("jetsAOD");
289 mgr->AddTask(pwg4spec);
290
291 AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer("pwg4spec", TList::Class(),AliAnalysisManager::kOutputContainer, "histos_pwg4spec.root");
292 // coutput1_Spec->SetSpecialOutput();
293 // Dummy AOD output container for jet analysis (no client yet)
294 c_aodSpec = mgr->CreateContainer("cAODjetSpec", TTree::Class(),
295 AliAnalysisManager::kExchangeContainer);
296 mgr->ConnectInput (pwg4spec, 0, cinput);
297 // mgr->ConnectInput (pwg4spec, 0, c_aodjet);
298 mgr->ConnectOutput (pwg4spec, 0, c_aodSpec );
299 // mgr->ConnectOutput (pwg4spec, 1, coutput1_Spec );
300
301 mgr->ConnectOutput (pwg4spec, 1, coutput1_Spec );
302 }
303
e989c76a 304
305 // Particle correlation analysis
306 if (iPWG4UE) {
cfff6259 307 AliAnalysisTaskUE* ueana = new AliAnalysisTaskUE("Underlying Event");
e989c76a 308
309
310 // default parameters use a switch via iPWGUE
311 // or a config file
312 Int_t anaType =1;
313 Int_t regType =1;
314 Double_t jetEtaCut=0.2;
315 Double_t trackPtCut=0.5;
316 Double_t trackEtaCut= 0.9;
317 Double_t rad=0.7;
318 Double_t deltaPhiCut = 2.616;
319
320 ueana->SetDebugLevel(10);
321 ueana->SetPtRangeInHist(25, 0., 250.);
322 ueana->SetAnaTopology(anaType);
323 ueana->SetRegionType(regType);
324 ueana->SetJet1EtaCut(jetEtaCut);
325 ueana->SetTrackPtCut(trackPtCut);
326 ueana->SetPtSumOrdering(2);
327 ueana->SetConeRadius(rad);
328 ueana->SetTrackEtaCut(trackEtaCut);
329 ueana->SetJet2DeltaPhiCut(deltaPhiCut);
330 mgr->AddTask(ueana);
331
332
333 AliAnalysisDataContainer *coutput1_UE = mgr->CreateContainer("histosUE", TList::Class(),AliAnalysisManager::kOutputContainer, "histosUE.root");
334
cfff6259 335 mgr->ConnectInput (ueana, 0, cinput);
336 // mgr->ConnectInput (ueana, 0, c_aodjet);
e989c76a 337 mgr->ConnectOutput (ueana, 0, coutput1_UE );
338 }
339
340 // Run the analysis
341 //
342 if (mgr->InitAnalysis()) {
343 mgr->PrintStatus();
cfff6259 344 if(bPROOF)mgr->StartAnalysis("proof",dataset.Data(), nEvents,nOffset);
345 else mgr->StartAnalysis("local",chain);
e989c76a 346 }
347}