]>
Commit | Line | Data |
---|---|---|
1b446896 | 1 | #include "AliHBTFunction.h" |
6e8d850a | 2 | |
3 | /* $Id: */ | |
4 | ||
5 | //-------------------------------------------------------------------- | |
26f1270c | 6 | //AliHBTFunction |
7 | //Author: Piotr Krzysztof Skowronski | |
8 | //Piotr.Skowronski@cern.ch | |
6e8d850a | 9 | //Base classes for HBT functions |
10 | /* | |
2c33acf3 | 11 | OnePairFctn Function TwoPairFctn |
26f1270c | 12 | | \ \ / | \ /|\ |
13 | | \ \ / | \ / | \ | |
14 | | \ \ 1D 2D 3D / | \ | |
15 | | \ \ / \ |\ | \________________/__ | \ | |
16 | | \ \/ \ | \__|_____________ / \| \ | |
17 | | \ \ \_|____|__ \ / | \ | |
18 | | \ / \___ | | \ \/ |\ \ | |
19 | | / \ | | \ /\ | \ \ | |
20 | | / \ \| | \ / \ | \ \ | |
21 | | / \ /\ | \ / \ | \ | | |
22 | | / \ / \ | \ / \ | \ | | |
6e8d850a | 23 | | / \ / \ | \ / \ | \ | |
26f1270c | 24 | | / \/ \ | \/ \ | \ | |
25 | OnePair1D OnePair2D OnePair3D TwoPair1D TwoPair2D TwoPair3D | |
26 | ||
27 | ||
1b446896 | 28 | four particle functions are intendent to be resolution functions: |
29 | it is mecessary to have simulated particle pair corresponding to given | |
30 | recontructed track pair in order to calculate function simualted value | |
2c33acf3 | 31 | and recontructed value, to be further histogrammed |
1b446896 | 32 | */ |
6e8d850a | 33 | //--------------------------------------------------------------------- |
26f1270c | 34 | |
2dc7203b | 35 | #include <TH2.h> |
36 | #include <TH3.h> | |
37 | ||
1b446896 | 38 | /******************************************************************/ |
39 | /******************************************************************/ | |
40 | ||
41 | ClassImp( AliHBTFunction ) | |
42 | ||
201fedb7 | 43 | AliHBTFunction::AliHBTFunction(): |
e6e21fa2 | 44 | fPairCut(new AliHBTEmptyPairCut()), //dummy cut |
45 | fWriteNumAndDen(kFALSE) | |
1b446896 | 46 | { |
2c33acf3 | 47 | //Default constructor |
ba95ae3f | 48 | } |
49 | /******************************************************************/ | |
28cf76fa | 50 | |
201fedb7 | 51 | AliHBTFunction::AliHBTFunction(const char* name,const char* title): |
e6e21fa2 | 52 | TNamed(name,title), |
53 | fPairCut(new AliHBTEmptyPairCut()), //dummy cut | |
54 | fWriteNumAndDen(kFALSE) | |
ba95ae3f | 55 | { |
201fedb7 | 56 | //Constructor |
1b446896 | 57 | } |
2674b9ff | 58 | /******************************************************************/ |
59 | ||
28cf76fa | 60 | AliHBTFunction::AliHBTFunction(const AliHBTFunction & source): |
61 | TNamed(source), | |
e6e21fa2 | 62 | fPairCut((AliHBTPairCut*)source.fPairCut->Clone()), |
63 | fWriteNumAndDen(source.fWriteNumAndDen) | |
28cf76fa | 64 | { |
65 | // Copy constructor needed by the coding conventions | |
66 | } | |
67 | /******************************************************************/ | |
68 | ||
2674b9ff | 69 | AliHBTFunction::~AliHBTFunction() |
2c33acf3 | 70 | { |
71 | //destructor | |
d289329c | 72 | if (AliHBTParticle::GetDebug() > 1) |
73 | { | |
74 | Info("~AliHBTFunction","Deleting %s",GetName()); | |
75 | } | |
8928fd0d | 76 | delete fPairCut; |
2c33acf3 | 77 | } |
2674b9ff | 78 | /******************************************************************/ |
28cf76fa | 79 | AliHBTFunction & AliHBTFunction::operator= (const AliHBTFunction & source) |
80 | { | |
81 | // Assignment needed by the coding conventions | |
82 | delete fPairCut; | |
83 | fPairCut = (AliHBTPairCut*)source.fPairCut->Clone(); | |
84 | return * this; | |
85 | } | |
1b446896 | 86 | |
c41732dc | 87 | void AliHBTFunction::WriteFunction() |
2c33acf3 | 88 | { |
89 | //writes result of the function to file | |
3976deed | 90 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","%s",GetName()); |
e6e21fa2 | 91 | if (fWriteNumAndDen) |
92 | { | |
3976deed | 93 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Num & Den"); |
e6e21fa2 | 94 | if (GetNumerator()) GetNumerator()->Write(); |
95 | if (GetDenominator()) GetDenominator()->Write(); | |
3976deed | 96 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Num & Den Done"); |
e6e21fa2 | 97 | } |
3976deed | 98 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Getting Result"); |
1b446896 | 99 | TH1* res = GetResult(); |
3976deed | 100 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Getting Result Done"); |
101 | ||
102 | if (res) | |
103 | { | |
104 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Result"); | |
105 | res->Write(); | |
106 | if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Result Done"); | |
107 | } | |
2c33acf3 | 108 | } |
1b446896 | 109 | /******************************************************************/ |
110 | ||
266c51ca | 111 | TH1* AliHBTFunction::GetRatio(Double_t normfactor) |
1b446896 | 112 | { |
2c33acf3 | 113 | //returns ratio of numerator and denominator |
114 | // | |
18c3af34 | 115 | if (AliHBTParticle::GetDebug()>0) Info("GetRatio","Norm. Factor is %f for %s",normfactor,GetName()); |
976183fd | 116 | |
117 | if (normfactor == 0.0) | |
118 | { | |
119 | Error("GetRatio","Scaling Factor is 0. Null poiner returned"); | |
120 | return 0x0; | |
121 | } | |
1b446896 | 122 | TString str = fName + " ratio"; |
123 | TH1 *result = (TH1*)GetNumerator()->Clone(str.Data()); | |
124 | ||
125 | result->SetTitle(str.Data()); | |
1b446896 | 126 | |
127 | result->Divide(GetNumerator(),GetDenominator(),normfactor); | |
128 | ||
129 | return result; | |
130 | ||
131 | } | |
132 | /******************************************************************/ | |
133 | void AliHBTFunction::SetPairCut(AliHBTPairCut* cut) | |
134 | { | |
135 | //Sets new Pair Cut. Old one is deleted | |
136 | //Note that it is created new object instead of simple pointer set | |
137 | //I do not want to have pointer | |
138 | //to object created somewhere else | |
139 | //because in that case I could not believe that | |
140 | //it would always exist (sb could delete it) | |
141 | //so we have always own copy | |
142 | ||
143 | if(!cut) | |
144 | { | |
145 | Error("AliHBTFunction::SetPairCut","argument is NULL"); | |
146 | return; | |
147 | } | |
148 | delete fPairCut; | |
149 | fPairCut = (AliHBTPairCut*)cut->Clone(); | |
150 | ||
151 | } | |
152 | ||
153 | /******************************************************************/ | |
154 | ||
8928fd0d | 155 | void AliHBTFunction::Rename(const Char_t * name) |
1b446896 | 156 | { |
157 | //renames the function and histograms | |
158 | SetName(name); | |
159 | SetTitle(name); | |
160 | ||
161 | TString numstr = fName + " Numerator"; //title and name of the | |
162 | //numerator histogram | |
163 | TString denstr = fName + " Denominator";//title and name of the | |
164 | //denominator histogram | |
165 | ||
166 | GetNumerator()->SetName(numstr.Data()); | |
167 | GetNumerator()->SetTitle(numstr.Data()); | |
168 | ||
169 | GetDenominator()->SetName(denstr.Data()); | |
170 | GetDenominator()->SetTitle(denstr.Data()); | |
171 | ||
172 | } | |
173 | ||
8928fd0d | 174 | void AliHBTFunction::Rename(const Char_t * name, const Char_t * title) |
1b446896 | 175 | { |
176 | //renames and retitle the function and histograms | |
177 | ||
178 | SetName(name); | |
179 | SetTitle(title); | |
180 | ||
181 | TString numstrn = fName + " Numerator"; //name of the | |
182 | //numerator histogram | |
183 | ||
184 | TString numstrt = fTitle + " Numerator"; //title of the | |
185 | //numerator histogram | |
186 | ||
187 | TString denstrn = fName + " Denominator";//name of the | |
188 | //denominator histogram | |
189 | ||
190 | TString denstrt = fTitle + " Denominator";//title of the | |
191 | //denominator histogram | |
192 | ||
193 | ||
194 | GetNumerator()->SetName(numstrn.Data()); | |
195 | GetNumerator()->SetTitle(numstrt.Data()); | |
196 | ||
197 | GetDenominator()->SetName(denstrn.Data()); | |
198 | GetDenominator()->SetTitle(denstrt.Data()); | |
199 | ||
200 | ||
201 | } | |
26f1270c | 202 | /******************************************************************/ |
203 | ||
c41732dc | 204 | void AliHBTFunction::InitFunction() |
26f1270c | 205 | { |
206 | //Iniotializes fctn.: Resets histograms | |
207 | //In case histograms are not created in ctor, builds with default parameters | |
d289329c | 208 | if (AliHBTParticle::GetDebug()>1) Info("InitFunction","%s",GetName()); |
26f1270c | 209 | if ( !(GetNumerator()&&GetDenominator()) ) BuildHistos(); |
210 | GetNumerator()->Reset(); | |
211 | GetDenominator()->Reset(); | |
3976deed | 212 | |
213 | GetNumerator()->SetDirectory(0x0); | |
214 | GetDenominator()->SetDirectory(0x0); | |
d289329c | 215 | if (AliHBTParticle::GetDebug()>1) Info("InitFunction","Done"); |
26f1270c | 216 | } |
fc13079c | 217 | /******************************************************************/ |
218 | /******************************************************************/ | |
219 | /******************************************************************/ | |
220 | ClassImp(AliHBTCorrelFunction) | |
221 | //____________________________________________ | |
222 | ////////////////////////////////////////////// | |
223 | // | |
224 | // class AliHBTCorrelFunction | |
225 | // | |
226 | // Base class for correlation fuctions, that is which returns ratio. | |
227 | // Stores pointer the created ratio histogram and deletes it when function is deleted | |
228 | // created in order to evoid memory leak | |
229 | // | |
230 | //////////////////////////////////////////////////////// | |
231 | AliHBTCorrelFunction& AliHBTCorrelFunction::operator=(const AliHBTCorrelFunction& in) | |
232 | { | |
233 | //assigment operator | |
234 | if (&in == this) return *this; | |
235 | delete fRatio; | |
236 | fRatio=(in.fRatio)?(TH1*)in.fRatio->Clone():0x0; | |
237 | return *this; | |
238 | } | |
1b446896 | 239 | |
240 | /******************************************************************/ | |
241 | /******************************************************************/ | |
242 | /******************************************************************/ | |
243 | ||
27b3fe5d | 244 | ClassImp( AliHBTOnePairFctn ) |
1b446896 | 245 | |
246 | /******************************************************************/ | |
247 | /******************************************************************/ | |
248 | /******************************************************************/ | |
249 | ||
27b3fe5d | 250 | ClassImp( AliHBTTwoPairFctn) |
1b446896 | 251 | |
252 | /******************************************************************/ | |
253 | /******************************************************************/ | |
254 | /******************************************************************/ | |
255 | ||
26f1270c | 256 | ClassImp( AliHBTFunction1D ) |
1b446896 | 257 | |
26f1270c | 258 | const Int_t AliHBTFunction1D::fgkDefaultNBins = 100; |
259 | const Float_t AliHBTFunction1D::fgkDefaultMin = 0.0; | |
260 | const Float_t AliHBTFunction1D::fgkDefaultMax = 0.15; | |
261 | const UInt_t AliHBTFunction1D::fgkDefaultNBinsToScale = 30; | |
262 | ||
263 | ||
264 | AliHBTFunction1D::AliHBTFunction1D(): | |
265 | fNumerator(0x0), | |
266 | fDenominator(0x0), | |
267 | fNBinsToScale(fgkDefaultNBinsToScale) | |
2c33acf3 | 268 | {//default constructor |
26f1270c | 269 | } |
270 | /******************************************************************/ | |
271 | ||
272 | AliHBTFunction1D::AliHBTFunction1D(Int_t nbins, Float_t maxXval, Float_t minXval): | |
273 | fNumerator(0x0), | |
274 | fDenominator(0x0), | |
275 | fNBinsToScale(fgkDefaultNBinsToScale) | |
276 | { | |
1b446896 | 277 | //Constructor of Two Part One Dimentional Function |
278 | // nbins: number of bins in histograms - default 100 | |
279 | // maxXval and minXval: range of histgram(s) default 0 - 0.15 (GeV) | |
26f1270c | 280 | BuildHistos(nbins,maxXval,minXval); |
281 | } | |
282 | /******************************************************************/ | |
283 | AliHBTFunction1D::AliHBTFunction1D(const Char_t *name, const Char_t *title): | |
284 | AliHBTFunction(name,title), | |
285 | fNumerator(0x0), | |
286 | fDenominator(0x0), | |
287 | fNBinsToScale(fgkDefaultNBinsToScale) | |
2c33acf3 | 288 | {//constructor |
ba95ae3f | 289 | } |
1b446896 | 290 | /******************************************************************/ |
26f1270c | 291 | AliHBTFunction1D::AliHBTFunction1D(const Char_t *name, const Char_t *title, |
292 | Int_t nbins, Float_t maxXval, Float_t minXval): | |
293 | AliHBTFunction(name,title), | |
294 | fNumerator(0x0), | |
295 | fDenominator(0x0), | |
296 | fNBinsToScale(fgkDefaultNBinsToScale) | |
297 | { | |
2c33acf3 | 298 | //constructor |
299 | BuildHistos(nbins,maxXval,minXval); | |
26f1270c | 300 | } |
301 | /******************************************************************/ | |
302 | ||
28cf76fa | 303 | AliHBTFunction1D::AliHBTFunction1D(const AliHBTFunction1D& source): |
304 | AliHBTFunction(source) | |
305 | { | |
306 | // Copy constructor needed by the coding conventions byt not used | |
307 | Fatal("AliHBTFunction1D(const AliHBTFunction1D&)","Cpy ctor not usable."); | |
308 | } | |
309 | /******************************************************************/ | |
310 | ||
311 | AliHBTFunction1D& AliHBTFunction1D::operator= (const AliHBTFunction1D & /*source*/) | |
312 | { | |
313 | // Assignment needed by the coding conventions byt not used | |
314 | Fatal("Assignment operator","not implemented"); | |
315 | return * this; | |
316 | } | |
317 | /******************************************************************/ | |
318 | ||
26f1270c | 319 | AliHBTFunction1D::~AliHBTFunction1D() |
1b446896 | 320 | { |
2c33acf3 | 321 | //destructor |
1b446896 | 322 | delete fNumerator; |
323 | delete fDenominator; | |
324 | } | |
26f1270c | 325 | /******************************************************************/ |
326 | void AliHBTFunction1D::BuildHistos() | |
327 | { | |
2c33acf3 | 328 | //builds histograms with default settings |
26f1270c | 329 | BuildHistos(fgkDefaultNBins,fgkDefaultMax,fgkDefaultMin); |
330 | } | |
331 | ||
976183fd | 332 | /******************************************************************/ |
333 | ||
26f1270c | 334 | void AliHBTFunction1D::BuildHistos(Int_t nbins, Float_t max, Float_t min) |
976183fd | 335 | { |
2c33acf3 | 336 | //builds numarator and denominator hitograms |
26f1270c | 337 | TString numstr = fName + " Numerator"; //title and name of the |
338 | //numerator histogram | |
339 | TString denstr = fName + " Denominator";//title and name of the | |
340 | //denominator histogram | |
341 | fNumerator = new TH1D(numstr.Data(),numstr.Data(),nbins,min,max); | |
342 | fDenominator = new TH1D(denstr.Data(),denstr.Data(),nbins,min,max); | |
343 | ||
344 | fNumerator->Sumw2(); | |
345 | fDenominator->Sumw2(); | |
976183fd | 346 | } |
347 | /******************************************************************/ | |
976183fd | 348 | |
26f1270c | 349 | Double_t AliHBTFunction1D::Scale() |
350 | { | |
351 | //Calculates the factor that should be used to scale | |
352 | //quatience of fNumerator and fDenominator to 1 at tail | |
353 | return Scale(fNumerator,fDenominator); | |
354 | } | |
976183fd | 355 | /******************************************************************/ |
26f1270c | 356 | |
357 | Double_t AliHBTFunction1D::Scale(TH1D* num,TH1D* den) | |
976183fd | 358 | { |
26f1270c | 359 | //Calculates the factor that should be used to scale |
360 | //quatience of num and den to 1 at tail | |
361 | ||
18c3af34 | 362 | if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()"); |
26f1270c | 363 | if(!num) |
976183fd | 364 | { |
365 | Error("Scale","No numerator"); | |
366 | return 0.0; | |
367 | } | |
26f1270c | 368 | if(!den) |
976183fd | 369 | { |
370 | Error("Scale","No denominator"); | |
371 | return 0.0; | |
372 | } | |
373 | ||
374 | if(fNBinsToScale < 1) | |
375 | { | |
976183fd | 376 | Error("Scale","Number of bins for scaling is smaller thnan 1"); |
0798b21e | 377 | return 0.0; |
976183fd | 378 | } |
26f1270c | 379 | UInt_t nbins = num->GetNbinsX(); |
976183fd | 380 | if (fNBinsToScale > nbins) |
381 | { | |
382 | Error("Scale","Number of bins for scaling is bigger thnan number of bins in histograms"); | |
383 | return 0.0; | |
384 | } | |
18c3af34 | 385 | if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected"); |
976183fd | 386 | |
dd82cadc | 387 | Double_t densum = 0.0; |
388 | Double_t numsum = 0.0; | |
2674b9ff | 389 | |
976183fd | 390 | Int_t offset = nbins - fNBinsToScale - 1; |
2c33acf3 | 391 | |
392 | for (UInt_t i = offset; i< nbins; i++) | |
976183fd | 393 | { |
26f1270c | 394 | if ( num->GetBinContent(i) > 0.0 ) |
976183fd | 395 | { |
dd82cadc | 396 | densum = fDenominator->GetBinContent(i); |
397 | numsum = fNumerator->GetBinContent(i); | |
976183fd | 398 | } |
399 | } | |
2674b9ff | 400 | |
dd82cadc | 401 | if(AliHBTParticle::GetDebug() > 0) |
402 | Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d",numsum,densum,fNBinsToScale); | |
2674b9ff | 403 | |
dd82cadc | 404 | if (numsum == 0) return 0.0; |
405 | Double_t ret = densum/numsum; | |
976183fd | 406 | |
18c3af34 | 407 | if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret); |
2674b9ff | 408 | return ret; |
976183fd | 409 | } |
410 | ||
1b446896 | 411 | /******************************************************************/ |
412 | /******************************************************************/ | |
413 | /******************************************************************/ | |
414 | ||
26f1270c | 415 | //____________________ |
416 | /////////////////////////////////////////////////////// | |
417 | // // | |
418 | // AliHBTFunction2D // | |
419 | // // | |
420 | // Base Calss for 2-dimensinal Functions // | |
421 | // // | |
422 | // Piotr.Skowronski@cern.ch // | |
423 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
424 | // // | |
425 | /////////////////////////////////////////////////////// | |
1b446896 | 426 | |
1db320d4 | 427 | ClassImp( AliHBTFunction2D ) |
1b446896 | 428 | |
26f1270c | 429 | const Int_t AliHBTFunction2D::fgkDefaultNBinsX = 200;//default number of Bins in X axis in histograms |
430 | const Float_t AliHBTFunction2D::fgkDefaultMinX = 0.0;//Default min value of X axis in histograms | |
431 | const Float_t AliHBTFunction2D::fgkDefaultMaxX = 1.5;//Default max value of X axis inhistograms | |
432 | ||
433 | const Int_t AliHBTFunction2D::fgkDefaultNBinsY = 200;//default number of Bins in histograms | |
434 | const Float_t AliHBTFunction2D::fgkDefaultMinY = -0.15;//Default min value of histograms | |
435 | const Float_t AliHBTFunction2D::fgkDefaultMaxY = 0.15;//Default max value of histograms | |
436 | ||
437 | const UInt_t AliHBTFunction2D::fgkDefaultNBinsToScaleX = 30;//Default number of X bins used for scaling to tale | |
438 | const UInt_t AliHBTFunction2D::fgkDefaultNBinsToScaleY = 30;//Default number of bins used for scaling to tale | |
439 | ||
440 | /******************************************************************/ | |
441 | AliHBTFunction2D::AliHBTFunction2D(): | |
442 | fNumerator(0x0), | |
443 | fDenominator(0x0), | |
444 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
445 | fNBinsToScaleY(fgkDefaultNBinsToScaleY) | |
446 | {//default constructor | |
447 | } | |
448 | /******************************************************************/ | |
449 | AliHBTFunction2D::AliHBTFunction2D(const Char_t *name, const Char_t *title): | |
450 | AliHBTFunction(name,title), | |
451 | fNumerator(0x0), | |
452 | fDenominator(0x0), | |
453 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
454 | fNBinsToScaleY(fgkDefaultNBinsToScaleY) | |
455 | {//constructor | |
456 | } | |
457 | /******************************************************************/ | |
458 | ||
459 | AliHBTFunction2D::AliHBTFunction2D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
460 | Int_t nYbins, Double_t maxYval, Double_t minYval): | |
461 | fNumerator(0x0), | |
462 | fDenominator(0x0), | |
463 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
464 | fNBinsToScaleY(fgkDefaultNBinsToScaleY) | |
1b446896 | 465 | { |
26f1270c | 466 | BuildHistos(nXbins,maxXval,minXval,nYbins,maxYval,minYval); |
467 | } | |
468 | /******************************************************************/ | |
1b446896 | 469 | |
26f1270c | 470 | AliHBTFunction2D::AliHBTFunction2D(const Char_t *name, const Char_t *title, |
471 | Int_t nXbins, Double_t maxXval, Double_t minXval, | |
472 | Int_t nYbins, Double_t maxYval, Double_t minYval): | |
473 | AliHBTFunction(name,title), | |
474 | fNumerator(0x0), | |
475 | fDenominator(0x0), | |
476 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
477 | fNBinsToScaleY(fgkDefaultNBinsToScaleY) | |
478 | { | |
479 | BuildHistos(nXbins,maxXval,minXval,nYbins,maxYval,minYval); | |
1b446896 | 480 | } |
26f1270c | 481 | /******************************************************************/ |
28cf76fa | 482 | AliHBTFunction2D::AliHBTFunction2D(const AliHBTFunction2D & source): |
483 | AliHBTFunction(source) | |
484 | { | |
485 | // Copy constructor needed by the coding conventions byt not used | |
486 | Fatal("AliHBTFunction2D(const AliHBTFunction2D&)","Cpy ctor not usable."); | |
487 | } | |
488 | /******************************************************************/ | |
489 | ||
490 | AliHBTFunction2D& AliHBTFunction2D::operator= (const AliHBTFunction2D& /*source*/) { | |
491 | // Assignment needed by the coding conventions byt not used | |
492 | Fatal("Assignment operator","not implemented"); | |
493 | return * this; | |
494 | } | |
495 | /******************************************************************/ | |
26f1270c | 496 | |
497 | AliHBTFunction2D::~AliHBTFunction2D() | |
1b446896 | 498 | { |
28cf76fa | 499 | //dtor |
1b446896 | 500 | delete fNumerator; |
501 | delete fDenominator; | |
502 | } | |
26f1270c | 503 | /******************************************************************/ |
504 | ||
505 | void AliHBTFunction2D::BuildHistos() | |
1b446896 | 506 | { |
26f1270c | 507 | //Creates default histograms |
508 | BuildHistos(fgkDefaultNBinsX,fgkDefaultMaxX,fgkDefaultMinX, | |
509 | fgkDefaultNBinsY,fgkDefaultMaxY,fgkDefaultMinY); | |
1b446896 | 510 | } |
26f1270c | 511 | /******************************************************************/ |
1b446896 | 512 | |
26f1270c | 513 | void AliHBTFunction2D::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin, |
514 | Int_t nybins, Float_t ymax, Float_t ymin) | |
1b446896 | 515 | { |
28cf76fa | 516 | //Builds numerator and denominator histograms (2d-case) |
26f1270c | 517 | TString numstr = fName + " Numerator"; //title and name of the |
518 | //numerator histogram | |
519 | TString denstr = fName + " Denominator";//title and name of the | |
520 | //denominator histogram | |
521 | ||
522 | fNumerator = new TH2D(numstr.Data(),numstr.Data(), | |
523 | nxbins,xmin,xmax,nybins,ymin,ymax); | |
524 | ||
525 | fDenominator = new TH2D(denstr.Data(),denstr.Data(), | |
526 | nxbins,xmin,xmax,nybins,ymin,ymax); | |
527 | ||
528 | fNumerator->Sumw2(); | |
529 | fDenominator->Sumw2(); | |
530 | } | |
531 | /******************************************************************/ | |
1b446896 | 532 | |
26f1270c | 533 | void AliHBTFunction2D::SetNumberOfBinsToScale(UInt_t xn, UInt_t yn) |
534 | { | |
535 | //defines area used for scaling factor calculation | |
536 | fNBinsToScaleX = xn; | |
537 | fNBinsToScaleY = yn; | |
1b446896 | 538 | } |
26f1270c | 539 | /******************************************************************/ |
1b446896 | 540 | |
26f1270c | 541 | Double_t AliHBTFunction2D::Scale() |
542 | { | |
28cf76fa | 543 | // Calculates the factor that should be used to scale |
544 | // quatience of fNumerator and fDenominator to 1 at | |
545 | // given region | |
18c3af34 | 546 | if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()"); |
26f1270c | 547 | if(!fNumerator) |
548 | { | |
549 | Error("Scale","No numerator"); | |
550 | return 0.0; | |
551 | } | |
552 | if(!fDenominator) | |
553 | { | |
554 | Error("Scale","No denominator"); | |
555 | return 0.0; | |
556 | } | |
557 | ||
558 | if( (fNBinsToScaleX < 1) || (fNBinsToScaleY < 1) ) | |
559 | { | |
26f1270c | 560 | Error("Scale","Number of bins for scaling is smaller thnan 1"); |
0798b21e | 561 | return 0.0; |
26f1270c | 562 | } |
563 | UInt_t nbinsX = fNumerator->GetNbinsX(); | |
564 | if (fNBinsToScaleX > nbinsX) | |
565 | { | |
566 | Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms"); | |
567 | return 0.0; | |
568 | } | |
569 | ||
570 | UInt_t nbinsY = fNumerator->GetNbinsX(); | |
571 | if (fNBinsToScaleY > nbinsY) | |
572 | { | |
573 | Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms"); | |
574 | return 0.0; | |
575 | } | |
576 | ||
18c3af34 | 577 | if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected"); |
26f1270c | 578 | |
579 | Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X | |
580 | Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis X | |
581 | ||
dd82cadc | 582 | Double_t densum = 0.0; |
583 | Double_t numsum = 0.0; | |
26f1270c | 584 | |
2c33acf3 | 585 | for (UInt_t j = offsetY; j< nbinsY; j++) |
586 | for (UInt_t i = offsetX; i< nbinsX; i++) | |
26f1270c | 587 | { |
588 | if ( fNumerator->GetBinContent(i,j) > 0.0 ) | |
589 | { | |
dd82cadc | 590 | densum = fDenominator->GetBinContent(i,j); |
591 | numsum = fNumerator->GetBinContent(i,j); | |
26f1270c | 592 | } |
593 | } | |
594 | ||
dd82cadc | 595 | if(AliHBTParticle::GetDebug() > 0) |
596 | Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d",numsum,densum,fNBinsToScaleX,fNBinsToScaleY); | |
26f1270c | 597 | |
dd82cadc | 598 | if (numsum == 0) return 0.0; |
599 | Double_t ret = densum/numsum; | |
26f1270c | 600 | |
18c3af34 | 601 | if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret); |
26f1270c | 602 | return ret; |
603 | } | |
1b446896 | 604 | |
605 | /******************************************************************/ | |
606 | /******************************************************************/ | |
607 | /******************************************************************/ | |
608 | ||
26f1270c | 609 | //____________________ |
610 | /////////////////////////////////////////////////////// | |
611 | // // | |
612 | // AliHBTFunction3D // | |
613 | // // | |
614 | // Base Calss for 3-dimensinal Functions // | |
615 | // // | |
616 | // Piotr.Skowronski@cern.ch // | |
617 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
618 | // // | |
619 | /////////////////////////////////////////////////////// | |
1b446896 | 620 | |
26f1270c | 621 | ClassImp( AliHBTFunction3D) |
1b446896 | 622 | |
26f1270c | 623 | const Int_t AliHBTFunction3D::fgkDefaultNBinsX = 200;//default number of Bins in X axis in histograms |
624 | const Float_t AliHBTFunction3D::fgkDefaultMinX = 0.0;//Default min value of X axis in histograms | |
625 | const Float_t AliHBTFunction3D::fgkDefaultMaxX = 1.5;//Default max value of X axis inhistograms | |
1b446896 | 626 | |
26f1270c | 627 | const Int_t AliHBTFunction3D::fgkDefaultNBinsY = 200;//default number of Bins in histograms |
628 | const Float_t AliHBTFunction3D::fgkDefaultMinY = -0.15;//Default min value of histograms | |
629 | const Float_t AliHBTFunction3D::fgkDefaultMaxY = 0.15;//Default max value of histograms | |
630 | ||
631 | const Int_t AliHBTFunction3D::fgkDefaultNBinsZ = 200;//default number of Bins in histograms | |
632 | const Float_t AliHBTFunction3D::fgkDefaultMinZ = -0.15;//Default min value of histograms | |
633 | const Float_t AliHBTFunction3D::fgkDefaultMaxZ = 0.15;//Default max value of histograms | |
634 | ||
635 | const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleX = 30;//Default number of X bins used for scaling to tale | |
636 | const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleY = 30;//Default number of bins used for scaling to tale | |
637 | const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleZ = 30;//Default number of bins used for scaling to tale | |
638 | ||
2c33acf3 | 639 | AliHBTFunction3D::AliHBTFunction3D(): |
640 | fNumerator(0x0), | |
641 | fDenominator(0x0), | |
642 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
643 | fNBinsToScaleY(fgkDefaultNBinsToScaleY), | |
644 | fNBinsToScaleZ(fgkDefaultNBinsToScaleZ) | |
645 | { | |
646 | //constructor | |
647 | } | |
648 | /******************************************************************/ | |
649 | ||
650 | AliHBTFunction3D::AliHBTFunction3D(const Char_t *name, const Char_t *title): | |
651 | AliHBTFunction(name,title), | |
652 | fNumerator(0x0), | |
653 | fDenominator(0x0), | |
654 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
655 | fNBinsToScaleY(fgkDefaultNBinsToScaleY), | |
656 | fNBinsToScaleZ(fgkDefaultNBinsToScaleZ) | |
657 | { | |
658 | //constructor | |
659 | } | |
660 | /******************************************************************/ | |
26f1270c | 661 | |
662 | AliHBTFunction3D::AliHBTFunction3D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
663 | Int_t nYbins, Double_t maxYval, Double_t minYval, | |
664 | Int_t nZbins, Double_t maxZval, Double_t minZval): | |
665 | fNumerator(0x0), | |
666 | fDenominator(0x0), | |
667 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
668 | fNBinsToScaleY(fgkDefaultNBinsToScaleY), | |
669 | fNBinsToScaleZ(fgkDefaultNBinsToScaleZ) | |
670 | { | |
2c33acf3 | 671 | //constructor |
672 | BuildHistos( nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval); | |
1b446896 | 673 | } |
ba95ae3f | 674 | /******************************************************************/ |
7836ee94 | 675 | |
2c33acf3 | 676 | AliHBTFunction3D::AliHBTFunction3D(const Char_t *name, const Char_t *title, |
677 | Int_t nXbins, Double_t maxXval, Double_t minXval, | |
678 | Int_t nYbins, Double_t maxYval, Double_t minYval, | |
679 | Int_t nZbins, Double_t maxZval, Double_t minZval): | |
680 | AliHBTFunction(name,title), | |
681 | fNumerator(0x0), | |
682 | fDenominator(0x0), | |
683 | fNBinsToScaleX(fgkDefaultNBinsToScaleX), | |
684 | fNBinsToScaleY(fgkDefaultNBinsToScaleY), | |
685 | fNBinsToScaleZ(fgkDefaultNBinsToScaleZ) | |
686 | { | |
687 | //constructor | |
688 | BuildHistos( nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval); | |
689 | } | |
690 | /******************************************************************/ | |
691 | ||
28cf76fa | 692 | AliHBTFunction3D::AliHBTFunction3D(const AliHBTFunction3D& source): |
693 | AliHBTFunction(source) | |
694 | { | |
695 | // Copy constructor needed by the coding conventions byt not used | |
696 | Fatal("AliHBTFunction3D(const AliHBTFunction3D&)","Cpy ctor not usable."); | |
697 | } | |
698 | /******************************************************************/ | |
699 | ||
700 | AliHBTFunction3D& AliHBTFunction3D::operator= (const AliHBTFunction3D & /*source*/) | |
701 | { | |
702 | // Assignment needed by the coding conventions byt not used | |
703 | Fatal("Assignment operator","not implemented"); | |
704 | return * this; | |
705 | } | |
706 | /******************************************************************/ | |
707 | ||
2c33acf3 | 708 | |
26f1270c | 709 | AliHBTFunction3D::~AliHBTFunction3D() |
7836ee94 | 710 | { |
711 | delete fNumerator; | |
712 | delete fDenominator; | |
713 | } | |
ba95ae3f | 714 | /******************************************************************/ |
7836ee94 | 715 | |
26f1270c | 716 | void AliHBTFunction3D::BuildHistos() |
717 | { | |
718 | //Creates default histograms | |
719 | BuildHistos(fgkDefaultNBinsX,fgkDefaultMaxX,fgkDefaultMinX, | |
720 | fgkDefaultNBinsY,fgkDefaultMaxY,fgkDefaultMinY, | |
721 | fgkDefaultNBinsZ,fgkDefaultMaxZ,fgkDefaultMinZ); | |
722 | } | |
ba95ae3f | 723 | /******************************************************************/ |
ba95ae3f | 724 | |
26f1270c | 725 | void AliHBTFunction3D::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin, |
726 | Int_t nybins, Float_t ymax, Float_t ymin, | |
727 | Int_t nzbins, Float_t zmax, Float_t zmin) | |
728 | { | |
6e8d850a | 729 | //Builds numerator and denominator histograms (3d-case) |
ba95ae3f | 730 | TString numstr = fName + " Numerator"; //title and name of the |
731 | //numerator histogram | |
732 | TString denstr = fName + " Denominator";//title and name of the | |
733 | //denominator histogram | |
734 | ||
dd82cadc | 735 | fNumerator = new TH3F(numstr.Data(),numstr.Data(), |
bed069a4 | 736 | nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax); |
ba95ae3f | 737 | |
dd82cadc | 738 | fDenominator = new TH3F(denstr.Data(),denstr.Data(), |
bed069a4 | 739 | nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax); |
ba95ae3f | 740 | |
741 | fNumerator->Sumw2(); | |
742 | fDenominator->Sumw2(); | |
ba95ae3f | 743 | } |
ba95ae3f | 744 | |
4e871a8a | 745 | /******************************************************************/ |
26f1270c | 746 | |
747 | Double_t AliHBTFunction3D::Scale() | |
4e871a8a | 748 | { |
6e8d850a | 749 | // Calculates the factor that should be used to scale |
750 | // quatience of fNumerator and fDenominator to 1 at | |
751 | // given volume | |
18c3af34 | 752 | if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()"); |
4e871a8a | 753 | if(!fNumerator) |
754 | { | |
755 | Error("Scale","No numerator"); | |
756 | return 0.0; | |
757 | } | |
758 | if(!fDenominator) | |
759 | { | |
760 | Error("Scale","No denominator"); | |
761 | return 0.0; | |
762 | } | |
763 | ||
26f1270c | 764 | if( (fNBinsToScaleX < 1) || (fNBinsToScaleY < 1) || (fNBinsToScaleZ < 1)) |
4e871a8a | 765 | { |
4e871a8a | 766 | Error("Scale","Number of bins for scaling is smaller thnan 1"); |
0798b21e | 767 | return 0.0; |
4e871a8a | 768 | } |
26f1270c | 769 | UInt_t nbinsX = fNumerator->GetNbinsX(); |
770 | if (fNBinsToScaleX > nbinsX) | |
4e871a8a | 771 | { |
26f1270c | 772 | Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms"); |
773 | return 0.0; | |
774 | } | |
775 | ||
776 | UInt_t nbinsY = fNumerator->GetNbinsX(); | |
777 | if (fNBinsToScaleY > nbinsY) | |
778 | { | |
779 | Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms"); | |
780 | return 0.0; | |
781 | } | |
782 | ||
783 | UInt_t nbinsZ = fNumerator->GetNbinsZ(); | |
784 | if (fNBinsToScaleZ > nbinsZ) | |
785 | { | |
786 | Error("Scale","Number of Z bins for scaling is bigger thnan number of bins in histograms"); | |
4e871a8a | 787 | return 0.0; |
788 | } | |
26f1270c | 789 | |
18c3af34 | 790 | if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected"); |
4e871a8a | 791 | |
26f1270c | 792 | Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X |
196e34f6 | 793 | Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis Y |
794 | Int_t offsetZ = nbinsZ - fNBinsToScaleZ - 1; //bin that we start loop over bins in axis Z | |
26f1270c | 795 | |
dd82cadc | 796 | Double_t densum = 0.0; |
797 | Double_t numsum = 0.0; | |
4e871a8a | 798 | |
196e34f6 | 799 | for (UInt_t k = offsetZ; k<nbinsZ; k++) |
800 | for (UInt_t j = offsetY; j<nbinsY; j++) | |
801 | for (UInt_t i = offsetX; i<nbinsX; i++) | |
26f1270c | 802 | { |
803 | if ( fNumerator->GetBinContent(i,j,k) > 0.0 ) | |
804 | { | |
dd82cadc | 805 | |
806 | densum = fDenominator->GetBinContent(i,j,k); | |
807 | numsum = fNumerator->GetBinContent(i,j,k); | |
26f1270c | 808 | } |
809 | } | |
4e871a8a | 810 | |
18c3af34 | 811 | if(AliHBTParticle::GetDebug() > 0) |
dd82cadc | 812 | Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d fNBinsToScaleZ=%d", |
813 | numsum,densum,fNBinsToScaleX,fNBinsToScaleY,fNBinsToScaleZ); | |
4e871a8a | 814 | |
dd82cadc | 815 | if (numsum == 0) return 0.0; |
816 | Double_t ret = densum/numsum; | |
4e871a8a | 817 | |
18c3af34 | 818 | if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret); |
4e871a8a | 819 | return ret; |
820 | } | |
2c33acf3 | 821 | /******************************************************************/ |
822 | ||
823 | void AliHBTFunction3D::SetNumberOfBinsToScale(UInt_t xn, UInt_t yn,UInt_t zn) | |
824 | { | |
825 | //sets up the volume to be used for scaling to tail | |
826 | fNBinsToScaleX = xn; | |
827 | fNBinsToScaleY = yn; | |
828 | fNBinsToScaleZ = zn; | |
829 | } | |
ba95ae3f | 830 | |
1b446896 | 831 | /******************************************************************/ |
832 | /******************************************************************/ | |
833 | /******************************************************************/ | |
26f1270c | 834 | /******************************************************************/ |
835 | /******************************************************************/ | |
836 | /******************************************************************/ | |
837 | /******************************************************************/ | |
838 | /******************************************************************/ | |
839 | /******************************************************************/ | |
1b446896 | 840 | |
26f1270c | 841 | //____________________ |
842 | /////////////////////////////////////////////////////// | |
843 | // // | |
844 | // AliHBTOnePairFctn1D // | |
845 | // // | |
846 | // Base Calss for 1-dimensinal Functions that need // | |
847 | // one pair to fill function // | |
848 | // // | |
849 | // Piotr.Skowronski@cern.ch // | |
850 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
851 | // // | |
852 | /////////////////////////////////////////////////////// | |
1b446896 | 853 | |
26f1270c | 854 | ClassImp( AliHBTOnePairFctn1D ) |
855 | /******************************************************************/ | |
1b446896 | 856 | |
26f1270c | 857 | AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval): |
858 | AliHBTFunction1D(nbins,maxXval,minXval) | |
1b446896 | 859 | { |
aa4e0a70 | 860 | //constructor |
26f1270c | 861 | } |
862 | /******************************************************************/ | |
1b446896 | 863 | |
26f1270c | 864 | AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title): |
865 | AliHBTFunction1D(name,title) | |
866 | { | |
aa4e0a70 | 867 | |
26f1270c | 868 | } |
869 | /******************************************************************/ | |
870 | ||
871 | AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title, | |
872 | Int_t nbins, Float_t maxXval, Float_t minXval): | |
873 | AliHBTFunction1D(name,title,nbins,maxXval,minXval) | |
874 | { | |
aa4e0a70 | 875 | //constructor |
26f1270c | 876 | } |
877 | /******************************************************************/ | |
878 | ||
879 | void AliHBTOnePairFctn1D::ProcessSameEventParticles(AliHBTPair* pair) | |
880 | { | |
6e8d850a | 881 | //Fills the numerator using pair from the same event |
26f1270c | 882 | pair = CheckPair(pair); |
883 | if(pair) fNumerator->Fill(GetValue(pair)); | |
884 | } | |
885 | /******************************************************************/ | |
886 | void AliHBTOnePairFctn1D::ProcessDiffEventParticles(AliHBTPair* pair) | |
887 | { | |
6e8d850a | 888 | //Fills the denumerator using mixed pairs |
26f1270c | 889 | pair = CheckPair(pair); |
890 | if(pair) fDenominator->Fill(GetValue(pair)); | |
891 | } | |
892 | ||
893 | /******************************************************************/ | |
894 | /******************************************************************/ | |
895 | /******************************************************************/ | |
896 | ||
897 | //____________________ | |
898 | /////////////////////////////////////////////////////// | |
899 | // // | |
900 | // AliHBTOnePairFctn2D // | |
901 | // // | |
902 | // Base Calss for 2-dimensinal Functions that need // | |
903 | // one pair to fill function // | |
904 | // // | |
905 | // Piotr.Skowronski@cern.ch // | |
906 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
907 | // // | |
908 | /////////////////////////////////////////////////////// | |
909 | ||
910 | ClassImp( AliHBTOnePairFctn2D ) | |
911 | /******************************************************************/ | |
912 | ||
913 | AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title): | |
914 | AliHBTFunction2D(name,title) | |
915 | { | |
aa4e0a70 | 916 | //constructor |
26f1270c | 917 | } |
918 | /******************************************************************/ | |
919 | ||
920 | AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
921 | Int_t nYbins, Double_t maxYval, Double_t minYval): | |
922 | AliHBTFunction2D(nXbins, maxXval, minXval, nYbins, maxYval, minYval) | |
923 | { | |
aa4e0a70 | 924 | //constructor |
26f1270c | 925 | } |
926 | /******************************************************************/ | |
927 | ||
928 | AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title, | |
929 | Int_t nXbins, Double_t maxXval, Double_t minXval, | |
930 | Int_t nYbins, Double_t maxYval, Double_t minYval): | |
931 | AliHBTFunction2D(name,title, nXbins, maxXval, minXval, nYbins, maxYval, minYval) | |
932 | { | |
aa4e0a70 | 933 | //constructor |
26f1270c | 934 | } |
935 | /******************************************************************/ | |
936 | ||
937 | void AliHBTOnePairFctn2D::ProcessSameEventParticles(AliHBTPair* pair) | |
938 | { | |
6e8d850a | 939 | // Fills the numerator using pairs from the same event |
26f1270c | 940 | pair = CheckPair(pair); |
941 | if(pair) | |
942 | { | |
943 | Double_t x,y; | |
944 | GetValues(pair,x,y); | |
945 | fNumerator->Fill(x,y); | |
946 | } | |
947 | } | |
948 | /******************************************************************/ | |
949 | ||
950 | void AliHBTOnePairFctn2D::ProcessDiffEventParticles(AliHBTPair* pair) | |
951 | { | |
6e8d850a | 952 | // Fills the denumerator using mixed pairs |
26f1270c | 953 | pair = CheckPair(pair); |
954 | if(pair) | |
955 | { | |
956 | Double_t x,y; | |
957 | GetValues(pair,x,y); | |
958 | fDenominator->Fill(x,y); | |
959 | } | |
960 | } | |
961 | /******************************************************************/ | |
962 | /******************************************************************/ | |
963 | /******************************************************************/ | |
964 | /******************************************************************/ | |
965 | //____________________ | |
966 | /////////////////////////////////////////////////////// | |
967 | // // | |
968 | // AliHBTOnePairFctn3D // | |
969 | // // | |
970 | // Base Calss for 3-dimensinal Functions that need // | |
971 | // one pair to fill function // | |
972 | // // | |
973 | // Piotr.Skowronski@cern.ch // | |
974 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
975 | // // | |
976 | /////////////////////////////////////////////////////// | |
977 | ClassImp( AliHBTOnePairFctn3D) | |
978 | ||
979 | /******************************************************************/ | |
980 | ||
981 | AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title): | |
982 | AliHBTFunction3D(name,title) | |
1b446896 | 983 | { |
aa4e0a70 | 984 | //constructor |
1b446896 | 985 | } |
26f1270c | 986 | /******************************************************************/ |
987 | ||
988 | AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
989 | Int_t nYbins, Double_t maxYval, Double_t minYval, | |
990 | Int_t nZbins, Double_t maxZval, Double_t minZval): | |
991 | AliHBTFunction3D(nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval) | |
992 | { | |
aa4e0a70 | 993 | //constructor |
26f1270c | 994 | } |
995 | /******************************************************************/ | |
996 | ||
997 | AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title, | |
998 | Int_t nXbins, Double_t maxXval, Double_t minXval, | |
999 | Int_t nYbins, Double_t maxYval, Double_t minYval, | |
1000 | Int_t nZbins, Double_t maxZval, Double_t minZval): | |
1001 | AliHBTFunction3D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval) | |
1002 | { | |
aa4e0a70 | 1003 | //constructor |
26f1270c | 1004 | } |
1005 | /******************************************************************/ | |
1006 | ||
1007 | void AliHBTOnePairFctn3D::ProcessSameEventParticles(AliHBTPair* pair) | |
1008 | { | |
1009 | //Reacts on pair coming from same event (real pairs) | |
1010 | //and fills numerator histogram | |
1011 | pair = CheckPair(pair); | |
1012 | if( pair ) | |
1013 | { | |
1014 | Double_t x,y,z; | |
1015 | GetValues(pair,x,y,z); | |
1016 | fNumerator->Fill(x,y,z); | |
1017 | } | |
1018 | } | |
1019 | /******************************************************************/ | |
1020 | ||
1021 | void AliHBTOnePairFctn3D::ProcessDiffEventParticles(AliHBTPair* pair) | |
1022 | { | |
1023 | //Reacts on pair coming from different events (mixed pairs) | |
1024 | //and fills denominator histogram | |
1025 | pair = CheckPair(pair); | |
1026 | if( pair ) | |
1027 | { | |
1028 | Double_t x,y,z; | |
1029 | GetValues(pair,x,y,z); | |
1030 | fDenominator->Fill(x,y,z); | |
1031 | } | |
1032 | } | |
1033 | ||
1034 | /******************************************************************/ | |
1035 | /******************************************************************/ | |
1036 | /******************************************************************/ | |
1037 | ||
1038 | //____________________ | |
1039 | /////////////////////////////////////////////////////// | |
1040 | // // | |
1041 | // AliHBTTwoPairFctn1D // | |
1042 | // // | |
1043 | // Base Calss for 1-dimensinal Functions that need // | |
1044 | // two pair (simulated and reconstructed) // | |
1045 | // to fill function // | |
1046 | // // | |
1047 | // Piotr.Skowronski@cern.ch // | |
1048 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
1049 | // // | |
1050 | /////////////////////////////////////////////////////// | |
1051 | ClassImp(AliHBTTwoPairFctn1D) | |
1052 | /******************************************************************/ | |
1053 | ||
1054 | AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval): | |
1055 | AliHBTFunction1D(nbins,maxXval,minXval) | |
1056 | { | |
aa4e0a70 | 1057 | //constructor |
26f1270c | 1058 | } |
1059 | /******************************************************************/ | |
1060 | ||
1061 | AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title): | |
1062 | AliHBTFunction1D(name,title) | |
1063 | { | |
aa4e0a70 | 1064 | //constructor |
26f1270c | 1065 | } |
1066 | /******************************************************************/ | |
1067 | ||
1068 | AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title, | |
1069 | Int_t nbins, Float_t maxXval, Float_t minXval): | |
1070 | AliHBTFunction1D(name,title,nbins,maxXval,minXval) | |
1071 | { | |
aa4e0a70 | 1072 | //constructor |
26f1270c | 1073 | } |
1074 | /******************************************************************/ | |
1075 | ||
1076 | void AliHBTTwoPairFctn1D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
1077 | { | |
6e8d850a | 1078 | // Fills the numerator using pairs from the same event |
26f1270c | 1079 | partpair = CheckPair(partpair); |
0bb07108 | 1080 | if( partpair == 0x0) return; |
1081 | ||
7513c9e5 | 1082 | if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair |
1083 | trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well | |
0bb07108 | 1084 | |
1085 | Double_t x = GetValue(trackpair,partpair); | |
1086 | fNumerator->Fill(x); | |
26f1270c | 1087 | } |
1088 | /******************************************************************/ | |
1089 | ||
1090 | void AliHBTTwoPairFctn1D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
1091 | { | |
6e8d850a | 1092 | // Fills the denumerator usin mixed pairs |
26f1270c | 1093 | partpair = CheckPair(partpair); |
0bb07108 | 1094 | if( partpair == 0x0) return; |
1095 | ||
7513c9e5 | 1096 | if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair |
1097 | trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well | |
0bb07108 | 1098 | |
1099 | Double_t x = GetValue(trackpair,partpair); | |
1100 | fDenominator->Fill(x); | |
26f1270c | 1101 | } |
1102 | /******************************************************************/ | |
1103 | /******************************************************************/ | |
1104 | /******************************************************************/ | |
1105 | ||
1106 | //____________________ | |
1107 | /////////////////////////////////////////////////////// | |
1108 | // // | |
1109 | // AliHBTTwoPairFctn2D // | |
1110 | // // | |
1111 | // Base Calss for 2-dimensinal Functions that need // | |
1112 | // two pair (simulated and reconstructed) // | |
1113 | // to fill function // | |
1114 | // // | |
1115 | // Piotr.Skowronski@cern.ch // | |
1116 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
1117 | // // | |
1118 | /////////////////////////////////////////////////////// | |
1119 | ||
1120 | ClassImp(AliHBTTwoPairFctn2D) | |
1121 | ||
1122 | /******************************************************************/ | |
1123 | ||
1124 | AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title): | |
1125 | AliHBTFunction2D(name,title) | |
1126 | { | |
aa4e0a70 | 1127 | //constructor |
26f1270c | 1128 | } |
1129 | /******************************************************************/ | |
1130 | ||
1131 | AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
1132 | Int_t nYbins, Double_t maxYval, Double_t minYval): | |
1133 | AliHBTFunction2D(nXbins, maxXval, minXval, nYbins, maxYval, minYval) | |
1134 | { | |
aa4e0a70 | 1135 | //constructor |
26f1270c | 1136 | } |
1137 | /******************************************************************/ | |
1138 | ||
1139 | AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title, | |
1140 | Int_t nXbins, Double_t maxXval, Double_t minXval, | |
1141 | Int_t nYbins, Double_t maxYval, Double_t minYval): | |
1142 | AliHBTFunction2D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval) | |
1143 | { | |
aa4e0a70 | 1144 | //constructor |
26f1270c | 1145 | } |
1146 | /******************************************************************/ | |
1147 | ||
1148 | void AliHBTTwoPairFctn2D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
1b446896 | 1149 | { |
2c33acf3 | 1150 | //processes pair of particles coming from a same events (real pair) |
1151 | partpair = CheckPair(partpair); //check cuts | |
0bb07108 | 1152 | if (partpair == 0x0) return; |
1153 | ||
7513c9e5 | 1154 | if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair |
1155 | trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well | |
0bb07108 | 1156 | |
1157 | Double_t x,y; | |
1158 | GetValues(trackpair,partpair,x,y); | |
1159 | fNumerator->Fill(x,y); | |
1b446896 | 1160 | } |
26f1270c | 1161 | /******************************************************************/ |
1b446896 | 1162 | |
26f1270c | 1163 | void AliHBTTwoPairFctn2D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) |
1b446896 | 1164 | { |
2c33acf3 | 1165 | //processes pair of particles coming from a different events (mixed pair) |
1b446896 | 1166 | partpair = CheckPair(partpair); |
0bb07108 | 1167 | if (partpair == 0x0) return; |
1168 | ||
7513c9e5 | 1169 | if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair |
1170 | trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well | |
0bb07108 | 1171 | |
1172 | Double_t x,y; | |
1173 | GetValues(trackpair,partpair,x,y); | |
1174 | fDenominator->Fill(x,y); | |
1b446896 | 1175 | } |
1176 | ||
ba95ae3f | 1177 | /******************************************************************/ |
1178 | /******************************************************************/ | |
1179 | /******************************************************************/ | |
26f1270c | 1180 | |
1181 | //____________________ | |
1182 | /////////////////////////////////////////////////////// | |
1183 | // // | |
1184 | // AliHBTTwoPairFctn3D // | |
1185 | // // | |
1186 | // Base Calss for 3-dimensinal Functions that need // | |
1187 | // two pair (simulated and reconstructed) // | |
1188 | // to fill function // | |
1189 | // // | |
1190 | // Piotr.Skowronski@cern.ch // | |
1191 | // http://alisoft.cern.ch/people/skowron/analyzer // | |
1192 | // // | |
1193 | /////////////////////////////////////////////////////// | |
1194 | ||
ba95ae3f | 1195 | ClassImp(AliHBTTwoPairFctn3D) |
1196 | ||
26f1270c | 1197 | /******************************************************************/ |
1198 | ||
1199 | AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title): | |
1200 | AliHBTFunction3D(name,title) | |
1201 | { | |
aa4e0a70 | 1202 | //constructor |
26f1270c | 1203 | } |
1204 | /******************************************************************/ | |
1205 | ||
1206 | AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval, | |
1207 | Int_t nYbins, Double_t maxYval, Double_t minYval, | |
1208 | Int_t nZbins, Double_t maxZval, Double_t minZval): | |
1209 | AliHBTFunction3D(nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval) | |
1210 | { | |
aa4e0a70 | 1211 | //constructor |
26f1270c | 1212 | } |
1213 | /******************************************************************/ | |
1214 | ||
1215 | AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title, | |
1216 | Int_t nXbins, Double_t maxXval, Double_t minXval, | |
1217 | Int_t nYbins, Double_t maxYval, Double_t minYval, | |
1218 | Int_t nZbins, Double_t maxZval, Double_t minZval): | |
1219 | AliHBTFunction3D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval) | |
1220 | { | |
aa4e0a70 | 1221 | //constructor |
26f1270c | 1222 | } |
1223 | /******************************************************************/ | |
1224 | ||
1225 | void AliHBTTwoPairFctn3D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) | |
ba95ae3f | 1226 | { |
6e8d850a | 1227 | // Fills th numerator using pairs from the same event |
ba95ae3f | 1228 | partpair = CheckPair(partpair); |
0bb07108 | 1229 | if( partpair == 0x0) return; |
1230 | ||
7513c9e5 | 1231 | if (partpair->GetSwapedPair() == 0x0)//it means that CheckPair returned swapped pair |
1232 | trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well | |
0bb07108 | 1233 | |
1234 | Double_t x,y,z; | |
1235 | GetValues(trackpair,partpair,x,y,z); | |
1236 | fNumerator->Fill(x,y,z); | |
1237 | ||
ba95ae3f | 1238 | } |
26f1270c | 1239 | /******************************************************************/ |
ba95ae3f | 1240 | |
26f1270c | 1241 | void AliHBTTwoPairFctn3D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) |
ba95ae3f | 1242 | { |
6e8d850a | 1243 | // Fills the denumerator using mixed pairs |
ba95ae3f | 1244 | partpair = CheckPair(partpair); |
0bb07108 | 1245 | if( partpair == 0x0) return; |
1246 | ||
7513c9e5 | 1247 | if (partpair->GetSwapedPair() == 0x0)//it means that CheckPair returned swapped pair |
1248 | trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well | |
0bb07108 | 1249 | |
1250 | Double_t x,y,z; | |
1251 | GetValues(trackpair,partpair,x,y,z); | |
1252 | fDenominator->Fill(x,y,z); | |
ba95ae3f | 1253 | } |
1254 | ||
26f1270c | 1255 | /******************************************************************/ |
1256 | /******************************************************************/ | |
1257 | /******************************************************************/ | |
1258 |