]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TPC/AliTPCPerformanceSummary.cxx
Summary and trend extraction for TPC with modified AliPerformanceTPC
[u/mrichter/AliRoot.git] / PWG1 / TPC / AliTPCPerformanceSummary.cxx
CommitLineData
b832d719 1//------------------------------------------------------------------------------
2// Implementation of AliTPCPerformanceSummary class.
3// It has only static member functions to extract some TPC Performance
4// parameters and produce trend graphs.
5// The function MakeReport is to be called for every run. It reads AliPerformanceTPC
6// and AliPerformanceDEdx objects from file and produces a
7// rootfile with the results stored in a TTree.
8// The function MakeReport needs a list of these rootfiles as input
9// and writes the output (tree and histograms) to another rootfile.
10//
0cb93e70 11// Author: M.Knichel 2010-08-24
b832d719 12//------------------------------------------------------------------------------
13
14#include <fstream>
15
16#include "TSystem.h"
17#include "TMath.h"
18#include "TVectorD.h"
19#include "TList.h"
20#include "TFile.h"
21#include "TGrid.h"
22#include "TF1.h"
23#include "TH1.h"
24#include "TH2.h"
0cb93e70 25#include "TH3.h"
b832d719 26#include "TProfile.h"
27#include "THnSparse.h"
28#include "TTree.h"
29#include "TChain.h"
30#include "TGraph.h"
31#include "TPad.h"
32#include "TCanvas.h"
33
0cb93e70 34#include "AliGRPObject.h"
35#include "AliTPCcalibDB.h"
36#include "AliTPCcalibDButil.h"
b832d719 37#include "TTreeStream.h"
38#include "AliPerformanceTPC.h"
39#include "AliPerformanceDEdx.h"
40#include "AliPerformanceDCA.h"
41
42#include "AliTPCPerformanceSummary.h"
43
44ClassImp(AliTPCPerformanceSummary)
45
0cb93e70 46Bool_t AliTPCPerformanceSummary::fgForceTHnSparse = kFALSE;
47
48
b832d719 49//_____________________________________________________________________________
50Int_t AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, TTreeSRedirector* pcstream, Int_t run)
51{
0cb93e70 52 //
b832d719 53 // Extracts performance parameters from pTPC and pTPCgain.
54 // Output is written to pcstream.
55 // The run number must be provided since it is not stored in
56 // AliPerformanceTPC or AliPerformanceDEdx.
57 //
0cb93e70 58 AliTPCcalibDB *calibDB=0;
59// AliTPCcalibDButil *dbutil =0;
60 Int_t startTimeGRP=0;
61 Int_t stopTimeGRP=0;
62 Int_t time=0;
63 calibDB = AliTPCcalibDB::Instance();
64// dbutil= new AliTPCcalibDButil;
65
66 printf("Processing run %d ...\n",run);
67 AliTPCcalibDB::Instance()->SetRun(run);
68// dbutil->UpdateFromCalibDB();
69// dbutil->SetReferenceRun(run);
70// dbutil->UpdateRefDataFromOCDB();
71
72 if (calibDB->GetGRP(run)){
73 startTimeGRP = AliTPCcalibDB::GetGRP(run)->GetTimeStart();
74 stopTimeGRP = AliTPCcalibDB::GetGRP(run)->GetTimeEnd();
75 }
76 TObjString runType(AliTPCcalibDB::GetRunType(run).Data());
77
78 time = (startTimeGRP+stopTimeGRP)/2;
b832d719 79
80 if (!pcstream) return -1;
0cb93e70 81 (*pcstream)<<"tpcQA"<<
82 "run="<<run<<
83 "time="<<time<<
84 "startTimeGRP="<<startTimeGRP<<
85 "stopTimeGRP="<<stopTimeGRP<<
86 //run type
87 "runType.="<<&runType;
b832d719 88 Int_t returncode = 0;
0cb93e70 89
90 pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(0.5,1.5);
91 pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0.25,10);
92 pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-1,1);
b832d719 93 returncode += AnalyzeNCL(pTPC, pcstream);
94 returncode += AnalyzeDrift(pTPC, pcstream);
95 returncode += AnalyzeDriftPos(pTPC, pcstream);
96 returncode += AnalyzeDriftNeg(pTPC, pcstream);
97 returncode += AnalyzeGain(pTPCgain, pcstream);
98 returncode += AnalyzeDCARPhi(pTPC, pcstream);
99 returncode += AnalyzeDCARPhiPos(pTPC, pcstream);
100 returncode += AnalyzeDCARPhiNeg(pTPC, pcstream);
101 returncode += AnalyzeEvent(pTPC, pcstream);
0cb93e70 102 pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(-10,10);
103 pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0,100);
104 pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-10,10);
b832d719 105 (*pcstream)<<"tpcQA"<<"\n";
106 return returncode;
0cb93e70 107
b832d719 108}
109
110//_____________________________________________________________________________
111Int_t AliTPCPerformanceSummary::WriteToFile(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, const Char_t* outfile, Int_t run)
112{
113 //
114 // Extracts performance parameters from pTPC and pTPCgain.
115 // Output is written to a TTree saved in outfile.
116 // The run number must be provided since it is not stored in
117 // AliPerformanceTPC or AliPerformanceDEdx.
118 //
119 // The function creates a TTreeSRedirector and calls the
120 // function WriteToTTreeSRedirector.
121 //
122
123 if (!outfile) return -1;
124 TTreeSRedirector* pcstream = 0;
125 pcstream = new TTreeSRedirector(outfile);
126 if (!pcstream) return -1;
127 Int_t returncode = WriteToTTreeSRedirector(pTPC, pTPCgain, pcstream, run);
128 if (pcstream) { delete pcstream; pcstream = 0; }
129 return returncode;
130
131}
132
133//_____________________________________________________________________________
134Int_t AliTPCPerformanceSummary::MakeReport(const Char_t* infile, const Char_t* outfile, Int_t run)
135{
136 //
137 // Reads QA information (AliPerformanceTPC and AliPerformanceDEdx) from
138 // infile (this must be a rootfile) and writes the output to a TTree
139 // stored in outfile.
140 // The run number must be provided since it is not stored in
141 // AliPerformanceTPC or AliPerformanceDEdx.
142 //
143 // The input objects must be named "AliPerformanceTPC" and
144 // "AliPerformanceDEdxTPCInner" and stored in a TList which name must
145 // be one of the following: "TPC", "TPCQA", "TPC_PerformanceQA"
146 // or "TPC_PerformanceQA/TPC" (with directory)
147 //
148
149 if (!infile) return -1;
150 if (!outfile) return -1;
151 TFile *f =0;
152 f=TFile::Open(infile,"read");
153 if (!f) {
154 printf("File %s not available\n", infile);
155 return -1;
156 }
157 TList* list = 0;
158 list = dynamic_cast<TList*>(f->Get("TPC"));
159 if (!list) { list = dynamic_cast<TList*>(f->Get("TPCQA")); }
b832d719 160 if (!list) { list = dynamic_cast<TList*>(f->Get("TPC_PerformanceQA/TPCQA")); }
0cb93e70 161 if (!list) { list = dynamic_cast<TList*>(f->Get("TPC_PerformanceQA")); }
b832d719 162 if (!list) {
163 printf("QA %s not available\n", infile);
164 return -1;
165 }
166 AliPerformanceTPC* pTPC = 0;
167 AliPerformanceDEdx* pTPCgain = 0;
168 if (list) { pTPC = (AliPerformanceTPC*)(list->FindObject("AliPerformanceTPC")); }
169 if (list) { pTPCgain = (AliPerformanceDEdx*)(list->FindObject("AliPerformanceDEdxTPCInner")); }
170
171 Int_t returncode = 0;
172 returncode = WriteToFile(pTPC, pTPCgain, outfile, run);
173 if (f) { delete f; f=0; }
174 return returncode;
175}
176
177//_____________________________________________________________________________
178Int_t AliTPCPerformanceSummary::ProduceTrends(const Char_t* infilelist, const Char_t* outfile)
179{
180 //
181 // Produces trend graphs.
182 //
183 // Input: infilelist is a textfile with one rootfile per line.
184 // There should be one rootfile for each run, the rootfile must
185 // contain the output of the MakeReport function
186 // Output: the information for all runs is merged into a TTree
187 // that is saved in outfile along with the trend graphs.
188 // Trend graphs are stored as TCanvas objects to include axis labels etc.
189 //
190
191 if (!infilelist) return -1;
192 if (!outfile) return -1;
193
194 TChain* chain = new TChain("tpcQA");
195 ifstream in;
196 in.open(infilelist);
197
198 TString currentFile;
199 while(in.good()) {
200 in >> currentFile;
201
202 if (!currentFile.Contains("root")) continue; // protection
203 chain->Add(currentFile.Data());
204 }
205 in.close();
206 //TTree *tree = chain;
207 TTree *tree = chain->CopyTree("1");
208 if (chain) { delete chain; chain=0; }
209 //TGraph* graph = dynamic_cast<TGraph*>(tree->DrawClone("run:run"));
210 //TGraph *graph = (TGraph*)gPad->GetPrimitive("Graph");
211
212 TFile* out = new TFile(outfile,"RECREATE");
213 out->cd();
214 Char_t* condition = "meanTPCncl>0";
215 SaveGraph(tree,"meanTPCnclF","run",condition);
216 SaveGraph(tree,"rmsTPCnclF","run",condition);
217 SaveGraph(tree,"meanTPCChi2","run",condition);
218 SaveGraph(tree,"rmsTPCChi2","run",condition);
219 SaveGraph(tree,"slopeATPCnclF","run",condition);
220 SaveGraph(tree,"slopeCTPCnclF","run",condition);
221 SaveGraph(tree,"slopeATPCnclFErr","run",condition);
222 SaveGraph(tree,"slopeCTPCnclFErr","run",condition);
223 SaveGraph(tree,"meanTPCncl","run",condition);
224 SaveGraph(tree,"rmsTPCncl","run",condition);
225 SaveGraph(tree,"slopeATPCncl","run",condition);
226 SaveGraph(tree,"slopeCTPCncl","run",condition);
227 SaveGraph(tree,"slopeATPCnclErr","run",condition);
228 SaveGraph(tree,"slopeCTPCnclErr","run",condition);
229
230 SaveGraph(tree,"offsetdRA","run",condition);
231 SaveGraph(tree,"slopedRA","run",condition);
232 SaveGraph(tree,"offsetdRC","run",condition);
233 SaveGraph(tree,"slopedRC","run",condition);
234 SaveGraph(tree,"offsetdRAErr","run",condition);
235 SaveGraph(tree,"slopedRAErr","run",condition);
236 SaveGraph(tree,"offsetdRCErr","run",condition);
237 SaveGraph(tree,"slopedRCErr","run",condition);
238 SaveGraph(tree,"offsetdRAchi2","run",condition);
239 SaveGraph(tree,"slopedRAchi2","run",condition);
240 SaveGraph(tree,"offsetdRCchi2","run",condition);
241 SaveGraph(tree,"slopedRCchi2","run",condition);
242
243 SaveGraph(tree,"offsetdRAPos","run",condition);
244
245 SaveGraph(tree,"slopedRAPos","run",condition);
246 SaveGraph(tree,"offsetdRCPos","run",condition);
247 SaveGraph(tree,"slopedRCPos","run",condition);
248 SaveGraph(tree,"offsetdRAErrPos","run",condition);
249 SaveGraph(tree,"slopedRAErrPos","run",condition);
250 SaveGraph(tree,"offsetdRCErrPos","run",condition);
251 SaveGraph(tree,"slopedRCErrPos","run",condition);
252 SaveGraph(tree,"offsetdRAchi2Pos","run",condition);
253 SaveGraph(tree,"slopedRAchi2Pos","run",condition);
254 SaveGraph(tree,"offsetdRCchi2Pos","run",condition);
255 SaveGraph(tree,"slopedRCchi2Pos","run",condition);
256
257 SaveGraph(tree,"offsetdRANeg","run",condition);
258 SaveGraph(tree,"slopedRANeg","run",condition);
259 SaveGraph(tree,"offsetdRCNeg","run",condition);
260 SaveGraph(tree,"slopedRCNeg","run",condition);
261 SaveGraph(tree,"offsetdRAErrNeg","run",condition);
262 SaveGraph(tree,"slopedRAErrNeg","run",condition);
263 SaveGraph(tree,"offsetdRCErrNeg","run",condition);
264 SaveGraph(tree,"slopedRCErrNeg","run",condition);
265 SaveGraph(tree,"offsetdRAchi2Neg","run",condition);
266 SaveGraph(tree,"slopedRAchi2Neg","run",condition);
267 SaveGraph(tree,"offsetdRCchi2Neg","run",condition);
268 SaveGraph(tree,"slopedRCchi2Neg","run",condition);
269
270 SaveGraph(tree,"offsetdZAPos","run",condition);
271 SaveGraph(tree,"slopedZAPos","run",condition);
272 SaveGraph(tree,"offsetdZCPos","run",condition);
273 SaveGraph(tree,"slopedZCPos","run",condition);
274 SaveGraph(tree,"offsetdZAErrPos","run",condition);
275 SaveGraph(tree,"slopedZAErrPos","run",condition);
276 SaveGraph(tree,"offsetdZCErrPos","run",condition);
277 SaveGraph(tree,"slopedZCErrPos","run",condition);
278 SaveGraph(tree,"offsetdZAchi2Pos","run",condition);
279 SaveGraph(tree,"slopedZAchi2Pos","run",condition);
280 SaveGraph(tree,"offsetdZCchi2Pos","run",condition);
281 SaveGraph(tree,"slopedZCchi2Pos","run",condition);
282
283 SaveGraph(tree,"offsetdZANeg","run",condition);
284 SaveGraph(tree,"slopedZANeg","run",condition);
285 SaveGraph(tree,"offsetdZCNeg","run",condition);
286 SaveGraph(tree,"slopedZCNeg","run",condition);
287 SaveGraph(tree,"offsetdZAErrNeg","run",condition);
288 SaveGraph(tree,"slopedZAErrNeg","run",condition);
289 SaveGraph(tree,"offsetdZCErrNeg","run",condition);
290 SaveGraph(tree,"slopedZCErrNeg","run",condition);
291 SaveGraph(tree,"offsetdZAchi2Neg","run",condition);
292 SaveGraph(tree,"slopedZAchi2Neg","run",condition);
293 SaveGraph(tree,"offsetdZCchi2Neg","run",condition);
294 SaveGraph(tree,"slopedZCchi2Neg","run",condition);
295
296 SaveGraph(tree,"offsetdZA","run",condition);
297 SaveGraph(tree,"slopedZA","run",condition);
298 SaveGraph(tree,"offsetdZC","run",condition);
299 SaveGraph(tree,"slopedZC","run",condition);
300 SaveGraph(tree,"offsetdZAErr","run",condition);
301 SaveGraph(tree,"slopedZAErr","run",condition);
302 SaveGraph(tree,"offsetdZCErr","run",condition);
303 SaveGraph(tree,"slopedZCErr","run",condition);
304 SaveGraph(tree,"offsetdZAchi2","run",condition);
305 SaveGraph(tree,"slopedZAchi2","run",condition);
306 SaveGraph(tree,"offsetdZCchi2","run",condition);
307 SaveGraph(tree,"slopedZCchi2","run",condition);
308
309 SaveGraph(tree,"meanVertX","run",condition);
310 SaveGraph(tree,"rmsVertX","run",condition);
311 SaveGraph(tree,"meanVertY","run",condition);
312 SaveGraph(tree,"rmsVertY","run",condition);
313 SaveGraph(tree,"meanVertZ","run",condition);
314 SaveGraph(tree,"rmsVertZ","run",condition);
315 SaveGraph(tree,"vertStatus","run",condition);
316 SaveGraph(tree,"meanMult","run",condition);
317 SaveGraph(tree,"rmsMult","run",condition);
318 SaveGraph(tree,"meanMultPos","run",condition);
319 SaveGraph(tree,"rmsMultPos","run",condition);
320 SaveGraph(tree,"meanMultNeg","run",condition);
321 SaveGraph(tree,"rmsMultNeg","run",condition);
322 SaveGraph(tree,"vertAll","run",condition);
323 SaveGraph(tree,"vertOK","run",condition);
324
325 tree->Write();
326
327 out->Close();
328 if (tree) { delete tree; tree=0; }
329 if (out) { delete out; out=0; }
330return 0;
331}
332
333//_____________________________________________________________________________
334Int_t AliTPCPerformanceSummary::SaveGraph(TTree* tree, const Char_t* y, const Char_t* x, const Char_t* condition)
335{
336 //
337 // Creates a Graph and writes the canvas to the current directory
338 // called by ProduceTrends function.
339 //
340
341 TString s(y);
342 s += ':';
343 s += x;
344 tree->Draw(s.Data(),condition,"goff");
345 TCanvas* c = new TCanvas(s.Data(),s.Data());
346 c->cd();
347 TPad* p = new TPad("pad0","pad0",0,0,1,1);
348 p->Draw();
349 p->cd();
350 if (tree->GetSelectedRows() > 0) {
351 TGraph* graph = new TGraph(tree->GetSelectedRows(), tree->GetV2(), tree->GetV1());
352 graph->Draw("AP");
353 graph->GetXaxis()->SetTitle(x);
354 graph->GetYaxis()->SetTitle(y);
355 c->Write(s.Data());
356 delete graph;
357 }
358 //graph->Write(s.Data());
359 delete c;
360
361return 0;
362}
363
364//_____________________________________________________________________________
365Int_t AliTPCPerformanceSummary::AnalyzeDCARPhi(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
366{
367 //
368 // Analyse DCA R imperfections
369 //
370
371 if (!pcstream) return 8;
372 if (!pTPC) return 8;
373
374 // variables:
375 static Double_t offsetdRA=0;
376 static Double_t slopedRA=0;
377 static Double_t offsetdRC=0;
378 static Double_t slopedRC=0;
379 static Double_t offsetdRAErr=0;
380 static Double_t slopedRAErr=0;
381 static Double_t offsetdRCErr=0;
382 static Double_t slopedRCErr=0;
383 static Double_t offsetdRAchi2=0;
384 static Double_t slopedRAchi2=0;
385 static Double_t offsetdRCchi2=0;
386 static Double_t slopedRCchi2=0;
387
388 //AliPerformanceTPC* pTPC = dynamic_cast<AliPerformanceTPC*>(pTPCObject);
0cb93e70 389
b832d719 390 TH1* his1D=0;
391 TH2* his2D=0;
0cb93e70 392 TH3* his3D=0;
393
394 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_3_5_7")) {
395 his3D = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_3_5_7"));
396 his3D->GetYaxis()->SetRangeUser(-1,1);
397 his3D->GetZaxis()->SetRangeUser(0.25,10);
398 }
399
b832d719 400 static TF1 *fpol1 = new TF1("fpol1","pol1");
401 TObjArray arrayFit;
0cb93e70 402 if (his3D && !fgForceTHnSparse) {
403 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
404 } else {
405 his2D = pTPC->GetTPCTrackHisto()->Projection(3,5);
406 }
407
408
409
b832d719 410 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
411 delete his2D;
412 his1D = (TH1*) arrayFit.At(1);
413 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
414 offsetdRC=fpol1->GetParameter(0);
415 slopedRC=fpol1->GetParameter(1);
416 offsetdRCchi2=fpol1->GetChisquare();
417 slopedRCchi2=fpol1->GetChisquare();
418 //
419 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
420 offsetdRA=fpol1->GetParameter(0);
421 slopedRA=fpol1->GetParameter(1);
422 offsetdRAErr=fpol1->GetParError(0);
423 slopedRAErr=fpol1->GetParError(1);
424 offsetdRAchi2=fpol1->GetChisquare();
425 slopedRAchi2=fpol1->GetChisquare();
426 //
427 printf("DCA R QA report\n");
428 printf("offsetdRA\t%f\n",offsetdRA);
429 printf("slopedRA\t%f\n",slopedRA);
430 printf("offsetdRC\t%f\n",offsetdRC);
431 printf("slopedRC\t%f\n",slopedRC);
432 //
433 // dump values
434 //
435 (*pcstream)<<"tpcQA"<<
436 "offsetdRA="<< offsetdRA<<
437 "slopedRA="<< slopedRA<<
438 "offsetdRC="<< offsetdRC<<
439 "slopedRC="<<slopedRC<<
440 //
441 "offsetdRAErr="<< offsetdRAErr<<
442 "slopedRAErr="<< slopedRAErr<<
443 "offsetdRCErr="<< offsetdRCErr<<
444 "slopedRCErr="<<slopedRCErr<<
445 //
446 "offsetdRAchi2="<< offsetdRAchi2<<
447 "slopedRAchi2="<< slopedRAchi2<<
448 "offsetdRCchi2="<< offsetdRCchi2<<
449 "slopedRCchi2="<<slopedRCchi2;
450
451 return 0;
452}
453
454//_____________________________________________________________________________
455Int_t AliTPCPerformanceSummary::AnalyzeDCARPhiPos(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
456{
457 //
458 // Analyse DCA R imperfections for positive particles
459 //
460
461 if (!pcstream) return 16;
462 if (!pTPC) return 16;
463
464 // variables:
465 static Double_t offsetdRAPos=0;
466 static Double_t slopedRAPos=0;
467 static Double_t offsetdRCPos=0;
468 static Double_t slopedRCPos=0;
469 static Double_t offsetdRAErrPos=0;
470 static Double_t slopedRAErrPos=0;
471 static Double_t offsetdRCErrPos=0;
472 static Double_t slopedRCErrPos=0;
473 static Double_t offsetdRAchi2Pos=0;
474 static Double_t slopedRAchi2Pos=0;
475 static Double_t offsetdRCchi2Pos=0;
476 static Double_t slopedRCchi2Pos=0;
477
478 //AliPerformanceTPC* pTPC = dynamic_cast<AliPerformanceTPC*>(pTPCObject);
479 TH1* his1D=0;
480 TH2* his2D=0;
0cb93e70 481 TH3* his3D=0;
482
483 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_7")) {
484 his3D = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_7"));
485 his3D->GetYaxis()->SetRangeUser(-1,1);
486 his3D->GetZaxis()->SetRangeUser(0.25,10);
487 }
488
b832d719 489 static TF1 *fpol1 = new TF1("fpol1","pol1");
490 TObjArray arrayFit;
0cb93e70 491 if (his3D && !fgForceTHnSparse) {
492 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
493 } else {
494 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(0,10);
495 his2D = pTPC->GetTPCTrackHisto()->Projection(3,5);
496 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-10,10);
497 }
498
b832d719 499 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
0cb93e70 500 delete his2D;
b832d719 501 his1D = (TH1*) arrayFit.At(1);
502 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
503 offsetdRCPos=fpol1->GetParameter(0);
504 slopedRCPos=fpol1->GetParameter(1);
505 offsetdRCchi2Pos=fpol1->GetChisquare();
506 slopedRCchi2Pos=fpol1->GetChisquare();
507 //
508 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
509 offsetdRAPos=fpol1->GetParameter(0);
510 slopedRAPos=fpol1->GetParameter(1);
511 offsetdRAErrPos=fpol1->GetParError(0);
512 slopedRAErrPos=fpol1->GetParError(1);
513 offsetdRAchi2Pos=fpol1->GetChisquare();
514 slopedRAchi2Pos=fpol1->GetChisquare();
515 //
516 printf("DCA R QA Pos report\n");
517 printf("offsetdRAPos\t%f\n",offsetdRAPos);
518 printf("slopedRAPos\t%f\n",slopedRAPos);
519 printf("offsetdRCPos\t%f\n",offsetdRCPos);
520 printf("slopedRCPos\t%f\n",slopedRCPos);
521 //
522 // dump values
523 //
524 (*pcstream)<<"tpcQA"<<
525 "offsetdRAPos="<< offsetdRAPos<<
526 "slopedRAPos="<< slopedRAPos<<
527 "offsetdRCPos="<< offsetdRCPos<<
528 "slopedRCPos="<<slopedRCPos<<
529 //
530 "offsetdRAErrPos="<< offsetdRAErrPos<<
531 "slopedRAErrPos="<< slopedRAErrPos<<
532 "offsetdRCErrPos="<< offsetdRCErrPos<<
533 "slopedRCErrPos="<<slopedRCErrPos<<
534 //
535 "offsetdRAchi2Pos="<< offsetdRAchi2Pos<<
536 "slopedRAchi2Pos="<< slopedRAchi2Pos<<
537 "offsetdRCchi2Pos="<< offsetdRCchi2Pos<<
538 "slopedRCchi2Pos="<<slopedRCchi2Pos;
539
540 return 0;
541}
542
543//_____________________________________________________________________________
544Int_t AliTPCPerformanceSummary::AnalyzeDCARPhiNeg(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
545{
546 //
547 // Analyse DCA R imperfections for negative particles
548 //
549 if (!pcstream) return 32;
550 if (!pTPC) return 32;
551
552 // variables:
553 static Double_t offsetdRANeg=0;
554 static Double_t slopedRANeg=0;
555 static Double_t offsetdRCNeg=0;
556 static Double_t slopedRCNeg=0;
557 static Double_t offsetdRAErrNeg=0;
558 static Double_t slopedRAErrNeg=0;
559 static Double_t offsetdRCErrNeg=0;
560 static Double_t slopedRCErrNeg=0;
561 static Double_t offsetdRAchi2Neg=0;
562 static Double_t slopedRAchi2Neg=0;
563 static Double_t offsetdRCchi2Neg=0;
564 static Double_t slopedRCchi2Neg=0;
565
566 //AliPerformanceTPC* pTPC = dynamic_cast<AliPerformanceTPC*>(pTPCObject);
567 TH1* his1D=0;
568 TH2* his2D=0;
0cb93e70 569 TH3* his3D=0;
570
571 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_7")) {
572 his3D = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_7"));
573 his3D->GetYaxis()->SetRangeUser(-1,1);
574 his3D->GetZaxis()->SetRangeUser(0.25,10);
575 }
576
b832d719 577 static TF1 *fpol1 = new TF1("fpol1","pol1");
578 TObjArray arrayFit;
0cb93e70 579 if (his3D && !fgForceTHnSparse) {
580 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
581 } else {
582 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-10,0);
583 his2D = pTPC->GetTPCTrackHisto()->Projection(3,5);
584 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-10,10);
585 }
b832d719 586 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
0cb93e70 587 delete his2D;
b832d719 588 his1D = (TH1*) arrayFit.At(1);
589 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
590 offsetdRCNeg=fpol1->GetParameter(0);
591 slopedRCNeg=fpol1->GetParameter(1);
592 offsetdRCchi2Neg=fpol1->GetChisquare();
593 slopedRCchi2Neg=fpol1->GetChisquare();
594 //
595 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
596 offsetdRANeg=fpol1->GetParameter(0);
597 slopedRANeg=fpol1->GetParameter(1);
598 offsetdRAErrNeg=fpol1->GetParError(0);
599 slopedRAErrNeg=fpol1->GetParError(1);
600 offsetdRAchi2Neg=fpol1->GetChisquare();
601 slopedRAchi2Neg=fpol1->GetChisquare();
602 //
603 printf("DCA R QA Neg report\n");
604 printf("offsetdRANeg\t%f\n",offsetdRANeg);
605 printf("slopedRANeg\t%f\n",slopedRANeg);
606 printf("offsetdRCNeg\t%f\n",offsetdRCNeg);
607 printf("slopedRCNeg\t%f\n",slopedRCNeg);
608 //
609 // dump drift QA values
610 //
611 (*pcstream)<<"tpcQA"<<
612 "offsetdRANeg="<< offsetdRANeg<<
613 "slopedRANeg="<< slopedRANeg<<
614 "offsetdRCNeg="<< offsetdRCNeg<<
615 "slopedRCNeg="<<slopedRCNeg<<
616 //
617 "offsetdRAErrNeg="<< offsetdRAErrNeg<<
618 "slopedRAErrNeg="<< slopedRAErrNeg<<
619 "offsetdRCErrNeg="<< offsetdRCErrNeg<<
620 "slopedRCErrNeg="<<slopedRCErrNeg<<
621 //
622 "offsetdRAchi2Neg="<< offsetdRAchi2Neg<<
623 "slopedRAchi2Neg="<< slopedRAchi2Neg<<
624 "offsetdRCchi2Neg="<< offsetdRCchi2Neg<<
625 "slopedRCchi2Neg="<<slopedRCchi2Neg;
626
627 return 0;
628}
629
630//_____________________________________________________________________________
631Int_t AliTPCPerformanceSummary::AnalyzeNCL(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
632{
633 //
634 // Analyse number of TPC clusters
635 //
636
637 if (!pcstream) return 1;
638 if (!pTPC) return 1;
639
640 // variables:
641 static Double_t meanTPCnclF=0;
642 static Double_t rmsTPCnclF=0;
643 static Double_t meanTPCChi2=0;
644 static Double_t rmsTPCChi2=0;
645 static Double_t slopeATPCnclF=0;
646 static Double_t slopeCTPCnclF=0;
647 static Double_t slopeATPCnclFErr=0;
648 static Double_t slopeCTPCnclFErr=0;
649 static Double_t meanTPCncl=0;
650 static Double_t rmsTPCncl=0;
651 static Double_t slopeATPCncl=0;
652 static Double_t slopeCTPCncl=0;
653 static Double_t slopeATPCnclErr=0;
654 static Double_t slopeCTPCnclErr=0;
655 TH1* his1D=0;
0cb93e70 656 //TH2* his2D=0;
657 TH3* his3D_0=0;
658 TH3* his3D_1=0;
659 TH3* his3D_2=0;
b832d719 660 TProfile* hprof=0;
661 static TF1 *fpol1 = new TF1("fpol1","pol1");
662 //
663 // all clusters
0cb93e70 664 // only events with rec. vertex
b832d719 665 // eta cut - +-1
0cb93e70 666 // pt cut - 0.250 GeV
b832d719 667 pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-1.,1.);
668 pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0.25,10);
0cb93e70 669
670 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_0_5_7")) {
671 his3D_0 = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_0_5_7"));
672 his3D_0->GetYaxis()->SetRangeUser(-1,1);
673 his3D_0->GetZaxis()->SetRangeUser(0.25,10);
674 }
675 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_1_5_7")) {
676 his3D_1 = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_1_5_7"));
677 his3D_1->GetYaxis()->SetRangeUser(-1,1);
678 his3D_1->GetZaxis()->SetRangeUser(0.25,10);
679 }
680 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_2_5_7")) {
681 his3D_2 = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_2_5_7"));
682 his3D_2->GetYaxis()->SetRangeUser(-1,1);
683 his3D_2->GetZaxis()->SetRangeUser(0.25,10);
684 his3D_2->GetXaxis()->SetRangeUser(0.4,1.1);
685 }
686
687
688 if (his3D_0 && !fgForceTHnSparse) {
689 his1D = his3D_0->Project3D("x");
690 } else {
691 his1D = pTPC->GetTPCTrackHisto()->Projection(0);
692 }
693
b832d719 694 meanTPCncl= his1D->GetMean();
695 rmsTPCncl= his1D->GetRMS();
696 delete his1D;
0cb93e70 697
698 if (his3D_1 && !fgForceTHnSparse) {
699 his1D = his3D_1->Project3D("x");
700 } else {
701 his1D = pTPC->GetTPCTrackHisto()->Projection(1);
702 }
703
b832d719 704 meanTPCChi2= his1D->GetMean();
705 rmsTPCChi2= his1D->GetRMS();
706 delete his1D;
0cb93e70 707
708 if (his3D_0 && !fgForceTHnSparse) {
709 hprof = (dynamic_cast<TH2*>(his3D_0->Project3D("xy")))->ProfileX();
710 } else {
711 hprof = pTPC->GetTPCTrackHisto()->Projection(0,5)->ProfileX();
712 }
713
714 hprof->Fit(fpol1,"QNR","QNR",0.1,0.8);
b832d719 715 slopeATPCncl= fpol1->GetParameter(1);
716 slopeATPCnclErr= fpol1->GetParError(1);
0cb93e70 717 hprof->Fit(fpol1,"QNR","QNR",-0.8,-0.1);
b832d719 718 slopeCTPCncl= fpol1->GetParameter(1);
719 slopeCTPCnclErr= fpol1->GetParameter(1);
720 delete hprof;
0cb93e70 721
b832d719 722 //
723 // findable clusters
724 //
0cb93e70 725
726 if (his3D_2 && !fgForceTHnSparse) {
727 his1D = his3D_2->Project3D("x");
728 } else {
729 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
730 his1D = pTPC->GetTPCTrackHisto()->Projection(2);
731 }
732
b832d719 733 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
734 his1D = pTPC->GetTPCTrackHisto()->Projection(2);
735 meanTPCnclF= his1D->GetMean();
736 rmsTPCnclF= his1D->GetRMS();
737 delete his1D;
0cb93e70 738
739 if (his3D_2 && !fgForceTHnSparse) {
740 his1D = (dynamic_cast<TH2*>(his3D_2->Project3D("xy")))->ProfileX();
741 } else {
742 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
743 his1D = pTPC->GetTPCTrackHisto()->Projection(2,5)->ProfileX();
744 }
745
746 his1D->Fit(fpol1,"QNR","QNR",0.1,0.8);
b832d719 747 slopeATPCnclF= fpol1->GetParameter(1);
748 slopeATPCnclFErr= fpol1->GetParError(1);
0cb93e70 749 his1D->Fit(fpol1,"QNR","QNR",-0.8,-0.1);
b832d719 750 slopeCTPCnclF= fpol1->GetParameter(1);
751 slopeCTPCnclFErr= fpol1->GetParameter(1);
752 delete his1D;
0cb93e70 753
754 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0,10);
755
b832d719 756 printf("Cluster QA report\n");
757 printf("meanTPCnclF=\t%f\n",meanTPCnclF);
758 printf("rmsTPCnclF=\t%f\n",rmsTPCnclF);
759 printf("slopeATPCnclF=\t%f\n",slopeATPCnclF);
760 printf("slopeCTPCnclF=\t%f\n",slopeCTPCnclF);
761 printf("meanTPCncl=\t%f\n",meanTPCncl);
762 printf("rmsTPCncl=\t%f\n",rmsTPCncl);
763 printf("slopeATPCncl=\t%f\n",slopeATPCncl);
764 printf("slopeCTPCncl=\t%f\n",slopeCTPCncl);
765 printf("meanTPCChi2=\t%f\n",meanTPCChi2);
766 printf("rmsTPCChi2=\t%f\n",rmsTPCChi2);
767 //
768 // dump results to the tree
769 //
770 (*pcstream)<<"tpcQA"<<
771 "meanTPCnclF="<<meanTPCnclF <<
772 "rmsTPCnclF="<<rmsTPCnclF <<
773 "meanTPCChi2="<<meanTPCChi2 <<
774 "rmsTPCChi2="<<rmsTPCChi2 <<
775 "slopeATPCnclF="<< slopeATPCnclF<<
776 "slopeCTPCnclF="<< slopeCTPCnclF<<
777 "slopeATPCnclFErr="<< slopeATPCnclFErr<<
778 "slopeCTPCnclFErr="<< slopeCTPCnclFErr<<
779 "meanTPCncl="<<meanTPCncl <<
780 "rmsTPCncl="<< rmsTPCncl<<
781 "slopeATPCncl="<< slopeATPCncl<<
782 "slopeCTPCncl="<< slopeCTPCncl<<
783 "slopeATPCnclErr="<< slopeATPCnclErr<<
784 "slopeCTPCnclErr="<< slopeCTPCnclErr;
785
786 return 0;
787}
788
789//_____________________________________________________________________________
790Int_t AliTPCPerformanceSummary::AnalyzeDrift(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
791{
792 //
793 // Analyse DCA Z imperferctions (drift velocity)
794 //
795
796 if (!pcstream) return 2;
797 if (!pTPC) return 2;
798
799 // variables:
800 static Double_t offsetdZA=0;
801 static Double_t slopedZA=0;
802 static Double_t offsetdZC=0;
803 static Double_t slopedZC=0;
804 static Double_t offsetdZAErr=0;
805 static Double_t slopedZAErr=0;
806 static Double_t offsetdZCErr=0;
807 static Double_t slopedZCErr=0;
808 static Double_t offsetdZAchi2=0;
809 static Double_t slopedZAchi2=0;
810 static Double_t offsetdZCchi2=0;
811 static Double_t slopedZCchi2=0;
812 TH1* his1D=0;
813 TH2* his2D=0;
0cb93e70 814 TH3* his3D=0;
815
816 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_4_5_7")) {
817 his3D = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_all_recvertex_4_5_7"));
818 his3D->GetYaxis()->SetRangeUser(-1,1);
819 his3D->GetZaxis()->SetRangeUser(0.25,10);
820 }
821 if (his3D && !fgForceTHnSparse) {
822 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
823 } else {
824 his2D = pTPC->GetTPCTrackHisto()->Projection(4,5);
825 }
826
b832d719 827 static TF1 *fpol1 = new TF1("fpol1","pol1");
828 TObjArray arrayFit;
b832d719 829 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
830 delete his2D;
831 his1D = (TH1*) arrayFit.At(1);
832 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
833 offsetdZC=fpol1->GetParameter(0);
834 slopedZC=fpol1->GetParameter(1);
835 offsetdZCErr=fpol1->GetParError(0);
836 slopedZCErr=fpol1->GetParError(1);
837 offsetdZCchi2=fpol1->GetChisquare();
838 slopedZCchi2=fpol1->GetChisquare();
839 //
840 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
841 offsetdZA=fpol1->GetParameter(0);
842 slopedZA=fpol1->GetParameter(1);
843 offsetdZAErr=fpol1->GetParError(0);
844 slopedZAErr=fpol1->GetParError(1);
845 offsetdZAchi2=fpol1->GetChisquare();
846 slopedZAchi2=fpol1->GetChisquare();
847 //
848 printf("Drift velocity QA report\n");
849 printf("offsetdZA\t%f\n",offsetdZA);
850 printf("slopedZA\t%f\n",slopedZA);
851 printf("offsetdZC\t%f\n",offsetdZC);
852 printf("slopedZC\t%f\n",slopedZC);
853 //
854 // dump drift QA values
855 //
856 (*pcstream)<<"tpcQA"<<
857 "offsetdZA="<< offsetdZA<<
858 "slopedZA="<< slopedZA<<
859 "offsetdZC="<< offsetdZC<<
860 "slopedZC="<<slopedZC<<
861 //
862 "offsetdZAErr="<< offsetdZAErr<<
863 "slopedZAErr="<< slopedZAErr<<
864 "offsetdZCErr="<< offsetdZCErr<<
865 "slopedZCErr="<<slopedZCErr<<
866 //
867 "offsetdZAchi2="<< offsetdZAchi2<<
868 "slopedZAchi2="<< slopedZAchi2<<
869 "offsetdZCchi2="<< offsetdZCchi2<<
870 "slopedZCchi2="<<slopedZCchi2;
871
872 return 0;
873}
874
875//_____________________________________________________________________________
876Int_t AliTPCPerformanceSummary::AnalyzeDriftPos(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
877{
878 //
879 // Analyse DCA Z imperferctions (drift velocity)
880 // for positive particles
881 //
882 if (!pcstream) return 64;
883 if (!pTPC) return 64;
884
885 // variables:
886 static Double_t offsetdZAPos=0;
887 static Double_t slopedZAPos=0;
888 static Double_t offsetdZCPos=0;
889 static Double_t slopedZCPos=0;
890 static Double_t offsetdZAErrPos=0;
891 static Double_t slopedZAErrPos=0;
892 static Double_t offsetdZCErrPos=0;
893 static Double_t slopedZCErrPos=0;
894 static Double_t offsetdZAchi2Pos=0;
895 static Double_t slopedZAchi2Pos=0;
896 static Double_t offsetdZCchi2Pos=0;
897 static Double_t slopedZCchi2Pos=0;
898 TH1* his1D=0;
899 TH2* his2D=0;
0cb93e70 900 TH3* his3D=0;
901
902 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(0,10);
903
904 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_pos_recvertex_4_5_7")) {
905 his3D = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_pos_recvertex_4_5_7"));
906 his3D->GetYaxis()->SetRangeUser(-1,1);
907 his3D->GetZaxis()->SetRangeUser(0.25,10);
908 }
909 if (his3D && !fgForceTHnSparse) {
910 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
911 } else {
912 his2D = pTPC->GetTPCTrackHisto()->Projection(4,5);
913 }
914
b832d719 915 static TF1 *fpol1 = new TF1("fpol1","pol1");
916 TObjArray arrayFit;
b832d719 917 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
918 delete his2D;
919 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-10,10);
0cb93e70 920
b832d719 921 his1D = (TH1*) arrayFit.At(1);
922 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
923 offsetdZCPos=fpol1->GetParameter(0);
924 slopedZCPos=fpol1->GetParameter(1);
925 offsetdZCErrPos=fpol1->GetParError(0);
926 slopedZCErrPos=fpol1->GetParError(1);
927 offsetdZCchi2Pos=fpol1->GetChisquare();
928 slopedZCchi2Pos=fpol1->GetChisquare();
929 //
930 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
931 offsetdZAPos=fpol1->GetParameter(0);
932 slopedZAPos=fpol1->GetParameter(1);
933 offsetdZAErrPos=fpol1->GetParError(0);
934 slopedZAErrPos=fpol1->GetParError(1);
935 offsetdZAchi2Pos=fpol1->GetChisquare();
936 slopedZAchi2Pos=fpol1->GetChisquare();
937 //
938 printf("Drift velocity QA report\n");
939 printf("offsetdZAPos\t%f\n",offsetdZAPos);
940 printf("slopedZAPos\t%f\n",slopedZAPos);
941 printf("offsetdZCPos\t%f\n",offsetdZCPos);
942 printf("slopedZCPos\t%f\n",slopedZCPos);
943 //
944 // dump drift QA values
945 //
946 (*pcstream)<<"tpcQA"<<
947 "offsetdZAPos="<< offsetdZAPos<<
948 "slopedZAPos="<< slopedZAPos<<
949 "offsetdZCPos="<< offsetdZCPos<<
950 "slopedZCPos="<<slopedZCPos<<
951 //
952 "offsetdZAErrPos="<< offsetdZAErrPos<<
953 "slopedZAErrPos="<< slopedZAErrPos<<
954 "offsetdZCErrPos="<< offsetdZCErrPos<<
955 "slopedZCErrPos="<<slopedZCErrPos<<
956 //
957 "offsetdZAchi2Pos="<< offsetdZAchi2Pos<<
958 "slopedZAchi2Pos="<< slopedZAchi2Pos<<
959 "offsetdZCchi2Pos="<< offsetdZCchi2Pos<<
960 "slopedZCchi2Pos="<<slopedZCchi2Pos;
961
962 return 0;
963}
964
965//_____________________________________________________________________________
966Int_t AliTPCPerformanceSummary::AnalyzeDriftNeg(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
967{
968 //
969 // Analyse DCA Z imperferctions (drift velocity)
970 // for negative particles
971 //
972 if (!pcstream) return 128;
973 if (!pTPC) return 128;
974
975 // variables:
976 static Double_t offsetdZANeg=0;
977 static Double_t slopedZANeg=0;
978 static Double_t offsetdZCNeg=0;
979 static Double_t slopedZCNeg=0;
980 static Double_t offsetdZAErrNeg=0;
981 static Double_t slopedZAErrNeg=0;
982 static Double_t offsetdZCErrNeg=0;
983 static Double_t slopedZCErrNeg=0;
984 static Double_t offsetdZAchi2Neg=0;
985 static Double_t slopedZAchi2Neg=0;
986 static Double_t offsetdZCchi2Neg=0;
987 static Double_t slopedZCchi2Neg=0;
988 TH1* his1D=0;
989 TH2* his2D=0;
0cb93e70 990 TH3* his3D=0;
991
992 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-10,0);
993
994 if (pTPC->GetTPCHistos()->FindObject("h_tpc_track_neg_recvertex_4_5_7")) {
995 his3D = dynamic_cast<TH3*>(pTPC->GetTPCHistos()->FindObject("h_tpc_track_neg_recvertex_4_5_7"));
996 his3D->GetYaxis()->SetRangeUser(-1,1);
997 his3D->GetZaxis()->SetRangeUser(0.25,10);
998 }
999 if (his3D && !fgForceTHnSparse) {
1000 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
1001 } else {
1002 his2D = pTPC->GetTPCTrackHisto()->Projection(4,5);
1003 }
1004
b832d719 1005 static TF1 *fpol1 = new TF1("fpol1","pol1");
1006 TObjArray arrayFit;
b832d719 1007 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
1008 delete his2D;
0cb93e70 1009
b832d719 1010 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-10,10);
1011 his1D = (TH1*) arrayFit.At(1);
1012 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
1013 offsetdZCNeg=fpol1->GetParameter(0);
1014 slopedZCNeg=fpol1->GetParameter(1);
1015 offsetdZCErrNeg=fpol1->GetParError(0);
1016 slopedZCErrNeg=fpol1->GetParError(1);
1017 offsetdZCchi2Neg=fpol1->GetChisquare();
1018 slopedZCchi2Neg=fpol1->GetChisquare();
1019 //
1020 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
1021 offsetdZANeg=fpol1->GetParameter(0);
1022 slopedZANeg=fpol1->GetParameter(1);
1023 offsetdZAErrNeg=fpol1->GetParError(0);
1024 slopedZAErrNeg=fpol1->GetParError(1);
1025 offsetdZAchi2Neg=fpol1->GetChisquare();
1026 slopedZAchi2Neg=fpol1->GetChisquare();
1027 //
1028 printf("Drift velocity QA report\n");
1029 printf("offsetdZANeg\t%f\n",offsetdZANeg);
1030 printf("slopedZANeg\t%f\n",slopedZANeg);
1031 printf("offsetdZCNeg\t%f\n",offsetdZCNeg);
1032 printf("slopedZCNeg\t%f\n",slopedZCNeg);
1033 //
1034 // dump drift QA values
1035 //
1036 (*pcstream)<<"tpcQA"<<
1037 "offsetdZANeg="<< offsetdZANeg<<
1038 "slopedZANeg="<< slopedZANeg<<
1039 "offsetdZCNeg="<< offsetdZCNeg<<
1040 "slopedZCNeg="<<slopedZCNeg<<
1041 //
1042 "offsetdZAErrNeg="<< offsetdZAErrNeg<<
1043 "slopedZAErrNeg="<< slopedZAErrNeg<<
1044 "offsetdZCErrNeg="<< offsetdZCErrNeg<<
1045 "slopedZCErrNeg="<<slopedZCErrNeg<<
1046 //
1047 "offsetdZAchi2Neg="<< offsetdZAchi2Neg<<
1048 "slopedZAchi2Neg="<< slopedZAchi2Neg<<
1049 "offsetdZCchi2Neg="<< offsetdZCchi2Neg<<
1050 "slopedZCchi2Neg="<<slopedZCchi2Neg;
1051
1052 return 0;
1053}
1054
1055//_____________________________________________________________________________
1056Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain, TTreeSRedirector* pcstream)
1057{
1058 //
1059 // Analyse Gain
1060 //
1061
1062 if (!pcstream) return 4;
1063 if (!pTPCgain) return 4;
1064
1065 static TVectorD meanMIPvsSector(36);
1066 static TVectorD sector(36);
1067 static Float_t meanMIP = 0;
1068 static Float_t resolutionMIP = 0;
1069 static Float_t attachSlopeC = 0;
1070 static Float_t attachSlopeA = 0;
1071
69878f59 1072 TH1 * his1D = 0;
1073
b832d719 1074 meanMIPvsSector.Zero();
1075 //
1076 // select MIP particles
1077 //
1078 pTPCgain->GetDeDxHisto()->GetAxis(7)->SetRangeUser(0.4,0.55);
1079 pTPCgain->GetDeDxHisto()->GetAxis(0)->SetRangeUser(35,60);
1080 pTPCgain->GetDeDxHisto()->GetAxis(6)->SetRangeUser(80,160);
1081 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1);
1082 //
1083 // MIP position and resolution
1084 //
1085 TF1 gausFit("gausFit","gaus");
1086 TH1 * hisProj1D = pTPCgain->GetDeDxHisto()->Projection(0);
1087 hisProj1D->Fit(&gausFit,"QN","QN");
1088 delete hisProj1D;
1089 meanMIP = gausFit.GetParameter(1);
1090 resolutionMIP = 0;
1091 if (meanMIP!=0) resolutionMIP = gausFit.GetParameter(2)/meanMIP;
1092 //
1093 // MIP position vs. dip angle (attachment)
1094 //
1095 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0);
1096 TH2* his2D = pTPCgain->GetDeDxHisto()->Projection(0,5);
1097 TF1 * fpol = new TF1("fpol","pol1");
1098 TObjArray arrayFit;
1099 his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);
1100 delete his2D;
69878f59 1101 his1D = (TH1*) arrayFit.At(1);
b832d719 1102 his1D->Fit(fpol,"QNROB=0.8","QNR",-1,0);
1103 attachSlopeC = fpol->GetParameter(1);
1104 //
1105 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3);
1106 TH2* his2DA = pTPCgain->GetDeDxHisto()->Projection(0,5);
1107 TF1 * fpolA = new TF1("fpolA","pol1");
1108 TObjArray arrayFitA;
1109 his2DA->FitSlicesY(0,0,-1,10,"QN",&arrayFit);
1110 delete his2DA;
1111 TH1 * his1DA = (TH1*) arrayFit.At(1);
1112 his1DA->Fit(fpolA,"QNROB=0.8","QN",0,1);
1113 attachSlopeA = fpolA->GetParameter(1);
1114 //
1115 // MIP position vs. sector
1116 //
1117 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0); // C side
1118 for(Int_t i = 0; i < 18; i++) { // loop over sectors; correct mapping to be checked!
0285b6f5 1119 //TH1* his1D=0;
b832d719 1120 Float_t phiLow = -TMath::Pi() + i*(20./360.)*(2*TMath::Pi());
1121 Float_t phiUp = -TMath::Pi() + (i+1)*(20./360.)*(2*TMath::Pi());
1122 pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
1123 his1D = pTPCgain->GetDeDxHisto()->Projection(0);
1124 TF1 gausFunc("gausFunc","gaus");
1125 his1D->Fit(&gausFunc, "QN");
1126 meanMIPvsSector(i) = gausFunc.GetParameter(1);
1127 sector(i)=i;
1128 delete his1D;
1129 }
1130 //
1131 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3); // A side
1132 for(Int_t i = 0; i < 18; i++) { // loop over sectors; correct mapping to be checked!
69878f59 1133 //TH1* his1D=0;
b832d719 1134 Float_t phiLow = -TMath::Pi() + i*(20./360.)*(2*TMath::Pi());
1135 Float_t phiUp = -TMath::Pi() + (i+1)*(20./360.)*(2*TMath::Pi());
1136 pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
1137 his1D = pTPCgain->GetDeDxHisto()->Projection(0);
1138 TF1 gausFunc("gausFunc","gaus");
1139 his1D->Fit(&gausFunc, "QN");
1140 meanMIPvsSector(i+18) = gausFunc.GetParameter(1);
1141 sector(i+18)=i+18;
1142 delete his1D;
1143 }
1144 //
1145 printf("Gain QA report\n");
1146 printf("MIP mean\t%f\n",meanMIP);
1147 printf("MIP resolution\t%f\n",resolutionMIP);
1148 printf("MIPslopeA\t%f\n",attachSlopeA);
1149 printf("MIPslopeC\t%f\n",attachSlopeC);
1150 //
1151 (*pcstream)<<"tpcQA"<<
1152 "MIPattachSlopeC="<<attachSlopeC<<
1153 "MIPattachSlopeA="<<attachSlopeA<<
1154 "resolutionMIP="<<resolutionMIP<<
1155 "meanMIPvsSector.="<<&meanMIPvsSector<<
1156 "sector.="<<&sector<<
1157 "meanMIP="<<meanMIP;
1158
1159 return 0;
1160}
1161
1162//_____________________________________________________________________________
1163Int_t AliTPCPerformanceSummary::AnalyzeEvent(const AliPerformanceTPC* pTPC, TTreeSRedirector* pcstream)
1164{
1165 //
1166 // Analyse Primary Vertex Distribution and Multiplicities
1167 //
1168 if (!pcstream) return 1;
1169 if (!pTPC) return 1;
1170 //
1171 //
1172 //
1173 static Double_t meanVertX=0;
1174 static Double_t rmsVertX=0;
1175 static Double_t meanVertY=0;
1176 static Double_t rmsVertY=0;
1177 static Double_t meanVertZ=0;
1178 static Double_t rmsVertZ=0;
1179 static Double_t vertStatus=0;
1180 static Double_t meanMult=0;
1181 static Double_t rmsMult=0;
1182 static Double_t meanMultPos=0;
1183 static Double_t rmsMultPos=0;
1184 static Double_t meanMultNeg=0;
1185 static Double_t rmsMultNeg=0;
1186 static Double_t vertAll = 0;
1187 static Double_t vertOK = 0;
1188
1189 TH1* his1D=0;
0cb93e70 1190 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_6") && !fgForceTHnSparse) {
1191 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_6")->Clone());
1192 } else {
1193 his1D = pTPC->GetTPCEventHisto()->Projection(6);
1194 }
b832d719 1195 vertAll = his1D->GetEntries();
0cb93e70 1196 vertOK = his1D->GetBinContent(2);
b832d719 1197 if (vertAll>=1) {
1198 vertStatus = vertOK / vertAll;
1199 }
0cb93e70 1200
1201 delete his1D;
1202
1203 pTPC->GetTPCEventHisto()->GetAxis(6)->SetRange(2,2);
1204
1205 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_0") && !fgForceTHnSparse) {
1206 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_0")->Clone());
1207 } else {
1208 his1D = pTPC->GetTPCEventHisto()->Projection(0);
1209 }
b832d719 1210 meanVertX = his1D->GetMean();
1211 rmsVertX = his1D->GetRMS();
1212 delete his1D;
1213
0cb93e70 1214
1215
1216
1217 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_1") && !fgForceTHnSparse) {
1218 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_1")->Clone());
1219 } else {
1220 his1D = pTPC->GetTPCEventHisto()->Projection(1);
1221 }
b832d719 1222 meanVertY = his1D->GetMean();
1223 rmsVertY = his1D->GetRMS();
1224 delete his1D;
1225
0cb93e70 1226
1227 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_2") && !fgForceTHnSparse) {
1228 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_2")->Clone());
1229 } else {
1230 his1D = pTPC->GetTPCEventHisto()->Projection(2);
1231 } meanVertZ = his1D->GetMean();
b832d719 1232 rmsVertZ = his1D->GetRMS();
1233 delete his1D;
1234
0cb93e70 1235
1236 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_3") && !fgForceTHnSparse) {
1237 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_3")->Clone());
1238 } else {
1239 his1D = pTPC->GetTPCEventHisto()->Projection(3);
1240 }
b832d719 1241 meanMult = his1D->GetMean();
1242 rmsMult = his1D->GetRMS();
1243 delete his1D;
1244
0cb93e70 1245
1246 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_4") && !fgForceTHnSparse) {
1247 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_4")->Clone());
1248 } else {
1249 his1D = pTPC->GetTPCEventHisto()->Projection(4);
1250 }
b832d719 1251 meanMultPos = his1D->GetMean();
1252 rmsMultPos = his1D->GetRMS();
1253 delete his1D;
1254
0cb93e70 1255 if (pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_5") && !fgForceTHnSparse) {
1256 his1D = dynamic_cast<TH1*>(pTPC->GetTPCHistos()->FindObject("h_tpc_event_recvertex_5")->Clone());
1257 } else {
1258 his1D = pTPC->GetTPCEventHisto()->Projection(5);
1259 }
b832d719 1260 meanMultNeg = his1D->GetMean();
1261 rmsMultNeg = his1D->GetRMS();
1262 delete his1D;
1263
0cb93e70 1264 pTPC->GetTPCEventHisto()->GetAxis(6)->SetRange(1,2);
b832d719 1265 //
1266 (*pcstream)<<"tpcQA"<<
1267 "meanVertX="<<meanVertX<<
1268 "rmsVertX="<<rmsVertX<<
1269 "meanVertY="<<meanVertY<<
1270 "rmsVertY="<<rmsVertY<<
1271 "meanVertZ="<<meanVertZ<<
1272 "rmsVertZ="<<rmsVertZ<<
1273 "vertStatus="<<vertStatus<<
1274 "vertAll="<<vertAll<<
1275 "vertOK="<<vertOK<<
1276 "meanMult="<<meanMult<<
1277 "rmsMult="<<rmsMult<<
1278 "meanMultPos="<<meanMultPos<<
1279 "rmsMultPos="<<rmsMultPos<<
1280 "meanMultNeg="<<meanMultNeg<<
1281 "rmsMultNeg="<<rmsMultNeg;
1282
1283 return 0;
1284}