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