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