Updating the functionality of AliAnalysisHadEtCorrections to accomodate centrality...
[u/mrichter/AliRoot.git] / prod / acrcaf / qa / qa.C
CommitLineData
847fd0ab 1void qa(Int_t runNumber, Int_t doQASym=1, Int_t doCosmic=0) {
c2174181 2 TStopwatch timer;
3 timer.Start();
4
5 gEnv->SetValue("XSec.GSI.DelegProxy","2");
6 // Select ROOT version
847fd0ab 7 TProof::Mgr("aliprod@alicecaf")->SetROOTVersion("v5-26-00");
c2174181 8 // Login to CAF
9 TProof::Open("aliprod@alicecaf");
10
11 // Enable AliRoot
847fd0ab 12
13 gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-18-Release.rec/AF-v4-18-rec.par");
14 gProof->EnablePackage("AF-v4-18-rec.par");
c2174181 15
a7ec3dd4 16 // Enable analysis libs
17 gSystem->Load("libANALYSIS.so");
18 gSystem->Load("libANALYSISalice.so");
847fd0ab 19 gProof->Exec("gSystem->Load(\"libANALYSIS.so\");" ,kTRUE);
a7ec3dd4 20 gProof->Exec("gSystem->Load(\"libANALYSISalice.so\");",kTRUE);
c2174181 21
22 //____________________________________________//
23 // Make the analysis manager
24 AliAnalysisManager *mgr = new AliAnalysisManager("AnalysisQAManager");
25 AliESDInputHandler* esdH = new AliESDInputHandler();
26 mgr->SetInputEventHandler(esdH);
847fd0ab 27 mgr->SetDebugLevel(3);
c2174181 28
29 //____________________________________________//
30 // 1st Cosmic task
847fd0ab 31 if (doCosmic) {
32 TFile::Cp("$ALICE_ROOT/PWG1/cosmic/AliAnalysisTaskCosmic.h",
33 "file:AliAnalysisTaskCosmic.h");
34 TFile::Cp("$ALICE_ROOT/PWG1/cosmic/AliAnalysisTaskCosmic.cxx",
35 "file:AliAnalysisTaskCosmic.cxx");
36 gProof->Load("AliAnalysisTaskCosmic.cxx++g");
37
38 AliAnalysisTaskCosmic *taskcosmic = new AliAnalysisTaskCosmic("TaskCosmic");
39 mgr->AddTask(taskcosmic);
40
41 // Create containers for input/output
42 AliAnalysisDataContainer *coutputcosmic = mgr->CreateContainer("chist1",TList::Class(),AliAnalysisManager::kOutputContainer,
43 Form("cosmic%d.root",runNumber));
44 mgr->ConnectInput (taskcosmic, 0, mgr->GetCommonInputContainer());
45 mgr->ConnectOutput (taskcosmic, 1, coutputcosmic);
46 }
47
48 if (doQASym) {
49 //____________________________________________//
50 // QA task for central barrel tracking exploiting symmetries
51 TFile::Cp("$ALICE_ROOT/PWG1/AliAnalysisTaskQASym.h",
52 "file:AliAnalysisTaskQASym.h");
53 TFile::Cp("$ALICE_ROOT/PWG1/AliAnalysisTaskQASym.cxx",
54 "file:AliAnalysisTaskQASym.cxx");
55 gProof->Load("AliAnalysisTaskQASym.cxx++g");
56 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskQAsym.C");
57 AliAnalysisTaskSE* taskqasym = AddTaskQAsym();
58 //
59 // QA task for VZERO
60 TFile::Cp("$ALICE_ROOT/PWG1/AliAnaVZEROQA.h",
61 "file:AliAnaVZEROQA.h");
62 TFile::Cp("$ALICE_ROOT/PWG1/AliAnaVZEROQA.cxx",
63 "file:AliAnaVZEROQA.cxx");
64 gProof->Load("AliAnaVZEROQA.cxx++g");
65 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskVZEROQA.C");
66 AliAnalysisTaskSE* taskvzeroqa = AddTaskVZEROQA(runNumber);
67 //
68 // QA task for vertexing
69 TFile::Cp("$ALICE_ROOT/PWG1/global/AliAnalysisTaskVertexESD.h",
70 "file:AliAnalysisTaskVertexESD.h");
71 TFile::Cp("$ALICE_ROOT/PWG1/global/AliAnalysisTaskVertexESD.cxx",
72 "file:AliAnalysisTaskVertexESD.cxx");
73 gProof->Load("AliAnalysisTaskVertexESD.cxx++g");
74 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskVertexESD.C");
75 AliAnalysisTaskSE* taskvertex = AddTaskVertexESD();
76 }
c2174181 77 if (!mgr->InitAnalysis()) return;
78 mgr->PrintStatus();
79 mgr->StartAnalysis("proof",
a7ec3dd4 80 Form("/ALIREC/aliprod/run%d",runNumber));
c2174181 81
82 timer.Stop();
83 timer.Print();
84
85 plot(runNumber);
86}
87
847fd0ab 88void plot(Int_t runNumber, Int_t doQASym=1, Int_t doCosmic=0)
c2174181 89{
847fd0ab 90 if (doCosmic && gSystem->AccessPathName(Form("cosmic%d.root",runNumber))) {
91 printf("Error: doCosmic requested but file cosmic%d.root not found.\n", runNumber);
92 doCosmic = 0;
93 }
94 if (doQASym && gSystem->AccessPathName("QAsym.root")) {
95 printf("Error: doCosmic requested but file QAsym.root not found.\n", runNumber);
96 doQASym = 0;
97 }
98 if (doCosmic) {
99 TFile* f1 = new TFile(Form("cosmic%d.root",runNumber), "read");
100
101 // pt, phi ....
102 TCanvas* c1 = new TCanvas("c1", "Cosmic: pt,eta,phi", 10, 10, 1100, 800);
103 c1->Divide(2,2);
104 c1->cd(1);
105 c1->GetPad(1)->SetLogy();
106 TList *chist1 = (TList*)f1.Get("chist1");
107 fhPtP = (TH1F*) chist1->FindObject("fhPtPC");
108 fhPtP->SetLineColor(2);
109 fhPtP->Draw();
110 fhPtN = (TH1F*) chist1->FindObject("fhPtNC");
111 fhPtN->SetLineColor(4);
112 fhPtN->Draw("same");
113
114 c1->cd(2);
115 fhPhiP = (TH1F*) chist1->FindObject("fhPhiPC");
116 fhPhiP->SetLineColor(2);
117 fhPhiP->Draw();
118 fhPhiN = (TH1F*) chist1->FindObject("fhPhiNC");
119 fhPhiN->SetLineColor(4);
120 fhPhiN->Draw("same");
121
122 c1->cd(3);
123 fhThetaP = (TH1F*) chist1->FindObject("fhThetaPC");
124 fhThetaP->SetLineColor(2);
125 fhThetaP->Draw();
126 fhThetaN = (TH1F*) chist1->FindObject("fhThetaNC");
127 fhThetaN->SetLineColor(4);
128 fhThetaN->Draw("same");
c2174181 129
847fd0ab 130 // delta phi
131 TCanvas* c2 = new TCanvas("c2", "Cosmic: #Delta#phi", 10, 10, 1100, 800);
132 c2->Divide(2,2);
133 // pos/neg charge
134 c2->cd(1);
135 c2->GetPad(1)->SetLogy();
136 fhDPhiP = (TH1F*) chist1->FindObject("fhDPhiPC");
137 fhDPhiN = (TH1F*) chist1->FindObject("fhDPhiNC");
138 fhDPhiP->SetLineColor(2);
139 fhDPhiN->SetLineColor(4);
140 fhDPhiP->SetXTitle("#Delta#phi [rad]");
141 fhDPhiP->Draw();
142 fhDPhiN->Draw("same");
143
144 // pos/neg z
145 c2->cd(2);
146 c2->GetPad(2)->SetLogy();
147
148 fhDPhiZP = (TH1F*) chist1->FindObject("fhDPhiPZ");
149 fhDPhiZN = (TH1F*) chist1->FindObject("fhDPhiNZ");
150 fhDPhiBA = (TH1F*) chist1->FindObject("fhDPhi_Bad");
151 fhDPhiZP->SetLineColor(2);
152 fhDPhiZN->SetLineColor(4);
153 fhDPhiBA->SetLineColor(6);
154
155 fhDPhiZP->SetXTitle("#Delta#phi [rad]");
156 fhDPhiZP->Draw();
157 fhDPhiZN->Draw("same");
158 // fhDPhiBA->Draw("same");
c2174181 159
160
847fd0ab 161 // delta theta
162 // pos/neg charge
163 c2->cd(3);
164 c2->GetPad(3)->SetLogy();
165 fhDThetaP = (TH1F*) chist1->FindObject("fhDThetaPC");
166 fhDThetaN = (TH1F*) chist1->FindObject("fhDThetaNC");
167 fhDThetaP->SetLineColor(2);
168 fhDThetaN->SetLineColor(4);
c2174181 169
170
847fd0ab 171 fhDThetaP->SetXTitle("#Delta#theta [rad]");
172 fhDThetaP->Draw();
173 fhDThetaN->Draw("same");
c2174181 174
847fd0ab 175 // pos/neg z
176 c2->cd(4);
177 c2->GetPad(4)->SetLogy();
c2174181 178
847fd0ab 179 fhDThetaZP = (TH1F*) chist1->FindObject("fhDThetaPZ");
180 fhDThetaZN = (TH1F*) chist1->FindObject("fhDThetaNZ");
181 fhDThetaBA = (TH1F*) chist1->FindObject("fhDTheta_Bad");
182 fhDThetaZP->SetLineColor(2);
183 fhDThetaZN->SetLineColor(4);
184 fhDThetaBA->SetLineColor(6);
185 fhDThetaZP->SetXTitle("#Delta#theta [rad]");
186 fhDThetaZP->Draw();
c2174181 187
847fd0ab 188 fhDThetaZN->Draw("same");
189 // fhDThetaBA->Draw("same");
c2174181 190
191
847fd0ab 192 // delta Pt
193 TCanvas* c3 = new TCanvas("c3", "Cosmic: #Delta p_{T}", 10, 10, 1100, 800);
194 c3->Divide(2,2);
195 // pos/neg charge
196 c3->cd(1);
197 c3->GetPad(1)->SetLogy();
198 fhDPtP = (TH1F*) chist1->FindObject("fhDPtPC");
199 fhDPtN = (TH1F*) chist1->FindObject("fhDPtNC");
200 fhDPtP->SetLineColor(2);
201 fhDPtN->SetLineColor(4);
c2174181 202
847fd0ab 203 fhDPtP->Draw();
204 fhDPtN->Draw("same");
205
206 // pos/neg z
207 c3->cd(2);
208 c3->GetPad(2)->SetLogy();
209
210 fhDPtZP = (TH1F*) chist1->FindObject("fhDPtPZ");
211 fhDPtZN = (TH1F*) chist1->FindObject("fhDPtNZ");
212 fhDPtZP->SetLineColor(2);
213 fhDPtZN->SetLineColor(4);
214 fhDPtZP->Draw();
215 fhDPtZN->Draw("same");
216
217 c3->cd(3);
218
219 fpDPtP = (TH1F*) chist1->FindObject("fpDPtPC");
220 fpDPtN = (TH1F*) chist1->FindObject("fpDPtNC");
221 fpDPtP->SetLineColor(2);
222 fpDPtN->SetLineColor(4);
223 fpDPtP->Draw();
224 fpDPtN->Draw("same");
225
226 c3->cd(4);
227
228 fpDPtZP = (TH1F*) chist1->FindObject("fpDPtPZ");
229 fpDPtZN = (TH1F*) chist1->FindObject("fpDPtNZ");
230 fpDPtZP->SetLineColor(2);
231 fpDPtZN->SetLineColor(4);
232 fpDPtZP->Draw();
233 fpDPtZN->Draw("same");
c2174181 234
235
847fd0ab 236 // dZ
237 TCanvas* c4 = new TCanvas("c4", "Cosmic: #Delta Z", 10, 10, 1100, 800);
238 c4->Divide(2,2);
239 // pos/neg charge
240 c4->cd(1);
241 c4->GetPad(1)->SetLogy();
242 fhDZP = (TH1F*) chist1->FindObject("fhDZPC");
243 fhDZN = (TH1F*) chist1->FindObject("fhDZNC");
244 fhDZP->SetLineColor(2);
245 fhDZN->SetLineColor(4);
c2174181 246
847fd0ab 247 fhDZP->Draw();
248 fhDZN->Draw("same");
c2174181 249
847fd0ab 250 // pos/neg z
251 c4->cd(2);
252 c4->GetPad(2)->SetLogy();
c2174181 253
847fd0ab 254 fhDZZP = (TH1F*) chist1->FindObject("fhDZPZ");
255 fhDZZN = (TH1F*) chist1->FindObject("fhDZNZ");
256 fhDZBA = (TH1F*) chist1->FindObject("fhDZ_Bad");
c2174181 257
847fd0ab 258 fhDZZP->SetLineColor(2);
259 fhDZZN->SetLineColor(4);
260 fhDZBA->SetLineColor(6);
c2174181 261
847fd0ab 262 fhDZZP->Draw();
263 fhDZZN->Draw("same");
264 fhDZBA->Draw("same");
265
266 // dX
267 // pos/neg charge
268 c4->cd(3);
269 c4->GetPad(3)->SetLogy();
270 fhDXP = (TH1F*) chist1->FindObject("fhDXPC");
271 fhDXN = (TH1F*) chist1->FindObject("fhDXNC");
272 fhDXP->SetLineColor(2);
273 fhDXN->SetLineColor(4);
c2174181 274
847fd0ab 275 fhDXP->Draw();
276 fhDXN->Draw("same");
277
278 // pos/neg z
279 c4->cd(4);
280 c4->GetPad(4)->SetLogy();
281
282 fhDXZP = (TH1F*) chist1->FindObject("fhDXPZ");
283 fhDXZN = (TH1F*) chist1->FindObject("fhDXNZ");
284 fhDXBA = (TH1F*) chist1->FindObject("fhDX_Bad");
285
286 fhDXZP->SetLineColor(2);
287 fhDXZN->SetLineColor(4);
288 fhDXBA->SetLineColor(6);
289
290 fhDXZP->Draw();
291 fhDXZN->Draw("same");
292 fhDXBA->Draw("same");
293
294 // dY
295 TCanvas* c4a = new TCanvas("c4a", "Cosmic #Delta Y", 10, 10, 1100, 800);
296 c4a->Divide(2,2);
297 // pos/neg charge
298 c4a->cd(1);
299 c4a->GetPad(1)->SetLogy();
300 fhDYP = (TH1F*) chist1->FindObject("fhDYPC");
301 fhDYN = (TH1F*) chist1->FindObject("fhDYNC");
302 fhDYP->SetLineColor(2);
303 fhDYN->SetLineColor(4);
c2174181 304
847fd0ab 305 fhDYP->Draw();
306 fhDYN->Draw("same");
c2174181 307
847fd0ab 308 // pos/neg z
309 c4a->cd(2);
310 c4a->GetPad(2)->SetLogy();
c2174181 311
847fd0ab 312 fhDYZP = (TH1F*) chist1->FindObject("fhDYPZ");
313 fhDYZN = (TH1F*) chist1->FindObject("fhDYNZ");
314 fhDYBA = (TH1F*) chist1->FindObject("fhDY_Bad");
c2174181 315
847fd0ab 316 fhDYZP->SetLineColor(2);
317 fhDYZN->SetLineColor(4);
318 fhDYBA->SetLineColor(6);
319
320 fhDYZP->Draw();
321 fhDYZN->Draw("same");
322 fhDYBA->Draw("same");
323
324 // delta Pt
325 TCanvas* c5 = new TCanvas("c5", "Cosmic #Delta p_{T} (n-sigma)", 10, 10, 1100, 800);
326 c5->Divide(2,2);
327 c5->cd(1);
328
329 fpDPtSP = (TH1F*) chist1->FindObject("fpDPtSPC");
330 fpDPtSN = (TH1F*) chist1->FindObject("fpDPtSNC");
331 fpDPtSP->SetLineColor(2);
332 fpDPtSN->SetLineColor(4);
333 fpDPtSP->Draw();
334 fpDPtSN->Draw("same");
335
336
337 c5->cd(2);
338
339 fpDPtSPZ = (TH1F*) chist1->FindObject("fpDPtSPZ");
340 fpDPtSNZ = (TH1F*) chist1->FindObject("fpDPtSNZ");
341 fpDPtSPZ->SetLineColor(2);
342 fpDPtSNZ->SetLineColor(4);
343 fpDPtSPZ->Draw();
344 fpDPtSNZ->Draw("same");
345
346 TCanvas* c6 = new TCanvas("c6", "Cosmic: Dz vs z", 10, 10, 1100, 800);
347 fhDZvsZ = (TH2F*) chist1->FindObject("fhDZvsZ");
348 fhDZvsZ->SetXTitle("z_{in} * sign(z_{in}) * sign(z_{out}) [cm]");
349 fhDZvsZ->SetYTitle("#DeltaZ [cm]");
350
351 gStyle->SetPalette(1);
c2174181 352
847fd0ab 353 fhDZvsZ->Draw("colz");
354 }
355 if (doQASym) {
356 TFile* f2 = new TFile("QAsym.root", "read");
357 TList *cont = (TList*)f2->Get("QAsymHists");
358 if (!cont) {
359 printf("Woops... list container changed name inside QAsym.root ?\n");
360 return;
361 }
362 // Global distributions
363 TCanvas* c7 = new TCanvas("c7", "QAsym: #Global quantities", 10, 10, 1100, 800);
364 c7->Divide(3,3);
365 c7->cd(1);
366 gPad->SetLogy();
367 fHistRECpt = (TH1F*)cont->FindObject("fHistRECpt");
368 fHistRECpt->SetLineColor(2);
369 fHistRECpt->Draw();
370 c7->cd(2);
371 gPad->SetLogy();
372 fEta = (TH1F*)cont->FindObject("fEta");
373 fEta->SetLineColor(4);
374 fEta->Draw();
375 c7->cd(3);
376 fEtaPhi = (TH2F*)cont->FindObject("fEtaPhi");
377 fEtaPhi->SetMarkerColor(2);
378 fEtaPhi->SetMarkerStyle(kCross);
379 fEtaPhi->Draw();
380 c7->cd(4);
381 fThetaRec = (TH1F*)cont->FindObject("fThetaRec");
382 fThetaRec->SetLineColor(4);
383 fThetaRec->Draw();
384 c7->cd(5);
385 fPhiRec = (TH1F*)cont->FindObject("fPhiRec");
386 fPhiRec->SetLineColor(2);
387 fPhiRec->Draw();
388 c7->cd(6);
389 fNumber = (TH1F*)cont->FindObject("fNumber");
390 fNumber->SetLineColor(3);
391 fNumber->Draw();
392 c7->cd(7);
393 fVx = (TH1F*)cont->FindObject("fVx");
394 fVx->Draw();
395 c7->cd(8);
396 fVy = (TH1F*)cont->FindObject("fVy");
397 fVy->Draw();
398 c7->cd(9);
399 fVz = (TH1F*)cont->FindObject("fVz");
400 fVz->Draw();
401
402 // Other global quantities
403 TCanvas* c8 = new TCanvas("c8", "QAsym: #Global quantities #2", 10, 10, 1100, 800);
404 c8->Divide(3,2);
405 c8->cd(1);
406 fEtaPt = (TH1F*)cont->FindObject("fEtaPt");
407 fEtaPt->SetLineColor(4);
408 fEtaPt->Draw();
409 c8->cd(2);
410 fQPt = (TH1F*)cont->FindObject("fQPt");
411 fQPt->SetLineColor(2);
412 fQPt->Draw();
413 c8->cd(3);
414 fDca = (TH1F*)cont->FindObject("fDca");
415 fDca->SetLineColor(3);
416 fDca->Draw();
417 c8->cd(4);
418 gPad->SetLogy();
419 fqRec = (TH1F*)cont->FindObject("fqRec");
420 fqRec->SetLineColor(2);
421 fqRec->Draw();
422 c8->cd(5);
423 gPad->SetLogy();
424 fsigmaPt = (TH1F*)cont->FindObject("fsigmaPt");
425 fsigmaPt->SetLineColor(3);
426 fsigmaPt->Draw();
427 // ITS DCA
428 TCanvas* c9 = new TCanvas("c9", "QAsym: #ITS DCA per layer (red=positive, blue=negative", 10, 10, 1100, 800);
429 c9->Divide(4,2);
430 for (Int_t i=0; i<7; i++) {
431 c9->cd(i+1);
432 gPad->SetLogy();
433 fSignDcaPos = (TH1F*)cont->FindObject(Form("fSignDcaPos%d", i));
434 fSignDcaPos->SetLineColor(4);
435 fSignDcaPos->Draw();
436 fSignDcaNeg = (TH1F*)cont->FindObject(Form("fSignDcaNeg%d", i));
437 fSignDcaNeg->SetLineColor(2);
438 fSignDcaNeg->Draw("same");
439 }
440 // YIELDs---------- positive and negative particles
441 TCanvas* c10 = new TCanvas("c10", "QAsym: #Positive (red) and negative (blue) particles", 10, 10, 1100, 800);
442 c10->Divide(3,2);
443 c10->cd(1);
444 gPad->SetLogy();
445 fRecPtPos = (TH1F*)cont->FindObject("fRecPtPos");
446 fRecPtPos->SetLineColor(2);
447 fRecPtPos->Draw();
448 fRecPtNeg = (TH1F*)cont->FindObject("fRecPtNeg");
449 fRecPtNeg->SetLineColor(4);
450 fRecPtNeg->Draw("same");
451 c10->cd(2);
452 gPad->SetLogy();
453 fRecPhiPos = (TH1F*)cont->FindObject("fRecPhiPos");
454 fRecPhiPos->SetLineColor(2);
455 fRecPhiPos->Draw();
456 fRecPhiNeg = (TH1F*)cont->FindObject("fRecPhiNeg");
457 fRecPhiNeg->SetLineColor(4);
458 fRecPhiNeg->Draw("same");
459 c10->cd(3);
460 gPad->SetLogy();
461 fRecEtaPos = (TH1F*)cont->FindObject("fRecEtaPos");
462 fRecEtaPos->SetLineColor(2);
463 fRecEtaPos->Draw();
464 fRecEtaNeg = (TH1F*)cont->FindObject("fRecEtaNeg");
465 fRecEtaNeg->SetLineColor(4);
466 fRecEtaNeg->Draw("same");
467 c10->cd(4);
468 gPad->SetLogy();
469 fRecEtaPtPos = (TH1F*)cont->FindObject("fRecEtaPtPos");
470 fRecEtaPtPos->SetLineColor(2);
471 fRecEtaPtPos->Draw();
472 fRecEtaPtNeg = (TH1F*)cont->FindObject("fRecEtaPtNeg");
473 fRecEtaPtNeg->SetLineColor(4);
474 fRecEtaPtNeg->Draw("same");
475 c10->cd(5);
476 gPad->SetLogy();
477 fRecDcaPos = (TH1F*)cont->FindObject("fRecDcaPos");
478 fRecDcaPos->SetLineColor(2);
479 fRecDcaPos->Draw();
480 fRecDcaNeg = (TH1F*)cont->FindObject("fRecDcaNeg");
481 fRecDcaNeg->SetLineColor(4);
482 fRecDcaNeg->Draw("same");
483 c10->cd(6);
484 gPad->SetLogy();
485 fRecDPos = (TH1F*)cont->FindObject("fRecDPos");
486 fRecDPos->SetLineColor(2);
487 fRecDPos->Draw();
488 fRecDNeg = (TH1F*)cont->FindObject("fRecDNeg");
489 fRecDNeg->SetLineColor(4);
490 fRecDNeg->Draw("same");
491 }
c2174181 492}
493