TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / ANALYSIS / macros / QAtrainsim.C
CommitLineData
041e39a0 1#include "Riostream.h"
2void LoadLibraries();
3void AddAnalysisTasks();
4void QAmerge(const char *, Int_t);
5
4034054b 6Int_t iCollisionType = ; // 0=pp, 1=PbPb
041e39a0 7// Trigger mask.
8
9UInt_t kTriggerInt = AliVEvent::kAnyINT;
10UInt_t kTriggerMuonAll = AliVEvent::kMUL7 | AliVEvent::kMUSH7 | AliVEvent::kMUU7 | AliVEvent::kMUS7
11 | AliVEvent::kMUSPB | AliVEvent::kMUSHPB | AliVEvent::kMuonLikePB | AliVEvent::kMuonUnlikePB;
12UInt_t kTriggerMuonBarell = AliVEvent::kMUU7;
4034054b 13UInt_t kTriggerEMC = AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMCEJE | AliVEvent::kEMCEGA;
041e39a0 14UInt_t kTriggerHM = AliVEvent::kHighMult;
15// Main trigger mask used:
16UInt_t kTriggerMask = kTriggerInt;
17
18Int_t runNumbers[5] = {158626};
19
20Bool_t doCDBconnect = 1;
21Bool_t doEventStat = 1;
4034054b 22Bool_t doCentrality = 0;
23Bool_t doQAsym = 0;
041e39a0 24Bool_t doVZERO = 1; // there is a 2nd file
25Bool_t doVZEROPbPb = 1;
26Bool_t doVertex = 1;
27Bool_t doSPD = 1; // needs RP
28Bool_t doTPC = 1;
29Bool_t doHLT = 1;
30Bool_t doSDD = 1; // needs RP
31Bool_t doSSDdEdx = 1;
32
33Bool_t doTRD = 1;
34Bool_t doITS = 1;
35Bool_t doITSsaTracks = 1;
36Bool_t doITSalign = 1;
37Bool_t doCALO = 1;
4034054b 38
041e39a0 39Bool_t doMUONTrig = 1;
40Bool_t doImpParRes = 1;
41Bool_t doMUON = 1;
42Bool_t doTOF = 1;
43Bool_t doHMPID = 1;
44Bool_t doT0 = 1;
45Bool_t doZDC = 1;
46Bool_t doPIDResponse = 1;
47Bool_t doPIDqa = 1; //new
48Bool_t doFMD = 1; // new
49Bool_t doPHOS = 1; // new
4034054b 50Bool_t doPHOSTrig = 1; // new
51Bool_t doEMCAL = 0;
041e39a0 52Bool_t doFBFqa = 1; // new - not ported yet to revision
53
4034054b 54Bool_t doMUONEff = 0; // NEEDS geometry
55Bool_t doV0 = 0; // NEEDS MCtruth
56
041e39a0 57 // Debug level
58Int_t debug_level = 1; // Debugging
59Int_t run_number = 0;
60
4034054b 61void QAtrainsim(Int_t run = 0,
041e39a0 62 const char *xmlfile = "wn.xml",
4034054b 63 Int_t stage = 0, /*0 = QA train, 1...n - merging stage*/
64 const char *cdb = "raw://")
041e39a0 65{
66 run_number = run;
4034054b 67 TString cdbString(cdb);
68 if (cdbString.Contains("raw://"))
69 {
041e39a0 70 TGrid::Connect("alien://");
71 if (!gGrid || !gGrid->IsConnected()) {
72 ::Error("QAtrain", "No grid connection");
73 return;
4034054b 74 }
75
76}
041e39a0 77 // Set temporary merging directory to current one
78 gSystem->Setenv("TMPDIR", gSystem->pwd());
79 // Set temporary compilation directory to current one
80 gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
81 // Load libraries
82 LoadLibraries();
83 printf("Include path: %s\n", gSystem->GetIncludePath());
84 // Create manager
85 AliAnalysisManager *mgr = new AliAnalysisManager("PilotAnalysis_sim", "Production train");
86 mgr->SetRunFromPath(run_number);
87 // Input handler
88 AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
89 esdHandler->SetReadFriends(kTRUE);
90 esdHandler->SetActiveBranches("ESDfriend");
91 mgr->SetInputEventHandler(esdHandler);
92 mgr->SetDebugLevel(debug_level);
93
94 // Monte Carlo handler
95 AliMCEventHandler* mcHandler = new AliMCEventHandler();
96 mgr->SetMCtruthEventHandler(mcHandler);
97 mcHandler->SetPreReadMode(1);
98 mcHandler->SetReadTR(kTRUE);
99
100 // AnalysisTasks
4034054b 101// mgr->Lock();
102 mgr->SetFileInfoLog("fileinfo.log");
103 AddAnalysisTasks(cdb);
104// mgr->UnLock();
105// mcHandler = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
106// mcHandler->SetReadTR(kTRUE);
107// mcHandler->SetPreReadMode(1);
041e39a0 108 if (stage>0) {
109 QAmerge(xmlfile, stage);
110 return;
111 }
112 // Input chain
113 TChain *chain = new TChain("esdTree");
114 chain->Add("AliESDs.root");
115 TStopwatch timer;
116 timer.Start();
117 if (mgr->InitAnalysis()) {
118 mgr->PrintStatus();
119 mgr->SetSkipTerminate(kTRUE);
4034054b 120 mgr->SetNSysInfo(1);
121 mgr->StartAnalysis("localfile", chain);
041e39a0 122 }
123 timer.Print();
124}
125
126void LoadLibraries()
127{
128 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD -I$ALICE_ROOT/PWGPP -I$ALICE_ROOT/PWGPP/TRD");
129 gSystem->Load("libANALYSIS");
130 gSystem->Load("libANALYSISalice");
230b7aff 131 gSystem->Load("libESDfilter");
041e39a0 132 gSystem->Load("libCORRFW");
230b7aff 133 gSystem->Load("libTender");
134 gSystem->Load("libPWGPP");
135 gSystem->Load("libAliHLTTrigger");
041e39a0 136
4034054b 137 if (doEMCAL || doPHOS || doCALO) {
041e39a0 138 gSystem->Load("libEMCALUtils");
139 gSystem->Load("libPHOSUtils");
140 gSystem->Load("libPWGCaloTrackCorrBase");
141 gSystem->Load("libPWGGACaloTrackCorrelations");
142 gSystem->Load("libPWGGACaloTasks");
143 gSystem->Load("libPWGGAPHOSTasks");
4034054b 144 gSystem->Load("libPWGTools");
145 gSystem->Load("libPWGEMCAL");
041e39a0 146 gSystem->Load("libPWGGAEMCALTasks");
147 }
148 if(doMUON || doMUONTrig) {
149 gSystem->Load("libPWGmuon");
150 gSystem->Load("libPWGPPMUONlite");
151 gSystem->Load("libPWGmuondep");
152 }
153 if (doFMD) {
154 gSystem->Load("libPWGLFforward2");
155 }
156}
4034054b 157
041e39a0 158
4034054b 159void AddAnalysisTasks(const char *cdb_location)
041e39a0 160{
161 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
162 mgr->SetCommonFileName("QAresults.root");
163 // Statistics task
164 mgr->AddStatisticsTask(kTriggerMask);
165 //
166 // CDB connection
167 //
168 if (doCDBconnect) {
169 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
4034054b 170 AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, run_number);
041e39a0 171 if (!taskCDB) return;
041e39a0 172 }
173
174 //
175 // Event Statistics (Jan Fiete)
176 //
177 if (doEventStat) {
178 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
179 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kTRUE /*MC*/);
180 }
181
182 //
183 // Centrality (A. Toia)
184 //
185 if (doCentrality) {
4034054b 186// if (!iCollisionType) {
187// printf("Disabling centrality task for p-p\n");
188// doCentrality = kFALSE;
189// } else {
041e39a0 190 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
191 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
192 taskCentrality->SetMCInput();
4034054b 193// }
041e39a0 194 }
195
196 // Vertexing (A. Dainese)
197 //
198 if (doVertex) {
199 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskVertexESD.C");
200 // Specific setting for MC
201 AliAnalysisTaskVertexESD* taskvertexesd = AddTaskVertexESD(kTRUE, kTriggerMask);
202 taskvertexesd->SelectCollisionCandidates(kTriggerMask);
203 }
204
205 // TPC QA (E. Sicking)
206 //
207 if (doQAsym) {
208 // offline trigger in AddTask
209 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskQAsym.C");
210 AliAnalysisTaskSE * taskqasim = AddTaskQAsym(0, kTriggerMask, kTriggerHM, kTriggerEMC, kTriggerMuonBarell);
211 }
212 //
213 // VZERO QA (C. Cheshkov)
214 //
215 if (doVZERO) {
216 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskVZEROQA.C");
217 AliAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
218// taskv0qa->SelectCollisionCandidates();
219 }
4034054b 220 if (doVZEROPbPb) {
041e39a0 221 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/VZERO/AddTaskVZEROPbPb.C");
4034054b 222 AliAnaVZEROPbPb* taskV0PbPb = (AliAnaVZEROPbPb*)AddTaskVZEROPbPb(run_number);
223// taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVLNWU-,CVLN-");
224// taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU,CPBI2,CPBI1WU-,CPBI1-,CVHNWU,CVHN,CVLNWU,CVLN");
225// taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_B2-,CVLNWU_B2-");
226// taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_R1-,CVLN_B2-,CVLNWU_R1-,CVLNWU_B2-");
227// taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_R1-,CVLN_B2-,CVLNWU_R1-,CVLNWU_B2-,CSEMI_R1-,CSEMIWU_R1-,CCENT_R2-,CCENTWU_R2-");
041e39a0 228 }
229 //
230 // TPC (Jacek Otwinowski & Michael Knichel)
231 //
232 //
233 // Optionally MC information can be used by setting the 1st argument to true
234 // Optionally friends information can be switched off by setting the 2st argument
235 // to false
236 // Optionally highMult axis can be used by setting the 3st argument to true (for PbPb)
237 if (doTPC) {
238 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
239 AliPerformanceTask *tpcQA = 0;
240 if (iCollisionType) {
241 // High multiplicity Pb-Pb
242 tpcQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kTRUE);
243 } else {
244 // Low multiplicity (pp)
245 tpcQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kFALSE);
246 }
247 tpcQA->SelectCollisionCandidates(kTriggerMask);
4034054b 248 AliPerformanceRes::SetMergeEntriesCut(5000000);
041e39a0 249 }
250
251 // HLT (Alberica Toia)
252 if (doHLT) {
253 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
254 AliPerformanceTask *hltQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kFALSE,0,kTRUE);
255 hltQA->SelectCollisionCandidates(kTriggerMask);
256 }
257 //
258 // SPD (A. Mastroserio)
259 //
260 if (doSPD) {
261 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskSPDQA.C");
262 AliAnalysisTaskSPD* taskspdqa = (AliAnalysisTaskSPD*)AddTaskSPDQA();
263 // Request from Annalisa
264 if (iCollisionType) taskspdqa->SetHeavyIonMode();
265 taskspdqa->SelectCollisionCandidates(kTriggerMask);
266 taskspdqa->SetOCDBInfo(run_number, "raw://");
267 }
268 //
269 // SDD (F. Prino)
270 //
271 if (doSDD) {
272 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddSDDPoints.C");
273 AliAnalysisTaskSE* tasksdd = AddSDDPoints();
274 tasksdd->SelectCollisionCandidates(kTriggerMask);
275 }
276 //
277 // SSD dEdx (Marek Chojnacki)
278 //
279 if (doSSDdEdx) {
280 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskdEdxSSDQA.C");
281 AliAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
282 taskssddedx->SelectCollisionCandidates(kTriggerMask);
283 }
284
285 //
286 // ITS
287 //
288 if (doITS) {
289 // hardcoded non-zero trigger mask
290 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceITS.C");
291 AliAnalysisTaskITSTrackingCheck *itsQA = 0;
292 AliAnalysisTaskITSTrackingCheck *itsQACent0010 = 0;
293 AliAnalysisTaskITSTrackingCheck *itsQACent3050 = 0;
294 AliAnalysisTaskITSTrackingCheck *itsQACent6080 = 0;
295 if(iCollisionType==0) {
296 itsQA = AddTaskPerformanceITS(kTRUE);
297 } else {
298 itsQA = AddTaskPerformanceITS(kTRUE);
299 itsQACent0010 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,3500,10000);
300 itsQACent3050 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,590,1570);
301 itsQACent6080 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,70,310);
302 }
303 }
304 //
305 // ITS saTracks, align (F.Prino)
306 //
307 if (doITSsaTracks) {
308 // offline trigger in AddTask
309 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskITSsaTracks.C");
310 AliAnalysisTaskITSsaTracks *itssaTracks = AddTaskITSsaTracks(kTRUE,kFALSE);
311 itssaTracks->SelectCollisionCandidates(kTriggerMask);
312 }
313 if (doITSalign) {
314 // no offline trigger selection
315 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskITSAlign.C");
316 AliAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011);
317 }
318 //
319 // TRD (Alex Bercuci, M. Fasel)
320 //
321 if(doTRD) {
322 // no offline trigger selection
323 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTrainPerformanceTRD.C");
324 // steer individual TRD tasks
325 Bool_t
326 doCheckESD(kTRUE), // AliTRDcheckESD
327 doCheckDET(kTRUE), // AliTRDcheckDET
328 doEffic(kTRUE), // AliTRDefficiency
329 doResolution(kTRUE),// AliTRDresolution
330 doCheckPID(kTRUE), // AliTRDcheckPID
331 doV0Monitor(kFALSE);// AliTRDv0Monitor
332 AddTrainPerformanceTRD(Translate(doCheckESD, doCheckDET, doEffic, doResolution, doCheckPID, doV0Monitor));
333 }
334
335 //
336 // ZDC (Chiara Oppedisano)
337 //
338 if(doZDC) {
339 // hardcoded kMB trigger mask
340 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/ZDC/AddTaskZDCQA.C");
341 AliAnalysisTaskSE *taskZDC = AddTaskZDCQA();
342 taskZDC->SelectCollisionCandidates(kTriggerMask);
343 }
344 //
345 // Calorimetry (Gustavo Conesa)
346 //
347
348 if(doCALO) {
4034054b 349
041e39a0 350 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
4034054b 351 AliAnalysisTaskCaloTrackCorrelation *taskCaloQA = AddTaskCalorimeterQA("default");
041e39a0 352 taskCaloQA->SetDebugLevel(0);
353 // offline mask set in AddTask to kMB
354 taskCaloQA->SelectCollisionCandidates(kTriggerMask);
355 // Add a new calo task with EMC1 trigger only
4034054b 356 taskCaloQA = AddTaskCalorimeterQA("trigEMC");
041e39a0 357 taskCaloQA->SetDebugLevel(0);
358 taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
4034054b 359
360// gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
361// AliAnalysisTaskCaloTrackCorrelation*taskCaloQA= AddTaskCalorimeterQA("ESD", 2012, kFALSE, kTRUE);
362// taskCaloQA->SetDebugLevel(0);
363 // offline mask set in AddTask to kMB
364// taskCaloQA->SelectCollisionCandidates(kTriggerMask);
365 // Add a new calo task with EMC1 trigger only
366// taskCaloQA= AddTaskCalorimeterQA("ESD", 2012, kFALSE, kTRUE, "", "EMC7");
367// taskCaloQA->SetDebugLevel(0);
368// taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
369
370
371// gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
372// AliAnalysisTaskCaloTrackCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kTRUE);
373// taskCaloQA->SetDebugLevel(0);
374 // offline mask set in AddTask to kMB
375// taskCaloQA->SelectCollisionCandidates(kTriggerMask);
376 // Add a new calo task with EMC1 trigger only
377// taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kTRUE, "", "EMC7");
378// taskCaloQA->SetDebugLevel(0);
379// taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
041e39a0 380 }
381
382 //
383 // Muon Trigger
384 //
385
386 if(doMUONTrig) {
387 // no offline trigger selection
388 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
389 AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
390 }
391
392 //
4034054b 393 // Muon Efficiency (not used)
394 //
395
396 if(doMUONEff) {
397 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
398 AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AddTaskMUONTrackingEfficiency();
399 }
400
401 //
402 // V0-Decay Reconstruction (Ana Marin) (not used)
403 //
404
405 if (doV0) {
406 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskV0QA.C");
407 AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(kTRUE);
408 }
409 //
041e39a0 410 // Impact parameter resolution (xianbao.yuan@pd.infn.it, andrea.dainese@pd.infn.it)
411 //
412 if (doImpParRes) {
413 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskImpParRes.C");
414 AliAnalysisTaskSE* taskimpparres=0;
415 // Specific setting for MC
416 if(iCollisionType==0) {
417 taskimpparres= AddTaskImpParRes(kTRUE);
418 } else {
419 taskimpparres= AddTaskImpParRes(kTRUE,-1,kTRUE,kFALSE);
420 }
421 taskimpparres->SelectCollisionCandidates(kTriggerMask);
422 }
423 //
424 // MUON QA (Philippe Pillot)
425 //
426 if (doMUON) {
427 // trigger analysis internal
428 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskMuonQA.C");
429 AliAnalysisTaskSE* taskmuonqa= AddTaskMuonQA();
430 }
431 //
432 // TOF (Francesca Bellini)
433 //
434 if (doTOF) {
435 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TOF/AddTaskTOFQA.C");
4034054b 436 AliAnalysisTaskTOFqa *tofQA = AddTaskTOFQA(kFALSE);
041e39a0 437 tofQA->SelectCollisionCandidates(kTriggerMask);
438 }
439 //
440 // PIDResponse(JENS)
441 //
442 if (doPIDResponse) {
443 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
444 AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse(kTRUE);
445 PIDResponse->SelectCollisionCandidates(kTriggerMask);
446 }
447
448 //
449 // PIDqa(JENS)
450 //
451 if (doPIDqa) {
452 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
453 AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
454 PIDQA->SelectCollisionCandidates(kTriggerMask);
455 }
456
457 //
458 // HMPID QA (Giacomo Volpe)
459 //
460 if (doHMPID) {
461 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/HMPID/AddTaskHmpidQA.C");
462 AliAnalysisTaskSE* taskhmpidqa= AddTaskHmpidQA(kTRUE);
463 // offline mask set in AddTask to kMB
464 taskhmpidqa->SelectCollisionCandidates(kTriggerMask);
465 }
466 // T0 QA (Alla Mayevskaya)
467 if (doT0) {
468 // no offline trigger selection
469 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/T0/AddTaskT0QA.C");
470 AliT0AnalysisTaskQA* taskt0qa= AddTaskT0QA();
471 taskt0qa->SelectCollisionCandidates(kTriggerMask);
472 }
473 // FMD QA (Christian Holm Christiansen)
474 if (doFMD) {
475 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/AddTaskForwardQA.C");
476 // Parameters: usemc, usecentrality
477 AliAnalysisTaskSE *forwardQA = (AliAnalysisTaskSE *)AddTaskForwardQA(kTRUE, (Bool_t)doCentrality);
478 // No offline trigger config. needed (see #84077)
479 }
480 //
481 // PHOS QA (Boris Polishchuk)
482 //
483 if (doPHOS) {
484 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
485 AliAnalysisTaskCaloCellsQA *taskPHOSCellQA1 = AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_AnyInt");
486 taskPHOSCellQA1->SelectCollisionCandidates(kTriggerMask);
487 taskPHOSCellQA1->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.3,1.0);
488 AliAnalysisTaskCaloCellsQA *taskPHOSCellQA2 = AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_PHI7");
489 taskPHOSCellQA2->SelectCollisionCandidates(AliVEvent::kPHI7);
490 taskPHOSCellQA2->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.3,1.0);
491 // Pi0 QA fo PbPb
4034054b 492 if (iCollisionType == 1) {
041e39a0 493 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPbQA/macros/AddTaskPHOSPbPb.C");
494 AliAnalysisTaskPHOSPbPbQA* phosPbPb = AddTaskPHOSPbPbQA(0);
495 }
4034054b 496 }
497 if (doPHOSTrig) {
498 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_TriggerQA/macros/AddTaskPHOSTriggerQA.C");
499 AliAnalysisTaskPHOSTriggerQA *taskPHOSTrig = AddTaskPHOSTriggerQA(NULL);
500 }
041e39a0 501 //
502 // EMCAL QA (Gustavo Conesa)
503 //
504 if (doEMCAL) {
505 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALTriggerQA.C");
506 AliAnalysisTaskEMCALTriggerQA *emctrig = AddTaskEMCALTriggerQA();
507 }
508 //
509 // FLOW and BF QA (C.Perez && A.Rodriguez)
510 //
511 if (doFBFqa) {
512 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskFBFqa.C");
513 AliAnalysisTaskSE *qaFBFMB = (AliAnalysisTaskSE*) AddTaskFBFqa("qaFBFmb",kFALSE);
514 qaFBFMB->SelectCollisionCandidates(AliVEvent::kMB);
515 AliAnalysisTaskSE *qaFBFSC = (AliAnalysisTaskSE*) AddTaskFBFqa("qaFBFsc",kFALSE);
516 qaFBFSC->SelectCollisionCandidates(AliVEvent::kSemiCentral);
517 AliAnalysisTaskSE *qaFBFCE = (AliAnalysisTaskSE*) AddTaskFBFqa("qaFBFce",kFALSE);
518 qaFBFCE->SelectCollisionCandidates(AliVEvent::kCentral);
519 }
520}
521
522void QAmerge(const char *dir, Int_t stage)
523{
524// Merging method
525 TStopwatch timer;
526 timer.Start();
527 TString outputDir = dir;
4034054b 528 TString outputFiles = "QAresults.root,EventStat_temp.root";
041e39a0 529 TString mergeExcludes = "";
530 TObjArray *list = outputFiles.Tokenize(",");
531 TIter *iter = new TIter(list);
532 TObjString *str;
533 TString outputFile;
534 Bool_t merged = kTRUE;
535 while((str=(TObjString*)iter->Next())) {
536 outputFile = str->GetString();
537 // Skip already merged outputs
538 if (!gSystem->AccessPathName(outputFile)) {
539 printf("Output file <%s> found. Not merging again.",outputFile.Data());
540 continue;
541 }
542 if (mergeExcludes.Contains(outputFile.Data())) continue;
543 merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, stage);
544 if (!merged) {
545 printf("ERROR: Cannot merge %s\n", outputFile.Data());
4034054b 546 continue;
041e39a0 547 }
548 }
4034054b 549 TString infolog = "fileinfo.log";
550 AliAnalysisAlien::MergeInfo(infolog, dir);
041e39a0 551 // read the analysis manager from file
552 if (!outputDir.Contains("Stage")) {
553 ofstream out;
554 out.open("outputs_valid", ios::out);
555 out.close();
556 return;
557 }
558 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
559 mgr->SetRunFromPath(mgr->GetRunFromAlienPath(dir));
560 mgr->SetSkipTerminate(kFALSE);
561 if (!mgr->InitAnalysis()) return;
562 mgr->PrintStatus();
563 AliLog::SetGlobalLogLevel(AliLog::kError);
564 TTree *tree = NULL;
4034054b 565 gROOT->cd();
041e39a0 566 mgr->StartAnalysis("gridterminate", tree);
567 ofstream out;
568 out.open("outputs_valid", ios::out);
569 out.close();
570 timer.Print();
571}