]>
Commit | Line | Data |
---|---|---|
d560b581 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
55e05544 | 16 | /* $Id$ */ |
17 | ||
18 | #include "AlidNdEtaCorrection.h" | |
19 | ||
74fd10b3 | 20 | #include <AliLog.h> |
55e05544 | 21 | #include <TCanvas.h> |
847489f7 | 22 | #include <TH3F.h> |
47ab1f70 | 23 | #include <TH2F.h> |
847489f7 | 24 | #include <TH1D.h> |
d560b581 | 25 | #include <TDirectory.h> |
74fd10b3 | 26 | #include <AliCorrection.h> |
27 | #include <AliCorrectionMatrix2D.h> | |
28 | #include <AliCorrectionMatrix3D.h> | |
55e05544 | 29 | |
30 | //____________________________________________________________________ | |
31 | ClassImp(AlidNdEtaCorrection) | |
32 | ||
33 | //____________________________________________________________________ | |
8b3563f4 | 34 | AlidNdEtaCorrection::AlidNdEtaCorrection() |
35 | : TNamed(), | |
36 | fTrack2ParticleCorrection(0), | |
37 | fVertexRecoCorrection(0), | |
7584d357 | 38 | fTriggerBiasCorrectionMBToINEL(0), |
39 | fTriggerBiasCorrectionMBToNSD(0), | |
81be4ee8 | 40 | fTriggerBiasCorrectionMBToND(0), |
41 | fTriggerBiasCorrectionMBToOnePart(0) | |
8b3563f4 | 42 | { |
43 | // default constructor | |
44 | } | |
45 | ||
46 | //____________________________________________________________________ | |
770a1f1d | 47 | AlidNdEtaCorrection::AlidNdEtaCorrection(const Char_t* name, const Char_t* title, AliPWG0Helper::AnalysisMode analysis) |
8b3563f4 | 48 | : TNamed(name, title), |
38233af1 | 49 | fTrack2ParticleCorrection(0), |
50 | fVertexRecoCorrection(0), | |
7584d357 | 51 | fTriggerBiasCorrectionMBToINEL(0), |
52 | fTriggerBiasCorrectionMBToNSD(0), | |
81be4ee8 | 53 | fTriggerBiasCorrectionMBToND(0), |
54 | fTriggerBiasCorrectionMBToOnePart(0) | |
8b3563f4 | 55 | { |
74fd10b3 | 56 | // |
55e05544 | 57 | // constructor |
58 | // | |
59 | ||
0f67a57c | 60 | fTrack2ParticleCorrection = new AliCorrection("Track2Particle", "Track2Particle", analysis); |
61 | fVertexRecoCorrection = new AliCorrection("VertexReconstruction", "VertexReconstruction", analysis); | |
1afae8ff | 62 | |
0f67a57c | 63 | fTriggerBiasCorrectionMBToINEL = new AliCorrection("TriggerBias_MBToINEL", "TriggerBias_MBToINEL", analysis); |
64 | fTriggerBiasCorrectionMBToNSD = new AliCorrection("TriggerBias_MBToNSD", "TriggerBias_MBToNSD", analysis); | |
65 | fTriggerBiasCorrectionMBToND = new AliCorrection("TriggerBias_MBToND", "TriggerBias_MBToND", analysis); | |
81be4ee8 | 66 | fTriggerBiasCorrectionMBToOnePart = new AliCorrection("TriggerBias_MBToOnePart", "TriggerBias_MBToOnePart", analysis); |
55e05544 | 67 | } |
68 | ||
38233af1 | 69 | //____________________________________________________________________ |
70 | AlidNdEtaCorrection::~AlidNdEtaCorrection() | |
71 | { | |
72 | // destructor | |
73 | ||
7584d357 | 74 | if (fTrack2ParticleCorrection) { |
38233af1 | 75 | delete fTrack2ParticleCorrection; |
76 | fTrack2ParticleCorrection = 0; | |
77 | } | |
78 | ||
7584d357 | 79 | if (fVertexRecoCorrection) { |
38233af1 | 80 | delete fVertexRecoCorrection; |
81 | fVertexRecoCorrection = 0; | |
82 | } | |
83 | ||
7584d357 | 84 | if (fTriggerBiasCorrectionMBToINEL) { |
85 | delete fTriggerBiasCorrectionMBToINEL; | |
86 | fTriggerBiasCorrectionMBToINEL = 0; | |
38233af1 | 87 | } |
88 | ||
7584d357 | 89 | if (fTriggerBiasCorrectionMBToNSD) { |
90 | delete fTriggerBiasCorrectionMBToNSD; | |
91 | fTriggerBiasCorrectionMBToNSD = 0; | |
92 | } | |
93 | ||
94 | if (fTriggerBiasCorrectionMBToND) { | |
95 | delete fTriggerBiasCorrectionMBToND; | |
96 | fTriggerBiasCorrectionMBToND = 0; | |
38233af1 | 97 | } |
81be4ee8 | 98 | |
99 | if (fTriggerBiasCorrectionMBToOnePart) { | |
100 | delete fTriggerBiasCorrectionMBToOnePart; | |
101 | fTriggerBiasCorrectionMBToOnePart = 0; | |
102 | } | |
38233af1 | 103 | } |
104 | ||
55e05544 | 105 | //____________________________________________________________________ |
106 | void | |
45e97e28 | 107 | AlidNdEtaCorrection::Finish() { |
55e05544 | 108 | // |
109 | // finish method | |
110 | // | |
45e97e28 | 111 | // divide the histograms in the AliCorrectionMatrix2D objects to get the corrections |
55e05544 | 112 | |
45e97e28 | 113 | fTrack2ParticleCorrection->Divide(); |
55e05544 | 114 | fVertexRecoCorrection->Divide(); |
7584d357 | 115 | fTriggerBiasCorrectionMBToINEL->Divide(); |
116 | fTriggerBiasCorrectionMBToNSD->Divide(); | |
117 | fTriggerBiasCorrectionMBToND->Divide(); | |
81be4ee8 | 118 | fTriggerBiasCorrectionMBToOnePart->Divide(); |
55e05544 | 119 | } |
120 | ||
121 | //____________________________________________________________________ | |
74fd10b3 | 122 | Long64_t AlidNdEtaCorrection::Merge(TCollection* list) |
123 | { | |
55e05544 | 124 | // Merge a list of dNdEtaCorrection objects with this (needed for |
7af955da | 125 | // PROOF). |
55e05544 | 126 | // Returns the number of merged objects (including this). |
127 | ||
128 | if (!list) | |
129 | return 0; | |
7af955da | 130 | |
55e05544 | 131 | if (list->IsEmpty()) |
132 | return 1; | |
133 | ||
134 | TIterator* iter = list->MakeIterator(); | |
135 | TObject* obj; | |
136 | ||
137 | // collections of measured and generated histograms | |
7584d357 | 138 | TList* collectionNtrackToNparticle = new TList; |
139 | TList* collectionVertexReco = new TList; | |
140 | TList* collectionTriggerBiasMBToINEL = new TList; | |
141 | TList* collectionTriggerBiasMBToNSD = new TList; | |
142 | TList* collectionTriggerBiasMBToND = new TList; | |
81be4ee8 | 143 | TList* collectionTriggerBiasMBToOnePart = new TList; |
55e05544 | 144 | |
145 | Int_t count = 0; | |
146 | while ((obj = iter->Next())) { | |
7af955da | 147 | |
55e05544 | 148 | AlidNdEtaCorrection* entry = dynamic_cast<AlidNdEtaCorrection*> (obj); |
7af955da | 149 | if (entry == 0) |
55e05544 | 150 | continue; |
151 | ||
74fd10b3 | 152 | collectionNtrackToNparticle ->Add(entry->fTrack2ParticleCorrection); |
153 | collectionVertexReco ->Add(entry->fVertexRecoCorrection); | |
154 | collectionTriggerBiasMBToINEL->Add(entry->fTriggerBiasCorrectionMBToINEL); | |
155 | collectionTriggerBiasMBToNSD ->Add(entry->fTriggerBiasCorrectionMBToNSD); | |
156 | collectionTriggerBiasMBToND ->Add(entry->fTriggerBiasCorrectionMBToND); | |
81be4ee8 | 157 | collectionTriggerBiasMBToOnePart ->Add(entry->fTriggerBiasCorrectionMBToOnePart); |
55e05544 | 158 | |
159 | count++; | |
160 | } | |
7584d357 | 161 | fTrack2ParticleCorrection ->Merge(collectionNtrackToNparticle); |
162 | fVertexRecoCorrection ->Merge(collectionVertexReco); | |
163 | fTriggerBiasCorrectionMBToINEL ->Merge(collectionTriggerBiasMBToINEL); | |
164 | fTriggerBiasCorrectionMBToNSD ->Merge(collectionTriggerBiasMBToNSD); | |
165 | fTriggerBiasCorrectionMBToND ->Merge(collectionTriggerBiasMBToND); | |
81be4ee8 | 166 | fTriggerBiasCorrectionMBToOnePart->Merge(collectionTriggerBiasMBToOnePart); |
10ebe68d | 167 | |
55e05544 | 168 | delete collectionNtrackToNparticle; |
169 | delete collectionVertexReco; | |
7584d357 | 170 | delete collectionTriggerBiasMBToINEL; |
171 | delete collectionTriggerBiasMBToNSD; | |
172 | delete collectionTriggerBiasMBToND; | |
81be4ee8 | 173 | delete collectionTriggerBiasMBToOnePart; |
10ebe68d | 174 | |
55e05544 | 175 | return count+1; |
176 | } | |
177 | ||
2e88424e | 178 | //____________________________________________________________________ |
179 | void AlidNdEtaCorrection::Add(AlidNdEtaCorrection* aCorrectionsToAdd, Float_t c) { | |
180 | // | |
181 | // adds the measured and generated of aCorrectionsToAdd to measured and generated | |
182 | // of all corrections in this | |
183 | ||
184 | fTrack2ParticleCorrection ->Add(aCorrectionsToAdd->GetTrack2ParticleCorrection() ,c); | |
185 | fVertexRecoCorrection ->Add(aCorrectionsToAdd->GetVertexRecoCorrection() ,c); | |
186 | fTriggerBiasCorrectionMBToINEL ->Add(aCorrectionsToAdd->GetTriggerBiasCorrectionINEL(),c); | |
187 | fTriggerBiasCorrectionMBToNSD ->Add(aCorrectionsToAdd->GetTriggerBiasCorrectionNSD() ,c); | |
188 | fTriggerBiasCorrectionMBToND ->Add(aCorrectionsToAdd->GetTriggerBiasCorrectionND() ,c); | |
81be4ee8 | 189 | fTriggerBiasCorrectionMBToOnePart ->Add(aCorrectionsToAdd->GetTriggerBiasCorrectionOnePart() ,c); |
190 | } | |
191 | ||
192 | //____________________________________________________________________ | |
193 | void AlidNdEtaCorrection::Scale(Float_t c) | |
194 | { | |
195 | // | |
196 | // scales all contained corrections | |
197 | // | |
198 | ||
199 | fTrack2ParticleCorrection ->Scale(c); | |
200 | fVertexRecoCorrection ->Scale(c); | |
201 | fTriggerBiasCorrectionMBToINEL ->Scale(c); | |
202 | fTriggerBiasCorrectionMBToNSD ->Scale(c); | |
203 | fTriggerBiasCorrectionMBToND ->Scale(c); | |
204 | fTriggerBiasCorrectionMBToOnePart ->Scale(c); | |
2e88424e | 205 | } |
206 | ||
207 | //____________________________________________________________________ | |
208 | void AlidNdEtaCorrection::Reset(void) { | |
209 | // | |
210 | // reset all corrections | |
211 | // | |
212 | ||
213 | fTrack2ParticleCorrection ->Reset(); | |
214 | fVertexRecoCorrection ->Reset(); | |
215 | fTriggerBiasCorrectionMBToINEL ->Reset(); | |
216 | fTriggerBiasCorrectionMBToNSD ->Reset(); | |
217 | fTriggerBiasCorrectionMBToND ->Reset(); | |
81be4ee8 | 218 | fTriggerBiasCorrectionMBToOnePart ->Reset(); |
2e88424e | 219 | } |
220 | ||
221 | ||
222 | ||
55e05544 | 223 | //____________________________________________________________________ |
74fd10b3 | 224 | Bool_t AlidNdEtaCorrection::LoadHistograms(const Char_t* dir) |
225 | { | |
55e05544 | 226 | // |
227 | // loads the histograms | |
74fd10b3 | 228 | // if dir is empty a directory with the name of this object is taken (like in SaveHistogram) |
55e05544 | 229 | // |
230 | ||
74fd10b3 | 231 | if (!dir) |
232 | dir = GetName(); | |
7584d357 | 233 | |
74fd10b3 | 234 | if (!gDirectory->cd(dir)) |
235 | return kFALSE; | |
236 | ||
237 | fTrack2ParticleCorrection ->LoadHistograms(); | |
238 | fVertexRecoCorrection ->LoadHistograms(); | |
239 | fTriggerBiasCorrectionMBToINEL ->LoadHistograms(); | |
240 | fTriggerBiasCorrectionMBToNSD ->LoadHistograms(); | |
241 | fTriggerBiasCorrectionMBToND ->LoadHistograms(); | |
81be4ee8 | 242 | fTriggerBiasCorrectionMBToOnePart ->LoadHistograms(); |
74fd10b3 | 243 | |
244 | gDirectory->cd(".."); | |
1afae8ff | 245 | |
55e05544 | 246 | return kTRUE; |
247 | } | |
248 | ||
55e05544 | 249 | //____________________________________________________________________ |
74fd10b3 | 250 | void AlidNdEtaCorrection::SaveHistograms() |
251 | { | |
55e05544 | 252 | // |
253 | // save the histograms | |
254 | // | |
255 | ||
256 | gDirectory->mkdir(fName.Data()); | |
257 | gDirectory->cd(fName.Data()); | |
258 | ||
7584d357 | 259 | fTrack2ParticleCorrection ->SaveHistograms(); |
260 | fVertexRecoCorrection ->SaveHistograms(); | |
261 | fTriggerBiasCorrectionMBToINEL->SaveHistograms(); | |
262 | fTriggerBiasCorrectionMBToNSD ->SaveHistograms(); | |
263 | fTriggerBiasCorrectionMBToND ->SaveHistograms(); | |
81be4ee8 | 264 | fTriggerBiasCorrectionMBToOnePart->SaveHistograms(); |
55e05544 | 265 | |
74fd10b3 | 266 | gDirectory->cd(".."); |
55e05544 | 267 | } |
268 | ||
269 | //____________________________________________________________________ | |
270 | void AlidNdEtaCorrection::DrawHistograms() | |
271 | { | |
272 | // | |
dd367a14 | 273 | // call the draw histogram method of the corrections |
74fd10b3 | 274 | // |
55e05544 | 275 | |
7584d357 | 276 | fTrack2ParticleCorrection ->DrawHistograms(); |
277 | fVertexRecoCorrection ->DrawHistograms(); | |
278 | fTriggerBiasCorrectionMBToINEL->DrawHistograms(); | |
279 | fTriggerBiasCorrectionMBToNSD ->DrawHistograms(); | |
280 | fTriggerBiasCorrectionMBToND ->DrawHistograms(); | |
81be4ee8 | 281 | fTriggerBiasCorrectionMBToOnePart ->DrawHistograms(); |
7584d357 | 282 | } |
283 | ||
dd367a14 | 284 | //____________________________________________________________________ |
285 | void AlidNdEtaCorrection::DrawOverview(const char* canvasName) | |
286 | { | |
287 | // | |
288 | // call the DrawOverview histogram method of the corrections | |
289 | // | |
290 | ||
291 | fTrack2ParticleCorrection ->DrawOverview(canvasName); | |
292 | fVertexRecoCorrection ->DrawOverview(canvasName); | |
293 | fTriggerBiasCorrectionMBToINEL->DrawOverview(canvasName); | |
294 | fTriggerBiasCorrectionMBToNSD ->DrawOverview(canvasName); | |
295 | fTriggerBiasCorrectionMBToND ->DrawOverview(canvasName); | |
81be4ee8 | 296 | fTriggerBiasCorrectionMBToOnePart ->DrawOverview(canvasName); |
dd367a14 | 297 | } |
298 | ||
7584d357 | 299 | //____________________________________________________________________ |
74fd10b3 | 300 | void AlidNdEtaCorrection::FillMCParticle(Float_t vtx, Float_t eta, Float_t pt, Bool_t trigger, Bool_t vertex, Int_t processType) |
7584d357 | 301 | { |
74fd10b3 | 302 | // fills a particle in the corrections |
303 | // it is filled in generated or measured depending of the flags | |
7584d357 | 304 | |
74fd10b3 | 305 | fTriggerBiasCorrectionMBToINEL->GetTrackCorrection()->FillGene(vtx, eta, pt); |
7584d357 | 306 | |
81be4ee8 | 307 | if ((processType & AliPWG0Helper::kSD) == 0) |
74fd10b3 | 308 | fTriggerBiasCorrectionMBToNSD->GetTrackCorrection()->FillGene(vtx, eta, pt); |
309 | ||
81be4ee8 | 310 | if (processType & AliPWG0Helper::kND ) |
74fd10b3 | 311 | fTriggerBiasCorrectionMBToND->GetTrackCorrection()->FillGene(vtx, eta, pt); |
312 | ||
81be4ee8 | 313 | if (processType & AliPWG0Helper::kOnePart) |
314 | fTriggerBiasCorrectionMBToOnePart->GetTrackCorrection()->FillGene(vtx, eta, pt); | |
315 | ||
74fd10b3 | 316 | if (!trigger) |
317 | return; | |
318 | ||
319 | fTriggerBiasCorrectionMBToINEL->GetTrackCorrection()->FillMeas(vtx, eta, pt); | |
320 | fTriggerBiasCorrectionMBToNSD->GetTrackCorrection()->FillMeas(vtx, eta, pt); | |
321 | fTriggerBiasCorrectionMBToND->GetTrackCorrection()->FillMeas(vtx, eta, pt); | |
81be4ee8 | 322 | fTriggerBiasCorrectionMBToOnePart->GetTrackCorrection()->FillMeas(vtx, eta, pt); |
74fd10b3 | 323 | fVertexRecoCorrection->GetTrackCorrection()->FillGene(vtx, eta, pt); |
324 | ||
325 | if (!vertex) | |
326 | return; | |
327 | ||
328 | fVertexRecoCorrection->GetTrackCorrection()->FillMeas(vtx, eta, pt); | |
329 | fTrack2ParticleCorrection->GetTrackCorrection()->FillGene(vtx, eta, pt); | |
7584d357 | 330 | } |
55e05544 | 331 | |
7584d357 | 332 | //____________________________________________________________________ |
68fa248f | 333 | void AlidNdEtaCorrection::FillTrackedParticle(Float_t vtx, Float_t eta, Float_t pt, Double_t weight) |
7584d357 | 334 | { |
74fd10b3 | 335 | // fills a tracked particle in the corrections |
336 | ||
68fa248f | 337 | fTrack2ParticleCorrection->GetTrackCorrection()->FillMeas(vtx, eta, pt, weight); |
55e05544 | 338 | } |
847489f7 | 339 | |
7584d357 | 340 | //____________________________________________________________________ |
74fd10b3 | 341 | void AlidNdEtaCorrection::FillEvent(Float_t vtx, Float_t n, Bool_t trigger, Bool_t vertex, Int_t processType) |
7584d357 | 342 | { |
74fd10b3 | 343 | // fills an event int he correction |
344 | // it is filled in generated or measured depending of the flags | |
345 | ||
346 | fTriggerBiasCorrectionMBToINEL->GetEventCorrection()->FillGene(vtx, n); | |
347 | ||
81be4ee8 | 348 | if ((processType & AliPWG0Helper::kSD) == 0) |
74fd10b3 | 349 | fTriggerBiasCorrectionMBToNSD->GetEventCorrection()->FillGene(vtx, n); |
7584d357 | 350 | |
81be4ee8 | 351 | if (processType & AliPWG0Helper::kND ) |
74fd10b3 | 352 | fTriggerBiasCorrectionMBToND->GetEventCorrection()->FillGene(vtx, n); |
353 | ||
81be4ee8 | 354 | if (processType & AliPWG0Helper::kOnePart) |
355 | fTriggerBiasCorrectionMBToOnePart->GetEventCorrection()->FillGene(vtx, n); | |
356 | ||
74fd10b3 | 357 | if (!trigger) |
358 | return; | |
359 | ||
360 | fTriggerBiasCorrectionMBToINEL->GetEventCorrection()->FillMeas(vtx, n); | |
361 | fTriggerBiasCorrectionMBToNSD->GetEventCorrection()->FillMeas(vtx, n); | |
362 | fTriggerBiasCorrectionMBToND->GetEventCorrection()->FillMeas(vtx, n); | |
81be4ee8 | 363 | fTriggerBiasCorrectionMBToOnePart->GetEventCorrection()->FillMeas(vtx, n); |
74fd10b3 | 364 | fVertexRecoCorrection->GetEventCorrection()->FillGene(vtx, n); |
365 | ||
366 | if (!vertex) | |
367 | return; | |
368 | ||
369 | fVertexRecoCorrection->GetEventCorrection()->FillMeas(vtx, n); | |
370 | } | |
7584d357 | 371 | |
847489f7 | 372 | //____________________________________________________________________ |
c17301f3 | 373 | Float_t AlidNdEtaCorrection::GetMeasuredFraction(CorrectionType correctionType, Float_t ptCutOff, Float_t eta, Int_t vertexBegin, Int_t vertexEnd, Bool_t debug) |
847489f7 | 374 | { |
375 | // calculates the fraction of particles measured (some are missed due to the pt cut off) | |
74fd10b3 | 376 | // |
377 | // uses the generated particle histogram from the correction passed, e.g. pass GetTrack2ParticleCorrection() | |
847489f7 | 378 | |
0448e811 | 379 | if (!GetCorrection(correctionType)) |
380 | return -1; | |
381 | ||
5a6310fe | 382 | const TH3* generated = GetCorrection(correctionType)->GetTrackCorrection()->GetGeneratedHistogram(); |
847489f7 | 383 | |
384 | // find eta borders, if eta is negative assume -0.8 ... 0.8 | |
385 | Int_t etaBegin = 0; | |
386 | Int_t etaEnd = 0; | |
700a5a26 | 387 | const TAxis * xax = generated->GetXaxis(); |
388 | const TAxis * yax = generated->GetYaxis(); | |
72e597d7 | 389 | if (eta < -99) |
847489f7 | 390 | { |
700a5a26 | 391 | etaBegin = yax->FindFixBin(-0.8); |
392 | etaEnd = yax->FindFixBin(0.8); | |
847489f7 | 393 | } |
394 | else | |
395 | { | |
700a5a26 | 396 | etaBegin = yax->FindFixBin(eta); |
847489f7 | 397 | etaEnd = etaBegin; |
398 | } | |
399 | ||
c17301f3 | 400 | if (vertexBegin == -1) |
700a5a26 | 401 | vertexBegin = xax->FindFixBin(-9.99); |
c17301f3 | 402 | |
403 | if (vertexEnd == -1) | |
700a5a26 | 404 | vertexEnd = xax->FindFixBin(9.99); |
847489f7 | 405 | |
92d2d8ad | 406 | TH1D* ptProj = dynamic_cast<TH1D*> (generated->ProjectionZ(Form("%s_pt", generated->GetName()), vertexBegin, vertexEnd, etaBegin, etaEnd)); |
b4b9cacc | 407 | //printf("GetMeasuredFraction: bin range %d %d %d %d\n", vertexBegin, vertexEnd, etaBegin, etaEnd); |
1afae8ff | 408 | ptProj->GetXaxis()->SetTitle(generated->GetZaxis()->GetTitle()); |
847489f7 | 409 | |
410 | Int_t ptBin = ptProj->FindBin(ptCutOff); | |
b4b9cacc | 411 | //printf("GetMeasuredFraction: bin range %d %d\n", ptBin, ptProj->GetNbinsX()); |
7307d52c | 412 | Float_t abovePtCut = ptProj->Integral(ptBin, ptProj->GetNbinsX()+1); |
413 | Float_t all = ptProj->Integral(1, ptProj->GetNbinsX()+1); | |
847489f7 | 414 | |
415 | if (all == 0) | |
416 | return -1; | |
417 | ||
418 | Float_t fraction = abovePtCut / all; | |
419 | ||
b4b9cacc | 420 | //printf("GetMeasuredFraction: all %f above %f fraction %f\n", all, abovePtCut, fraction); |
74fd10b3 | 421 | |
847489f7 | 422 | if (debug) |
423 | { | |
424 | new TCanvas; | |
425 | ptProj->Draw(); | |
426 | } | |
92d2d8ad | 427 | else |
428 | delete ptProj; | |
847489f7 | 429 | |
72e597d7 | 430 | if (debug) |
431 | printf("AlidNdEtaCorrection::GetMeasuredFraction: pt cut off = %f, eta = %f, => fraction = %f\n", ptCutOff, eta, fraction); | |
432 | ||
847489f7 | 433 | return fraction; |
434 | } | |
435 | ||
3dfa46a4 | 436 | //____________________________________________________________________ |
437 | TH1* AlidNdEtaCorrection::GetMeasuredEventFraction(CorrectionType correctionType, Int_t multCut) | |
438 | { | |
439 | // calculates the fraction of events above multCut (but including it) | |
440 | // | |
441 | // uses the generated event histogram from the correction passed, e.g. pass GetTrack2ParticleCorrection() | |
442 | ||
443 | if (!GetCorrection(correctionType)) | |
444 | return 0; | |
445 | ||
5a6310fe | 446 | const TH2* generated = GetCorrection(correctionType)->GetEventCorrection()->GetGeneratedHistogram(); |
3dfa46a4 | 447 | |
448 | TH1* allEvents = generated->ProjectionX(Form("%s_all", generated->GetName()), 1, generated->GetNbinsY()); | |
700a5a26 | 449 | TH1* aboveEvents = generated->ProjectionX(Form("%s_above", generated->GetName()), generated->GetYaxis()->FindFixBin(multCut), generated->GetNbinsY()); |
3dfa46a4 | 450 | |
451 | aboveEvents->Divide(aboveEvents, allEvents, 1, 1, "B"); | |
452 | ||
453 | return aboveEvents; | |
454 | } | |
455 | ||
74fd10b3 | 456 | //____________________________________________________________________ |
0ab29cfa | 457 | void AlidNdEtaCorrection::ReduceInformation() |
458 | { | |
459 | // this function deletes the measured and generated histograms from the corrections to reduce the amount of data | |
460 | // in memory | |
461 | ||
462 | // these are needed for GetMeasuredFraction(): fTrack2ParticleCorrection->ReduceInformation(); | |
7584d357 | 463 | fVertexRecoCorrection ->ReduceInformation(); |
464 | fTriggerBiasCorrectionMBToINEL ->ReduceInformation(); | |
465 | fTriggerBiasCorrectionMBToNSD ->ReduceInformation(); | |
466 | fTriggerBiasCorrectionMBToND ->ReduceInformation(); | |
81be4ee8 | 467 | fTriggerBiasCorrectionMBToOnePart ->ReduceInformation(); |
0ab29cfa | 468 | } |
7af955da | 469 | |
0448e811 | 470 | //____________________________________________________________________ |
471 | AliCorrection* AlidNdEtaCorrection::GetCorrection(CorrectionType correctionType) | |
472 | { | |
473 | // returns the given correction | |
474 | ||
475 | switch (correctionType) | |
476 | { | |
477 | case kNone : return 0; | |
478 | case kTrack2Particle : return fTrack2ParticleCorrection; | |
479 | case kVertexReco : return fVertexRecoCorrection; | |
480 | case kINEL : return fTriggerBiasCorrectionMBToINEL; | |
481 | case kNSD : return fTriggerBiasCorrectionMBToNSD; | |
482 | case kND : return fTriggerBiasCorrectionMBToND; | |
81be4ee8 | 483 | case kOnePart : return fTriggerBiasCorrectionMBToOnePart; |
0448e811 | 484 | } |
485 | ||
486 | return 0; | |
487 | } |