1 //------------------------------------------------------------------------------
2 // Implementation of AliPerformanceDCA class. It keeps information from
3 // comparison of reconstructed and MC particle tracks. In addtion,
4 // it keeps selection cuts used during comparison. The comparison
5 // information is stored in the ROOT histograms. Analysis of these
6 // histograms can be done by using Analyse() class function. The result of
7 // the analysis (histograms/graphs) are stored in the folder
8 // which is a data member of AliPerformanceDCA.
10 // Author: J.Otwinowski 04/02/2008
11 //------------------------------------------------------------------------------
15 // after running comparison task, read the file, and get component
16 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/Macros/LoadMyLibs.C");
18 TFile f("Output.root");
19 AliPerformanceDCA * compObj = (AliPerformanceDCA*)coutput->FindObject("AliPerformanceDCA");
21 // Analyse comparison data
24 // the output histograms/graphs will be stored in the folder "folderDCA"
25 compObj->GetAnalysisFolder()->ls("*");
27 // user can save whole comparison object (or only folder with anlysed histograms)
28 // in the seperate output file (e.g.)
29 TFile fout("Analysed_DCA.root","recreate");
30 compObj->Write(); // compObj->GetAnalysisFolder()->Write();
44 #include "AliPerformanceDCA.h"
45 #include "AliESDEvent.h"
46 #include "AliESDVertex.h"
48 #include "AliMathBase.h"
49 #include "AliRecInfoCuts.h"
50 #include "AliMCInfoCuts.h"
52 #include "AliMCEvent.h"
53 #include "AliTracker.h"
54 #include "AliHeader.h"
55 #include "AliGenEventHeader.h"
59 ClassImp(AliPerformanceDCA)
61 //_____________________________________________________________________________
62 AliPerformanceDCA::AliPerformanceDCA(const Char_t* name, const Char_t* title,Int_t analysisMode, Bool_t hptGenerator):
63 AliPerformanceObject(name,title),
77 SetAnalysisMode(analysisMode);
78 SetHptGenerator(hptGenerator);
82 //_____________________________________________________________________________
83 AliPerformanceDCA::~AliPerformanceDCA()
86 if(fDCAHisto) delete fDCAHisto; fDCAHisto=0;
87 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
90 //_____________________________________________________________________________
91 void AliPerformanceDCA::Init()
97 Double_t ptMin = 1.e-2, ptMax = 20.;
101 if (IsHptGenerator()) {
104 binsPt = CreateLogAxis(nPtBins,ptMin,ptMax);
108 Double_t binsPt[32] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.25,2.5,2.75,3.,3.5,4.,5.,6.,8.,10.};
109 Double_t ptMin = 0., ptMax = 10.;
111 if(IsHptGenerator() == kTRUE) {
113 ptMin = 0.; ptMax = 100.;
117 //dca_r, dca_z, eta, pt
118 Int_t binsQA[5] = {100,100,30,nPtBins,144};
119 Double_t xminQA[5] = {-10.,-10.,-1.5,ptMin,0.};
120 Double_t xmaxQA[5] = {10.,10.,1.5,ptMax,2*TMath::Pi()};
122 fDCAHisto = new THnSparseF("fDCAHisto","dca_r:dca_z:eta:pt:phi",5,binsQA,xminQA,xmaxQA);
123 fDCAHisto->SetBinEdges(3,binsPt);
125 fDCAHisto->GetAxis(0)->SetTitle("dca_r (cm)");
126 fDCAHisto->GetAxis(1)->SetTitle("dca_z (cm)");
127 fDCAHisto->GetAxis(2)->SetTitle("#eta");
128 fDCAHisto->GetAxis(3)->SetTitle("p_{T} (GeV/c)");
129 fDCAHisto->GetAxis(4)->SetTitle("phi (rad)");
134 AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
136 AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
139 fAnalysisFolder = CreateFolder("folderDCA","Analysis DCA Folder");
142 //_____________________________________________________________________________
143 void AliPerformanceDCA::ProcessTPC(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent* const esdEvent)
145 // Fill DCA comparison information
146 if(!esdEvent) return;
147 if(!esdTrack) return;
149 if( IsUseTrackVertex() )
151 // Relate TPC inner params to prim. vertex
152 const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTracks();
153 Double_t x[3]; esdTrack->GetXYZ(x);
154 Double_t b[3]; AliTracker::GetBxByBz(x,b);
155 Bool_t isOK = esdTrack->RelateToVertexTPCBxByBz(vtxESD, b, kVeryBig);
159 // JMT -- recaluclate DCA for HLT if not present
160 if ( dca[0] == 0. && dca[1] == 0. ) {
161 track->GetDZ( vtxESD->GetX(), vtxESD->GetY(), vtxESD->GetZ(), esdEvent->GetMagneticField(), dca );
166 // get TPC inner params at DCA to prim. vertex
167 const AliExternalTrackParam *track = esdTrack->GetTPCInnerParam();
170 // read from ESD track
171 Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
172 esdTrack->GetImpactParametersTPC(dca,cov);
174 if (esdTrack->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return; // min. nb. TPC clusters
176 Double_t vDCAHisto[5]={dca[0],dca[1],track->Eta(),track->Pt(),track->Phi()};
177 fDCAHisto->Fill(vDCAHisto);
180 // Fill rec vs MC information
186 //_____________________________________________________________________________
187 void AliPerformanceDCA::ProcessTPCITS(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent* const esdEvent)
189 // Fill DCA comparison information
190 if(!esdTrack) return;
191 if(!esdEvent) return;
193 if( IsUseTrackVertex() )
195 // Relate TPC inner params to prim. vertex
196 const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTracks();
197 Double_t x[3]; esdTrack->GetXYZ(x);
198 Double_t b[3]; AliTracker::GetBxByBz(x,b);
199 Bool_t isOK = esdTrack->RelateToVertexBxByBz(vtxESD, b, kVeryBig);
203 // JMT -- recaluclate DCA for HLT if not present
204 if ( dca[0] == 0. && dca[1] == 0. ) {
205 track->GetDZ( vtxESD->GetX(), vtxESD->GetY(), vtxESD->GetZ(), esdEvent->GetMagneticField(), dca );
210 Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
211 esdTrack->GetImpactParameters(dca,cov);
213 if ((esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0) return; // TPC refit
214 if (esdTrack->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return; // min. nb. TPC clusters
215 if(esdTrack->GetITSclusters(0)<fCutsRC->GetMinNClustersITS()) return; // min. nb. ITS clusters
217 Double_t vDCAHisto[5]={dca[0],dca[1],esdTrack->Eta(),esdTrack->Pt(), esdTrack->Phi()};
218 fDCAHisto->Fill(vDCAHisto);
221 // Fill rec vs MC information
227 void AliPerformanceDCA::ProcessConstrained(AliStack* const /*stack*/, AliESDtrack *const /*esdTrack*/)
229 // Fill DCA comparison information
231 AliDebug(AliLog::kWarning, "Warning: Not implemented");
234 //_____________________________________________________________________________
235 Long64_t AliPerformanceDCA::Merge(TCollection* const list)
237 // Merge list of objects (needed by PROOF)
245 TIterator* iter = list->MakeIterator();
248 // collection of generated histograms
250 while((obj = iter->Next()) != 0)
252 AliPerformanceDCA* entry = dynamic_cast<AliPerformanceDCA*>(obj);
253 if (entry == 0) continue;
255 fDCAHisto->Add(entry->fDCAHisto);
262 //_____________________________________________________________________________
263 void AliPerformanceDCA::Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEvent, AliESDfriend *const esdFriend, const Bool_t bUseMC, const Bool_t bUseESDfriend)
265 // Process comparison information
269 Error("Exec","esdEvent not available");
272 AliHeader* header = 0;
273 AliGenEventHeader* genHeader = 0;
280 Error("Exec","mcEvent not available");
283 // get MC event header
284 header = mcEvent->Header();
286 Error("Exec","Header not available");
290 stack = mcEvent->Stack();
292 Error("Exec","Stack not available");
296 genHeader = header->GenEventHeader();
298 Error("Exec","Could not retrieve genHeader from Header");
301 genHeader->PrimaryVertex(vtxMC);
307 Error("Exec","esdFriend not available");
313 if(!bUseMC &&GetTriggerClass()) {
314 Bool_t isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass());
315 if(!isEventTriggered) return;
319 const AliESDVertex *vtxESD = NULL;
320 if( IsUseTrackVertex() )
323 vtxESD = esdEvent->GetPrimaryVertexTracks();
327 vtxESD = esdEvent->GetPrimaryVertexTPC();
329 if(vtxESD && (vtxESD->GetStatus()<=0)) return;
332 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
334 AliESDtrack *track = esdEvent->GetTrack(iTrack);
337 if(GetAnalysisMode() == 0) ProcessTPC(stack,track,esdEvent);
338 else if(GetAnalysisMode() == 1) ProcessTPCITS(stack,track,esdEvent);
339 else if(GetAnalysisMode() == 2) ProcessConstrained(stack,track);
341 printf("ERROR: AnalysisMode %d \n",fAnalysisMode);
347 //_____________________________________________________________________________
348 void AliPerformanceDCA::Analyse()
351 // Analyse comparison information and store output histograms
352 // in the analysis folder "folderDCA"
355 TH1::AddDirectory(kFALSE);
358 TObjArray *aFolderObj = new TObjArray;
359 if(!aFolderObj) return;
361 TObjArray *arr[6] = {0};
366 // set pt measurable range
367 //fDCAHisto->GetAxis(3)->SetRangeUser(0.10,10.);
370 h2D = (TH2F*)fDCAHisto->Projection(0,1); // inverse projection convention
371 h2D->SetName("dca_r_vs_dca_z");
372 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle());
373 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(0)->GetTitle());
374 snprintf(title,256,"%s vs %s",fDCAHisto->GetAxis(0)->GetTitle(),fDCAHisto->GetAxis(1)->GetTitle());
375 h2D->SetTitle(title);
376 aFolderObj->Add(h2D);
379 h2D = (TH2F*)fDCAHisto->Projection(0,2);
380 h2D->SetName("dca_r_vs_eta");
381 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
382 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(0)->GetTitle());
383 snprintf(title,256,"%s vs %s",fDCAHisto->GetAxis(2)->GetTitle(),fDCAHisto->GetAxis(0)->GetTitle());
384 h2D->SetTitle(title);
385 aFolderObj->Add(h2D);
390 h1D = MakeStat1D(h2D,0,0);
391 h1D->SetName("mean_dca_r_vs_eta");
392 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
393 h1D->GetYaxis()->SetTitle("mean_dca_r (cm)");
394 snprintf(title,256," mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
395 h1D->SetTitle(title);
396 aFolderObj->Add(h1D);
398 h1D = MakeStat1D(h2D,0,1);
399 h1D->SetName("rms_dca_r_vs_eta");
400 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
401 h1D->GetYaxis()->SetTitle("rms_dca_r (cm)");
402 snprintf(title,256," rms_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
403 h1D->SetTitle(title);
404 aFolderObj->Add(h1D);
407 // fit mean and sigma
410 arr[0] = new TObjArray();
411 f1[0] = new TF1("gaus","gaus");
412 h2D->FitSlicesY(f1[0],0,-1,0,"QNR",arr[0]);
414 h1D = (TH1F*)arr[0]->At(1);
415 h1D->SetName("fit_mean_dca_r_vs_eta");
416 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
417 h1D->GetYaxis()->SetTitle("fit_mean_dca_r (cm)");
418 snprintf(title,256," fit_mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
419 h1D->SetTitle(title);
420 aFolderObj->Add(h1D);
422 h1D = (TH1F*)arr[0]->At(2);
423 h1D->SetName("res_dca_r_vs_eta");
424 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
425 h1D->GetYaxis()->SetTitle("res_dca_r (cm)");
426 snprintf(title,256," res_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
427 h1D->SetTitle(title);
428 aFolderObj->Add(h1D);
433 h2D = (TH2F*)fDCAHisto->Projection(0,3);
434 h2D->SetName("dca_r_vs_pt");
435 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
436 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(0)->GetTitle());
437 snprintf(title,256,"%s vs %s",fDCAHisto->GetAxis(0)->GetTitle(),fDCAHisto->GetAxis(3)->GetTitle());
438 h2D->SetTitle(title);
439 h2D->SetBit(TH1::kLogX);
440 aFolderObj->Add(h2D);
442 h1D = MakeStat1D(h2D,0,0);
443 h1D->SetName("mean_dca_r_vs_pt");
444 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
445 h1D->GetYaxis()->SetTitle("mean_dca_r (cm)");
446 snprintf(title,256,"mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
447 h1D->SetTitle(title);
448 h1D->SetBit(TH1::kLogX);
449 aFolderObj->Add(h1D);
451 h1D = MakeStat1D(h2D,0,1);
452 h1D->SetName("rms_dca_r_vs_pt");
453 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
454 h1D->GetYaxis()->SetTitle("rms_dca_r (cm)");
455 snprintf(title,256,"rms_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
456 h1D->SetTitle(title);
457 h1D->SetBit(TH1::kLogX);
458 aFolderObj->Add(h1D);
461 // fit mean and sigma
464 arr[1] = new TObjArray();
465 f1[1] = new TF1("gaus","gaus");
466 h2D->FitSlicesY(f1[1],0,-1,0,"QNR",arr[1]);
468 h1D = (TH1F*)arr[1]->At(1);
469 h1D->SetName("fit_mean_dca_r_vs_pt");
470 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
471 h1D->GetYaxis()->SetTitle("fit_mean_dca_r (cm)");
472 snprintf(title,256,"fit_mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
473 h1D->SetTitle(title);
474 h1D->SetBit(TH1::kLogX);
475 aFolderObj->Add(h1D);
477 h1D = (TH1F*)arr[1]->At(2);
478 h1D->SetName("res_dca_r_vs_pt");
479 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
480 h1D->GetYaxis()->SetTitle("res_dca_r (cm)");
481 snprintf(title,256,"res_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
482 h1D->SetTitle(title);
483 h1D->SetBit(TH1::kLogX);
484 aFolderObj->Add(h1D);
487 h2D = (TH2F*)fDCAHisto->Projection(1,2);
488 h2D->SetName("dca_z_vs_eta");
489 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
490 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle());
491 snprintf(title,256,"%s vs %s",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(2)->GetTitle());
492 h2D->SetTitle(title);
493 aFolderObj->Add(h2D);
495 h1D = MakeStat1D(h2D,0,0);
496 h1D->SetName("mean_dca_z_vs_eta");
497 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
498 h1D->GetYaxis()->SetTitle("mean_dca_z (cm)");
499 snprintf(title,256,"mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
500 h1D->SetTitle(title);
501 aFolderObj->Add(h1D);
503 h1D = MakeStat1D(h2D,0,1);
504 h1D->SetName("rms_dca_z_vs_eta");
505 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
506 h1D->GetYaxis()->SetTitle("rms_dca_z (cm)");
507 snprintf(title,256,"rms_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
508 h1D->SetTitle(title);
509 aFolderObj->Add(h1D);
512 // fit mean and sigma
514 arr[2] = new TObjArray();
515 f1[2] = new TF1("gaus","gaus");
516 h2D->FitSlicesY(f1[2],0,-1,0,"QNR",arr[2]);
518 h1D = (TH1F*)arr[2]->At(1);
519 h1D->SetName("fit_mean_dca_z_vs_eta");
520 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
521 h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)");
522 snprintf(title,256,"fit_mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
523 h1D->SetTitle(title);
524 aFolderObj->Add(h1D);
526 h1D = (TH1F*)arr[2]->At(2);
527 h1D->SetName("res_dca_z_vs_eta");
528 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle());
529 h1D->GetYaxis()->SetTitle("res_dca_z (cm)");
530 snprintf(title,256,"res_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle());
531 h1D->SetTitle(title);
532 aFolderObj->Add(h1D);
535 h2D = (TH2F*)fDCAHisto->Projection(1,3);
536 h2D->SetName("dca_z_vs_pt");
537 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
538 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle());
539 snprintf(title,256,"%s vs %s",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(3)->GetTitle());
540 h2D->SetTitle(title);
541 h2D->SetBit(TH1::kLogX);
542 aFolderObj->Add(h2D);
544 h1D = MakeStat1D(h2D,0,0);
545 h1D->SetName("mean_dca_z_vs_pt");
546 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
547 h1D->GetYaxis()->SetTitle("mean_dca_z (cm)");
548 snprintf(title,256,"mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
549 h1D->SetTitle(title);
550 h1D->SetBit(TH1::kLogX);
551 aFolderObj->Add(h1D);
553 h1D = MakeStat1D(h2D,0,1);
554 h1D->SetName("rms_dca_z_vs_pt");
555 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
556 h1D->GetYaxis()->SetTitle("rms_dca_z (cm)");
557 snprintf(title,256,"rms_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
558 h1D->SetTitle(title);
559 h1D->SetBit(TH1::kLogX);
560 aFolderObj->Add(h1D);
563 // fit mean and sigma
566 arr[3] = new TObjArray();
567 f1[3] = new TF1("gaus","gaus");
568 h2D->FitSlicesY(f1[3],0,-1,0,"QNR",arr[3]);
570 h1D = (TH1F*)arr[3]->At(1);
571 h1D->SetName("fit_mean_dca_z_vs_pt");
572 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
573 h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)");
574 snprintf(title,256,"fit_mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
575 h1D->SetTitle(title);
576 h1D->SetBit(TH1::kLogX);
577 aFolderObj->Add(h1D);
579 h1D = (TH1F*)arr[3]->At(2);
580 h1D->SetName("res_dca_z_vs_pt");
581 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle());
582 h1D->GetYaxis()->SetTitle("res_dca_z (cm)");
583 snprintf(title,256,"res_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle());
584 h1D->SetTitle(title);
585 h1D->SetBit(TH1::kLogX);
586 aFolderObj->Add(h1D);
589 fDCAHisto->GetAxis(2)->SetRangeUser(-1.5,0.0);
591 h2D = (TH2F*)fDCAHisto->Projection(1,4);
592 h2D->SetName("dca_z_vs_phi_Aside");
593 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
594 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle());
595 snprintf(title,256,"%s vs %s (A-side)",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(4)->GetTitle());
596 h2D->SetTitle(title);
597 aFolderObj->Add(h2D);
599 h1D = MakeStat1D(h2D,0,0);
600 h1D->SetName("mean_dca_z_vs_phi_Aside");
601 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
602 h1D->GetYaxis()->SetTitle("mean_dca_z (cm)");
603 snprintf(title,256,"mean_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle());
604 h1D->SetTitle(title);
605 aFolderObj->Add(h1D);
607 h1D = MakeStat1D(h2D,0,1);
608 h1D->SetName("rms_dca_z_vs_phi_Aside");
609 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
610 h1D->GetYaxis()->SetTitle("rms_dca_z (cm)");
611 snprintf(title,256,"rms_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle());
612 h1D->SetTitle(title);
613 aFolderObj->Add(h1D);
616 // fit mean and sigma
618 arr[4] = new TObjArray();
619 f1[4] = new TF1("gaus","gaus");
620 h2D->FitSlicesY(f1[4],0,-1,0,"QNR",arr[4]);
622 h1D = (TH1F*)arr[4]->At(1);
623 h1D->SetName("fit_mean_dca_z_vs_phi_Aside");
624 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
625 h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)");
626 snprintf(title,256,"fit_mean_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle());
627 h1D->SetTitle(title);
628 aFolderObj->Add(h1D);
630 h1D = (TH1F*)arr[4]->At(2);
631 h1D->SetName("res_dca_z_vs_phi_Aside");
632 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
633 h1D->GetYaxis()->SetTitle("res_dca_z (cm)");
634 snprintf(title,256,"res_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle());
635 h1D->SetTitle(title);
636 aFolderObj->Add(h1D);
640 fDCAHisto->GetAxis(2)->SetRangeUser(0.0,1.5);
642 h2D = (TH2F*)fDCAHisto->Projection(1,4);
643 h2D->SetName("dca_z_vs_phi_Cside");
644 h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
645 h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle());
646 snprintf(title,256,"%s vs %s (C-side)",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(4)->GetTitle());
647 h2D->SetTitle(title);
648 aFolderObj->Add(h2D);
650 h1D = MakeStat1D(h2D,0,0);
651 h1D->SetName("mean_dca_z_vs_phi_Cside");
652 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
653 h1D->GetYaxis()->SetTitle("mean_dca_z (cm)");
654 snprintf(title,256,"mean_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle());
655 h1D->SetTitle(title);
656 aFolderObj->Add(h1D);
658 h1D = MakeStat1D(h2D,0,1);
659 h1D->SetName("rms_dca_z_vs_phi_Cside");
660 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
661 h1D->GetYaxis()->SetTitle("rms_dca_z (cm)");
662 snprintf(title,256,"rms_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle());
663 h1D->SetTitle(title);
664 aFolderObj->Add(h1D);
667 // fit mean and sigma
669 arr[5] = new TObjArray();
670 f1[5] = new TF1("gaus","gaus");
671 h2D->FitSlicesY(f1[5],0,-1,0,"QNR",arr[5]);
673 h1D = (TH1F*)arr[5]->At(1);
674 h1D->SetName("fit_mean_dca_z_vs_phi_Cside");
675 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
676 h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)");
677 snprintf(title,256,"fit_mean_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle());
678 h1D->SetTitle(title);
679 aFolderObj->Add(h1D);
681 h1D = (TH1F*)arr[5]->At(2);
682 h1D->SetName("res_dca_z_vs_phi_Cside");
683 h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle());
684 h1D->GetYaxis()->SetTitle("res_dca_z (cm)");
685 snprintf(title,256,"res_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle());
686 h1D->SetTitle(title);
687 aFolderObj->Add(h1D);
689 // export objects to analysis folder
690 fAnalysisFolder = ExportToFolder(aFolderObj);
692 // delete only TObjArray
693 if(aFolderObj) delete aFolderObj;
696 //_____________________________________________________________________________
697 TH1F* AliPerformanceDCA::MakeStat1D(TH2 *hist, Int_t delta0, Int_t type)
699 // Return TH1F histogram
700 // delta - number of bins to integrate
701 // with mean (type == 0) or RMS (type==1)
704 const char* suffix = "_stat1d";
705 snprintf(hname,256,"%s%s",hist->GetName(),suffix);
706 TAxis* xaxis = hist->GetXaxis();
707 Int_t nbinx = xaxis->GetNbins();
709 TH1F *hnew = (TH1F*)hist->ProjectionX()->Clone();
710 hnew->SetName(hname);
713 for (Int_t ix=0; ix<=nbinx;ix++) {
714 snprintf(name,256,"%s_%d",hist->GetName(),ix);
715 TH1 *projection = hist->ProjectionY(name,ix-delta0,ix+delta0);
717 Float_t stat= 0., stat_err =0.;
718 if (type==0) { stat = projection->GetMean(); stat_err = projection->GetMeanError(); }
719 if (type==1) { stat = projection->GetRMS(); stat_err = projection->GetRMSError(); }
721 hnew->SetBinContent(ix, stat);
722 hnew->SetBinError(ix, stat_err);
728 //_____________________________________________________________________________
729 TH2F* AliPerformanceDCA::MakeStat2D(TH3 *hist, Int_t delta0, Int_t delta1, Int_t type)
731 // Return TH1F histogram
732 // delta0 - number of bins to integrate in x
733 // delta1 - number of bins to integrate in y
734 // with mean (type==0) or RMS (type==1)
737 const char* suffix = "_stat2d";
738 snprintf(hname,256,"%s%s",hist->GetName(),suffix);
740 TAxis* xaxis = hist->GetXaxis();
741 Int_t nbinx = xaxis->GetNbins();
743 TH2F *hnew = (TH2F*)hist->Project3D("yx")->Clone();
744 hnew->SetName(hname);
746 TAxis* yaxis = hist->GetYaxis();
747 Int_t nbiny = yaxis->GetNbins();
750 for (Int_t ix=0; ix<=nbinx;ix++) {
751 for (Int_t iy=0; iy<=nbiny;iy++) {
752 snprintf(name,256,"%s_%d_%d",hist->GetName(),ix,iy);
753 TH1 *projection = hist->ProjectionZ(name,ix-delta0,ix+delta0,iy-delta1,iy+delta1);
755 Float_t stat= 0., stat_err =0.;
756 if (type==0) { stat = projection->GetMean(); stat_err = projection->GetMeanError(); }
757 if (type==1) { stat = projection->GetRMS(); stat_err = projection->GetRMSError(); }
759 hnew->SetBinContent(ix,iy,stat);
760 hnew->SetBinError(ix,iy,stat_err);
767 //_____________________________________________________________________________
768 TFolder* AliPerformanceDCA::ExportToFolder(TObjArray * array)
770 // recreate folder avery time and export objects to new one
772 AliPerformanceDCA * comp=this;
773 TFolder *folder = comp->GetAnalysisFolder();
776 TFolder *newFolder = 0;
778 Int_t size = array->GetSize();
781 // get name and title from old folder
782 name = folder->GetName();
783 title = folder->GetTitle();
789 newFolder = CreateFolder(name.Data(),title.Data());
790 newFolder->SetOwner();
792 // add objects to folder
794 newFolder->Add(array->At(i));
802 //_____________________________________________________________________________
803 TFolder* AliPerformanceDCA::CreateFolder(TString name,TString title) {
804 // create folder for analysed histograms
806 folder = new TFolder(name.Data(),title.Data());