]>
Commit | Line | Data |
---|---|---|
7cc34f08 | 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. | |
9 | // | |
10 | // Author: J.Otwinowski 04/02/2008 | |
11 | //------------------------------------------------------------------------------ | |
12 | ||
13 | /* | |
14 | ||
15 | // after running comparison task, read the file, and get component | |
16 | gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C"); | |
17 | LoadMyLibs(); | |
18 | TFile f("Output.root"); | |
19 | AliPerformanceDCA * compObj = (AliPerformanceDCA*)coutput->FindObject("AliPerformanceDCA"); | |
20 | ||
21 | // Analyse comparison data | |
22 | compObj->Analyse(); | |
23 | ||
24 | // the output histograms/graphs will be stored in the folder "folderDCA" | |
25 | compObj->GetAnalysisFolder()->ls("*"); | |
26 | ||
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(); | |
31 | fout.Close(); | |
32 | ||
33 | */ | |
34 | ||
35 | #include <TAxis.h> | |
36 | #include <TCanvas.h> | |
37 | #include <TGraph.h> | |
38 | #include <TGraph2D.h> | |
39 | #include <TH1.h> | |
40 | #include <TH2.h> | |
41 | #include <TH3.h> | |
4bb5f8a9 | 42 | #include <TF1.h> |
7cc34f08 | 43 | |
44 | #include "AliPerformanceDCA.h" | |
45 | #include "AliESDEvent.h" | |
46 | #include "AliESDVertex.h" | |
47 | #include "AliLog.h" | |
48 | #include "AliMathBase.h" | |
49 | #include "AliRecInfoCuts.h" | |
50 | #include "AliMCInfoCuts.h" | |
51 | #include "AliStack.h" | |
52 | #include "AliMCEvent.h" | |
53 | #include "AliTracker.h" | |
54 | #include "AliHeader.h" | |
55 | #include "AliGenEventHeader.h" | |
56 | ||
57 | using namespace std; | |
58 | ||
59 | ClassImp(AliPerformanceDCA) | |
60 | ||
61 | //_____________________________________________________________________________ | |
62 | AliPerformanceDCA::AliPerformanceDCA(): | |
63 | AliPerformanceObject("AliPerformanceDCA"), | |
64 | ||
65 | // DCA histograms | |
66 | fDCAHisto(0), | |
67 | ||
68 | // Cuts | |
69 | fCutsRC(0), | |
70 | fCutsMC(0), | |
71 | ||
72 | // histogram folder | |
73 | fAnalysisFolder(0) | |
74 | { | |
75 | // default constructor | |
76 | Init(); | |
77 | } | |
78 | ||
79 | //_____________________________________________________________________________ | |
80 | AliPerformanceDCA::AliPerformanceDCA(Char_t* name="AliPerformanceDCA", Char_t* title="AliPerformanceDCA",Int_t analysisMode=0, Bool_t hptGenerator=kFALSE): | |
81 | AliPerformanceObject(name,title), | |
82 | ||
83 | // DCA histograms | |
84 | fDCAHisto(0), | |
85 | ||
86 | // Cuts | |
87 | fCutsRC(0), | |
88 | fCutsMC(0), | |
89 | ||
90 | // histogram folder | |
91 | fAnalysisFolder(0) | |
92 | { | |
93 | // named constructor | |
94 | ||
95 | SetAnalysisMode(analysisMode); | |
96 | SetHptGenerator(hptGenerator); | |
97 | Init(); | |
98 | } | |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | AliPerformanceDCA::~AliPerformanceDCA() | |
102 | { | |
103 | // destructor | |
104 | if(fDCAHisto) delete fDCAHisto; fDCAHisto=0; | |
105 | if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0; | |
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | void AliPerformanceDCA::Init() | |
110 | { | |
111 | // DCA histograms | |
112 | Int_t nPtBins = 50; | |
113 | Double_t ptMin = 1.e-2, ptMax = 10.; | |
114 | ||
115 | Double_t *binsPt = 0; | |
116 | if (IsHptGenerator()) { | |
117 | nPtBins = 100; ptMax = 100.; | |
118 | binsPt = CreateLogAxis(nPtBins,ptMin,ptMax); | |
119 | } else { | |
120 | binsPt = CreateLogAxis(nPtBins,ptMin,ptMax); | |
121 | } | |
122 | ||
123 | /* | |
124 | Int_t nPtBins = 31; | |
125 | 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.}; | |
126 | Double_t ptMin = 0., ptMax = 10.; | |
127 | ||
128 | if(IsHptGenerator() == kTRUE) { | |
129 | nPtBins = 100; | |
130 | ptMin = 0.; ptMax = 100.; | |
131 | } | |
132 | */ | |
133 | ||
134 | //dca_r, dca_z, eta, pt | |
e6a60a90 | 135 | Int_t binsQA[5] = {100,100,30,nPtBins,144}; |
886bf4d3 | 136 | Double_t xminQA[5] = {-10.,-10.,-1.5,ptMin,0.}; |
137 | Double_t xmaxQA[5] = {10.,10.,1.5,ptMax,2*TMath::Pi()}; | |
7cc34f08 | 138 | |
886bf4d3 | 139 | fDCAHisto = new THnSparseF("fDCAHisto","dca_r:dca_z:eta:pt:phi",5,binsQA,xminQA,xmaxQA); |
7cc34f08 | 140 | fDCAHisto->SetBinEdges(3,binsPt); |
141 | ||
142 | fDCAHisto->GetAxis(0)->SetTitle("dca_r (cm)"); | |
143 | fDCAHisto->GetAxis(1)->SetTitle("dca_z (cm)"); | |
144 | fDCAHisto->GetAxis(2)->SetTitle("#eta"); | |
145 | fDCAHisto->GetAxis(3)->SetTitle("p_{T} (GeV/c)"); | |
886bf4d3 | 146 | fDCAHisto->GetAxis(4)->SetTitle("phi (rad)"); |
7cc34f08 | 147 | fDCAHisto->Sumw2(); |
148 | ||
149 | // init cuts | |
150 | if(!fCutsMC) | |
151 | AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object"); | |
152 | if(!fCutsRC) | |
153 | AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object"); | |
154 | ||
155 | // init folder | |
156 | fAnalysisFolder = CreateFolder("folderDCA","Analysis DCA Folder"); | |
157 | } | |
158 | ||
159 | //_____________________________________________________________________________ | |
160 | void AliPerformanceDCA::ProcessTPC(AliStack* const stack, AliESDtrack *const esdTrack) | |
161 | { | |
162 | // Fill DCA comparison information | |
163 | if(!esdTrack) return; | |
164 | ||
165 | const AliExternalTrackParam *track = esdTrack->GetTPCInnerParam(); | |
166 | if(!track) return; | |
167 | ||
168 | Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z | |
169 | esdTrack->GetImpactParametersTPC(dca,cov); | |
170 | ||
171 | if (esdTrack->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return; // min. nb. TPC clusters | |
172 | ||
886bf4d3 | 173 | Double_t vDCAHisto[5]={dca[0],dca[1],track->Eta(),track->Pt(),track->Phi()}; |
7cc34f08 | 174 | fDCAHisto->Fill(vDCAHisto); |
175 | ||
176 | // | |
177 | // Fill rec vs MC information | |
178 | // | |
179 | if(!stack) return; | |
180 | ||
181 | } | |
182 | ||
183 | //_____________________________________________________________________________ | |
184 | void AliPerformanceDCA::ProcessTPCITS(AliStack* const stack, AliESDtrack *const esdTrack) | |
185 | { | |
186 | // Fill DCA comparison information | |
187 | if(!esdTrack) return; | |
188 | ||
189 | Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z | |
190 | esdTrack->GetImpactParameters(dca,cov); | |
191 | ||
192 | if ((esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0) return; // TPC refit | |
193 | if (esdTrack->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return; // min. nb. TPC clusters | |
194 | Int_t clusterITS[200]; | |
195 | if(esdTrack->GetITSclusters(clusterITS)<fCutsRC->GetMinNClustersITS()) return; // min. nb. ITS clusters | |
196 | ||
886bf4d3 | 197 | Double_t vDCAHisto[5]={dca[0],dca[1],esdTrack->Eta(),esdTrack->Pt(), esdTrack->Phi()}; |
7cc34f08 | 198 | fDCAHisto->Fill(vDCAHisto); |
199 | ||
200 | // | |
201 | // Fill rec vs MC information | |
202 | // | |
203 | if(!stack) return; | |
204 | ||
205 | } | |
206 | ||
207 | void AliPerformanceDCA::ProcessConstrained(AliStack* const /*stack*/, AliESDtrack *const /*esdTrack*/) | |
208 | { | |
209 | // Fill DCA comparison information | |
210 | ||
211 | AliDebug(AliLog::kWarning, "Warning: Not implemented"); | |
212 | } | |
213 | ||
214 | //_____________________________________________________________________________ | |
215 | Long64_t AliPerformanceDCA::Merge(TCollection* const list) | |
216 | { | |
217 | // Merge list of objects (needed by PROOF) | |
218 | ||
219 | if (!list) | |
220 | return 0; | |
221 | ||
222 | if (list->IsEmpty()) | |
223 | return 1; | |
224 | ||
225 | TIterator* iter = list->MakeIterator(); | |
226 | TObject* obj = 0; | |
227 | ||
228 | // collection of generated histograms | |
229 | Int_t count=0; | |
230 | while((obj = iter->Next()) != 0) | |
231 | { | |
232 | AliPerformanceDCA* entry = dynamic_cast<AliPerformanceDCA*>(obj); | |
233 | if (entry == 0) continue; | |
234 | ||
235 | fDCAHisto->Add(entry->fDCAHisto); | |
236 | count++; | |
237 | } | |
238 | ||
239 | return count; | |
240 | } | |
241 | ||
242 | //_____________________________________________________________________________ | |
243 | void AliPerformanceDCA::Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEvent, AliESDfriend *const esdFriend, const Bool_t bUseMC, const Bool_t bUseESDfriend) | |
244 | { | |
245 | // Process comparison information | |
246 | // | |
247 | if(!esdEvent) | |
248 | { | |
249 | Error("Exec","esdEvent not available"); | |
250 | return; | |
251 | } | |
252 | AliHeader* header = 0; | |
253 | AliGenEventHeader* genHeader = 0; | |
254 | AliStack* stack = 0; | |
255 | TArrayF vtxMC(3); | |
256 | ||
257 | if(bUseMC) | |
258 | { | |
259 | if(!mcEvent) { | |
260 | Error("Exec","mcEvent not available"); | |
261 | return; | |
262 | } | |
263 | // get MC event header | |
264 | header = mcEvent->Header(); | |
265 | if (!header) { | |
266 | Error("Exec","Header not available"); | |
267 | return; | |
268 | } | |
269 | // MC particle stack | |
270 | stack = mcEvent->Stack(); | |
271 | if (!stack) { | |
272 | Error("Exec","Stack not available"); | |
273 | return; | |
274 | } | |
275 | // get MC vertex | |
276 | genHeader = header->GenEventHeader(); | |
277 | if (!genHeader) { | |
278 | Error("Exec","Could not retrieve genHeader from Header"); | |
279 | return; | |
280 | } | |
281 | genHeader->PrimaryVertex(vtxMC); | |
282 | } | |
283 | ||
284 | // use ESD friends | |
285 | if(bUseESDfriend) { | |
286 | if(!esdFriend) { | |
287 | Error("Exec","esdFriend not available"); | |
288 | return; | |
289 | } | |
290 | } | |
291 | ||
e6a60a90 | 292 | // trigger |
4bb5f8a9 | 293 | if(!bUseMC ) { |
294 | Bool_t isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass()); | |
295 | if(!isEventTriggered) return; | |
296 | } | |
e6a60a90 | 297 | |
298 | // get TPC event vertex | |
299 | const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTPC(); | |
300 | if(vtxESD && (vtxESD->GetStatus()<=0)) return; | |
301 | ||
7cc34f08 | 302 | // Process events |
303 | for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++) | |
304 | { | |
305 | AliESDtrack *track = esdEvent->GetTrack(iTrack); | |
306 | if(!track) continue; | |
307 | ||
308 | if(GetAnalysisMode() == 0) ProcessTPC(stack,track); | |
309 | else if(GetAnalysisMode() == 1) ProcessTPCITS(stack,track); | |
310 | else if(GetAnalysisMode() == 2) ProcessConstrained(stack,track); | |
311 | else { | |
312 | printf("ERROR: AnalysisMode %d \n",fAnalysisMode); | |
313 | return; | |
314 | } | |
315 | } | |
316 | } | |
317 | ||
318 | //_____________________________________________________________________________ | |
319 | void AliPerformanceDCA::Analyse() | |
320 | { | |
321 | // | |
322 | // Analyse comparison information and store output histograms | |
323 | // in the analysis folder "folderDCA" | |
324 | // | |
325 | ||
326 | TH1::AddDirectory(kFALSE); | |
4bb5f8a9 | 327 | TH1F *h1D=0; |
328 | TH2F *h2D=0; | |
7cc34f08 | 329 | TObjArray *aFolderObj = new TObjArray; |
330 | char title[256]; | |
4bb5f8a9 | 331 | TObjArray *arr[6] = {0}; |
332 | TF1 *f1[6] = {0}; | |
7cc34f08 | 333 | |
334 | // set pt measurable range | |
a13f4653 | 335 | //fDCAHisto->GetAxis(3)->SetRangeUser(0.10,10.); |
7cc34f08 | 336 | |
337 | // | |
4bb5f8a9 | 338 | h2D = (TH2F*)fDCAHisto->Projection(0,1); // inverse projection convention |
7cc34f08 | 339 | h2D->SetName("dca_r_vs_dca_z"); |
340 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle()); | |
341 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(0)->GetTitle()); | |
342 | sprintf(title,"%s vs %s",fDCAHisto->GetAxis(0)->GetTitle(),fDCAHisto->GetAxis(1)->GetTitle()); | |
343 | h2D->SetTitle(title); | |
344 | aFolderObj->Add(h2D); | |
345 | ||
346 | // | |
4bb5f8a9 | 347 | h2D = (TH2F*)fDCAHisto->Projection(0,2); |
7cc34f08 | 348 | h2D->SetName("dca_r_vs_eta"); |
349 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
350 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(0)->GetTitle()); | |
351 | sprintf(title,"%s vs %s",fDCAHisto->GetAxis(2)->GetTitle(),fDCAHisto->GetAxis(0)->GetTitle()); | |
352 | h2D->SetTitle(title); | |
353 | aFolderObj->Add(h2D); | |
354 | ||
4bb5f8a9 | 355 | // |
356 | // mean and rms | |
357 | // | |
7cc34f08 | 358 | h1D = MakeStat1D(h2D,0,0); |
359 | h1D->SetName("mean_dca_r_vs_eta"); | |
360 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
361 | h1D->GetYaxis()->SetTitle("mean_dca_r (cm)"); | |
362 | sprintf(title," mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
363 | h1D->SetTitle(title); | |
364 | aFolderObj->Add(h1D); | |
365 | ||
366 | h1D = MakeStat1D(h2D,0,1); | |
367 | h1D->SetName("rms_dca_r_vs_eta"); | |
368 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
369 | h1D->GetYaxis()->SetTitle("rms_dca_r (cm)"); | |
370 | sprintf(title," rms_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
371 | h1D->SetTitle(title); | |
372 | aFolderObj->Add(h1D); | |
373 | ||
374 | // | |
4bb5f8a9 | 375 | // fit mean and sigma |
376 | // | |
377 | ||
378 | arr[0] = new TObjArray(); | |
379 | f1[0] = new TF1("gaus","gaus"); | |
380 | h2D->FitSlicesY(f1[0],0,-1,0,"QNR",arr[0]); | |
381 | ||
382 | h1D = (TH1F*)arr[0]->At(1); | |
383 | h1D->SetName("fit_mean_dca_r_vs_eta"); | |
384 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
385 | h1D->GetYaxis()->SetTitle("fit_mean_dca_r (cm)"); | |
386 | sprintf(title," fit_mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
387 | h1D->SetTitle(title); | |
388 | aFolderObj->Add(h1D); | |
389 | ||
390 | h1D = (TH1F*)arr[0]->At(2); | |
391 | h1D->SetName("res_dca_r_vs_eta"); | |
392 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
393 | h1D->GetYaxis()->SetTitle("res_dca_r (cm)"); | |
394 | sprintf(title," res_dca_r (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
395 | h1D->SetTitle(title); | |
396 | aFolderObj->Add(h1D); | |
397 | ||
398 | // | |
399 | // | |
400 | // | |
401 | h2D = (TH2F*)fDCAHisto->Projection(0,3); | |
7cc34f08 | 402 | h2D->SetName("dca_r_vs_pt"); |
403 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
404 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(0)->GetTitle()); | |
405 | sprintf(title,"%s vs %s",fDCAHisto->GetAxis(0)->GetTitle(),fDCAHisto->GetAxis(3)->GetTitle()); | |
406 | h2D->SetTitle(title); | |
407 | h2D->SetBit(TH1::kLogX); | |
408 | aFolderObj->Add(h2D); | |
409 | ||
410 | h1D = MakeStat1D(h2D,0,0); | |
411 | h1D->SetName("mean_dca_r_vs_pt"); | |
412 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
413 | h1D->GetYaxis()->SetTitle("mean_dca_r (cm)"); | |
414 | sprintf(title,"mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
415 | h1D->SetTitle(title); | |
416 | h1D->SetBit(TH1::kLogX); | |
417 | aFolderObj->Add(h1D); | |
418 | ||
419 | h1D = MakeStat1D(h2D,0,1); | |
420 | h1D->SetName("rms_dca_r_vs_pt"); | |
421 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
422 | h1D->GetYaxis()->SetTitle("rms_dca_r (cm)"); | |
423 | sprintf(title,"rms_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
424 | h1D->SetTitle(title); | |
425 | h1D->SetBit(TH1::kLogX); | |
426 | aFolderObj->Add(h1D); | |
427 | ||
4bb5f8a9 | 428 | // |
429 | // fit mean and sigma | |
430 | // | |
431 | ||
432 | arr[1] = new TObjArray(); | |
433 | f1[1] = new TF1("gaus","gaus"); | |
434 | h2D->FitSlicesY(f1[1],0,-1,0,"QNR",arr[1]); | |
435 | ||
436 | h1D = (TH1F*)arr[1]->At(1); | |
437 | h1D->SetName("fit_mean_dca_r_vs_pt"); | |
438 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
439 | h1D->GetYaxis()->SetTitle("fit_mean_dca_r (cm)"); | |
440 | sprintf(title,"fit_mean_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
441 | h1D->SetTitle(title); | |
442 | h1D->SetBit(TH1::kLogX); | |
443 | aFolderObj->Add(h1D); | |
444 | ||
445 | h1D = (TH1F*)arr[1]->At(2); | |
446 | h1D->SetName("res_dca_r_vs_pt"); | |
447 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
448 | h1D->GetYaxis()->SetTitle("res_dca_r (cm)"); | |
449 | sprintf(title,"res_dca_r (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
450 | h1D->SetTitle(title); | |
451 | h1D->SetBit(TH1::kLogX); | |
452 | aFolderObj->Add(h1D); | |
453 | ||
7cc34f08 | 454 | // |
4bb5f8a9 | 455 | h2D = (TH2F*)fDCAHisto->Projection(1,2); |
7cc34f08 | 456 | h2D->SetName("dca_z_vs_eta"); |
457 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
458 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle()); | |
459 | sprintf(title,"%s vs %s",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(2)->GetTitle()); | |
460 | h2D->SetTitle(title); | |
461 | aFolderObj->Add(h2D); | |
462 | ||
463 | h1D = MakeStat1D(h2D,0,0); | |
464 | h1D->SetName("mean_dca_z_vs_eta"); | |
465 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
466 | h1D->GetYaxis()->SetTitle("mean_dca_z (cm)"); | |
467 | sprintf(title,"mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
468 | h1D->SetTitle(title); | |
469 | aFolderObj->Add(h1D); | |
470 | ||
471 | h1D = MakeStat1D(h2D,0,1); | |
472 | h1D->SetName("rms_dca_z_vs_eta"); | |
473 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
474 | h1D->GetYaxis()->SetTitle("rms_dca_z (cm)"); | |
475 | sprintf(title,"rms_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
476 | h1D->SetTitle(title); | |
477 | aFolderObj->Add(h1D); | |
478 | ||
479 | // | |
4bb5f8a9 | 480 | // fit mean and sigma |
481 | // | |
482 | arr[2] = new TObjArray(); | |
483 | f1[2] = new TF1("gaus","gaus"); | |
484 | h2D->FitSlicesY(f1[2],0,-1,0,"QNR",arr[2]); | |
485 | ||
486 | h1D = (TH1F*)arr[2]->At(1); | |
487 | h1D->SetName("fit_mean_dca_z_vs_eta"); | |
488 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
489 | h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)"); | |
490 | sprintf(title,"fit_mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
491 | h1D->SetTitle(title); | |
492 | aFolderObj->Add(h1D); | |
493 | ||
494 | h1D = (TH1F*)arr[2]->At(2); | |
495 | h1D->SetName("res_dca_z_vs_eta"); | |
496 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(2)->GetTitle()); | |
497 | h1D->GetYaxis()->SetTitle("res_dca_z (cm)"); | |
498 | sprintf(title,"res_dca_z (cm) vs %s",fDCAHisto->GetAxis(2)->GetTitle()); | |
499 | h1D->SetTitle(title); | |
500 | aFolderObj->Add(h1D); | |
501 | ||
502 | // | |
503 | h2D = (TH2F*)fDCAHisto->Projection(1,3); | |
7cc34f08 | 504 | h2D->SetName("dca_z_vs_pt"); |
505 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
506 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle()); | |
507 | sprintf(title,"%s vs %s",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(3)->GetTitle()); | |
508 | h2D->SetTitle(title); | |
509 | h2D->SetBit(TH1::kLogX); | |
510 | aFolderObj->Add(h2D); | |
511 | ||
512 | h1D = MakeStat1D(h2D,0,0); | |
513 | h1D->SetName("mean_dca_z_vs_pt"); | |
514 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
515 | h1D->GetYaxis()->SetTitle("mean_dca_z (cm)"); | |
516 | sprintf(title,"mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
517 | h1D->SetTitle(title); | |
518 | h1D->SetBit(TH1::kLogX); | |
519 | aFolderObj->Add(h1D); | |
520 | ||
521 | h1D = MakeStat1D(h2D,0,1); | |
522 | h1D->SetName("rms_dca_z_vs_pt"); | |
523 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
524 | h1D->GetYaxis()->SetTitle("rms_dca_z (cm)"); | |
525 | sprintf(title,"rms_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
526 | h1D->SetTitle(title); | |
527 | h1D->SetBit(TH1::kLogX); | |
528 | aFolderObj->Add(h1D); | |
529 | ||
4bb5f8a9 | 530 | // |
531 | // fit mean and sigma | |
532 | // | |
533 | ||
534 | arr[3] = new TObjArray(); | |
535 | f1[3] = new TF1("gaus","gaus"); | |
536 | h2D->FitSlicesY(f1[3],0,-1,0,"QNR",arr[3]); | |
537 | ||
538 | h1D = (TH1F*)arr[3]->At(1); | |
539 | h1D->SetName("fit_mean_dca_z_vs_pt"); | |
540 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
541 | h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)"); | |
542 | sprintf(title,"fit_mean_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
543 | h1D->SetTitle(title); | |
544 | h1D->SetBit(TH1::kLogX); | |
545 | aFolderObj->Add(h1D); | |
546 | ||
547 | h1D = (TH1F*)arr[3]->At(2); | |
548 | h1D->SetName("res_dca_z_vs_pt"); | |
549 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(3)->GetTitle()); | |
550 | h1D->GetYaxis()->SetTitle("res_dca_z (cm)"); | |
551 | sprintf(title,"res_dca_z (cm) vs %s",fDCAHisto->GetAxis(3)->GetTitle()); | |
552 | h1D->SetTitle(title); | |
553 | h1D->SetBit(TH1::kLogX); | |
554 | aFolderObj->Add(h1D); | |
555 | ||
886bf4d3 | 556 | // A - side |
557 | fDCAHisto->GetAxis(2)->SetRangeUser(-1.5,0.0); | |
7cc34f08 | 558 | |
4bb5f8a9 | 559 | h2D = (TH2F*)fDCAHisto->Projection(1,4); |
560 | h2D->SetName("dca_z_vs_phi_Aside"); | |
886bf4d3 | 561 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); |
562 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle()); | |
563 | sprintf(title,"%s vs %s (A-side)",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(4)->GetTitle()); | |
7cc34f08 | 564 | h2D->SetTitle(title); |
565 | aFolderObj->Add(h2D); | |
566 | ||
886bf4d3 | 567 | h1D = MakeStat1D(h2D,0,0); |
4bb5f8a9 | 568 | h1D->SetName("mean_dca_z_vs_phi_Aside"); |
886bf4d3 | 569 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); |
570 | h1D->GetYaxis()->SetTitle("mean_dca_z (cm)"); | |
571 | sprintf(title,"mean_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
572 | h1D->SetTitle(title); | |
573 | aFolderObj->Add(h1D); | |
7cc34f08 | 574 | |
886bf4d3 | 575 | h1D = MakeStat1D(h2D,0,1); |
4bb5f8a9 | 576 | h1D->SetName("rms_dca_z_vs_phi_Aside"); |
886bf4d3 | 577 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); |
578 | h1D->GetYaxis()->SetTitle("rms_dca_z (cm)"); | |
579 | sprintf(title,"rms_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
580 | h1D->SetTitle(title); | |
581 | aFolderObj->Add(h1D); | |
582 | ||
4bb5f8a9 | 583 | // |
584 | // fit mean and sigma | |
585 | // | |
586 | arr[4] = new TObjArray(); | |
587 | f1[4] = new TF1("gaus","gaus"); | |
588 | h2D->FitSlicesY(f1[4],0,-1,0,"QNR",arr[4]); | |
589 | ||
590 | h1D = (TH1F*)arr[4]->At(1); | |
591 | h1D->SetName("fit_mean_dca_z_vs_phi_Aside"); | |
592 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); | |
593 | h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)"); | |
594 | sprintf(title,"fit_mean_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
595 | h1D->SetTitle(title); | |
596 | aFolderObj->Add(h1D); | |
597 | ||
598 | h1D = (TH1F*)arr[4]->At(2); | |
599 | h1D->SetName("res_dca_z_vs_phi_Aside"); | |
600 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); | |
601 | h1D->GetYaxis()->SetTitle("res_dca_z (cm)"); | |
602 | sprintf(title,"res_dca_z (cm) vs %s (A-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
603 | h1D->SetTitle(title); | |
604 | aFolderObj->Add(h1D); | |
605 | ||
606 | ||
886bf4d3 | 607 | // C - side |
608 | fDCAHisto->GetAxis(2)->SetRangeUser(0.0,1.5); | |
7cc34f08 | 609 | |
4bb5f8a9 | 610 | h2D = (TH2F*)fDCAHisto->Projection(1,4); |
611 | h2D->SetName("dca_z_vs_phi_Cside"); | |
886bf4d3 | 612 | h2D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); |
613 | h2D->GetYaxis()->SetTitle(fDCAHisto->GetAxis(1)->GetTitle()); | |
614 | sprintf(title,"%s vs %s (C-side)",fDCAHisto->GetAxis(1)->GetTitle(),fDCAHisto->GetAxis(4)->GetTitle()); | |
7cc34f08 | 615 | h2D->SetTitle(title); |
616 | aFolderObj->Add(h2D); | |
617 | ||
886bf4d3 | 618 | h1D = MakeStat1D(h2D,0,0); |
4bb5f8a9 | 619 | h1D->SetName("mean_dca_z_vs_phi_Cside"); |
886bf4d3 | 620 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); |
621 | h1D->GetYaxis()->SetTitle("mean_dca_z (cm)"); | |
622 | sprintf(title,"mean_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
623 | h1D->SetTitle(title); | |
624 | aFolderObj->Add(h1D); | |
625 | ||
626 | h1D = MakeStat1D(h2D,0,1); | |
4bb5f8a9 | 627 | h1D->SetName("rms_dca_z_vs_phi_Cside"); |
886bf4d3 | 628 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); |
629 | h1D->GetYaxis()->SetTitle("rms_dca_z (cm)"); | |
630 | sprintf(title,"rms_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
631 | h1D->SetTitle(title); | |
632 | aFolderObj->Add(h1D); | |
886bf4d3 | 633 | |
4bb5f8a9 | 634 | // |
635 | // fit mean and sigma | |
636 | // | |
637 | arr[5] = new TObjArray(); | |
638 | f1[5] = new TF1("gaus","gaus"); | |
639 | h2D->FitSlicesY(f1[5],0,-1,0,"QNR",arr[5]); | |
640 | ||
641 | h1D = (TH1F*)arr[5]->At(1); | |
642 | h1D->SetName("fit_mean_dca_z_vs_phi_Cside"); | |
643 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); | |
644 | h1D->GetYaxis()->SetTitle("fit_mean_dca_z (cm)"); | |
645 | sprintf(title,"fit_mean_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
646 | h1D->SetTitle(title); | |
647 | aFolderObj->Add(h1D); | |
7cc34f08 | 648 | |
4bb5f8a9 | 649 | h1D = (TH1F*)arr[5]->At(2); |
650 | h1D->SetName("res_dca_z_vs_phi_Cside"); | |
651 | h1D->GetXaxis()->SetTitle(fDCAHisto->GetAxis(4)->GetTitle()); | |
652 | h1D->GetYaxis()->SetTitle("res_dca_z (cm)"); | |
653 | sprintf(title,"res_dca_z (cm) vs %s (C-side)",fDCAHisto->GetAxis(4)->GetTitle()); | |
654 | h1D->SetTitle(title); | |
655 | aFolderObj->Add(h1D); | |
656 | ||
7cc34f08 | 657 | // export objects to analysis folder |
658 | fAnalysisFolder = ExportToFolder(aFolderObj); | |
659 | ||
660 | // delete only TObjArray | |
661 | if(aFolderObj) delete aFolderObj; | |
662 | } | |
663 | ||
664 | //_____________________________________________________________________________ | |
665 | TH1F* AliPerformanceDCA::MakeStat1D(TH2 *hist, Int_t delta0, Int_t type) | |
666 | { | |
667 | // Return TH1F histogram | |
668 | // delta - number of bins to integrate | |
669 | // with mean (type == 0) or RMS (type==1) | |
670 | ||
671 | char hname[256]; | |
672 | const char* suffix = "_stat1d"; | |
673 | sprintf(hname,"%s%s",hist->GetName(),suffix); | |
674 | TAxis* xaxis = hist->GetXaxis(); | |
675 | Int_t nbinx = xaxis->GetNbins(); | |
676 | ||
677 | TH1F *hnew = (TH1F*)hist->ProjectionX()->Clone(); | |
678 | hnew->SetName(hname); | |
679 | ||
680 | char name[256]; | |
681 | for (Int_t ix=0; ix<=nbinx;ix++) { | |
682 | sprintf(name,"%s_%d",hist->GetName(),ix); | |
683 | TH1 *projection = hist->ProjectionY(name,ix-delta0,ix+delta0); | |
684 | ||
685 | Float_t stat= 0., stat_err =0.; | |
686 | if (type==0) { stat = projection->GetMean(); stat_err = projection->GetMeanError(); } | |
687 | if (type==1) { stat = projection->GetRMS(); stat_err = projection->GetRMSError(); } | |
688 | ||
689 | hnew->SetBinContent(ix, stat); | |
690 | hnew->SetBinError(ix, stat_err); | |
691 | } | |
692 | ||
693 | return hnew; | |
694 | } | |
695 | ||
696 | //_____________________________________________________________________________ | |
697 | TH2F* AliPerformanceDCA::MakeStat2D(TH3 *hist, Int_t delta0, Int_t delta1, Int_t type) | |
698 | { | |
699 | // Return TH1F histogram | |
700 | // delta0 - number of bins to integrate in x | |
701 | // delta1 - number of bins to integrate in y | |
702 | // with mean (type==0) or RMS (type==1) | |
703 | ||
704 | char hname[256]; | |
705 | const char* suffix = "_stat2d"; | |
706 | sprintf(hname,"%s%s",hist->GetName(),suffix); | |
707 | ||
708 | TAxis* xaxis = hist->GetXaxis(); | |
709 | Int_t nbinx = xaxis->GetNbins(); | |
710 | ||
711 | TH2F *hnew = (TH2F*)hist->Project3D("yx")->Clone(); | |
712 | hnew->SetName(hname); | |
713 | ||
714 | TAxis* yaxis = hist->GetYaxis(); | |
715 | Int_t nbiny = yaxis->GetNbins(); | |
716 | ||
717 | char name[256]; | |
718 | for (Int_t ix=0; ix<=nbinx;ix++) { | |
719 | for (Int_t iy=0; iy<=nbiny;iy++) { | |
720 | sprintf(name,"%s_%d_%d",hist->GetName(),ix,iy); | |
721 | TH1 *projection = hist->ProjectionZ(name,ix-delta0,ix+delta0,iy-delta1,iy+delta1); | |
722 | ||
723 | Float_t stat= 0., stat_err =0.; | |
724 | if (type==0) { stat = projection->GetMean(); stat_err = projection->GetMeanError(); } | |
725 | if (type==1) { stat = projection->GetRMS(); stat_err = projection->GetRMSError(); } | |
726 | ||
727 | hnew->SetBinContent(ix,iy,stat); | |
728 | hnew->SetBinError(ix,iy,stat_err); | |
729 | } | |
730 | } | |
731 | ||
732 | return hnew; | |
733 | } | |
734 | ||
735 | //_____________________________________________________________________________ | |
736 | TFolder* AliPerformanceDCA::ExportToFolder(TObjArray * array) | |
737 | { | |
738 | // recreate folder avery time and export objects to new one | |
739 | // | |
740 | AliPerformanceDCA * comp=this; | |
741 | TFolder *folder = comp->GetAnalysisFolder(); | |
742 | ||
743 | TString name, title; | |
744 | TFolder *newFolder = 0; | |
745 | Int_t i = 0; | |
746 | Int_t size = array->GetSize(); | |
747 | ||
748 | if(folder) { | |
749 | // get name and title from old folder | |
750 | name = folder->GetName(); | |
751 | title = folder->GetTitle(); | |
752 | ||
753 | // delete old one | |
754 | delete folder; | |
755 | ||
756 | // create new one | |
757 | newFolder = CreateFolder(name.Data(),title.Data()); | |
758 | newFolder->SetOwner(); | |
759 | ||
760 | // add objects to folder | |
761 | while(i < size) { | |
762 | newFolder->Add(array->At(i)); | |
763 | i++; | |
764 | } | |
765 | } | |
766 | ||
767 | return newFolder; | |
768 | } | |
769 | ||
770 | //_____________________________________________________________________________ | |
771 | TFolder* AliPerformanceDCA::CreateFolder(TString name,TString title) { | |
772 | // create folder for analysed histograms | |
773 | TFolder *folder = 0; | |
774 | folder = new TFolder(name.Data(),title.Data()); | |
775 | ||
776 | return folder; | |
777 | } |