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