]>
Commit | Line | Data |
---|---|---|
1b446896 | 1 | #include "AliHBTFunction.h" |
2 | /******************************************************************/ | |
3 | /* | |
4 | Piotr Krzysztof Skowronski | |
5 | Piotr.Skowronski@cern.ch | |
6 | Base classes for HBT functions | |
7 | ||
8 | function | |
9 | / \ | |
10 | / \ | |
11 | / \ | |
12 | / \ | |
13 | / \ | |
14 | / \ | |
15 | / \ | |
27b3fe5d | 16 | one pair two pair |
1b446896 | 17 | / | \ / | \ |
18 | / | \ / | \ | |
19 | 1D 2D 3D 1D 2D 3D | |
20 | ||
21 | four particle functions are intendent to be resolution functions: | |
22 | it is mecessary to have simulated particle pair corresponding to given | |
23 | recontructed track pair in order to calculate function simualted value | |
24 | and recontructed value to be further histogrammed | |
25 | ||
26 | */ | |
27 | /******************************************************************/ | |
28 | /******************************************************************/ | |
29 | ||
976183fd | 30 | #include <iostream.h> |
1b446896 | 31 | ClassImp( AliHBTFunction ) |
32 | ||
33 | AliHBTFunction::AliHBTFunction() | |
34 | { | |
ba95ae3f | 35 | fPairCut = new AliHBTEmptyPairCut(); //dummy cut |
36 | } | |
37 | /******************************************************************/ | |
38 | AliHBTFunction::AliHBTFunction(const char* name,const char* title):TNamed(name,title) | |
39 | { | |
40 | fPairCut = new AliHBTEmptyPairCut(); //dummy cut | |
1b446896 | 41 | } |
2674b9ff | 42 | /******************************************************************/ |
43 | ||
44 | AliHBTFunction::~AliHBTFunction() | |
45 | { | |
46 | if (fPairCut) delete fPairCut; | |
47 | } | |
48 | /******************************************************************/ | |
1b446896 | 49 | |
50 | void AliHBTFunction:: | |
51 | Write() | |
52 | { | |
53 | if (GetNumerator()) GetNumerator()->Write(); | |
54 | if (GetDenominator()) GetDenominator()->Write(); | |
55 | TH1* res = GetResult(); | |
976183fd | 56 | if (res) res->Write(); |
1b446896 | 57 | } |
58 | /******************************************************************/ | |
59 | ||
60 | TH1* AliHBTFunction:: | |
61 | GetRatio(Double_t normfactor) | |
62 | { | |
2674b9ff | 63 | if (gDebug>0) cout<<"Mormfactor is "<<normfactor<<" for "<<fName<<endl; |
976183fd | 64 | |
65 | if (normfactor == 0.0) | |
66 | { | |
67 | Error("GetRatio","Scaling Factor is 0. Null poiner returned"); | |
68 | return 0x0; | |
69 | } | |
1b446896 | 70 | TString str = fName + " ratio"; |
71 | TH1 *result = (TH1*)GetNumerator()->Clone(str.Data()); | |
72 | ||
73 | result->SetTitle(str.Data()); | |
976183fd | 74 | //result->Sumw2(); |
1b446896 | 75 | |
76 | result->Divide(GetNumerator(),GetDenominator(),normfactor); | |
77 | ||
78 | return result; | |
79 | ||
80 | } | |
81 | /******************************************************************/ | |
82 | void AliHBTFunction::SetPairCut(AliHBTPairCut* cut) | |
83 | { | |
84 | //Sets new Pair Cut. Old one is deleted | |
85 | //Note that it is created new object instead of simple pointer set | |
86 | //I do not want to have pointer | |
87 | //to object created somewhere else | |
88 | //because in that case I could not believe that | |
89 | //it would always exist (sb could delete it) | |
90 | //so we have always own copy | |
91 | ||
92 | if(!cut) | |
93 | { | |
94 | Error("AliHBTFunction::SetPairCut","argument is NULL"); | |
95 | return; | |
96 | } | |
97 | delete fPairCut; | |
98 | fPairCut = (AliHBTPairCut*)cut->Clone(); | |
99 | ||
100 | } | |
101 | ||
102 | /******************************************************************/ | |
103 | ||
104 | void AliHBTFunction:: | |
105 | Rename(const Char_t * name) | |
106 | { | |
107 | //renames the function and histograms | |
108 | SetName(name); | |
109 | SetTitle(name); | |
110 | ||
111 | TString numstr = fName + " Numerator"; //title and name of the | |
112 | //numerator histogram | |
113 | TString denstr = fName + " Denominator";//title and name of the | |
114 | //denominator histogram | |
115 | ||
116 | GetNumerator()->SetName(numstr.Data()); | |
117 | GetNumerator()->SetTitle(numstr.Data()); | |
118 | ||
119 | GetDenominator()->SetName(denstr.Data()); | |
120 | GetDenominator()->SetTitle(denstr.Data()); | |
121 | ||
122 | } | |
123 | ||
124 | void AliHBTFunction:: | |
125 | Rename(const Char_t * name, const Char_t * title) | |
126 | { | |
127 | //renames and retitle the function and histograms | |
128 | ||
129 | SetName(name); | |
130 | SetTitle(title); | |
131 | ||
132 | TString numstrn = fName + " Numerator"; //name of the | |
133 | //numerator histogram | |
134 | ||
135 | TString numstrt = fTitle + " Numerator"; //title of the | |
136 | //numerator histogram | |
137 | ||
138 | TString denstrn = fName + " Denominator";//name of the | |
139 | //denominator histogram | |
140 | ||
141 | TString denstrt = fTitle + " Denominator";//title of the | |
142 | //denominator histogram | |
143 | ||
144 | ||
145 | GetNumerator()->SetName(numstrn.Data()); | |
146 | GetNumerator()->SetTitle(numstrt.Data()); | |
147 | ||
148 | GetDenominator()->SetName(denstrn.Data()); | |
149 | GetDenominator()->SetTitle(denstrt.Data()); | |
150 | ||
151 | ||
152 | } | |
153 | ||
154 | /******************************************************************/ | |
155 | /******************************************************************/ | |
156 | /******************************************************************/ | |
157 | ||
27b3fe5d | 158 | ClassImp( AliHBTOnePairFctn ) |
1b446896 | 159 | |
160 | /******************************************************************/ | |
161 | /******************************************************************/ | |
162 | /******************************************************************/ | |
163 | ||
27b3fe5d | 164 | ClassImp( AliHBTTwoPairFctn) |
1b446896 | 165 | |
166 | /******************************************************************/ | |
167 | /******************************************************************/ | |
168 | /******************************************************************/ | |
169 | ||
27b3fe5d | 170 | ClassImp( AliHBTOnePairFctn1D ) |
ba95ae3f | 171 | AliHBTOnePairFctn1D::AliHBTOnePairFctn1D():fNBinsToScale(30) |
172 | { | |
173 | fNumerator = 0x0; | |
174 | fDenominator = 0x0; | |
175 | } | |
1b446896 | 176 | |
27b3fe5d | 177 | AliHBTOnePairFctn1D:: |
178 | AliHBTOnePairFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval) | |
1b446896 | 179 | { |
180 | //Constructor of Two Part One Dimentional Function | |
181 | // nbins: number of bins in histograms - default 100 | |
182 | // maxXval and minXval: range of histgram(s) default 0 - 0.15 (GeV) | |
183 | ||
184 | ||
185 | TString numstr = fName + " Numerator"; //title and name of the | |
186 | //numerator histogram | |
187 | TString denstr = fName + " Denominator";//title and name of the | |
188 | //denominator histogram | |
189 | ||
190 | fNumerator = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval); | |
191 | fDenominator = new TH1D(denstr.Data(),denstr.Data(),nbins,minXval,maxXval); | |
192 | ||
193 | fNumerator->Sumw2(); | |
194 | fDenominator->Sumw2(); | |
195 | ||
976183fd | 196 | fNBinsToScale = 30; |
197 | ||
1b446896 | 198 | } |
ba95ae3f | 199 | AliHBTOnePairFctn1D:: |
200 | AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title, | |
201 | Int_t nbins, Double_t maxXval, Double_t minXval) | |
202 | :AliHBTOnePairFctn(name,title) | |
203 | { | |
204 | TString numstr = fName + " Numerator"; //title and name of the | |
205 | //numerator histogram | |
206 | TString denstr = fName + " Denominator";//title and name of the | |
207 | //denominator histogram | |
208 | ||
209 | fNumerator = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval); | |
210 | fDenominator = new TH1D(denstr.Data(),denstr.Data(),nbins,minXval,maxXval); | |
211 | ||
212 | fNumerator->Sumw2(); | |
213 | fDenominator->Sumw2(); | |
214 | ||
215 | fNBinsToScale = 30; | |
216 | } | |
1b446896 | 217 | /******************************************************************/ |
27b3fe5d | 218 | AliHBTOnePairFctn1D::~AliHBTOnePairFctn1D() |
1b446896 | 219 | { |
220 | delete fNumerator; | |
221 | delete fDenominator; | |
222 | } | |
976183fd | 223 | /******************************************************************/ |
224 | ||
27b3fe5d | 225 | void AliHBTOnePairFctn1D::ProcessSameEventParticles(AliHBTPair* pair) |
976183fd | 226 | { |
227 | //Fills the numerator | |
228 | pair = CheckPair(pair); | |
229 | if(pair) fNumerator->Fill(GetValue(pair)); | |
230 | } | |
231 | /******************************************************************/ | |
27b3fe5d | 232 | void AliHBTOnePairFctn1D::ProcessDiffEventParticles(AliHBTPair* pair) |
976183fd | 233 | { |
234 | //fills denumerator | |
235 | pair = CheckPair(pair); | |
236 | if(pair) fDenominator->Fill(GetValue(pair)); | |
237 | ||
238 | } | |
239 | /******************************************************************/ | |
27b3fe5d | 240 | Double_t AliHBTOnePairFctn1D::Scale() |
976183fd | 241 | { |
2674b9ff | 242 | if (gDebug>0) cout<<"Enetered Scale()"<<endl; |
976183fd | 243 | if(!fNumerator) |
244 | { | |
245 | Error("Scale","No numerator"); | |
246 | return 0.0; | |
247 | } | |
248 | if(!fDenominator) | |
249 | { | |
250 | Error("Scale","No denominator"); | |
251 | return 0.0; | |
252 | } | |
253 | ||
254 | if(fNBinsToScale < 1) | |
255 | { | |
256 | return 0.0; | |
257 | Error("Scale","Number of bins for scaling is smaller thnan 1"); | |
258 | } | |
259 | Int_t nbins = fNumerator->GetNbinsX(); | |
260 | if (fNBinsToScale > nbins) | |
261 | { | |
262 | Error("Scale","Number of bins for scaling is bigger thnan number of bins in histograms"); | |
263 | return 0.0; | |
264 | } | |
2674b9ff | 265 | if (gDebug>0) cout<<"No errors detected"<<endl; |
976183fd | 266 | |
2674b9ff | 267 | Double_t ratio; |
268 | Double_t sum = 0; | |
269 | Int_t N = 0; | |
270 | ||
976183fd | 271 | Int_t offset = nbins - fNBinsToScale - 1; |
272 | Int_t i; | |
273 | for ( i = offset; i< nbins; i++) | |
274 | { | |
2674b9ff | 275 | if ( fNumerator->GetBinContent(i) > 0.0 ) |
976183fd | 276 | { |
2674b9ff | 277 | ratio = fDenominator->GetBinContent(i)/fNumerator->GetBinContent(i); |
278 | sum += ratio; | |
279 | N++; | |
976183fd | 280 | } |
281 | } | |
2674b9ff | 282 | |
283 | if(gDebug > 0) cout<<"sum="<<sum<<" fNBinsToScale="<<fNBinsToScale<<" N="<<N<<endl; | |
284 | ||
285 | if (N == 0) return 0.0; | |
286 | Double_t ret = sum/((Double_t)N); | |
976183fd | 287 | |
2674b9ff | 288 | if(gDebug > 0) cout<<"Scale() returning "<<ret<<endl; |
289 | return ret; | |
976183fd | 290 | } |
291 | ||
1b446896 | 292 | /******************************************************************/ |
293 | /******************************************************************/ | |
294 | /******************************************************************/ | |
295 | ||
27b3fe5d | 296 | ClassImp( AliHBTOnePairFctn2D ) |
1b446896 | 297 | |
27b3fe5d | 298 | AliHBTOnePairFctn2D:: |
299 | AliHBTOnePairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , | |
1b446896 | 300 | Int_t nYbins, Double_t maxYval, Double_t minYval) |
301 | ||
302 | { | |
303 | TString numstr = fName + " Numerator"; //title and name of the | |
304 | //numerator histogram | |
305 | TString denstr = fName + " Denominator";//title and name of the | |
306 | //denominator histogram | |
307 | ||
308 | fNumerator = new TH2D(numstr.Data(),numstr.Data(), | |
309 | nXbins,minXval,maxXval, | |
310 | nYbins,minYval,maxYval); | |
311 | ||
312 | fDenominator = new TH2D(denstr.Data(),denstr.Data(), | |
313 | nXbins,minXval,maxXval, | |
314 | nYbins,minYval,maxYval); | |
315 | ||
316 | fNumerator->Sumw2(); | |
317 | fDenominator->Sumw2(); | |
318 | ||
319 | } | |
27b3fe5d | 320 | AliHBTOnePairFctn2D::~AliHBTOnePairFctn2D() |
1b446896 | 321 | { |
322 | delete fNumerator; | |
323 | delete fDenominator; | |
324 | } | |
27b3fe5d | 325 | void AliHBTOnePairFctn2D::ProcessSameEventParticles(AliHBTPair* pair) |
1b446896 | 326 | { |
327 | pair = CheckPair(pair); | |
328 | if(pair) | |
329 | { | |
330 | Double_t x,y; | |
331 | GetValues(pair,x,y); | |
332 | fNumerator->Fill(y,x); | |
333 | } | |
334 | } | |
335 | ||
27b3fe5d | 336 | void AliHBTOnePairFctn2D::ProcessDiffEventParticles(AliHBTPair* pair) |
1b446896 | 337 | { |
338 | pair = CheckPair(pair); | |
339 | if(pair) | |
340 | { | |
341 | Double_t x,y; | |
342 | GetValues(pair,x,y); | |
343 | fDenominator->Fill(y,x); | |
344 | } | |
345 | ||
346 | } | |
347 | ||
348 | ||
349 | /******************************************************************/ | |
350 | /******************************************************************/ | |
351 | /******************************************************************/ | |
352 | ||
27b3fe5d | 353 | ClassImp( AliHBTOnePairFctn3D) |
1b446896 | 354 | |
27b3fe5d | 355 | AliHBTOnePairFctn3D:: |
356 | AliHBTOnePairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
1b446896 | 357 | Int_t nYbins, Double_t maxYval, Double_t minYval, |
358 | Int_t nZbins, Double_t maxZval, Double_t minZval) | |
359 | ||
360 | { | |
361 | TString numstr = fName + " Numerator"; //title and name of the | |
362 | //numerator histogram | |
363 | TString denstr = fName + " Denominator";//title and name of the | |
364 | //denominator histogram | |
365 | ||
366 | fNumerator = new TH3D(numstr.Data(),numstr.Data(), | |
367 | nXbins,minXval,maxXval, | |
368 | nYbins,minYval,maxYval, | |
369 | nZbins,minZval,maxZval); | |
370 | ||
371 | fDenominator = new TH3D(denstr.Data(),denstr.Data(), | |
372 | nXbins,minXval,maxXval, | |
373 | nYbins,minYval,maxYval, | |
374 | nZbins,minZval,maxZval); | |
375 | ||
376 | fNumerator->Sumw2(); | |
377 | fDenominator->Sumw2(); | |
378 | ||
379 | } | |
ba95ae3f | 380 | /******************************************************************/ |
7836ee94 | 381 | |
5a9432a9 | 382 | AliHBTOnePairFctn3D::~AliHBTOnePairFctn3D() |
7836ee94 | 383 | { |
384 | delete fNumerator; | |
385 | delete fDenominator; | |
386 | } | |
ba95ae3f | 387 | /******************************************************************/ |
7836ee94 | 388 | |
7836ee94 | 389 | |
ba95ae3f | 390 | /******************************************************************/ |
391 | /******************************************************************/ | |
392 | /******************************************************************/ | |
393 | ClassImp( AliHBTTwoPairFctn1D) | |
394 | ||
395 | AliHBTTwoPairFctn1D:: | |
396 | AliHBTTwoPairFctn1D(Int_t nbins, Double_t maxval, Double_t minval) | |
397 | { | |
398 | TString numstr = fName + " Numerator"; //title and name of the | |
399 | //numerator histogram | |
400 | TString denstr = fName + " Denominator";//title and name of the | |
401 | //denominator histogram | |
402 | ||
403 | fNumerator = new TH1D(numstr.Data(),numstr.Data(), | |
404 | nbins,minval,maxval); | |
405 | ||
406 | fDenominator = new TH1D(denstr.Data(),denstr.Data(), | |
407 | nbins,minval,maxval); | |
408 | ||
409 | fNumerator->Sumw2(); | |
410 | fDenominator->Sumw2(); | |
411 | } | |
412 | ||
413 | AliHBTTwoPairFctn1D:: | |
414 | AliHBTTwoPairFctn1D(const Char_t* name, const Char_t* title, | |
415 | Int_t nbins, Double_t maxval, Double_t minval) | |
416 | :AliHBTTwoPairFctn(name,title) | |
417 | { | |
418 | TString numstr = fName + " Numerator"; //title and name of the | |
419 | //numerator histogram | |
420 | TString denstr = fName + " Denominator";//title and name of the | |
421 | //denominator histogram | |
422 | ||
423 | fNumerator = new TH1D(numstr.Data(),numstr.Data(), | |
424 | nbins,minval,maxval); | |
425 | ||
426 | fDenominator = new TH1D(denstr.Data(),denstr.Data(), | |
427 | nbins,minval,maxval); | |
428 | ||
429 | fNumerator->Sumw2(); | |
430 | fDenominator->Sumw2(); | |
431 | } | |
432 | ||
433 | ||
434 | /******************************************************************/ | |
435 | AliHBTTwoPairFctn1D::~AliHBTTwoPairFctn1D() | |
436 | { | |
437 | delete fNumerator; | |
438 | delete fDenominator; | |
439 | } | |
440 | void AliHBTTwoPairFctn1D:: | |
441 | ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
442 | { | |
443 | partpair = CheckPair(partpair); | |
444 | trackpair = CheckPair(trackpair); | |
445 | if( partpair && trackpair) | |
446 | { | |
447 | Double_t x = GetValue(trackpair,partpair); | |
448 | fNumerator->Fill(x); | |
449 | } | |
450 | } | |
451 | /******************************************************************/ | |
452 | ||
453 | void AliHBTTwoPairFctn1D:: | |
454 | ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
455 | { | |
456 | partpair = CheckPair(partpair); | |
457 | trackpair = CheckPair(trackpair); | |
458 | if( partpair && trackpair) | |
459 | { | |
460 | Double_t x = GetValue(trackpair,partpair); | |
461 | fDenominator->Fill(x); | |
462 | } | |
463 | ||
464 | } | |
465 | ||
1b446896 | 466 | /******************************************************************/ |
467 | /******************************************************************/ | |
468 | /******************************************************************/ | |
27b3fe5d | 469 | ClassImp( AliHBTTwoPairFctn2D) |
1b446896 | 470 | |
471 | ||
27b3fe5d | 472 | AliHBTTwoPairFctn2D:: |
473 | AliHBTTwoPairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , | |
1b446896 | 474 | Int_t nYbins, Double_t maxYval, Double_t minYval) |
475 | ||
476 | { | |
477 | TString numstr = fName + " Numerator"; //title and name of the | |
478 | //numerator histogram | |
479 | TString denstr = fName + " Denominator";//title and name of the | |
480 | //denominator histogram | |
481 | ||
482 | fNumerator = new TH2D(numstr.Data(),numstr.Data(), | |
483 | nXbins,minXval,maxXval, | |
484 | nYbins,minYval,maxYval); | |
485 | ||
486 | fDenominator = new TH2D(denstr.Data(),denstr.Data(), | |
487 | nXbins,minXval,maxXval, | |
488 | nYbins,minYval,maxYval); | |
489 | ||
490 | fNumerator->Sumw2(); | |
491 | fDenominator->Sumw2(); | |
492 | ||
493 | } | |
27b3fe5d | 494 | AliHBTTwoPairFctn2D::~AliHBTTwoPairFctn2D() |
1b446896 | 495 | { |
496 | delete fNumerator; | |
497 | delete fDenominator; | |
498 | } | |
27b3fe5d | 499 | void AliHBTTwoPairFctn2D:: |
1b446896 | 500 | ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) |
501 | { | |
502 | partpair = CheckPair(partpair); | |
503 | trackpair = CheckPair(trackpair); | |
504 | if( partpair && trackpair) | |
505 | { | |
506 | Double_t x,y; | |
507 | GetValues(trackpair,partpair,x,y); | |
508 | fNumerator->Fill(y,x); | |
509 | } | |
510 | } | |
511 | ||
27b3fe5d | 512 | void AliHBTTwoPairFctn2D:: |
1b446896 | 513 | ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) |
514 | { | |
515 | partpair = CheckPair(partpair); | |
516 | trackpair = CheckPair(trackpair); | |
517 | if( partpair && trackpair) | |
518 | { | |
519 | Double_t x,y; | |
520 | GetValues(trackpair,partpair,x,y); | |
521 | fDenominator->Fill(y,x); | |
522 | } | |
523 | ||
524 | } | |
525 | ||
ba95ae3f | 526 | /******************************************************************/ |
527 | /******************************************************************/ | |
528 | /******************************************************************/ | |
529 | ClassImp(AliHBTTwoPairFctn3D) | |
530 | ||
531 | void AliHBTTwoPairFctn3D:: | |
532 | ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
533 | { | |
534 | partpair = CheckPair(partpair); | |
535 | trackpair = CheckPair(trackpair); | |
536 | if( partpair && trackpair) | |
537 | { | |
538 | Double_t x,y,z; | |
539 | GetValues(trackpair,partpair,x,y,z); | |
540 | fNumerator->Fill(z,y,x); | |
541 | } | |
542 | } | |
543 | ||
544 | void AliHBTTwoPairFctn3D:: | |
545 | ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
546 | { | |
547 | partpair = CheckPair(partpair); | |
548 | trackpair = CheckPair(trackpair); | |
549 | if( partpair && trackpair) | |
550 | { | |
551 | Double_t x,y,z; | |
552 | GetValues(trackpair,partpair,x,y,z); | |
553 | fDenominator->Fill(z,y,x); | |
554 | } | |
555 | ||
556 | } | |
557 |