]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/TPC/AliTPCPerformanceSummary.cxx
guess the run number from the input file path
[u/mrichter/AliRoot.git] / PWGPP / 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
c64cb1f6 45using std::ifstream;
46
b832d719 47ClassImp(AliTPCPerformanceSummary)
48
0cb93e70 49Bool_t AliTPCPerformanceSummary::fgForceTHnSparse = kFALSE;
50
51
b832d719 52//_____________________________________________________________________________
9f5fbaba 53void AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, const AliPerformanceMatch* pTPCMatch,const AliPerformanceMatch* pTPCPull, const AliPerformanceMatch* pConstrain, TTreeSRedirector* const pcstream, Int_t run)
b832d719 54{
0cb93e70 55 //
b832d719 56 // Extracts performance parameters from pTPC and pTPCgain.
57 // Output is written to pcstream.
58 // The run number must be provided since it is not stored in
59 // AliPerformanceTPC or AliPerformanceDEdx.
60 //
814d192f 61 if (run <= 0 ) {
f69eb048 62 if (pTPCMatch) {run = pTPCMatch->GetRunNumber(); }
814d192f 63 if (pTPCgain) {run = pTPCgain->GetRunNumber(); }
64 if (pTPC) { run = pTPC->GetRunNumber(); }
65 }
f69eb048 66 TObjString runType;
f1fb93e0 67
68 //AliTPCcalibDB *calibDB=0;
69
0cb93e70 70// AliTPCcalibDButil *dbutil =0;
71 Int_t startTimeGRP=0;
72 Int_t stopTimeGRP=0;
73 Int_t time=0;
814d192f 74 Int_t duration=0;
f1fb93e0 75
76 //Float_t currentL3 =0;
77 //Int_t polarityL3 = 0;
78 //Float_t bz = 0;
79
80 //calibDB = AliTPCcalibDB::Instance();
81
0cb93e70 82// dbutil= new AliTPCcalibDButil;
f69eb048 83
f1fb93e0 84 //printf("Processing run %d ...\n",run);
85 //if (calibDB) {
86 //AliTPCcalibDB::Instance()->SetRun(run);
87
0cb93e70 88// dbutil->UpdateFromCalibDB();
89// dbutil->SetReferenceRun(run);
90// dbutil->UpdateRefDataFromOCDB();
91
f1fb93e0 92 //if (calibDB->GetGRP(run)){
93 //startTimeGRP = AliTPCcalibDB::GetGRP(run)->GetTimeStart();
94 //stopTimeGRP = AliTPCcalibDB::GetGRP(run)->GetTimeEnd();
95 //currentL3 = AliTPCcalibDB::GetL3Current(run);
96 //polarityL3 = AliTPCcalibDB::GetL3Polarity(run);
97 //bz = AliTPCcalibDB::GetBz(run);
814d192f 98
f1fb93e0 99 //}
100 //runType = AliTPCcalibDB::GetRunType(run).Data();
101 //}
0cb93e70 102 time = (startTimeGRP+stopTimeGRP)/2;
814d192f 103 duration = (stopTimeGRP-startTimeGRP);
b832d719 104
f69eb048 105 if (!pcstream) return;
0cb93e70 106 (*pcstream)<<"tpcQA"<<
107 "run="<<run<<
108 "time="<<time<<
109 "startTimeGRP="<<startTimeGRP<<
110 "stopTimeGRP="<<stopTimeGRP<<
5dff0b89 111 "duration="<<duration<<
0cb93e70 112 "runType.="<<&runType;
814d192f 113 if (pTPC) {
114 pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(0.5,1.5);
115 pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0.25,10);
116 pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-1,1);
f69eb048 117 AnalyzeNCL(pTPC, pcstream);
118 AnalyzeDrift(pTPC, pcstream);
119 AnalyzeDriftPos(pTPC, pcstream);
120 AnalyzeDriftNeg(pTPC, pcstream);
121 AnalyzeDCARPhi(pTPC, pcstream);
122 AnalyzeDCARPhiPos(pTPC, pcstream);
123 AnalyzeDCARPhiNeg(pTPC, pcstream);
124 AnalyzeEvent(pTPC, pcstream);
10d5d625 125
126 AnalyzePt(pTPC,pcstream);
127 AnalyzeChargeOverPt(pTPC,pcstream);
ac617c68 128 AnalyzeQAPosNegDpT(pTPC,pcstream);
129 AnalyzeQADCAFitParameter(pTPC,pcstream);
2f09a281 130 AnalyzeOcc(pTPC,pcstream);
10d5d625 131
814d192f 132 pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(-10,10);
133 pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0,100);
f69eb048 134 pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-10,10);
814d192f 135 }
f69eb048 136 AnalyzeGain(pTPCgain, pcstream);
137 AnalyzeMatch(pTPCMatch, pcstream);
1833a193 138 AnalyzePull(pTPCPull, pcstream);
9f5fbaba 139 AnalyzeConstrain(pConstrain, pcstream);
140
b832d719 141 (*pcstream)<<"tpcQA"<<"\n";
b832d719 142}
143
144//_____________________________________________________________________________
9f5fbaba 145void AliTPCPerformanceSummary::WriteToFile(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, const AliPerformanceMatch* pMatch, const AliPerformanceMatch* pPull, const AliPerformanceMatch* pConstrain, const Char_t* outfile, Int_t run)
b832d719 146{
147 //
148 // Extracts performance parameters from pTPC and pTPCgain.
149 // Output is written to a TTree saved in outfile.
150 // The run number must be provided since it is not stored in
151 // AliPerformanceTPC or AliPerformanceDEdx.
152 //
153 // The function creates a TTreeSRedirector and calls the
154 // function WriteToTTreeSRedirector.
155 //
156
f69eb048 157 if (!outfile) return;
b832d719 158 TTreeSRedirector* pcstream = 0;
159 pcstream = new TTreeSRedirector(outfile);
f69eb048 160 if (!pcstream) return;
9f5fbaba 161 WriteToTTreeSRedirector(pTPC, pTPCgain, pMatch, pPull, pConstrain, pcstream, run);
f69eb048 162 if (pcstream) { delete pcstream; pcstream = 0; }
b832d719 163
164}
165
166//_____________________________________________________________________________
167Int_t AliTPCPerformanceSummary::MakeReport(const Char_t* infile, const Char_t* outfile, Int_t run)
168{
169 //
170 // Reads QA information (AliPerformanceTPC and AliPerformanceDEdx) from
171 // infile (this must be a rootfile) and writes the output to a TTree
172 // stored in outfile.
173 // The run number must be provided since it is not stored in
174 // AliPerformanceTPC or AliPerformanceDEdx.
175 //
176 // The input objects must be named "AliPerformanceTPC" and
177 // "AliPerformanceDEdxTPCInner" and stored in a TList which name must
178 // be one of the following: "TPC", "TPCQA", "TPC_PerformanceQA"
179 // or "TPC_PerformanceQA/TPC" (with directory)
180 //
181
182 if (!infile) return -1;
183 if (!outfile) return -1;
184 TFile *f =0;
185 f=TFile::Open(infile,"read");
186 if (!f) {
187 printf("File %s not available\n", infile);
188 return -1;
189 }
190 TList* list = 0;
191 list = dynamic_cast<TList*>(f->Get("TPC"));
192 if (!list) { list = dynamic_cast<TList*>(f->Get("TPCQA")); }
b832d719 193 if (!list) { list = dynamic_cast<TList*>(f->Get("TPC_PerformanceQA/TPCQA")); }
0cb93e70 194 if (!list) { list = dynamic_cast<TList*>(f->Get("TPC_PerformanceQA")); }
1833a193 195 if (!list) { list = dynamic_cast<TList*>(f->Get("ITSTPCMatch")); }
b832d719 196 if (!list) {
197 printf("QA %s not available\n", infile);
198 return -1;
199 }
200 AliPerformanceTPC* pTPC = 0;
201 AliPerformanceDEdx* pTPCgain = 0;
f69eb048 202 AliPerformanceMatch* pTPCmatch = 0;
1833a193 203 AliPerformanceMatch* pTPCPull = 0;
9f5fbaba 204 AliPerformanceMatch* pConstrain = 0;
205
f69eb048 206 if (list) { pTPC = dynamic_cast<AliPerformanceTPC*>(list->FindObject("AliPerformanceTPC")); }
207 if (list) { pTPCgain = dynamic_cast<AliPerformanceDEdx*>(list->FindObject("AliPerformanceDEdxTPCInner")); }
208 if (list) { pTPCmatch = dynamic_cast<AliPerformanceMatch*>(list->FindObject("AliPerformanceMatchTPCITS")); }
1833a193 209 if (list) { pTPCPull = dynamic_cast<AliPerformanceMatch*>(list->FindObject("AliPerformanceMatchITSTPC")); }
9f5fbaba 210 if (list) { pConstrain = dynamic_cast<AliPerformanceMatch*>(list->FindObject("AliPerformanceMatchTPCConstrain")); }
b832d719 211
212 Int_t returncode = 0;
9f5fbaba 213 WriteToFile(pTPC, pTPCgain, pTPCmatch , pTPCPull, pConstrain, outfile, run);
b832d719 214 if (f) { delete f; f=0; }
215 return returncode;
216}
217
218//_____________________________________________________________________________
219Int_t AliTPCPerformanceSummary::ProduceTrends(const Char_t* infilelist, const Char_t* outfile)
220{
221 //
222 // Produces trend graphs.
223 //
224 // Input: infilelist is a textfile with one rootfile per line.
225 // There should be one rootfile for each run, the rootfile must
226 // contain the output of the MakeReport function
227 // Output: the information for all runs is merged into a TTree
228 // that is saved in outfile along with the trend graphs.
229 // Trend graphs are stored as TCanvas objects to include axis labels etc.
230 //
231
232 if (!infilelist) return -1;
233 if (!outfile) return -1;
234
235 TChain* chain = new TChain("tpcQA");
26a35193 236 if(!chain) return -1;
237
b832d719 238 ifstream in;
239 in.open(infilelist);
240
241 TString currentFile;
242 while(in.good()) {
243 in >> currentFile;
244
245 if (!currentFile.Contains("root")) continue; // protection
246 chain->Add(currentFile.Data());
247 }
248 in.close();
249 //TTree *tree = chain;
250 TTree *tree = chain->CopyTree("1");
26a35193 251 if(!tree) return -1;
b832d719 252 if (chain) { delete chain; chain=0; }
253 //TGraph* graph = dynamic_cast<TGraph*>(tree->DrawClone("run:run"));
254 //TGraph *graph = (TGraph*)gPad->GetPrimitive("Graph");
255
256 TFile* out = new TFile(outfile,"RECREATE");
26a35193 257 if(!out) return -1;
258
b832d719 259 out->cd();
c6d45264 260 const Char_t* condition = "meanTPCncl>0";
b832d719 261 SaveGraph(tree,"meanTPCnclF","run",condition);
262 SaveGraph(tree,"rmsTPCnclF","run",condition);
263 SaveGraph(tree,"meanTPCChi2","run",condition);
264 SaveGraph(tree,"rmsTPCChi2","run",condition);
265 SaveGraph(tree,"slopeATPCnclF","run",condition);
266 SaveGraph(tree,"slopeCTPCnclF","run",condition);
267 SaveGraph(tree,"slopeATPCnclFErr","run",condition);
268 SaveGraph(tree,"slopeCTPCnclFErr","run",condition);
269 SaveGraph(tree,"meanTPCncl","run",condition);
270 SaveGraph(tree,"rmsTPCncl","run",condition);
271 SaveGraph(tree,"slopeATPCncl","run",condition);
272 SaveGraph(tree,"slopeCTPCncl","run",condition);
273 SaveGraph(tree,"slopeATPCnclErr","run",condition);
274 SaveGraph(tree,"slopeCTPCnclErr","run",condition);
275
276 SaveGraph(tree,"offsetdRA","run",condition);
277 SaveGraph(tree,"slopedRA","run",condition);
278 SaveGraph(tree,"offsetdRC","run",condition);
279 SaveGraph(tree,"slopedRC","run",condition);
280 SaveGraph(tree,"offsetdRAErr","run",condition);
281 SaveGraph(tree,"slopedRAErr","run",condition);
282 SaveGraph(tree,"offsetdRCErr","run",condition);
283 SaveGraph(tree,"slopedRCErr","run",condition);
284 SaveGraph(tree,"offsetdRAchi2","run",condition);
285 SaveGraph(tree,"slopedRAchi2","run",condition);
286 SaveGraph(tree,"offsetdRCchi2","run",condition);
287 SaveGraph(tree,"slopedRCchi2","run",condition);
288
289 SaveGraph(tree,"offsetdRAPos","run",condition);
290
291 SaveGraph(tree,"slopedRAPos","run",condition);
292 SaveGraph(tree,"offsetdRCPos","run",condition);
293 SaveGraph(tree,"slopedRCPos","run",condition);
294 SaveGraph(tree,"offsetdRAErrPos","run",condition);
295 SaveGraph(tree,"slopedRAErrPos","run",condition);
296 SaveGraph(tree,"offsetdRCErrPos","run",condition);
297 SaveGraph(tree,"slopedRCErrPos","run",condition);
298 SaveGraph(tree,"offsetdRAchi2Pos","run",condition);
299 SaveGraph(tree,"slopedRAchi2Pos","run",condition);
300 SaveGraph(tree,"offsetdRCchi2Pos","run",condition);
301 SaveGraph(tree,"slopedRCchi2Pos","run",condition);
302
303 SaveGraph(tree,"offsetdRANeg","run",condition);
304 SaveGraph(tree,"slopedRANeg","run",condition);
305 SaveGraph(tree,"offsetdRCNeg","run",condition);
306 SaveGraph(tree,"slopedRCNeg","run",condition);
307 SaveGraph(tree,"offsetdRAErrNeg","run",condition);
308 SaveGraph(tree,"slopedRAErrNeg","run",condition);
309 SaveGraph(tree,"offsetdRCErrNeg","run",condition);
310 SaveGraph(tree,"slopedRCErrNeg","run",condition);
311 SaveGraph(tree,"offsetdRAchi2Neg","run",condition);
312 SaveGraph(tree,"slopedRAchi2Neg","run",condition);
313 SaveGraph(tree,"offsetdRCchi2Neg","run",condition);
314 SaveGraph(tree,"slopedRCchi2Neg","run",condition);
315
316 SaveGraph(tree,"offsetdZAPos","run",condition);
317 SaveGraph(tree,"slopedZAPos","run",condition);
318 SaveGraph(tree,"offsetdZCPos","run",condition);
319 SaveGraph(tree,"slopedZCPos","run",condition);
320 SaveGraph(tree,"offsetdZAErrPos","run",condition);
321 SaveGraph(tree,"slopedZAErrPos","run",condition);
322 SaveGraph(tree,"offsetdZCErrPos","run",condition);
323 SaveGraph(tree,"slopedZCErrPos","run",condition);
324 SaveGraph(tree,"offsetdZAchi2Pos","run",condition);
325 SaveGraph(tree,"slopedZAchi2Pos","run",condition);
326 SaveGraph(tree,"offsetdZCchi2Pos","run",condition);
327 SaveGraph(tree,"slopedZCchi2Pos","run",condition);
328
329 SaveGraph(tree,"offsetdZANeg","run",condition);
330 SaveGraph(tree,"slopedZANeg","run",condition);
331 SaveGraph(tree,"offsetdZCNeg","run",condition);
332 SaveGraph(tree,"slopedZCNeg","run",condition);
333 SaveGraph(tree,"offsetdZAErrNeg","run",condition);
334 SaveGraph(tree,"slopedZAErrNeg","run",condition);
335 SaveGraph(tree,"offsetdZCErrNeg","run",condition);
336 SaveGraph(tree,"slopedZCErrNeg","run",condition);
337 SaveGraph(tree,"offsetdZAchi2Neg","run",condition);
338 SaveGraph(tree,"slopedZAchi2Neg","run",condition);
339 SaveGraph(tree,"offsetdZCchi2Neg","run",condition);
340 SaveGraph(tree,"slopedZCchi2Neg","run",condition);
341
342 SaveGraph(tree,"offsetdZA","run",condition);
343 SaveGraph(tree,"slopedZA","run",condition);
344 SaveGraph(tree,"offsetdZC","run",condition);
345 SaveGraph(tree,"slopedZC","run",condition);
346 SaveGraph(tree,"offsetdZAErr","run",condition);
347 SaveGraph(tree,"slopedZAErr","run",condition);
348 SaveGraph(tree,"offsetdZCErr","run",condition);
349 SaveGraph(tree,"slopedZCErr","run",condition);
350 SaveGraph(tree,"offsetdZAchi2","run",condition);
351 SaveGraph(tree,"slopedZAchi2","run",condition);
352 SaveGraph(tree,"offsetdZCchi2","run",condition);
353 SaveGraph(tree,"slopedZCchi2","run",condition);
354
355 SaveGraph(tree,"meanVertX","run",condition);
356 SaveGraph(tree,"rmsVertX","run",condition);
357 SaveGraph(tree,"meanVertY","run",condition);
358 SaveGraph(tree,"rmsVertY","run",condition);
359 SaveGraph(tree,"meanVertZ","run",condition);
360 SaveGraph(tree,"rmsVertZ","run",condition);
361 SaveGraph(tree,"vertStatus","run",condition);
362 SaveGraph(tree,"meanMult","run",condition);
363 SaveGraph(tree,"rmsMult","run",condition);
364 SaveGraph(tree,"meanMultPos","run",condition);
365 SaveGraph(tree,"rmsMultPos","run",condition);
366 SaveGraph(tree,"meanMultNeg","run",condition);
367 SaveGraph(tree,"rmsMultNeg","run",condition);
368 SaveGraph(tree,"vertAll","run",condition);
369 SaveGraph(tree,"vertOK","run",condition);
370
10d5d625 371
372 SaveGraph(tree,"meanPtAPos","run",condition);
373 SaveGraph(tree,"mediumPtAPos","run",condition);
374 SaveGraph(tree,"highPtAPos","run",condition);
375 SaveGraph(tree,"meanPtCPos","run",condition);
376 SaveGraph(tree,"mediumPtCPos","run",condition);
377 SaveGraph(tree,"highPtCPos","run",condition);
378 SaveGraph(tree,"meanPtANeg","run",condition);
379 SaveGraph(tree,"mediumPtANeg","run",condition);
380 SaveGraph(tree,"highPtANeg","run",condition);
381 SaveGraph(tree,"meanPtCNeg","run",condition);
382 SaveGraph(tree,"mediumPtCNeg","run",condition);
383 SaveGraph(tree,"highPtCNeg","run",condition);
384
385 SaveGraph(tree,"qOverPt","run",condition);
386 SaveGraph(tree,"qOverPtA","run",condition);
387 SaveGraph(tree,"qOverPtC","run",condition);
1833a193 388
9f5fbaba 389 SaveGraph(tree,"dcarAP0","run",condition);
390 SaveGraph(tree,"dcarAP1","run",condition);
391 SaveGraph(tree,"dcarCP0","run",condition);
392 SaveGraph(tree,"dcarCP1","run",condition);
393
1833a193 394 condition = "";
395 SaveGraph(tree,"tpcItsMatchA","run",condition);
396 SaveGraph(tree,"tpcItsMatchHighPtA","run",condition);
397 SaveGraph(tree,"tpcItsMatchC","run",condition);
398 SaveGraph(tree,"tpcItsMatchHighPtC","run",condition);
399
400 SaveGraph(tree,"phiPull","run",condition);
401 SaveGraph(tree,"phiPullHighPt","run",condition);
402 SaveGraph(tree,"ptPull","run",condition);
403 SaveGraph(tree,"ptPullHighPt","run",condition);
404 SaveGraph(tree,"yPull","run",condition);
405 SaveGraph(tree,"yPullHighPt","run",condition);
406 SaveGraph(tree,"zPull","run",condition);
407 SaveGraph(tree,"zPullHighPt","run",condition);
408 SaveGraph(tree,"lambdaPull","run",condition);
409 SaveGraph(tree,"lambdaPullHighPt","run",condition);
410
9f5fbaba 411 SaveGraph(tree,"tpcConstrainPhiA","run",condition);
412 SaveGraph(tree,"tpcConstrainPhiC","run",condition);
413
ac617c68 414 SaveGraph(tree,"deltaPt","run",condition);
415 SaveGraph(tree,"deltaPtchi2","run",condition);
416 SaveGraph(tree,"deltaPtA","run",condition);
417 SaveGraph(tree,"deltaPtchi2A","run",condition);
418 SaveGraph(tree,"deltaPtC","run",condition);
419 SaveGraph(tree,"deltaPtchi2C","run",condition);
420 SaveGraph(tree,"deltaPtA_Err","run",condition);
421 SaveGraph(tree,"deltaPtA_Err","run",condition);
422 SaveGraph(tree,"deltaPtC_Err","run",condition);
423
424 ////////////////////////////////////////////////////////////////////////////////////////////////////////
425 //save dca fit parameters
426 SaveGraph(tree,"dcar_posA_0","run",condition);
427 SaveGraph(tree,"dcar_posA_1","run",condition);
428 SaveGraph(tree,"dcar_posA_2","run",condition);
429 SaveGraph(tree,"dcar_posA_chi2","run",condition);
430 SaveGraph(tree,"dcar_posA_0_Err","run",condition);
431 SaveGraph(tree,"dcar_posA_1_Err","run",condition);
432 SaveGraph(tree,"dcar_posA_2_Err","run",condition);
433
434 SaveGraph(tree,"dcaz_posA_0","run",condition);
435 SaveGraph(tree,"dcaz_posA_1","run",condition);
436 SaveGraph(tree,"dcaz_posA_2","run",condition);
437 SaveGraph(tree,"dcaz_posA_chi2","run",condition);
438 SaveGraph(tree,"dcaz_posA_0_Err","run",condition);
439 SaveGraph(tree,"dcaz_posA_1_Err","run",condition);
440 SaveGraph(tree,"dcaz_posA_2_Err","run",condition);
441
442 SaveGraph(tree,"dcaz_posC_0","run",condition);
443 SaveGraph(tree,"dcaz_posC_1","run",condition);
444 SaveGraph(tree,"dcaz_posC_2","run",condition);
445 SaveGraph(tree,"dcaz_posC_chi2","run",condition);
446 SaveGraph(tree,"dcaz_posC_0_Err","run",condition);
447 SaveGraph(tree,"dcaz_posC_1_Err","run",condition);
448 SaveGraph(tree,"dcaz_posC_2_Err","run",condition);
449
450 SaveGraph(tree,"dcar_posC_0","run",condition);
451 SaveGraph(tree,"dcar_posC_1","run",condition);
452 SaveGraph(tree,"dcar_posC_2","run",condition);
453 SaveGraph(tree,"dcar_posC_chi2","run",condition);
454 SaveGraph(tree,"dcar_posC_0_Err","run",condition);
455 SaveGraph(tree,"dcar_posC_1_Err","run",condition);
456 SaveGraph(tree,"dcar_posC_2_Err","run",condition);
457
458 SaveGraph(tree,"dcar_negA_0","run",condition);
459 SaveGraph(tree,"dcar_negA_1","run",condition);
460 SaveGraph(tree,"dcar_negA_2","run",condition);
461 SaveGraph(tree,"dcar_negA_chi2","run",condition);
462 SaveGraph(tree,"dcar_negA_0_Err","run",condition);
463 SaveGraph(tree,"dcar_negA_1_Err","run",condition);
464 SaveGraph(tree,"dcar_negA_2_Err","run",condition);
465
466 SaveGraph(tree,"dcaz_negA_0","run",condition);
467 SaveGraph(tree,"dcaz_negA_1","run",condition);
468 SaveGraph(tree,"dcaz_negA_2","run",condition);
469 SaveGraph(tree,"dcaz_negA_chi2","run",condition);
470 SaveGraph(tree,"dcaz_negA_0_Err","run",condition);
471 SaveGraph(tree,"dcaz_negA_1_Err","run",condition);
472 SaveGraph(tree,"dcaz_negA_2_Err","run",condition);
473
474 SaveGraph(tree,"dcaz_negC_0","run",condition);
475 SaveGraph(tree,"dcaz_negC_1","run",condition);
476 SaveGraph(tree,"dcaz_negC_2","run",condition);
477 SaveGraph(tree,"dcaz_negC_chi2","run",condition);
478 SaveGraph(tree,"dcaz_negC_0_Err","run",condition);
479 SaveGraph(tree,"dcaz_negC_1_Err","run",condition);
480 SaveGraph(tree,"dcaz_negC_2_Err","run",condition);
481
482 SaveGraph(tree,"dcar_negC_0","run",condition);
483 SaveGraph(tree,"dcar_negC_1","run",condition);
484 SaveGraph(tree,"dcar_negC_2","run",condition);
485 SaveGraph(tree,"dcar_negC_chi2","run",condition);
486 SaveGraph(tree,"dcar_negC_0_Err","run",condition);
487 SaveGraph(tree,"dcar_negC_1_Err","run",condition);
488 SaveGraph(tree,"dcar_negC_2_Err","run",condition);
ac617c68 489
2f09a281 490 SaveGraph(tree,"iroc_A_side","run",condition);
491 SaveGraph(tree,"iroc_C_side","run",condition);
492 SaveGraph(tree,"oroc_A_side","run",condition);
493 SaveGraph(tree,"oroc_C_side","run",condition);
ac617c68 494
2f09a281 495 //A/C side IROC
496 SaveGraph(tree,"TPC_Occ_IROC.","run",condition);
497 SaveGraph(tree,"TPC_Occ_OROC.","run",condition);
ac617c68 498 ////////////////////////////////////////////////////////////////////////////////////////////////////////
499
2f09a281 500 tree->Write();
b832d719 501 out->Close();
502 if (tree) { delete tree; tree=0; }
503 if (out) { delete out; out=0; }
1833a193 504 return 0;
b832d719 505}
506
507//_____________________________________________________________________________
508Int_t AliTPCPerformanceSummary::SaveGraph(TTree* tree, const Char_t* y, const Char_t* x, const Char_t* condition)
509{
510 //
511 // Creates a Graph and writes the canvas to the current directory
512 // called by ProduceTrends function.
513 //
514
515 TString s(y);
516 s += ':';
517 s += x;
518 tree->Draw(s.Data(),condition,"goff");
519 TCanvas* c = new TCanvas(s.Data(),s.Data());
520 c->cd();
521 TPad* p = new TPad("pad0","pad0",0,0,1,1);
522 p->Draw();
523 p->cd();
524 if (tree->GetSelectedRows() > 0) {
525 TGraph* graph = new TGraph(tree->GetSelectedRows(), tree->GetV2(), tree->GetV1());
526 graph->Draw("AP");
527 graph->GetXaxis()->SetTitle(x);
528 graph->GetYaxis()->SetTitle(y);
529 c->Write(s.Data());
530 delete graph;
531 }
532 //graph->Write(s.Data());
533 delete c;
534
535return 0;
536}
537
538//_____________________________________________________________________________
70f4b25f 539Int_t AliTPCPerformanceSummary::AnalyzeDCARPhi(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 540{
541 //
542 // Analyse DCA R imperfections
543 //
544
545 if (!pcstream) return 8;
546 if (!pTPC) return 8;
547
548 // variables:
549 static Double_t offsetdRA=0;
550 static Double_t slopedRA=0;
551 static Double_t offsetdRC=0;
552 static Double_t slopedRC=0;
553 static Double_t offsetdRAErr=0;
554 static Double_t slopedRAErr=0;
555 static Double_t offsetdRCErr=0;
556 static Double_t slopedRCErr=0;
557 static Double_t offsetdRAchi2=0;
558 static Double_t slopedRAchi2=0;
559 static Double_t offsetdRCchi2=0;
560 static Double_t slopedRCchi2=0;
9f5fbaba 561 static Double_t dcarAP0 = 0;
562 static Double_t dcarAP1 = 0;
563 static Double_t dcarCP0 = 0;
564 static Double_t dcarCP1 = 0;
b832d719 565
566 //AliPerformanceTPC* pTPC = dynamic_cast<AliPerformanceTPC*>(pTPCObject);
0cb93e70 567
b832d719 568 TH1* his1D=0;
569 TH2* his2D=0;
0cb93e70 570 TH3* his3D=0;
571
28bb9d1f 572 if (pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_3_5_7")) {
573 his3D = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_3_5_7"));
26a35193 574 if(!his3D) return 8;
0cb93e70 575 his3D->GetYaxis()->SetRangeUser(-1,1);
576 his3D->GetZaxis()->SetRangeUser(0.25,10);
577 }
578
b832d719 579 static TF1 *fpol1 = new TF1("fpol1","pol1");
580 TObjArray arrayFit;
0cb93e70 581 if (his3D && !fgForceTHnSparse) {
582 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
583 } else {
584 his2D = pTPC->GetTPCTrackHisto()->Projection(3,5);
585 }
26a35193 586 if(!his2D) return 8;
0cb93e70 587
588
b832d719 589 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
590 delete his2D;
591 his1D = (TH1*) arrayFit.At(1);
592 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
593 offsetdRC=fpol1->GetParameter(0);
594 slopedRC=fpol1->GetParameter(1);
595 offsetdRCchi2=fpol1->GetChisquare();
596 slopedRCchi2=fpol1->GetChisquare();
597 //
598 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
599 offsetdRA=fpol1->GetParameter(0);
600 slopedRA=fpol1->GetParameter(1);
601 offsetdRAErr=fpol1->GetParError(0);
602 slopedRAErr=fpol1->GetParError(1);
603 offsetdRAchi2=fpol1->GetChisquare();
604 slopedRAchi2=fpol1->GetChisquare();
605 //
606 printf("DCA R QA report\n");
607 printf("offsetdRA\t%f\n",offsetdRA);
608 printf("slopedRA\t%f\n",slopedRA);
609 printf("offsetdRC\t%f\n",offsetdRC);
610 printf("slopedRC\t%f\n",slopedRC);
9f5fbaba 611
612 //
613 //extraction of DCAr versus pt
614 //
615 TLinearFitter linearFit;
616 linearFit.SetFormula("pol1");
617 TObjArray arrayWidth;
618 TH1 *width;
619 Int_t nXbins;
620 Double_t x,y;
621 Int_t pn = 1;
622
623 if(!his3D)
624 return 8;
625 his3D->GetYaxis()->SetRangeUser(-1,1);
626
627 //get his2D in A Side
628 his3D->GetYaxis()->SetRangeUser(0,1);
629 his3D->GetZaxis()->SetRangeUser(0.35,8);
630 his2D = dynamic_cast<TH2*>(his3D->Project3D("xz"));
e01d9fa9 631 if (his2D)
632 his2D->FitSlicesY(0,0,-1,0,"QNR",&arrayWidth);
248ee6f9 633
9f5fbaba 634 width = dynamic_cast<TH1*>(arrayWidth.At(2));
248ee6f9 635 if (width)
636 {
e01d9fa9 637 nXbins = width->GetNbinsX();
9f5fbaba 638 for(Int_t i=2; i<nXbins; i++){
639 x = width->GetBinCenter(i);
640 if(x!=0)
641 x = 1.0/(x*x);
642 y = width->GetBinContent(i);
643 y = y*y;
644 linearFit.AddPoint(&x,y,1);
645 }
646 if(!linearFit.Eval()){
647
648 dcarAP0 = linearFit.GetParameter(0);
649 if(dcarAP0!=0)
650 pn = Int_t(TMath::Abs(dcarAP0)/dcarAP0);
651 dcarAP0 = pn*TMath::Sqrt(TMath::Abs(dcarAP0));
652
653 dcarAP1 = linearFit.GetParameter(1);
654 if(dcarAP1!=0)
655 pn = Int_t(TMath::Abs(dcarAP1)/dcarAP1);
656 dcarAP1 = pn*TMath::Sqrt(TMath::Abs(dcarAP1));
657 }
248ee6f9 658 }
9f5fbaba 659
660 linearFit.ClearPoints();
661
662 //get his2D in C Side
663 his3D->GetYaxis()->SetRangeUser(-1,-0.001);
664 his2D = dynamic_cast<TH2*>(his3D->Project3D("xz"));
e01d9fa9 665 if (his2D)
666 his2D->FitSlicesY(0,0,-1,0,"QNR",&arrayWidth);
248ee6f9 667 width = dynamic_cast<TH1*>(arrayWidth.At(2));
668 if (width)
669 {
e01d9fa9 670 nXbins = width->GetNbinsX();
9f5fbaba 671 for(Int_t i=2; i<nXbins; i++){
672 x = width->GetBinCenter(i);
673 if(x!=0)
674 x = 1.0/(x*x);
675 y = width->GetBinContent(i);
676 y = y*y;
677 linearFit.AddPoint(&x,y);
678 }
679 if(!linearFit.Eval()){
680 dcarCP0 = linearFit.GetParameter(0);
681 if(dcarCP0!=0)
682 pn = Int_t(TMath::Abs(dcarCP0)/dcarCP0);
683 dcarCP0 = pn*TMath::Sqrt(TMath::Abs(dcarCP0));
684
685 dcarCP1 = linearFit.GetParameter(1);
686 if(dcarCP1!=0)
687 pn = Int_t(TMath::Abs(dcarCP1)/dcarCP1);
688 dcarCP1 = pn*TMath::Sqrt(TMath::Abs(dcarCP1));
689 }
248ee6f9 690 }
9f5fbaba 691 his3D->GetYaxis()->SetRangeUser(-1,1);
692 his3D->GetZaxis()->SetRangeUser(0,20);
693
b832d719 694 //
695 // dump values
696 //
697 (*pcstream)<<"tpcQA"<<
2f09a281 698 "offsetdRA="<< offsetdRA<<
699 "slopedRA="<< slopedRA<<
700 "offsetdRC="<< offsetdRC<<
701 "slopedRC="<<slopedRC<<
702 //
703 "offsetdRAErr="<< offsetdRAErr<<
704 "slopedRAErr="<< slopedRAErr<<
705 "offsetdRCErr="<< offsetdRCErr<<
706 "slopedRCErr="<<slopedRCErr<<
707 //
708 "offsetdRAchi2="<< offsetdRAchi2<<
709 "slopedRAchi2="<< slopedRAchi2<<
710 "offsetdRCchi2="<< offsetdRCchi2<<
711 "slopedRCchi2="<<slopedRCchi2<<
712 //
713 "dcarAP0="<<dcarAP0<<
714 "dcarAP1="<<dcarAP1<<
715 "dcarCP0="<<dcarCP0<<
716 "dcarCP1="<<dcarCP1;
b832d719 717
718 return 0;
719}
720
721//_____________________________________________________________________________
70f4b25f 722Int_t AliTPCPerformanceSummary::AnalyzeDCARPhiPos(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 723{
724 //
725 // Analyse DCA R imperfections for positive particles
726 //
727
728 if (!pcstream) return 16;
729 if (!pTPC) return 16;
730
731 // variables:
732 static Double_t offsetdRAPos=0;
733 static Double_t slopedRAPos=0;
734 static Double_t offsetdRCPos=0;
735 static Double_t slopedRCPos=0;
736 static Double_t offsetdRAErrPos=0;
737 static Double_t slopedRAErrPos=0;
738 static Double_t offsetdRCErrPos=0;
739 static Double_t slopedRCErrPos=0;
740 static Double_t offsetdRAchi2Pos=0;
741 static Double_t slopedRAchi2Pos=0;
742 static Double_t offsetdRCchi2Pos=0;
743 static Double_t slopedRCchi2Pos=0;
744
745 //AliPerformanceTPC* pTPC = dynamic_cast<AliPerformanceTPC*>(pTPCObject);
746 TH1* his1D=0;
747 TH2* his2D=0;
0cb93e70 748 TH3* his3D=0;
749
28bb9d1f 750 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_7")) {
751 his3D = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_7"));
26a35193 752 if(!his3D) return 16;
0cb93e70 753 his3D->GetYaxis()->SetRangeUser(-1,1);
754 his3D->GetZaxis()->SetRangeUser(0.25,10);
755 }
756
b832d719 757 static TF1 *fpol1 = new TF1("fpol1","pol1");
758 TObjArray arrayFit;
0cb93e70 759 if (his3D && !fgForceTHnSparse) {
760 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
761 } else {
5ca104e5 762 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(0,1.5);
0cb93e70 763 his2D = pTPC->GetTPCTrackHisto()->Projection(3,5);
5ca104e5 764 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-1.5,1.5);
0cb93e70 765 }
26a35193 766 if(!his2D) return 16;
0cb93e70 767
b832d719 768 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
0cb93e70 769 delete his2D;
b832d719 770 his1D = (TH1*) arrayFit.At(1);
771 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
772 offsetdRCPos=fpol1->GetParameter(0);
773 slopedRCPos=fpol1->GetParameter(1);
774 offsetdRCchi2Pos=fpol1->GetChisquare();
775 slopedRCchi2Pos=fpol1->GetChisquare();
776 //
777 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
778 offsetdRAPos=fpol1->GetParameter(0);
779 slopedRAPos=fpol1->GetParameter(1);
780 offsetdRAErrPos=fpol1->GetParError(0);
781 slopedRAErrPos=fpol1->GetParError(1);
782 offsetdRAchi2Pos=fpol1->GetChisquare();
783 slopedRAchi2Pos=fpol1->GetChisquare();
784 //
785 printf("DCA R QA Pos report\n");
786 printf("offsetdRAPos\t%f\n",offsetdRAPos);
787 printf("slopedRAPos\t%f\n",slopedRAPos);
788 printf("offsetdRCPos\t%f\n",offsetdRCPos);
789 printf("slopedRCPos\t%f\n",slopedRCPos);
790 //
791 // dump values
792 //
793 (*pcstream)<<"tpcQA"<<
2f09a281 794 "offsetdRAPos="<< offsetdRAPos<<
795 "slopedRAPos="<< slopedRAPos<<
796 "offsetdRCPos="<< offsetdRCPos<<
797 "slopedRCPos="<<slopedRCPos<<
798 //
799 "offsetdRAErrPos="<< offsetdRAErrPos<<
800 "slopedRAErrPos="<< slopedRAErrPos<<
801 "offsetdRCErrPos="<< offsetdRCErrPos<<
802 "slopedRCErrPos="<<slopedRCErrPos<<
803 //
804 "offsetdRAchi2Pos="<< offsetdRAchi2Pos<<
805 "slopedRAchi2Pos="<< slopedRAchi2Pos<<
806 "offsetdRCchi2Pos="<< offsetdRCchi2Pos<<
807 "slopedRCchi2Pos="<<slopedRCchi2Pos;
b832d719 808
809 return 0;
810}
811
812//_____________________________________________________________________________
70f4b25f 813Int_t AliTPCPerformanceSummary::AnalyzeDCARPhiNeg(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 814{
815 //
816 // Analyse DCA R imperfections for negative particles
817 //
818 if (!pcstream) return 32;
819 if (!pTPC) return 32;
820
821 // variables:
822 static Double_t offsetdRANeg=0;
823 static Double_t slopedRANeg=0;
824 static Double_t offsetdRCNeg=0;
825 static Double_t slopedRCNeg=0;
826 static Double_t offsetdRAErrNeg=0;
827 static Double_t slopedRAErrNeg=0;
828 static Double_t offsetdRCErrNeg=0;
829 static Double_t slopedRCErrNeg=0;
830 static Double_t offsetdRAchi2Neg=0;
831 static Double_t slopedRAchi2Neg=0;
832 static Double_t offsetdRCchi2Neg=0;
833 static Double_t slopedRCchi2Neg=0;
834
835 //AliPerformanceTPC* pTPC = dynamic_cast<AliPerformanceTPC*>(pTPCObject);
836 TH1* his1D=0;
837 TH2* his2D=0;
0cb93e70 838 TH3* his3D=0;
839
28bb9d1f 840 if (pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_7")) {
841 his3D = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_7"));
26a35193 842 if(!his3D) return 32;
0cb93e70 843 his3D->GetYaxis()->SetRangeUser(-1,1);
844 his3D->GetZaxis()->SetRangeUser(0.25,10);
845 }
846
b832d719 847 static TF1 *fpol1 = new TF1("fpol1","pol1");
848 TObjArray arrayFit;
0cb93e70 849 if (his3D && !fgForceTHnSparse) {
850 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
851 } else {
5ca104e5 852 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-1.5,0);
0cb93e70 853 his2D = pTPC->GetTPCTrackHisto()->Projection(3,5);
5ca104e5 854 pTPC->GetTPCTrackHisto()->GetAxis(8)->SetRangeUser(-1.5,1.5);
0cb93e70 855 }
26a35193 856 if(!his2D) return 32;
857
b832d719 858 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
0cb93e70 859 delete his2D;
b832d719 860 his1D = (TH1*) arrayFit.At(1);
861 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
862 offsetdRCNeg=fpol1->GetParameter(0);
863 slopedRCNeg=fpol1->GetParameter(1);
864 offsetdRCchi2Neg=fpol1->GetChisquare();
865 slopedRCchi2Neg=fpol1->GetChisquare();
866 //
867 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
868 offsetdRANeg=fpol1->GetParameter(0);
869 slopedRANeg=fpol1->GetParameter(1);
870 offsetdRAErrNeg=fpol1->GetParError(0);
871 slopedRAErrNeg=fpol1->GetParError(1);
872 offsetdRAchi2Neg=fpol1->GetChisquare();
873 slopedRAchi2Neg=fpol1->GetChisquare();
874 //
875 printf("DCA R QA Neg report\n");
876 printf("offsetdRANeg\t%f\n",offsetdRANeg);
877 printf("slopedRANeg\t%f\n",slopedRANeg);
878 printf("offsetdRCNeg\t%f\n",offsetdRCNeg);
879 printf("slopedRCNeg\t%f\n",slopedRCNeg);
880 //
881 // dump drift QA values
882 //
883 (*pcstream)<<"tpcQA"<<
884 "offsetdRANeg="<< offsetdRANeg<<
885 "slopedRANeg="<< slopedRANeg<<
886 "offsetdRCNeg="<< offsetdRCNeg<<
887 "slopedRCNeg="<<slopedRCNeg<<
888 //
889 "offsetdRAErrNeg="<< offsetdRAErrNeg<<
890 "slopedRAErrNeg="<< slopedRAErrNeg<<
891 "offsetdRCErrNeg="<< offsetdRCErrNeg<<
892 "slopedRCErrNeg="<<slopedRCErrNeg<<
893 //
894 "offsetdRAchi2Neg="<< offsetdRAchi2Neg<<
895 "slopedRAchi2Neg="<< slopedRAchi2Neg<<
896 "offsetdRCchi2Neg="<< offsetdRCchi2Neg<<
897 "slopedRCchi2Neg="<<slopedRCchi2Neg;
898
899 return 0;
900}
901
902//_____________________________________________________________________________
70f4b25f 903Int_t AliTPCPerformanceSummary::AnalyzeNCL(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 904{
905 //
906 // Analyse number of TPC clusters
907 //
908
909 if (!pcstream) return 1;
910 if (!pTPC) return 1;
911
912 // variables:
913 static Double_t meanTPCnclF=0;
914 static Double_t rmsTPCnclF=0;
915 static Double_t meanTPCChi2=0;
916 static Double_t rmsTPCChi2=0;
917 static Double_t slopeATPCnclF=0;
918 static Double_t slopeCTPCnclF=0;
919 static Double_t slopeATPCnclFErr=0;
920 static Double_t slopeCTPCnclFErr=0;
921 static Double_t meanTPCncl=0;
922 static Double_t rmsTPCncl=0;
923 static Double_t slopeATPCncl=0;
924 static Double_t slopeCTPCncl=0;
925 static Double_t slopeATPCnclErr=0;
926 static Double_t slopeCTPCnclErr=0;
70f4b25f 927 //
b832d719 928 TH1* his1D=0;
70f4b25f 929 TH3* his3D0=0;
930 TH3* his3D1=0;
931 TH3* his3D2=0;
b832d719 932 TProfile* hprof=0;
933 static TF1 *fpol1 = new TF1("fpol1","pol1");
934 //
935 // all clusters
0cb93e70 936 // only events with rec. vertex
b832d719 937 // eta cut - +-1
0cb93e70 938 // pt cut - 0.250 GeV
b832d719 939 pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-1.,1.);
940 pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0.25,10);
0cb93e70 941
28bb9d1f 942 if (pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_0_5_7")) {
70f4b25f 943 his3D0 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_0_5_7"));
26a35193 944 if(!his3D0) return 1;
70f4b25f 945 his3D0->GetYaxis()->SetRangeUser(-1,1);
946 his3D0->GetZaxis()->SetRangeUser(0.25,10);
0cb93e70 947 }
28bb9d1f 948 if (pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_1_5_7")) {
70f4b25f 949 his3D1 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_1_5_7"));
26a35193 950 if(!his3D1) return 1;
70f4b25f 951 his3D1->GetYaxis()->SetRangeUser(-1,1);
952 his3D1->GetZaxis()->SetRangeUser(0.25,10);
0cb93e70 953 }
28bb9d1f 954 if (pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_2_5_7")) {
70f4b25f 955 his3D2 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_2_5_7"));
26a35193 956 if(!his3D2) return 1;
70f4b25f 957 his3D2->GetYaxis()->SetRangeUser(-1,1);
958 his3D2->GetZaxis()->SetRangeUser(0.25,10);
959 his3D2->GetXaxis()->SetRangeUser(0.4,1.1);
0cb93e70 960 }
961
962
70f4b25f 963 if (his3D0 && !fgForceTHnSparse) {
964 his1D = his3D0->Project3D("x");
0cb93e70 965 } else {
966 his1D = pTPC->GetTPCTrackHisto()->Projection(0);
967 }
968
b832d719 969 meanTPCncl= his1D->GetMean();
970 rmsTPCncl= his1D->GetRMS();
971 delete his1D;
0cb93e70 972
70f4b25f 973 if (his3D1 && !fgForceTHnSparse) {
974 his1D = his3D1->Project3D("x");
0cb93e70 975 } else {
976 his1D = pTPC->GetTPCTrackHisto()->Projection(1);
977 }
978
b832d719 979 meanTPCChi2= his1D->GetMean();
980 rmsTPCChi2= his1D->GetRMS();
981 delete his1D;
0cb93e70 982
70f4b25f 983 if (his3D0 && !fgForceTHnSparse) {
984 hprof = (dynamic_cast<TH2*>(his3D0->Project3D("xy")))->ProfileX();
0cb93e70 985 } else {
986 hprof = pTPC->GetTPCTrackHisto()->Projection(0,5)->ProfileX();
987 }
26a35193 988 if(!hprof) return 1;
0cb93e70 989
990 hprof->Fit(fpol1,"QNR","QNR",0.1,0.8);
b832d719 991 slopeATPCncl= fpol1->GetParameter(1);
992 slopeATPCnclErr= fpol1->GetParError(1);
0cb93e70 993 hprof->Fit(fpol1,"QNR","QNR",-0.8,-0.1);
b832d719 994 slopeCTPCncl= fpol1->GetParameter(1);
995 slopeCTPCnclErr= fpol1->GetParameter(1);
996 delete hprof;
0cb93e70 997
b832d719 998 //
999 // findable clusters
1000 //
0cb93e70 1001
70f4b25f 1002 if (his3D2 && !fgForceTHnSparse) {
1003 his1D = his3D2->Project3D("x");
0cb93e70 1004 } else {
1005 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
1006 his1D = pTPC->GetTPCTrackHisto()->Projection(2);
1007 }
814d192f 1008
b832d719 1009 meanTPCnclF= his1D->GetMean();
1010 rmsTPCnclF= his1D->GetRMS();
1011 delete his1D;
0cb93e70 1012
70f4b25f 1013 if (his3D2 && !fgForceTHnSparse) {
1014 his1D = (dynamic_cast<TH2*>(his3D2->Project3D("xy")))->ProfileX();
0cb93e70 1015 } else {
1016 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
1017 his1D = pTPC->GetTPCTrackHisto()->Projection(2,5)->ProfileX();
1018 }
26a35193 1019 if(!his1D) return 1;
0cb93e70 1020
1021 his1D->Fit(fpol1,"QNR","QNR",0.1,0.8);
b832d719 1022 slopeATPCnclF= fpol1->GetParameter(1);
1023 slopeATPCnclFErr= fpol1->GetParError(1);
0cb93e70 1024 his1D->Fit(fpol1,"QNR","QNR",-0.8,-0.1);
b832d719 1025 slopeCTPCnclF= fpol1->GetParameter(1);
1026 slopeCTPCnclFErr= fpol1->GetParameter(1);
1027 delete his1D;
0cb93e70 1028
1029 pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0,10);
1030
b832d719 1031 printf("Cluster QA report\n");
1032 printf("meanTPCnclF=\t%f\n",meanTPCnclF);
1033 printf("rmsTPCnclF=\t%f\n",rmsTPCnclF);
1034 printf("slopeATPCnclF=\t%f\n",slopeATPCnclF);
1035 printf("slopeCTPCnclF=\t%f\n",slopeCTPCnclF);
1036 printf("meanTPCncl=\t%f\n",meanTPCncl);
1037 printf("rmsTPCncl=\t%f\n",rmsTPCncl);
1038 printf("slopeATPCncl=\t%f\n",slopeATPCncl);
1039 printf("slopeCTPCncl=\t%f\n",slopeCTPCncl);
1040 printf("meanTPCChi2=\t%f\n",meanTPCChi2);
1041 printf("rmsTPCChi2=\t%f\n",rmsTPCChi2);
1042 //
1043 // dump results to the tree
1044 //
1045 (*pcstream)<<"tpcQA"<<
2f09a281 1046 "meanTPCnclF="<<meanTPCnclF <<
1047 "rmsTPCnclF="<<rmsTPCnclF <<
1048 "meanTPCChi2="<<meanTPCChi2 <<
1049 "rmsTPCChi2="<<rmsTPCChi2 <<
1050 "slopeATPCnclF="<< slopeATPCnclF<<
1051 "slopeCTPCnclF="<< slopeCTPCnclF<<
1052 "slopeATPCnclFErr="<< slopeATPCnclFErr<<
1053 "slopeCTPCnclFErr="<< slopeCTPCnclFErr<<
1054 "meanTPCncl="<<meanTPCncl <<
1055 "rmsTPCncl="<< rmsTPCncl<<
1056 "slopeATPCncl="<< slopeATPCncl<<
1057 "slopeCTPCncl="<< slopeCTPCncl<<
1058 "slopeATPCnclErr="<< slopeATPCnclErr<<
1059 "slopeCTPCnclErr="<< slopeCTPCnclErr;
b832d719 1060
1061 return 0;
1062}
1063
1064//_____________________________________________________________________________
70f4b25f 1065Int_t AliTPCPerformanceSummary::AnalyzeDrift(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 1066{
1067 //
1068 // Analyse DCA Z imperferctions (drift velocity)
1069 //
1070
1071 if (!pcstream) return 2;
1072 if (!pTPC) return 2;
1073
1074 // variables:
1075 static Double_t offsetdZA=0;
1076 static Double_t slopedZA=0;
1077 static Double_t offsetdZC=0;
1078 static Double_t slopedZC=0;
1079 static Double_t offsetdZAErr=0;
1080 static Double_t slopedZAErr=0;
1081 static Double_t offsetdZCErr=0;
1082 static Double_t slopedZCErr=0;
1083 static Double_t offsetdZAchi2=0;
1084 static Double_t slopedZAchi2=0;
1085 static Double_t offsetdZCchi2=0;
1086 static Double_t slopedZCchi2=0;
1087 TH1* his1D=0;
1088 TH2* his2D=0;
0cb93e70 1089 TH3* his3D=0;
1090
28bb9d1f 1091 if (pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_4_5_7")) {
1092 his3D = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_4_5_7"));
26a35193 1093 if(!his3D) return 2;
0cb93e70 1094 his3D->GetYaxis()->SetRangeUser(-1,1);
1095 his3D->GetZaxis()->SetRangeUser(0.25,10);
26a35193 1096 }
1097
0cb93e70 1098 if (his3D && !fgForceTHnSparse) {
1099 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
1100 } else {
1101 his2D = pTPC->GetTPCTrackHisto()->Projection(4,5);
1102 }
26a35193 1103 if(!his2D) return 2;
0cb93e70 1104
b832d719 1105 static TF1 *fpol1 = new TF1("fpol1","pol1");
1106 TObjArray arrayFit;
b832d719 1107 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
1108 delete his2D;
1109 his1D = (TH1*) arrayFit.At(1);
1110 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
1111 offsetdZC=fpol1->GetParameter(0);
1112 slopedZC=fpol1->GetParameter(1);
1113 offsetdZCErr=fpol1->GetParError(0);
1114 slopedZCErr=fpol1->GetParError(1);
1115 offsetdZCchi2=fpol1->GetChisquare();
1116 slopedZCchi2=fpol1->GetChisquare();
1117 //
1118 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
1119 offsetdZA=fpol1->GetParameter(0);
1120 slopedZA=fpol1->GetParameter(1);
1121 offsetdZAErr=fpol1->GetParError(0);
1122 slopedZAErr=fpol1->GetParError(1);
1123 offsetdZAchi2=fpol1->GetChisquare();
1124 slopedZAchi2=fpol1->GetChisquare();
1125 //
1126 printf("Drift velocity QA report\n");
1127 printf("offsetdZA\t%f\n",offsetdZA);
1128 printf("slopedZA\t%f\n",slopedZA);
1129 printf("offsetdZC\t%f\n",offsetdZC);
1130 printf("slopedZC\t%f\n",slopedZC);
1131 //
1132 // dump drift QA values
1133 //
1134 (*pcstream)<<"tpcQA"<<
2f09a281 1135 "offsetdZA="<< offsetdZA<<
b832d719 1136 "slopedZA="<< slopedZA<<
1137 "offsetdZC="<< offsetdZC<<
1138 "slopedZC="<<slopedZC<<
1139 //
1140 "offsetdZAErr="<< offsetdZAErr<<
1141 "slopedZAErr="<< slopedZAErr<<
1142 "offsetdZCErr="<< offsetdZCErr<<
1143 "slopedZCErr="<<slopedZCErr<<
1144 //
1145 "offsetdZAchi2="<< offsetdZAchi2<<
1146 "slopedZAchi2="<< slopedZAchi2<<
1147 "offsetdZCchi2="<< offsetdZCchi2<<
1148 "slopedZCchi2="<<slopedZCchi2;
1149
1150 return 0;
1151}
1152
1153//_____________________________________________________________________________
70f4b25f 1154Int_t AliTPCPerformanceSummary::AnalyzeDriftPos(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 1155{
1156 //
1157 // Analyse DCA Z imperferctions (drift velocity)
1158 // for positive particles
1159 //
1160 if (!pcstream) return 64;
1161 if (!pTPC) return 64;
1162
1163 // variables:
1164 static Double_t offsetdZAPos=0;
1165 static Double_t slopedZAPos=0;
1166 static Double_t offsetdZCPos=0;
1167 static Double_t slopedZCPos=0;
1168 static Double_t offsetdZAErrPos=0;
1169 static Double_t slopedZAErrPos=0;
1170 static Double_t offsetdZCErrPos=0;
1171 static Double_t slopedZCErrPos=0;
1172 static Double_t offsetdZAchi2Pos=0;
1173 static Double_t slopedZAchi2Pos=0;
1174 static Double_t offsetdZCchi2Pos=0;
1175 static Double_t slopedZCchi2Pos=0;
1176 TH1* his1D=0;
1177 TH2* his2D=0;
0cb93e70 1178 TH3* his3D=0;
1179
28bb9d1f 1180 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_4_5_7")) {
1181 his3D = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_4_5_7"));
26a35193 1182 if(!his3D) return 64;
0cb93e70 1183 his3D->GetYaxis()->SetRangeUser(-1,1);
1184 his3D->GetZaxis()->SetRangeUser(0.25,10);
26a35193 1185 }
1186
0cb93e70 1187 if (his3D && !fgForceTHnSparse) {
1188 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
1189 } else {
1190 his2D = pTPC->GetTPCTrackHisto()->Projection(4,5);
1191 }
26a35193 1192 if(!his2D) return 64;
0cb93e70 1193
b832d719 1194 static TF1 *fpol1 = new TF1("fpol1","pol1");
1195 TObjArray arrayFit;
b832d719 1196 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
1197 delete his2D;
0cb93e70 1198
b832d719 1199 his1D = (TH1*) arrayFit.At(1);
1200 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
1201 offsetdZCPos=fpol1->GetParameter(0);
1202 slopedZCPos=fpol1->GetParameter(1);
1203 offsetdZCErrPos=fpol1->GetParError(0);
1204 slopedZCErrPos=fpol1->GetParError(1);
1205 offsetdZCchi2Pos=fpol1->GetChisquare();
1206 slopedZCchi2Pos=fpol1->GetChisquare();
1207 //
1208 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
1209 offsetdZAPos=fpol1->GetParameter(0);
1210 slopedZAPos=fpol1->GetParameter(1);
1211 offsetdZAErrPos=fpol1->GetParError(0);
1212 slopedZAErrPos=fpol1->GetParError(1);
1213 offsetdZAchi2Pos=fpol1->GetChisquare();
1214 slopedZAchi2Pos=fpol1->GetChisquare();
1215 //
1216 printf("Drift velocity QA report\n");
1217 printf("offsetdZAPos\t%f\n",offsetdZAPos);
1218 printf("slopedZAPos\t%f\n",slopedZAPos);
1219 printf("offsetdZCPos\t%f\n",offsetdZCPos);
1220 printf("slopedZCPos\t%f\n",slopedZCPos);
1221 //
1222 // dump drift QA values
1223 //
1224 (*pcstream)<<"tpcQA"<<
1225 "offsetdZAPos="<< offsetdZAPos<<
1226 "slopedZAPos="<< slopedZAPos<<
1227 "offsetdZCPos="<< offsetdZCPos<<
1228 "slopedZCPos="<<slopedZCPos<<
1229 //
1230 "offsetdZAErrPos="<< offsetdZAErrPos<<
1231 "slopedZAErrPos="<< slopedZAErrPos<<
1232 "offsetdZCErrPos="<< offsetdZCErrPos<<
1233 "slopedZCErrPos="<<slopedZCErrPos<<
1234 //
1235 "offsetdZAchi2Pos="<< offsetdZAchi2Pos<<
1236 "slopedZAchi2Pos="<< slopedZAchi2Pos<<
1237 "offsetdZCchi2Pos="<< offsetdZCchi2Pos<<
1238 "slopedZCchi2Pos="<<slopedZCchi2Pos;
1239
1240 return 0;
1241}
1242
1243//_____________________________________________________________________________
70f4b25f 1244Int_t AliTPCPerformanceSummary::AnalyzeDriftNeg(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 1245{
1246 //
1247 // Analyse DCA Z imperferctions (drift velocity)
1248 // for negative particles
1249 //
1250 if (!pcstream) return 128;
1251 if (!pTPC) return 128;
1252
1253 // variables:
1254 static Double_t offsetdZANeg=0;
1255 static Double_t slopedZANeg=0;
1256 static Double_t offsetdZCNeg=0;
1257 static Double_t slopedZCNeg=0;
1258 static Double_t offsetdZAErrNeg=0;
1259 static Double_t slopedZAErrNeg=0;
1260 static Double_t offsetdZCErrNeg=0;
1261 static Double_t slopedZCErrNeg=0;
1262 static Double_t offsetdZAchi2Neg=0;
1263 static Double_t slopedZAchi2Neg=0;
1264 static Double_t offsetdZCchi2Neg=0;
1265 static Double_t slopedZCchi2Neg=0;
1266 TH1* his1D=0;
1267 TH2* his2D=0;
0cb93e70 1268 TH3* his3D=0;
1269
0cb93e70 1270
28bb9d1f 1271 if (pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_4_5_7")) {
1272 his3D = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_4_5_7"));
26a35193 1273 if(!his3D) return 128;
0cb93e70 1274 his3D->GetYaxis()->SetRangeUser(-1,1);
1275 his3D->GetZaxis()->SetRangeUser(0.25,10);
1276 }
1277 if (his3D && !fgForceTHnSparse) {
1278 his2D = dynamic_cast<TH2*>(his3D->Project3D("xy"));
1279 } else {
1280 his2D = pTPC->GetTPCTrackHisto()->Projection(4,5);
1281 }
26a35193 1282 if(!his2D) return 128;
0cb93e70 1283
b832d719 1284 static TF1 *fpol1 = new TF1("fpol1","pol1");
1285 TObjArray arrayFit;
b832d719 1286 his2D->FitSlicesY(0,0,-1,10,"QNR",&arrayFit);
1287 delete his2D;
0cb93e70 1288
b832d719 1289 his1D = (TH1*) arrayFit.At(1);
1290 his1D->Fit(fpol1,"QNRROB=0.8","QNR",-0.8,-0.1);
1291 offsetdZCNeg=fpol1->GetParameter(0);
1292 slopedZCNeg=fpol1->GetParameter(1);
1293 offsetdZCErrNeg=fpol1->GetParError(0);
1294 slopedZCErrNeg=fpol1->GetParError(1);
1295 offsetdZCchi2Neg=fpol1->GetChisquare();
1296 slopedZCchi2Neg=fpol1->GetChisquare();
1297 //
1298 his1D->Fit(fpol1,"QNRROB=0.8","QNR",0.1,0.8);
1299 offsetdZANeg=fpol1->GetParameter(0);
1300 slopedZANeg=fpol1->GetParameter(1);
1301 offsetdZAErrNeg=fpol1->GetParError(0);
1302 slopedZAErrNeg=fpol1->GetParError(1);
1303 offsetdZAchi2Neg=fpol1->GetChisquare();
1304 slopedZAchi2Neg=fpol1->GetChisquare();
1305 //
1306 printf("Drift velocity QA report\n");
1307 printf("offsetdZANeg\t%f\n",offsetdZANeg);
1308 printf("slopedZANeg\t%f\n",slopedZANeg);
1309 printf("offsetdZCNeg\t%f\n",offsetdZCNeg);
1310 printf("slopedZCNeg\t%f\n",slopedZCNeg);
1311 //
1312 // dump drift QA values
1313 //
1314 (*pcstream)<<"tpcQA"<<
1315 "offsetdZANeg="<< offsetdZANeg<<
1316 "slopedZANeg="<< slopedZANeg<<
1317 "offsetdZCNeg="<< offsetdZCNeg<<
1318 "slopedZCNeg="<<slopedZCNeg<<
1319 //
1320 "offsetdZAErrNeg="<< offsetdZAErrNeg<<
1321 "slopedZAErrNeg="<< slopedZAErrNeg<<
1322 "offsetdZCErrNeg="<< offsetdZCErrNeg<<
1323 "slopedZCErrNeg="<<slopedZCErrNeg<<
1324 //
1325 "offsetdZAchi2Neg="<< offsetdZAchi2Neg<<
1326 "slopedZAchi2Neg="<< slopedZAchi2Neg<<
1327 "offsetdZCchi2Neg="<< offsetdZCchi2Neg<<
1328 "slopedZCchi2Neg="<<slopedZCchi2Neg;
1329
1330 return 0;
1331}
1332
1333//_____________________________________________________________________________
70f4b25f 1334Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain, TTreeSRedirector* const pcstream)
b832d719 1335{
1336 //
1337 // Analyse Gain
1338 //
1339
1340 if (!pcstream) return 4;
1341 if (!pTPCgain) return 4;
1342
1343 static TVectorD meanMIPvsSector(36);
1344 static TVectorD sector(36);
1345 static Float_t meanMIP = 0;
1346 static Float_t resolutionMIP = 0;
1347 static Float_t attachSlopeC = 0;
1348 static Float_t attachSlopeA = 0;
2f09a281 1349 static Float_t meanMIPele = 0;
1350 static Float_t resolutionMIPele = 0;
1351 static Float_t electroMIPSeparation = 0;
1352
69878f59 1353 TH1 * his1D = 0;
814d192f 1354 //TH1 * hisProj1D=0;
1355 TH2* his2D=0;
1356
b832d719 1357 meanMIPvsSector.Zero();
1358 //
1359 // select MIP particles
1360 //
1361 pTPCgain->GetDeDxHisto()->GetAxis(7)->SetRangeUser(0.4,0.55);
1362 pTPCgain->GetDeDxHisto()->GetAxis(0)->SetRangeUser(35,60);
1363 pTPCgain->GetDeDxHisto()->GetAxis(6)->SetRangeUser(80,160);
1364 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1);
1365 //
1366 // MIP position and resolution
814d192f 1367 //
b832d719 1368 TF1 gausFit("gausFit","gaus");
814d192f 1369
1370 if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_0") && !fgForceTHnSparse) {
1371 his1D = dynamic_cast<TH1*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_0")->Clone());
1372 } else {
1373 his1D = pTPCgain->GetDeDxHisto()->Projection(0);
1374 }
26a35193 1375 if(!his1D) return 4;
814d192f 1376 his1D->Fit(&gausFit,"QN","QN");
1377
b832d719 1378 meanMIP = gausFit.GetParameter(1);
1379 resolutionMIP = 0;
1380 if (meanMIP!=0) resolutionMIP = gausFit.GetParameter(2)/meanMIP;
814d192f 1381 //removedtotest// delete his1D;
2f09a281 1382
b832d719 1383 //
1384 // MIP position vs. dip angle (attachment)
814d192f 1385 //
1386 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0); // C side
1387 if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_5") && !fgForceTHnSparse) {
1388 his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_5")->Clone());
1389 } else {
1390 his2D = pTPCgain->GetDeDxHisto()->Projection(0,5);
1391 }
26a35193 1392 if(!his2D) return 4;
1393
b832d719 1394 TF1 * fpol = new TF1("fpol","pol1");
1395 TObjArray arrayFit;
814d192f 1396 his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);
69878f59 1397 his1D = (TH1*) arrayFit.At(1);
b832d719 1398 his1D->Fit(fpol,"QNROB=0.8","QNR",-1,0);
1399 attachSlopeC = fpol->GetParameter(1);
2f09a281 1400 //removedtotest// delete his2D;
1401 //removedtotest// delete his1D;
b832d719 1402 //
814d192f 1403 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3); // A side
1404 if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_5") && !fgForceTHnSparse) {
1405 his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_5")->Clone());
1406 } else {
1407 his2D = pTPCgain->GetDeDxHisto()->Projection(0,5);
1408 }
26a35193 1409 if(!his2D) return 4;
1410
b832d719 1411 TF1 * fpolA = new TF1("fpolA","pol1");
1412 TObjArray arrayFitA;
2f09a281 1413 //FitSlicesY(TF1* f1 = 0, Int_t firstxbin = 0, Int_t lastxbin = -1, Int_t cut = 0, Option_t* option = "QNR", TObjArray* arr = 0)
1414 his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);
814d192f 1415 his1D = (TH1*) arrayFit.At(1);
1416 his1D->Fit(fpolA,"QNROB=0.8","QN",0,1);
b832d719 1417 attachSlopeA = fpolA->GetParameter(1);
814d192f 1418 //removedtotest// delete his2D;
1419 //removedtotest// delete his1D;
b832d719 1420 //
1421 // MIP position vs. sector
1422 //
1423 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0); // C side
814d192f 1424 if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_1") && !fgForceTHnSparse) {
1425 his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_1")->Clone());
1426 } else {
1427 his2D = pTPCgain->GetDeDxHisto()->Projection(0,1);
1428 }
26a35193 1429 if(!his2D) return 4;
1430
b832d719 1431 for(Int_t i = 0; i < 18; i++) { // loop over sectors; correct mapping to be checked!
0285b6f5 1432 //TH1* his1D=0;
b832d719 1433 Float_t phiLow = -TMath::Pi() + i*(20./360.)*(2*TMath::Pi());
1434 Float_t phiUp = -TMath::Pi() + (i+1)*(20./360.)*(2*TMath::Pi());
814d192f 1435 //pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
1436 his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
1437 //his1D = pTPCgain->GetDeDxHisto()->Projection(0);
1438 his1D = his2D->ProjectionY();
b832d719 1439 TF1 gausFunc("gausFunc","gaus");
1440 his1D->Fit(&gausFunc, "QN");
1441 meanMIPvsSector(i) = gausFunc.GetParameter(1);
1442 sector(i)=i;
814d192f 1443 //removedtotest// delete his1D;
b832d719 1444 }
814d192f 1445 //removedtotest// delete his2D;
b832d719 1446 //
1447 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3); // A side
814d192f 1448 if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_1") && !fgForceTHnSparse) {
1449 his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_1")->Clone());
1450 } else {
1451 his2D = pTPCgain->GetDeDxHisto()->Projection(0,1);
1452 }
26a35193 1453 if(!his2D) return 4;
1454
b832d719 1455 for(Int_t i = 0; i < 18; i++) { // loop over sectors; correct mapping to be checked!
69878f59 1456 //TH1* his1D=0;
b832d719 1457 Float_t phiLow = -TMath::Pi() + i*(20./360.)*(2*TMath::Pi());
1458 Float_t phiUp = -TMath::Pi() + (i+1)*(20./360.)*(2*TMath::Pi());
814d192f 1459 //pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
1460 his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
1461 //his1D = pTPCgain->GetDeDxHisto()->Projection(0);
1462 his1D = his2D->ProjectionY();
b832d719 1463 TF1 gausFunc("gausFunc","gaus");
1464 his1D->Fit(&gausFunc, "QN");
1465 meanMIPvsSector(i+18) = gausFunc.GetParameter(1);
1466 sector(i+18)=i+18;
814d192f 1467 //removedtotest// delete his1D;
b832d719 1468 }
814d192f 1469 //removedtotest// delete his2D;
2f09a281 1470
1471 //
1472 //
1473 // select electrons
1474 //
1475 pTPCgain->GetDeDxHisto()->GetAxis(7)->SetRangeUser(0.32,0.38); // momenta
1476 pTPCgain->GetDeDxHisto()->GetAxis(0)->SetRangeUser(70,100); // dedx
1477 pTPCgain->GetDeDxHisto()->GetAxis(6)->SetRangeUser(80,160); // nr clusters
1478 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1); // eta
1479
1480 TF1 gausFitEle("gausFitEle","gaus");
1481
1482 if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mipsele_0") && !fgForceTHnSparse) {
1483 his1D = dynamic_cast<TH1*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mipsele_0")->Clone());
1484 } else {
1485 his1D = pTPCgain->GetDeDxHisto()->Projection(0);
1486 }
1487 if(!his1D) return 4;
1488 his1D->Fit(&gausFitEle,"QN","QN");
1489
1490 meanMIPele = gausFitEle.GetParameter(1);
1491 resolutionMIPele = 0;
1492 if (meanMIPele!=0) resolutionMIPele = gausFitEle.GetParameter(2)/meanMIPele;
1493
1494 //restore cuts as before
1495 pTPCgain->GetDeDxHisto()->GetAxis(7)->SetRangeUser(0.4,0.55);
1496 pTPCgain->GetDeDxHisto()->GetAxis(0)->SetRangeUser(35,60);
1497 pTPCgain->GetDeDxHisto()->GetAxis(6)->SetRangeUser(80,160);
1498 pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1);
1499
1500 //
1501 // separation between electrons and MIPs
1502 //
1503 electroMIPSeparation = TMath::Abs((meanMIP-meanMIPele));
1504
b832d719 1505 printf("Gain QA report\n");
1506 printf("MIP mean\t%f\n",meanMIP);
1507 printf("MIP resolution\t%f\n",resolutionMIP);
1508 printf("MIPslopeA\t%f\n",attachSlopeA);
1509 printf("MIPslopeC\t%f\n",attachSlopeC);
2f09a281 1510 printf("Electons energy loss MIP mean\t%f\n",meanMIPele);
1511 printf("Electons MIP resolution\t%f\n",resolutionMIPele);
814d192f 1512 //
1513
b832d719 1514 (*pcstream)<<"tpcQA"<<
2f09a281 1515 "MIPattachSlopeC="<<attachSlopeC<<
1516 "MIPattachSlopeA="<<attachSlopeA<<
1517 "resolutionMIP="<<resolutionMIP<<
1518 "meanMIPvsSector.="<<&meanMIPvsSector<<
1519 "sector.="<<&sector<<
1520 "meanMIP="<<meanMIP<<
1521 "meanMIPele="<<meanMIPele<<
1522 "resolutionMIPele="<<resolutionMIPele<<
1523 "electroMIPSeparation="<<electroMIPSeparation;
1524
b832d719 1525 return 0;
1526}
1527
1528//_____________________________________________________________________________
70f4b25f 1529Int_t AliTPCPerformanceSummary::AnalyzeEvent(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
b832d719 1530{
1531 //
1532 // Analyse Primary Vertex Distribution and Multiplicities
1533 //
1534 if (!pcstream) return 1;
1535 if (!pTPC) return 1;
1536 //
1537 //
1538 //
1539 static Double_t meanVertX=0;
1540 static Double_t rmsVertX=0;
1541 static Double_t meanVertY=0;
1542 static Double_t rmsVertY=0;
1543 static Double_t meanVertZ=0;
1544 static Double_t rmsVertZ=0;
1545 static Double_t vertStatus=0;
1546 static Double_t meanMult=0;
1547 static Double_t rmsMult=0;
1548 static Double_t meanMultPos=0;
1549 static Double_t rmsMultPos=0;
1550 static Double_t meanMultNeg=0;
1551 static Double_t rmsMultNeg=0;
1552 static Double_t vertAll = 0;
1553 static Double_t vertOK = 0;
1554
1555 TH1* his1D=0;
820afb27 1556 TH1* hc=0;
28bb9d1f 1557 if (pTPC->GetHistos()->FindObject("h_tpc_event_6") && !fgForceTHnSparse) {
1558 his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_6")->Clone());
0cb93e70 1559 } else {
1560 his1D = pTPC->GetTPCEventHisto()->Projection(6);
1561 }
26a35193 1562 if(!his1D) return 1;
1563
b832d719 1564 vertAll = his1D->GetEntries();
0cb93e70 1565 vertOK = his1D->GetBinContent(2);
b832d719 1566 if (vertAll>=1) {
1567 vertStatus = vertOK / vertAll;
1568 }
0cb93e70 1569
1570 delete his1D;
1571
1572 pTPC->GetTPCEventHisto()->GetAxis(6)->SetRange(2,2);
1573
28bb9d1f 1574 if (pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_0") && !fgForceTHnSparse) {
1575 his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_0")->Clone());
0cb93e70 1576 } else {
1577 his1D = pTPC->GetTPCEventHisto()->Projection(0);
1578 }
26a35193 1579 if(!his1D) return 1;
1580
b832d719 1581 meanVertX = his1D->GetMean();
1582 rmsVertX = his1D->GetRMS();
1583 delete his1D;
1584
0cb93e70 1585
1586
1587
28bb9d1f 1588 if (pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_1") && !fgForceTHnSparse) {
1589 his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_1")->Clone());
0cb93e70 1590 } else {
1591 his1D = pTPC->GetTPCEventHisto()->Projection(1);
1592 }
26a35193 1593 if(!his1D) return 1;
1594
b832d719 1595 meanVertY = his1D->GetMean();
1596 rmsVertY = his1D->GetRMS();
1597 delete his1D;
1598
0cb93e70 1599
28bb9d1f 1600 if (pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_2") && !fgForceTHnSparse) {
820afb27 1601 hc = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_2"));
1602 if(!hc) return 1;
1603 //his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_2")->Clone());
1604 his1D = (TH1*)hc->Clone();
0cb93e70 1605 } else {
1606 his1D = pTPC->GetTPCEventHisto()->Projection(2);
820afb27 1607 }
26a35193 1608 if(!his1D) return 1;
1609
820afb27 1610 meanVertZ = his1D->GetMean();
b832d719 1611 rmsVertZ = his1D->GetRMS();
1612 delete his1D;
1613
0cb93e70 1614
28bb9d1f 1615 if (pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_3") && !fgForceTHnSparse) {
820afb27 1616 hc = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_3"));
1617 if(!hc) return 1;
1618 //his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_3")->Clone());
1619 his1D = (TH1*)hc->Clone();
0cb93e70 1620 } else {
1621 his1D = pTPC->GetTPCEventHisto()->Projection(3);
1622 }
26a35193 1623 if(!his1D) return 1;
1624
b832d719 1625 meanMult = his1D->GetMean();
1626 rmsMult = his1D->GetRMS();
1627 delete his1D;
1628
0cb93e70 1629
28bb9d1f 1630 if (pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_4") && !fgForceTHnSparse) {
1631 his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_4")->Clone());
0cb93e70 1632 } else {
1633 his1D = pTPC->GetTPCEventHisto()->Projection(4);
1634 }
26a35193 1635 if(!his1D) return 1;
1636
b832d719 1637 meanMultPos = his1D->GetMean();
1638 rmsMultPos = his1D->GetRMS();
1639 delete his1D;
1640
28bb9d1f 1641 if (pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_5") && !fgForceTHnSparse) {
1642 his1D = dynamic_cast<TH1*>(pTPC->GetHistos()->FindObject("h_tpc_event_recvertex_5")->Clone());
0cb93e70 1643 } else {
1644 his1D = pTPC->GetTPCEventHisto()->Projection(5);
1645 }
26a35193 1646 if(!his1D) return 1;
1647
b832d719 1648 meanMultNeg = his1D->GetMean();
1649 rmsMultNeg = his1D->GetRMS();
1650 delete his1D;
1651
0cb93e70 1652 pTPC->GetTPCEventHisto()->GetAxis(6)->SetRange(1,2);
b832d719 1653 //
1654 (*pcstream)<<"tpcQA"<<
1655 "meanVertX="<<meanVertX<<
1656 "rmsVertX="<<rmsVertX<<
1657 "meanVertY="<<meanVertY<<
1658 "rmsVertY="<<rmsVertY<<
1659 "meanVertZ="<<meanVertZ<<
1660 "rmsVertZ="<<rmsVertZ<<
1661 "vertStatus="<<vertStatus<<
1662 "vertAll="<<vertAll<<
1663 "vertOK="<<vertOK<<
1664 "meanMult="<<meanMult<<
1665 "rmsMult="<<rmsMult<<
1666 "meanMultPos="<<meanMultPos<<
1667 "rmsMultPos="<<rmsMultPos<<
1668 "meanMultNeg="<<meanMultNeg<<
1669 "rmsMultNeg="<<rmsMultNeg;
1670
1671 return 0;
1672}
f69eb048 1673
1674//_____________________________________________________________________________
70f4b25f 1675Int_t AliTPCPerformanceSummary::AnalyzePt(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
10d5d625 1676{
1677 //
1678 // Analyse DCA R imperfections for positive particles
1679 //
1680
1681 if (!pcstream) return 256;
1682 if (!pTPC) return 256;
1683
1684 // variables:
1685 static Double_t meanPtAPos = 0;
1686 static Double_t mediumPtAPos = 0;
1687 static Double_t highPtAPos = 0;
1688 static Double_t meanPtCPos = 0;
1689 static Double_t mediumPtCPos = 0;
1690 static Double_t highPtCPos = 0;
1691
1692 static Double_t meanPtANeg = 0;
1693 static Double_t mediumPtANeg = 0;
1694 static Double_t highPtANeg = 0;
1695 static Double_t meanPtCNeg = 0;
1696 static Double_t mediumPtCNeg = 0;
1697 static Double_t highPtCNeg = 0;
1698
70f4b25f 1699 TH3* his3D1=0;
1700 TH3* his3D2=0;
10d5d625 1701
1702 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_7")) {
1703
70f4b25f 1704 his3D1 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_7"));
26a35193 1705 if(!his3D1) return 256;
10d5d625 1706
70f4b25f 1707 his3D1->GetYaxis()->SetRangeUser(0.1,0.8);
10d5d625 1708
70f4b25f 1709 his3D1->GetZaxis()->SetRangeUser(0.25,10);
1710 meanPtAPos = his3D1->GetMean(3);
1711 his3D1->GetZaxis()->SetRangeUser(2,5);
1712 mediumPtAPos = his3D1->GetMean(3);
1713 his3D1->GetZaxis()->SetRangeUser(5,10);
1714 highPtAPos = his3D1->GetMean(3);
10d5d625 1715
70f4b25f 1716 his3D1->GetYaxis()->SetRangeUser(-0.8,-0.1);
10d5d625 1717
70f4b25f 1718 his3D1->GetZaxis()->SetRangeUser(0.25,10);
1719 meanPtCPos = his3D1->GetMean(3);
1720 his3D1->GetZaxis()->SetRangeUser(2,5);
1721 mediumPtCPos = his3D1->GetMean(3);
1722 his3D1->GetZaxis()->SetRangeUser(5,10);
1723 highPtCPos = his3D1->GetMean(3);
10d5d625 1724
70f4b25f 1725 his3D1->GetYaxis()->SetRangeUser(-1,1);
1726 his3D1->GetZaxis()->SetRangeUser(0.25,10);
10d5d625 1727 }
1728
1729
1730 if (pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_7")) {
1731
70f4b25f 1732 his3D2 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_7"));
26a35193 1733 if(!his3D2) return 256;
10d5d625 1734
70f4b25f 1735 his3D2->GetYaxis()->SetRangeUser(0.1,0.8);
1736
1737 his3D2->GetZaxis()->SetRangeUser(0.25,10);
1738 meanPtANeg = his3D2->GetMean(3);
1739 his3D2->GetZaxis()->SetRangeUser(2,5);
1740 mediumPtANeg = his3D2->GetMean(3);
1741 his3D2->GetZaxis()->SetRangeUser(5,10);
1742 highPtANeg = his3D2->GetMean(3);
10d5d625 1743
70f4b25f 1744 his3D2->GetYaxis()->SetRangeUser(-0.8,-0.1);
1745
1746 his3D2->GetZaxis()->SetRangeUser(0.25,10);
1747 meanPtCNeg = his3D2->GetMean(3);
1748 his3D2->GetZaxis()->SetRangeUser(2,5);
1749 mediumPtCNeg = his3D2->GetMean(3);
1750 his3D2->GetZaxis()->SetRangeUser(5,10);
1751 highPtCNeg = his3D2->GetMean(3);
10d5d625 1752
70f4b25f 1753 his3D2->GetYaxis()->SetRangeUser(-1,1);
1754 his3D2->GetZaxis()->SetRangeUser(0.25,10);
10d5d625 1755 }
1756
1757
1758
1759 // dump values
1760 //
1761 (*pcstream)<<"tpcQA"<<
1762 "meanPtAPos="<< meanPtAPos<<
1763 "mediumPtAPos="<< mediumPtAPos<<
1764 "highPtAPos="<< highPtAPos<<
1765 //
1766 "meanPtCPos="<< meanPtCPos<<
1767 "mediumPtCPos="<< mediumPtCPos<<
1768 "highPtCPos="<< highPtCPos<<
1769 //
1770 "meanPtANeg="<< meanPtANeg<<
1771 "mediumPtANeg="<< mediumPtANeg<<
1772 "highPtANeg="<< highPtANeg<<
1773 //
1774 "meanPtCNeg="<< meanPtCNeg<<
1775 "mediumPtCNeg="<< mediumPtCNeg<<
1776 "highPtCNeg="<< highPtCNeg;
1777
1778
1779 return 0;
1780}
1781
1782//_____________________________________________________________________________
1783
70f4b25f 1784Int_t AliTPCPerformanceSummary::AnalyzeChargeOverPt(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream){
10d5d625 1785 //
1786 // Analyse DCA R imperfections for positive particles
1787 //
1788
1789 if (!pcstream) return 512;
1790 if (!pTPC) return 512;
1791
1792 // variables:
1793 static Double_t qOverPt = 0;
1794 static Double_t qOverPtA = 0;
1795 static Double_t qOverPtC = 0;
1796
1797 TH2* his2D=0;
70f4b25f 1798 TH1* his1D1=0;
1799 TH1* his1D2=0;
1800 TH1* his1D3=0;
10d5d625 1801 TF1 *fp1 = new TF1("fp1","pol2",-1.0,1.0);
1802 TF1 *fp2 = new TF1("fp2","pol2",-1.0,1.0);
1803 TF1 *fp3 = new TF1("fp3","pol2",-1.0,1.0);
1804
1805 if (pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_5_8")) {
1806
1807 his2D = dynamic_cast<TH2*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_5_8"));
26a35193 1808 if(!his2D) return 512;
10d5d625 1809
70f4b25f 1810 his1D1 = his2D->ProjectionX();
1811 his1D1->Fit(fp1,"R");
10d5d625 1812 if(fp1->GetParameter(2)!=0){
1813 qOverPt = (-1.0)*(fp1->GetParameter(1)/(2.0*fp1->GetParameter(2)));
1814 }
1815 delete fp1;
70f4b25f 1816 delete his1D1;
10d5d625 1817
1818 his2D->GetYaxis()->SetRangeUser(0.1,0.8);
70f4b25f 1819 his1D2 = his2D->ProjectionX();
1820 his1D2->Fit(fp2,"R");
10d5d625 1821 if(fp2->GetParameter(2)!=0)
1822 qOverPtA = (-1.0)*(fp2->GetParameter(1)/(2.0*fp2->GetParameter(2)));
1823 delete fp2;
70f4b25f 1824 delete his1D2;
10d5d625 1825
1826 his2D->GetYaxis()->SetRangeUser(-0.8,-0.1);
70f4b25f 1827 his1D3 = his2D->ProjectionX();
1828 his1D3->Fit(fp3,"R");
10d5d625 1829 if(fp3->GetParameter(2)!=0)
1830 qOverPtC = (-1.0)*(fp3->GetParameter(1)/(2.0*fp3->GetParameter(2)));
1831 delete fp3;
70f4b25f 1832 delete his1D3;
10d5d625 1833
1834 his2D->GetYaxis()->SetRangeUser(-1.0,1.0);
1835 }
1836
1837
1838 (*pcstream)<<"tpcQA"<<
1839 "qOverPt="<< qOverPt<<
1840 "qOverPtA="<< qOverPtA<<
1841 "qOverPtC="<< qOverPtC;
1842
1843 return 0;
1844}
1845
1833a193 1846Int_t AliTPCPerformanceSummary::AnalyzeMatch(const AliPerformanceMatch* pMatch, TTreeSRedirector* const pcstream)
f69eb048 1847{
1833a193 1848 /* if ((pMatch == 0) or (0 == pcstream)) { printf("this will not work anyway..."); }
1849 printf("funtion not implemented");*/
1850
1851 if (!pcstream) return 1024;
1852 if (!pMatch) return 1024;
1853 static Double_t tpcItsMatchA = 0;
1854 static Double_t tpcItsMatchHighPtA = 0;
1855 static Double_t tpcItsMatchC = 0;
1856 static Double_t tpcItsMatchHighPtC = 0;
1857
1858 TH2 *h2D = 0;
1859 TH2 *h2D1 = 0;
1860 if(pMatch->GetHistos()->FindObject("h_tpc_match_trackingeff_all_2_3") &&
1861 pMatch->GetHistos()->FindObject("h_tpc_match_trackingeff_tpc_2_3")){
1862 h2D = dynamic_cast<TH2*>(pMatch->GetHistos()->FindObject("h_tpc_match_trackingeff_all_2_3"));
1863 h2D1 = dynamic_cast<TH2*>(pMatch->GetHistos()->FindObject("h_tpc_match_trackingeff_tpc_2_3"));
8f5423ae 1864
1865 if(!h2D) return 4;
1866 if(!h2D1) return 4;
1833a193 1867
1868 h2D->GetXaxis()->SetRangeUser(0,1.5);
1869 h2D1->GetXaxis()->SetRangeUser(0,1.5);
1870
1871 Double_t entries,entries1;
1872 entries = h2D->GetEffectiveEntries();
1873 entries1 = h2D1->GetEffectiveEntries();
1874 if(entries > 0)
1875 tpcItsMatchA = entries1/entries;
1876
9f5fbaba 1877 h2D->GetYaxis()->SetRangeUser(4.01,20.);
1878 h2D1->GetYaxis()->SetRangeUser(4.01,20.);
1833a193 1879 entries = h2D->GetEffectiveEntries();
1880 entries1 = h2D1->GetEffectiveEntries();
1881 if(entries > 0)
9f5fbaba 1882 tpcItsMatchHighPtA = entries1/entries;
1833a193 1883
1884
9f5fbaba 1885 h2D->GetXaxis()->SetRangeUser(-1.5,-0.01);
1886 h2D1->GetXaxis()->SetRangeUser(-1.5,-0.01);
1833a193 1887 h2D->GetYaxis()->SetRangeUser(0.0,20.);
1888 h2D1->GetYaxis()->SetRangeUser(0.0,20.);
1889
1890 entries = h2D->GetEffectiveEntries();
1891 entries1 = h2D1->GetEffectiveEntries();
1892 if(entries > 0)
1893 tpcItsMatchC = entries1/entries;
1894
9f5fbaba 1895 h2D->GetYaxis()->SetRangeUser(4.01,20.);
1896 h2D1->GetYaxis()->SetRangeUser(4.01,20.);
1833a193 1897 entries = h2D->GetEffectiveEntries();
1898 entries1 = h2D1->GetEffectiveEntries();
1899 if(entries > 0)
1900 tpcItsMatchHighPtC = entries1/entries;
1901
1902 h2D->GetXaxis()->SetRangeUser(-1.5,1.5);
1903 h2D1->GetXaxis()->SetRangeUser(-1.5,1.5);
1904 h2D->GetYaxis()->SetRangeUser(0.0,20.);
1905 h2D1->GetYaxis()->SetRangeUser(0.0,20.);
1906 // delete h2D;
1907 // delete h2D1;
1908 }
1909
1910 (*pcstream)<<"tpcQA"<<
1911 "tpcItsMatchA="<< tpcItsMatchA<<
1912 "tpcItsMatchHighPtA="<< tpcItsMatchHighPtA<<
1913 "tpcItsMatchC="<< tpcItsMatchC<<
1914 "tpcItsMatchHighPtC="<< tpcItsMatchHighPtC;
1915
1916 return 0;
1917}
1918
1919Int_t AliTPCPerformanceSummary::AnalyzePull(const AliPerformanceMatch* pPull, TTreeSRedirector* const pcstream)
1920{
1921 /* if ((pPull == 0) or (0 == pcstream)) { printf("this will not work anyway..."); }
1922 printf("funtion not implemented");*/
1923
1924 if (!pcstream) return 2048;
1925 if (!pPull) return 2048;
1926 static Double_t phiPull = 0;
1927 static Double_t phiPullHighPt = 0;
1928 static Double_t ptPull = 0;
1929 static Double_t ptPullHighPt = 0;
1930 static Double_t yPull = 0;
1931 static Double_t yPullHighPt = 0;
1932 static Double_t zPull = 0;
1933 static Double_t zPullHighPt = 0;
1934 static Double_t lambdaPull = 0;
1935 static Double_t lambdaPullHighPt = 0;
1936
1937 TH2 *h2D1 = 0;
1938 if(pPull->GetHistos()->FindObject("h_tpc_match_pull_2_7")){
1939 h2D1 = dynamic_cast<TH2*>(pPull->GetHistos()->FindObject("h_tpc_match_pull_2_7"));
8f5423ae 1940 if(!h2D1) return 4;
1833a193 1941 phiPull = h2D1->GetMean(2);
1942 h2D1->SetAxisRange(0.0,1.0/5.0,"X");
1943 phiPullHighPt = h2D1->GetMean(2);
1944 h2D1->SetAxisRange(0.0,10.0,"X");
1945 // delete h2D1;
1946 }
1947
1948 TH2 *h2D2 = 0;
1949 if(pPull->GetHistos()->FindObject("h_tpc_match_pull_4_7")){
1950 h2D2 = dynamic_cast<TH2*>(pPull->GetHistos()->FindObject("h_tpc_match_pull_4_7"));
8f5423ae 1951 if(!h2D2) return 4;
1833a193 1952 ptPull = h2D2->GetMean(2);
1953
1954 h2D2->SetAxisRange(0.0,1.0/5.0,"X");
1955 ptPullHighPt = h2D2->GetMean(2);
1956 h2D2->SetAxisRange(0.0,10.0,"X");
1957 // delete h2D2;
1958 }
1959
1960 TH2 *h2D3 = 0;
1961 if(pPull->GetHistos()->FindObject("h_tpc_match_pull_0_7")){
1962 h2D3 = dynamic_cast<TH2*>(pPull->GetHistos()->FindObject("h_tpc_match_pull_0_7"));
8f5423ae 1963 if(!h2D3) return 4;
1833a193 1964 yPull = h2D3->GetMean(2);
1965
1966 h2D3->SetAxisRange(0.0,1.0/5.0,"X");
1967 yPullHighPt = h2D3->GetMean(2);
1968 h2D3->SetAxisRange(0.0,10.0,"X");
1969 // delete h2D3;
1970 }
1971
1972 TH2 *h2D4 = 0;
1973 if(pPull->GetHistos()->FindObject("h_tpc_match_pull_1_7")){
1974 h2D4 = dynamic_cast<TH2*>(pPull->GetHistos()->FindObject("h_tpc_match_pull_1_7"));
8f5423ae 1975 if(!h2D4) return 4;
1833a193 1976 zPull = h2D4->GetMean(2);
1977
1978 h2D4->SetAxisRange(0.0,1.0/5.0,"X");
1979 zPullHighPt = h2D4->GetMean(2);
1980 h2D4->SetAxisRange(0.0,10.0,"X");
1981 // delete h2D4;
1982 }
1983
1984 TH2 *h2D5 = 0;
1985 if(pPull->GetHistos()->FindObject("h_tpc_match_pull_3_7")){
1986 h2D5 = dynamic_cast<TH2*>(pPull->GetHistos()->FindObject("h_tpc_match_pull_3_7"));
8f5423ae 1987 if(!h2D5) return 4;
1833a193 1988 lambdaPull = h2D5->GetMean(2);
1989
1990 h2D5->SetAxisRange(0.0,1.0/5.0,"X");
1991 lambdaPullHighPt = h2D5->GetMean(2);
1992 h2D5->SetAxisRange(0.0,10.0,"X");
1993 // delete h2D5;
1994}
1995
1996 (*pcstream)<<"tpcQA"<<
1997 "phiPull="<< phiPull<<
1998 "phiPullHighPt="<< phiPullHighPt<<
1999 "ptPull="<< ptPull<<
2000 "ptPullHighPt="<< ptPullHighPt<<
2001 "yPull="<< yPull<<
2002 "yPullHighPt="<< yPullHighPt<<
2003 "zPull="<< zPull<<
2004 "zPullHighPt="<< zPullHighPt<<
2005 "lambdaPull="<< lambdaPull<<
2006 "lambdaPullHighPt="<< lambdaPullHighPt;
2007
2008 return 0;
f69eb048 2009}
9f5fbaba 2010Int_t AliTPCPerformanceSummary::AnalyzeConstrain(const AliPerformanceMatch* pConstrain, TTreeSRedirector* pcstream)
2011{
2012 if (!pcstream) return 5126;
2013 if (!pConstrain) return 5126;
2014
2015 TH3* his3D=0;
2016 static Double_t tpcConstrainPhiA = 0;
2017 static Double_t tpcConstrainPhiC = 0;
2018
2019 if (pConstrain->GetHistos()->FindObject("h_tpc_constrain_tpc_0_2_3")) {
2020
2021 his3D = dynamic_cast<TH3*>(pConstrain->GetHistos()->FindObject("h_tpc_constrain_tpc_0_2_3"));//phi pull:pt:eta
2022 if(!his3D) return 5126;
2023
2024 his3D->GetZaxis()->SetRangeUser(0.0,1.0);
2025 tpcConstrainPhiA = his3D->GetMean(1);
2026 his3D->GetZaxis()->SetRangeUser(-1.0,-0.001);
2027 tpcConstrainPhiC = his3D->GetMean(1);
2028 }
2029
2030 (*pcstream)<<"tpcQA"<<
2031 "tpcConstrainPhiA="<<tpcConstrainPhiA <<
2032 "tpcConstrainPhiC="<< tpcConstrainPhiC;
2033
2034 return 0;
2035}
ac617c68 2036
2037//_____________________________________________________________________________
2038 Int_t AliTPCPerformanceSummary::AnalyzeQAPosNegDpT(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
2039{
2040 //function which plot 1/Pt for negative and
2041 //positive particles
2042
2043 if (!pcstream) return 512;
2044 if (!pTPC) return 512;
2045
2046 TH3D* pos3=0;
2047 TH3D* neg3=0;
2048 TH1D* pos=0;
2049 TH1D* neg=0;
2050 TH1D* posC=0;
2051 TH1D* negC=0;
2052 TH1D* posA=0;
2053 TH1D* negA=0;
2054 static Double_t deltaPtC = 0;
2055 static Double_t deltaPtchi2C = 0;
2056 static Double_t slopeC = 0;
2057 static Double_t deltaPtA = 0;
2058 static Double_t deltaPtchi2A = 0;
2059 static Double_t slopeA = 0;
2060 static Double_t deltaPt = 0;
2061 static Double_t deltaPtchi2 = 0;
2062 static Double_t slope = 0;
2063 static Double_t deltaPt_Err = 0;
2064 static Double_t deltaPtA_Err = 0;
2065 static Double_t deltaPtC_Err = 0;
2066
2067
2068//C side
2069
2070 if(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_0_5_7"))
2071 {
2072 pos3 = dynamic_cast<TH3D*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_0_5_7"));
2073 if(!pos3) return 512;
2074
2075 pos = pos3->ProjectionZ("pos",71,-1,6,25);
2076 posC = pos3->ProjectionZ("posC",71,-1,6,15);
2077 posA = pos3->ProjectionZ("posA",71,-1,16,25);
2078 }
2079
2080 if(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_0_5_7")){
2081 neg3 = dynamic_cast<TH3D*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_0_5_7"));
2082 if(!neg3) return 512;
2083
2084 neg = neg3->ProjectionZ("neg",71,-1,6,25);
2085 negC = neg3->ProjectionZ("negC",71,-1,6,15);
2086 negA = neg3->ProjectionZ("negA",71,-1,16,25);
2087}
2088
004e3919 2089if(!pos) return 512;
2090if(!neg) return 512;
2091if(!posA) return 512;
2092if(!negA) return 512;
2093if(!posC) return 512;
2094if(!negC) return 512;
ac617c68 2095
2096pos->Sumw2();
2097neg->Sumw2();
2098posA->Sumw2();
2099negA->Sumw2();
2100posC->Sumw2();
2101negC->Sumw2();
2102
2103pos->Scale(1.,"width");
2104neg->Scale(1.,"width");
2105posA->Scale(1.,"width");
2106negA->Scale(1.,"width");
2107posC->Scale(1.,"width");
2108negC->Scale(1.,"width");
2109
2110//both sides
2111
2112TF1 fpt("fpt","[1]*exp(-1/((1/x))*[0])",0.1,10);
2113TF1 fpt2("fpt2","[1]*exp(-1/((1/x))*[0])",0.1,10);
2f09a281 2114fpt.SetParameters(1,0.5);
2115fpt2.SetParameters(1,0.5);
ac617c68 2116pos->Fit(&fpt,"","",1,4); pos->Fit(&fpt,"","",1,4); pos->Fit(&fpt,"","",1,4);
2117neg->Fit(&fpt2,"","",1,4); neg->Fit(&fpt2,"","",1,4); neg->Fit(&fpt2,"","",1,4);
2118
2119slope = (fpt.GetParameter(0)+fpt2.GetParameter(0))/2.;
2120
2121TH1D* ratio = new TH1D(*pos);
2122ratio->Divide(neg);
2123
2124ratio->Draw();
2125TF1 fptRatio("fptratio","[2]*exp(-1/((1/x)+[1])*[0])/exp(-1/((1/x)-[1])*[0])",0.1,10);
2f09a281 2126fptRatio.SetParameters(0.5,0.006,1);
ac617c68 2127fptRatio.FixParameter(0,slope);
2128fptRatio.Draw();
2129ratio->Fit(&fptRatio,"","",1,4); ratio->Fit(&fptRatio,"","",1,4);
2130ratio->Fit(&fptRatio,"","",1,4);
2131
2132deltaPt = fptRatio.GetParameter(1);
2133deltaPtchi2 = fptRatio.GetChisquare();
2134
2135//get the errors
2136deltaPt_Err = fptRatio.GetParError(1);
2137
2138
2139//A side
2140
2141TF1 fptA("fptA","[1]*exp(-1/((1/x))*[0])",0.1,10);
2142TF1 fpt2A("fpt2A","[1]*exp(-1/((1/x))*[0])",0.1,10);
2f09a281 2143fptA.SetParameters(1,0.5);
2144fpt2A.SetParameters(1,0.5);
ac617c68 2145posA->Fit(&fptA,"","",1,4); posA->Fit(&fptA,"","",1,4); posA->Fit(&fptA,"","",1,4);
2146negA->Fit(&fpt2A,"","",1,4); negA->Fit(&fpt2A,"","",1,4); negA->Fit(&fpt2A,"","",1,4);
2147
2148slopeA = (fptA.GetParameter(0)+fpt2A.GetParameter(0))/2.;
2149
2150TH1D* ratioA = new TH1D(*posA);
2151ratioA->Divide(negA);
2152
2153ratioA->Draw();
2154TF1 fptRatioA("fptratioA","[2]*exp(-1/((1/x)+[1])*[0])/exp(-1/((1/x)-[1])*[0])",0.1,10);
2155fptRatioA.SetParameters(0.5,0.006,1);
2156fptRatioA.FixParameter(0,slopeA);
2157fptRatioA.Draw();
2158ratioA->Fit(&fptRatioA,"","",1,4); ratio->Fit(&fptRatioA,"","",1,4);
2159ratioA->Fit(&fptRatioA,"","",1,4);
2160
2161deltaPtA = fptRatioA.GetParameter(1);
2162deltaPtchi2A = fptRatioA.GetChisquare();
2163
2164//get the errors
2165deltaPtA_Err = fptRatioA.GetParError(1);
2166
2167 delete ratioA;
2168 delete pos;
2169 delete neg;
2170
2171
2172//C side
2173TF1 fptC("fptC","[1]*exp(-1/((1/x))*[0])",0.1,10);
2174TF1 fpt2C("fpt2C","[1]*exp(-1/((1/x))*[0])",0.1,10);
2f09a281 2175fptC.SetParameters(1,0.5);
2176fpt2C.SetParameters(1,0.5);
ac617c68 2177posC->Fit(&fptC,"","",1,4); posC->Fit(&fptC,"","",1,4); posC->Fit(&fptC,"","",1,4);
2178negC->Fit(&fpt2C,"","",1,4); negC->Fit(&fpt2C,"","",1,4); negC->Fit(&fpt2C,"","",1,4);
2179
2180slopeC = (fptC.GetParameter(0)+fpt2C.GetParameter(0))/2.;
2181
2182TH1D* ratioC = new TH1D(*posC);
2183ratioC->Divide(negC);
2184
2185ratioC->Draw();
2186TF1 fptRatioC("fptratioC","[2]*exp(-1/((1/x)+[1])*[0])/exp(-1/((1/x)-[1])*[0])",0.1,10);
2f09a281 2187fptRatioC.SetParameters(0.5,0.006,1);
ac617c68 2188fptRatioC.FixParameter(0,slopeC);
2189fptRatioC.Draw();
2190ratioC->Fit(&fptRatioC,"","",1,4); ratio->Fit(&fptRatioC,"","",1,4);
2191ratioC->Fit(&fptRatioC,"","",1,4);
2192
2193deltaPtC = fptRatioC.GetParameter(1);
2194deltaPtchi2C = fptRatioC.GetChisquare();
2195
2196//get the errors
2197deltaPtC_Err = fptRatioC.GetParError(1);
2198
2199
2200 delete posC;
2201 delete negC;
2202 delete ratioC;
2203
2204 (*pcstream)<<"tpcQA"<<
2205 "deltaPt="<< deltaPt<<
2206 "deltaPtchi2="<< deltaPtchi2<<
2207 "deltaPtA="<< deltaPtA<<
2208 "deltaPtchi2A="<< deltaPtchi2A<<
2209 "deltaPtC="<< deltaPtC<<
2210 "deltaPtchi2C="<< deltaPtchi2C<<
2211 "deltaPt_Err="<< deltaPt_Err<<
2212 "deltaPtA_Err="<< deltaPtA_Err<<
2213 "deltaPtC_Err="<< deltaPtC_Err;
2214
2215 return 0;
2216}
2217
2218//_____________________________________________________________________________
2219 Int_t AliTPCPerformanceSummary::AnalyzeQADCAFitParameter(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
2220{
2221
2222 //
2223 //function which retrieve DCA fit parameters
2224 //
2225
2226 if (!pcstream) return 16;
2227 if (!pTPC) return 16;
2228
2229 TH3* dcar_pos3=0;
2230 TH3* dcaz_pos3=0;
2231 TH3* dcar_neg3=0;
2232 TH3* dcaz_neg3=0;
2233
2234 static Double_t dcar_posA_0=0;
2235 static Double_t dcar_posA_1=0;
2236 static Double_t dcar_posA_2=0;
2237 static Double_t dcar_posA_chi2=0;
2238 static Double_t dcar_posA_0_Err=0;
2239 static Double_t dcar_posA_1_Err=0;
2240 static Double_t dcar_posA_2_Err=0;
2241
2242 static Double_t dcar_posC_0=0;
2243 static Double_t dcar_posC_1=0;
2244 static Double_t dcar_posC_2=0;
2245 static Double_t dcar_posC_chi2=0;
2246 static Double_t dcar_posC_0_Err=0;
2247 static Double_t dcar_posC_1_Err=0;
2248 static Double_t dcar_posC_2_Err=0;
2249
2250 static Double_t dcaz_posA_0=0;
2251 static Double_t dcaz_posA_1=0;
2252 static Double_t dcaz_posA_2=0;
2253 static Double_t dcaz_posA_chi2=0;
2254 static Double_t dcaz_posA_0_Err=0;
2255 static Double_t dcaz_posA_1_Err=0;
2256 static Double_t dcaz_posA_2_Err=0;
2257
2258 static Double_t dcaz_posC_0=0;
2259 static Double_t dcaz_posC_1=0;
2260 static Double_t dcaz_posC_2=0;
2261 static Double_t dcaz_posC_chi2=0;
2262 static Double_t dcaz_posC_0_Err=0;
2263 static Double_t dcaz_posC_1_Err=0;
2264 static Double_t dcaz_posC_2_Err=0;
2265
2266 static Double_t dcar_negA_0=0;
2267 static Double_t dcar_negA_1=0;
2268 static Double_t dcar_negA_2=0;
2269 static Double_t dcar_negA_chi2=0;
2270 static Double_t dcar_negA_0_Err=0;
2271 static Double_t dcar_negA_1_Err=0;
2272 static Double_t dcar_negA_2_Err=0;
2273
2274 static Double_t dcar_negC_0=0;
2275 static Double_t dcar_negC_1=0;
2276 static Double_t dcar_negC_2=0;
2277 static Double_t dcar_negC_chi2=0;
2278 static Double_t dcar_negC_0_Err=0;
2279 static Double_t dcar_negC_1_Err=0;
2280 static Double_t dcar_negC_2_Err=0;
2281
2282 static Double_t dcaz_negA_0=0;
2283 static Double_t dcaz_negA_1=0;
2284 static Double_t dcaz_negA_2=0;
2285 static Double_t dcaz_negA_chi2=0;
2286 static Double_t dcaz_negA_0_Err=0;
2287 static Double_t dcaz_negA_1_Err=0;
2288 static Double_t dcaz_negA_2_Err=0;
2289
2290 static Double_t dcaz_negC_0=0;
2291 static Double_t dcaz_negC_1=0;
2292 static Double_t dcaz_negC_2=0;
2293 static Double_t dcaz_negC_chi2=0;
2294 static Double_t dcaz_negC_0_Err=0;
2295 static Double_t dcaz_negC_1_Err=0;
2296 static Double_t dcaz_negC_2_Err=0;
2297
2298 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {
2299 dcar_pos3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6"));
2300 }
2301
2302 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {
2303 dcaz_pos3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_4_5_6"));
2304 }
2305
2306 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {
2307 dcar_neg3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_3_5_6"));
2308 }
2309
2310 if (pTPC->GetHistos()->FindObject("h_tpc_track_pos_recvertex_3_5_6")) {
2311 dcaz_neg3 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_neg_recvertex_4_5_6"));
2312 }
2313
2314 TF1 fit("fit","[0]+[1]*cos(x)+[2]*sin(x)",0,7);
2315
2316 dcar_pos3->GetYaxis()->SetRangeUser(0,0.99);
2317 TH1* dcar_posA = (dynamic_cast<TH2*>(dcar_pos3->Project3D("xz_1")))->ProfileX();
2318 dcar_posA->Fit(&fit,"NQ");
2319 dcar_posA_0 = fit.GetParameter(0);
2320 dcar_posA_1 = fit.GetParameter(1);
2321 dcar_posA_2 = fit.GetParameter(2);
2322 dcar_posA_chi2 = fit.GetChisquare();
2323 dcar_posA_0_Err = fit.GetParError(0);
2324 dcar_posA_1_Err = fit.GetParError(1);
2325 dcar_posA_2_Err = fit.GetParError(2);
2326
2327 dcar_pos3->GetYaxis()->SetRangeUser(-1.0,-0.01);
2328 TH1* dcar_posC = (dynamic_cast<TH2*>(dcar_pos3->Project3D("xz_2")))->ProfileX();
2329 dcar_posC->Fit(&fit,"NQ");
2330 dcar_posC_0 = fit.GetParameter(0);
2331 dcar_posC_1 = fit.GetParameter(1);
2332 dcar_posC_2 = fit.GetParameter(2);
2333 dcar_posC_chi2 = fit.GetChisquare();
2334 dcar_posC_0_Err = fit.GetParError(0);
2335 dcar_posC_1_Err = fit.GetParError(1);
2336 dcar_posC_2_Err = fit.GetParError(2);
2337
2338 dcaz_pos3->GetYaxis()->SetRangeUser(0,0.99);
2339 TH1* dcaz_posA = (dynamic_cast<TH2*>(dcaz_pos3->Project3D("xz_3")))->ProfileX();
2340 dcaz_posA->Fit(&fit,"NQ");
2341 dcaz_posA_0 = fit.GetParameter(0);
2342 dcaz_posA_1 = fit.GetParameter(1);
2343 dcaz_posA_2 = fit.GetParameter(2);
2344 dcaz_posA_chi2 = fit.GetChisquare();
2345 dcaz_posA_0_Err = fit.GetParError(0);
2346 dcaz_posA_1_Err = fit.GetParError(1);
2347 dcaz_posA_2_Err = fit.GetParError(2);
2348
2349 dcaz_pos3->GetYaxis()->SetRangeUser(-1.0,-0.01);
2350 TH1* dcaz_posC = (dynamic_cast<TH2*>(dcaz_pos3->Project3D("xz_4")))->ProfileX();
2351 dcaz_posC->Fit(&fit,"NQ");
2352 dcaz_posC_0 = fit.GetParameter(0);
2353 dcaz_posC_1 = fit.GetParameter(1);
2354 dcaz_posC_2 = fit.GetParameter(2);
2355 dcaz_posC_chi2 = fit.GetChisquare();
2356 dcaz_posC_0_Err = fit.GetParError(0);
2357 dcaz_posC_1_Err = fit.GetParError(1);
2358 dcaz_posC_2_Err = fit.GetParError(2);
2359
2360
2361
2362 dcar_neg3->GetYaxis()->SetRangeUser(0,0.99);
2363 TH1* dcar_negA = (dynamic_cast<TH2*>(dcar_neg3->Project3D("xz_1")))->ProfileX();
2364 dcar_negA->Fit(&fit,"NQ");
2365 dcar_negA_0 = fit.GetParameter(0);
2366 dcar_negA_1 = fit.GetParameter(1);
2367 dcar_negA_2 = fit.GetParameter(2);
2368 dcar_negA_chi2 = fit.GetChisquare();
2369 dcar_negA_0_Err = fit.GetParError(0);
2370 dcar_negA_1_Err = fit.GetParError(1);
2371 dcar_negA_2_Err = fit.GetParError(2);
2372
2373 dcar_neg3->GetYaxis()->SetRangeUser(-1.0,-0.01);
2374 TH1* dcar_negC = (dynamic_cast<TH2*>(dcar_neg3->Project3D("xz_2")))->ProfileX();
2375 dcar_negC->Fit(&fit,"NQ");
2376 dcar_negC_0 = fit.GetParameter(0);
2377 dcar_negC_1 = fit.GetParameter(1);
2378 dcar_negC_2 = fit.GetParameter(2);
2379 dcar_negC_chi2 = fit.GetChisquare();
2380 dcar_negC_0_Err = fit.GetParError(0);
2381 dcar_negC_1_Err = fit.GetParError(1);
2382 dcar_negC_2_Err = fit.GetParError(2);
2383
2384 dcaz_neg3->GetYaxis()->SetRangeUser(0,0.99);
2385 TH1* dcaz_negA = (dynamic_cast<TH2*>(dcaz_neg3->Project3D("xz_3")))->ProfileX();
2386 dcaz_negA->Fit(&fit,"NQ");
2387 dcaz_negA_0 = fit.GetParameter(0);
2388 dcaz_negA_1 = fit.GetParameter(1);
2389 dcaz_negA_2 = fit.GetParameter(2);
2390 dcaz_negA_chi2 = fit.GetChisquare();
2391 dcaz_negA_0_Err = fit.GetParError(0);
2392 dcaz_negA_1_Err = fit.GetParError(1);
2393 dcaz_negA_2_Err = fit.GetParError(2);
2394
2395 dcaz_neg3->GetYaxis()->SetRangeUser(-1.0,-0.01);
2396 TH1* dcaz_negC = (dynamic_cast<TH2*>(dcaz_neg3->Project3D("xz_4")))->ProfileX();
2397 dcaz_negC->Fit(&fit,"NQ");
2398 dcaz_negC_0 = fit.GetParameter(0);
2399 dcaz_negC_1 = fit.GetParameter(1);
2400 dcaz_negC_2 = fit.GetParameter(2);
2401 dcaz_negC_chi2 = fit.GetChisquare();
2402 dcaz_negC_0_Err = fit.GetParError(0);
2403 dcaz_negC_1_Err = fit.GetParError(1);
2404 dcaz_negC_2_Err = fit.GetParError(2);
2405
2406
2407// store results (shift in dca) in ttree
2408
2409 (*pcstream)<<"tpcQA"<<
2410 "dcar_posA_0="<< dcar_posA_0<<
2411 "dcar_posA_1="<< dcar_posA_1<<
2412 "dcar_posA_2="<< dcar_posA_2<<
2413 "dcar_posA_chi2="<< dcar_posA_chi2<<
2414 "dcar_posA_0_Err="<< dcar_posA_0_Err<<
2415 "dcar_posA_1_Err="<< dcar_posA_1_Err<<
2416 "dcar_posA_2_Err="<< dcar_posA_2_Err;
2417
2418 (*pcstream)<<"tpcQA"<<
2419 "dcaz_posA_0="<< dcaz_posA_0<<
2420 "dcaz_posA_1="<< dcaz_posA_1<<
2421 "dcaz_posA_2="<< dcaz_posA_2<<
2422 "dcaz_posA_chi2="<< dcaz_posA_chi2<<
2423 "dcaz_posA_0_Err="<< dcaz_posA_0_Err<<
2424 "dcaz_posA_1_Err="<< dcaz_posA_1_Err<<
2425 "dcaz_posA_2_Err="<< dcaz_posA_2_Err;
2426
2427 (*pcstream)<<"tpcQA"<<
2428 "dcaz_posC_0="<< dcaz_posC_0<<
2429 "dcaz_posC_1="<< dcaz_posC_1<<
2430 "dcaz_posC_2="<< dcaz_posC_2<<
2431 "dcaz_posC_chi2="<< dcaz_posC_chi2<<
2432 "dcaz_posC_0_Err="<< dcaz_posC_0_Err<<
2433 "dcaz_posC_1_Err="<< dcaz_posC_1_Err<<
2434 "dcaz_posC_2_Err="<< dcaz_posC_2_Err;
2435
2436 (*pcstream)<<"tpcQA"<<
2437 "dcar_posC_0="<< dcar_posC_0<<
2438 "dcar_posC_1="<< dcar_posC_1<<
2439 "dcar_posC_2="<< dcar_posC_2<<
2440 "dcar_posC_chi2="<< dcar_posC_chi2<<
2441 "dcar_posC_0_Err="<< dcar_posC_0_Err<<
2442 "dcar_posC_1_Err="<< dcar_posC_1_Err<<
2443 "dcar_posC_2_Err="<< dcar_posC_2_Err;
2444
2445
2446 (*pcstream)<<"tpcQA"<<
2447 "dcar_negA_0="<< dcar_negA_0<<
2448 "dcar_negA_1="<< dcar_negA_1<<
2449 "dcar_negA_2="<< dcar_negA_2<<
2450 "dcar_negA_chi2="<< dcar_negA_chi2<<
2451 "dcar_negA_0_Err="<< dcar_negA_0_Err<<
2452 "dcar_negA_1_Err="<< dcar_negA_1_Err<<
2453 "dcar_negA_2_Err="<< dcar_negA_2_Err;
2454
2455 (*pcstream)<<"tpcQA"<<
2456 "dcaz_negA_0="<< dcaz_negA_0<<
2457 "dcaz_negA_1="<< dcaz_negA_1<<
2458 "dcaz_negA_2="<< dcaz_negA_2<<
2459 "dcaz_negA_chi2="<< dcaz_negA_chi2<<
2460 "dcaz_negA_0_Err="<< dcaz_negA_0_Err<<
2461 "dcaz_negA_1_Err="<< dcaz_negA_1_Err<<
2462 "dcaz_negA_2_Err="<< dcaz_negA_2_Err;
2463
2464 (*pcstream)<<"tpcQA"<<
2465 "dcaz_negC_0="<< dcaz_negC_0<<
2466 "dcaz_negC_1="<< dcaz_negC_1<<
2467 "dcaz_negC_2="<< dcaz_negC_2<<
2468 "dcaz_negC_chi2="<< dcaz_negC_chi2<<
2469 "dcaz_negC_0_Err="<< dcaz_negC_0_Err<<
2470 "dcaz_negC_1_Err="<< dcaz_negC_1_Err<<
2471 "dcaz_negC_2_Err="<< dcaz_negC_2_Err;
2472
2473 (*pcstream)<<"tpcQA"<<
2474 "dcar_negC_0="<< dcar_negC_0<<
2475 "dcar_negC_1="<< dcar_negC_1<<
2476 "dcar_negC_2="<< dcar_negC_2<<
2477 "dcar_negC_chi2="<< dcar_negC_chi2<<
2478 "dcar_negC_0_Err="<< dcar_negC_0_Err<<
2479 "dcar_negC_1_Err="<< dcar_negC_1_Err<<
2480 "dcar_negC_2_Err="<< dcar_negC_2_Err;
2481
2482 return 0;
2483}
2f09a281 2484
2485//_____________________________________________________________________________
2486Int_t AliTPCPerformanceSummary::AnalyzeOcc(const AliPerformanceTPC* pTPC, TTreeSRedirector* const pcstream)
2487{
2488 //
2489 //function which make trending of occupany per side and IROC-OROC
2490 //
2491
2492 if (!pcstream) return 16;
2493 if (!pTPC) return 16;
2494
2495 TH3* h3D_1=0;
2496 TH2* his2D=0;
2497 TH1* his1D=0;
2498
2499 static Double_t norm=0;
2500 static Double_t mean_occ_chamber=0;
2501 static Double_t rms_mean_occ_chamber=0;
2502 static Float_t occ_chamber=0;
2503 static Double_t rmsNr = 3.0;
2504 static Int_t n_chamber_lowOcc = 0;
2505 static Double_t minOcc= 0;
2506
2507 //nr of chamber within the thresholds
2508 static Int_t iroc_A_side =0;
2509 static Int_t oroc_A_side=0;
2510 static Int_t iroc_C_side =0;
2511 static Int_t oroc_C_side =0;
2512
2513 //occupancy for each chamber, normalized to the total occupancy
2514 static TVectorF meanOccArray_iroc(36);
2515 static TVectorF meanOccArray_oroc(36);
2516
2517 if (pTPC->GetHistos()->FindObject("h_tpc_clust_0_1_2")) {
2518 h3D_1 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_clust_0_1_2"));
2519 }
2520
2521 //////////////////////////////////////////
2522 // normalization
2523 h3D_1->GetZaxis()->SetRangeUser(0,0.99); //A side
2524 h3D_1->GetXaxis()->SetRangeUser(0,160); //IROC + OROC
2525 his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_A_norm"));
2526 if(!his2D) return 4;
2527 his1D = his2D->ProjectionX();
2528 norm = his1D->Integral();
2529 printf("normalization: \t%f\n",norm);
2530 if (norm < 0.001) norm=0.00001;
2531 delete his2D;
2532
2533 //////////////////////////////////////////
2534 // A_side IROC
2535 h3D_1->GetZaxis()->SetRangeUser(0,0.99); //A_side
2536 h3D_1->GetXaxis()->SetRangeUser(0,63); //IROC
2537
2538 his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_A_side_IROC"));
2539 if(!his2D) return 4;
2540
2541 printf("-------------- A_IROC occupancy \t\n");
2542
2543 for(Int_t i = 0; i < 18; i++) { //fill IROC A_side
2544 Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
2545 Float_t phiUp = (i+1)*(20./360.)*(2*TMath::Pi());
2546 his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
2547 his1D = his2D->ProjectionX();
2548 occ_chamber = (his1D->Integral()) / norm;
2549 printf("%d occ_chamber \t%f \t phiLow phiUp \t%f %f \n",i, occ_chamber, phiLow, phiUp);
2550 meanOccArray_iroc[i]= occ_chamber;//fill array with occupancy for each chamber
2551 mean_occ_chamber += occ_chamber;//compute the average occupancy
2552 rms_mean_occ_chamber += occ_chamber*occ_chamber;
2553 delete his1D;
2554 }
2555 delete his2D;
2556
2557 mean_occ_chamber /= 18; //nr of sectors
2558 rms_mean_occ_chamber /= 18; //nr of sectors
2559
2560 rms_mean_occ_chamber = TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );
2561 minOcc = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;
2562
2563 printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
2564 printf("min Occ allowed (threshold) \t%f \n", minOcc);
2565
2566 for (Int_t i = 0; i<18; i++) {
2567 if (meanOccArray_iroc[i] < minOcc) {n_chamber_lowOcc++;}
2568 }
2569 iroc_A_side = (18 - n_chamber_lowOcc); //nr of iroc above the thr
2570 printf("Nr of iroc_A_side \t%i \n \n ",iroc_A_side);
2571
2572 mean_occ_chamber=0;
2573 rms_mean_occ_chamber=0;
2574 occ_chamber=0.;
2575 n_chamber_lowOcc=0;
2576 minOcc=0.;
2577 ////////////////////////////////////////////
2578 // A_side OROC
2579 h3D_1->GetZaxis()->SetRangeUser(0,0.99); //A_side
2580 h3D_1->GetXaxis()->SetRangeUser(64,160); //OROC
2581
2582 his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_A_side_OROC"));
2583 if(!his2D) return 4;
2584
2585 printf("-------------- A_OROC occupancy \t\n");
2586
2587 for(Int_t i = 0; i < 18; i++) {
2588 Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
2589 Float_t phiUp = (i+1)*(20./360.)*(2*TMath::Pi());
2590 his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
2591 his1D = his2D->ProjectionX();
2592 occ_chamber = (his1D->Integral()) / norm;
2593 printf("%d occ_chamber \t%f \t phiLow phiUp \t%f %f \n",i, occ_chamber, phiLow, phiUp);
2594 meanOccArray_oroc[i]= occ_chamber;//fill array with occupancy for each chamber
2595 mean_occ_chamber += occ_chamber;//compute the average occupancy
2596 rms_mean_occ_chamber += occ_chamber*occ_chamber;
2597 delete his1D;
2598 }
2599 delete his2D;
2600
2601 mean_occ_chamber /= 18; //nr of sectors
2602 rms_mean_occ_chamber /= 18; //nr of sectors
2603
2604 rms_mean_occ_chamber = TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );
2605 minOcc = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;
2606
2607 printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
2608 printf("min Occ allowed (threshold) \t%f \n", minOcc);
2609
2610 for (Int_t i = 0; i<18; i++) {
2611 if (meanOccArray_oroc[i] < minOcc) {n_chamber_lowOcc++;}
2612 }
2613 oroc_A_side = (18 - n_chamber_lowOcc); //variable stored in the trending
2614 printf("Nr of oroc_A_side \t%i \n \n ",oroc_A_side);
2615
2616 mean_occ_chamber=0;
2617 rms_mean_occ_chamber=0;
2618 occ_chamber=0.;
2619 n_chamber_lowOcc=0;
2620 minOcc=0.;
2621
2622 ////////////////////////////////////////////////////////////////////////////////
2623 // C side
2624 //////////////////////////////////////////
2625
2626 // normalization
2627 h3D_1->GetZaxis()->SetRangeUser(-1,-0.001); //C side
2628 h3D_1->GetXaxis()->SetRangeUser(0,160); //IROC + OROC
2629 his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_C_norm"));
2630 if(!his2D) return 4;
2631 his1D = his2D->ProjectionX();
2632 norm = his1D->Integral();
2633 printf("normalization: \t%f\n",norm);
2634 if (norm < 0.001) norm=0.00001;
2635 delete his2D;
2636
2637 //////////////////////////////////////////
2638 // C_side IROC
2639 h3D_1->GetZaxis()->SetRangeUser(-1,-0.001); //C_side
2640 h3D_1->GetXaxis()->SetRangeUser(0,63); //IROC
2641
2642 his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_C_side_IROC"));
2643 if(!his2D) return 4;
2644
2645 printf("-------------- C_IROC occupancy \t\n");
2646
2647 for(Int_t i = 0; i < 18; i++) {
2648 Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
2649 Float_t phiUp = (i+1)*(20./360.)*(2*TMath::Pi());
2650 his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
2651 his1D = his2D->ProjectionX();
2652 occ_chamber = (his1D->Integral()) / norm;
2653 printf("%d occ_chamber \t%f \t phiLow phiUp \t%f %f \n",i, occ_chamber, phiLow, phiUp);
2654 meanOccArray_iroc[18+i]= occ_chamber;//fill array with occupancy for each chamber, C side, therefore index 18+i
2655 mean_occ_chamber += occ_chamber;//compute the average occupancy
2656 rms_mean_occ_chamber += occ_chamber*occ_chamber;
2657 delete his1D;
2658 }
2659 delete his2D;
2660
2661 mean_occ_chamber /= 18; //nr of sectors
2662 rms_mean_occ_chamber /= 18; //nr of sectors
2663
2664 rms_mean_occ_chamber = TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );
2665 minOcc = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;
2666
2667 printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
2668 printf("min Occ allowed (threshold) \t%f \n", minOcc);
2669
2670 for (Int_t i = 18; i<36; i++) {
2671 if (meanOccArray_iroc[i] < minOcc) {n_chamber_lowOcc++;}
2672 }
2673 iroc_C_side = (18 - n_chamber_lowOcc); //variable stored in the trending
2674 printf("Nr of iroc_C_side \t%i \n \n ",iroc_C_side);
2675
2676 mean_occ_chamber=0;
2677 rms_mean_occ_chamber=0;
2678 occ_chamber=0.;
2679 n_chamber_lowOcc=0;
2680 minOcc=0.;
2681
2682 ////////////////////////////////////////////
2683 // C_side OROC
2684 h3D_1->GetZaxis()->SetRangeUser(-1,-0.001); //C_side
2685 h3D_1->GetXaxis()->SetRangeUser(64,160); //OROC
2686
2687 his2D = dynamic_cast<TH2*>(h3D_1->Project3D("xy_C_side_OROC"));
2688 if(!his2D) return 4;
2689
2690 printf("-------------- C_OROC occupancy \t\n");
2691
2692 for(Int_t i = 0; i < 18; i++) {
2693 Float_t phiLow = i*(20./360.)*(2*TMath::Pi());
2694 Float_t phiUp = (i+1)*(20./360.)*(2*TMath::Pi());
2695 his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
2696 his1D = his2D->ProjectionX();
2697 occ_chamber = (his1D->Integral()) / norm;
2698 printf("%d occ_chamber \t%f \t phiLow phiUp \t%f %f \n",i, occ_chamber, phiLow, phiUp);
2699 meanOccArray_oroc[18+i]= occ_chamber;//fill array with occupancy for each chamber
2700 mean_occ_chamber += occ_chamber;//compute the average occupancy
2701 rms_mean_occ_chamber += occ_chamber*occ_chamber;
2702 delete his1D;
2703 }
2704 delete his2D;
2705
2706 mean_occ_chamber /= 18; //nr of sectors
2707 rms_mean_occ_chamber /= 18; //nr of sectors
2708
2709 rms_mean_occ_chamber = TMath::Sqrt( TMath::Abs(rms_mean_occ_chamber - (mean_occ_chamber*mean_occ_chamber)) );
2710 minOcc = mean_occ_chamber - rmsNr*rms_mean_occ_chamber;
2711
2712 printf("mean_occ_chamber +- rms_mean_occ_chamber \t%f\t%f \n", mean_occ_chamber, rms_mean_occ_chamber);
2713 printf("min Occ allowed (threshold) \t%f \n", minOcc);
2714
2715 for (Int_t i = 18; i<36; i++) {
2716 if (meanOccArray_oroc[i] < minOcc) {n_chamber_lowOcc++;}
2717 }
2718 oroc_C_side = (18 - n_chamber_lowOcc); //variable stored in the trending
2719 printf("Nr of oroc_C_side \t%i \n \n ",oroc_C_side);
2720
2721 mean_occ_chamber=0;
2722 rms_mean_occ_chamber=0;
2723 occ_chamber=0.;
2724 n_chamber_lowOcc=0;
2725 minOcc=0.;
2726
2727 (*pcstream)<<"tpcQA"<<
2728 "iroc_A_side="<< iroc_A_side<<
2729 "oroc_A_side="<< oroc_A_side<<
2730 "iroc_C_side="<< iroc_C_side<<
2731 "oroc_C_side="<< oroc_C_side<<
2732 //A/C side IROC
2733 "TPC_Occ_IROC.="<< &meanOccArray_iroc<<
2734 //A/C side OROC
2735 "TPC_Occ_OROC.="<< &meanOccArray_oroc;
2736
2737 return 0;
2738 }
2739