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 | / \ |
16 | two part four part |
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 | |
30 | ClassImp( AliHBTFunction ) |
31 | |
32 | AliHBTFunction::AliHBTFunction() |
33 | { |
34 | |
35 | fPairCut = new AliHBTEmptyPairCut(); //dummy cut |
36 | } |
37 | |
38 | void AliHBTFunction:: |
39 | Write() |
40 | { |
41 | if (GetNumerator()) GetNumerator()->Write(); |
42 | if (GetDenominator()) GetDenominator()->Write(); |
43 | TH1* res = GetResult(); |
44 | if (res) GetResult()->Write(); |
45 | } |
46 | /******************************************************************/ |
47 | |
48 | TH1* AliHBTFunction:: |
49 | GetRatio(Double_t normfactor) |
50 | { |
51 | TString str = fName + " ratio"; |
52 | TH1 *result = (TH1*)GetNumerator()->Clone(str.Data()); |
53 | |
54 | result->SetTitle(str.Data()); |
55 | result->Sumw2(); |
56 | |
57 | result->Divide(GetNumerator(),GetDenominator(),normfactor); |
58 | |
59 | return result; |
60 | |
61 | } |
62 | /******************************************************************/ |
63 | void AliHBTFunction::SetPairCut(AliHBTPairCut* cut) |
64 | { |
65 | //Sets new Pair Cut. Old one is deleted |
66 | //Note that it is created new object instead of simple pointer set |
67 | //I do not want to have pointer |
68 | //to object created somewhere else |
69 | //because in that case I could not believe that |
70 | //it would always exist (sb could delete it) |
71 | //so we have always own copy |
72 | |
73 | if(!cut) |
74 | { |
75 | Error("AliHBTFunction::SetPairCut","argument is NULL"); |
76 | return; |
77 | } |
78 | delete fPairCut; |
79 | fPairCut = (AliHBTPairCut*)cut->Clone(); |
80 | |
81 | } |
82 | |
83 | /******************************************************************/ |
84 | |
85 | void AliHBTFunction:: |
86 | Rename(const Char_t * name) |
87 | { |
88 | //renames the function and histograms |
89 | SetName(name); |
90 | SetTitle(name); |
91 | |
92 | TString numstr = fName + " Numerator"; //title and name of the |
93 | //numerator histogram |
94 | TString denstr = fName + " Denominator";//title and name of the |
95 | //denominator histogram |
96 | |
97 | GetNumerator()->SetName(numstr.Data()); |
98 | GetNumerator()->SetTitle(numstr.Data()); |
99 | |
100 | GetDenominator()->SetName(denstr.Data()); |
101 | GetDenominator()->SetTitle(denstr.Data()); |
102 | |
103 | } |
104 | |
105 | void AliHBTFunction:: |
106 | Rename(const Char_t * name, const Char_t * title) |
107 | { |
108 | //renames and retitle the function and histograms |
109 | |
110 | SetName(name); |
111 | SetTitle(title); |
112 | |
113 | TString numstrn = fName + " Numerator"; //name of the |
114 | //numerator histogram |
115 | |
116 | TString numstrt = fTitle + " Numerator"; //title of the |
117 | //numerator histogram |
118 | |
119 | TString denstrn = fName + " Denominator";//name of the |
120 | //denominator histogram |
121 | |
122 | TString denstrt = fTitle + " Denominator";//title of the |
123 | //denominator histogram |
124 | |
125 | |
126 | GetNumerator()->SetName(numstrn.Data()); |
127 | GetNumerator()->SetTitle(numstrt.Data()); |
128 | |
129 | GetDenominator()->SetName(denstrn.Data()); |
130 | GetDenominator()->SetTitle(denstrt.Data()); |
131 | |
132 | |
133 | } |
134 | |
135 | /******************************************************************/ |
136 | /******************************************************************/ |
137 | /******************************************************************/ |
138 | |
139 | ClassImp( AliHBTTwoPartFctn ) |
140 | |
141 | /******************************************************************/ |
142 | /******************************************************************/ |
143 | /******************************************************************/ |
144 | |
145 | ClassImp( AliHBTFourPartFctn) |
146 | |
147 | /******************************************************************/ |
148 | /******************************************************************/ |
149 | /******************************************************************/ |
150 | |
151 | ClassImp( AliHBTTwoPartFctn1D ) |
152 | |
153 | AliHBTTwoPartFctn1D:: |
154 | AliHBTTwoPartFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval) |
155 | { |
156 | //Constructor of Two Part One Dimentional Function |
157 | // nbins: number of bins in histograms - default 100 |
158 | // maxXval and minXval: range of histgram(s) default 0 - 0.15 (GeV) |
159 | |
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 | fNumerator = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval); |
167 | fDenominator = new TH1D(denstr.Data(),denstr.Data(),nbins,minXval,maxXval); |
168 | |
169 | fNumerator->Sumw2(); |
170 | fDenominator->Sumw2(); |
171 | |
172 | } |
173 | /******************************************************************/ |
174 | AliHBTTwoPartFctn1D::~AliHBTTwoPartFctn1D() |
175 | { |
176 | delete fNumerator; |
177 | delete fDenominator; |
178 | } |
179 | /******************************************************************/ |
180 | /******************************************************************/ |
181 | /******************************************************************/ |
182 | |
183 | ClassImp( AliHBTTwoPartFctn2D ) |
184 | |
185 | AliHBTTwoPartFctn2D:: |
186 | AliHBTTwoPartFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , |
187 | Int_t nYbins, Double_t maxYval, Double_t minYval) |
188 | |
189 | { |
190 | TString numstr = fName + " Numerator"; //title and name of the |
191 | //numerator histogram |
192 | TString denstr = fName + " Denominator";//title and name of the |
193 | //denominator histogram |
194 | |
195 | fNumerator = new TH2D(numstr.Data(),numstr.Data(), |
196 | nXbins,minXval,maxXval, |
197 | nYbins,minYval,maxYval); |
198 | |
199 | fDenominator = new TH2D(denstr.Data(),denstr.Data(), |
200 | nXbins,minXval,maxXval, |
201 | nYbins,minYval,maxYval); |
202 | |
203 | fNumerator->Sumw2(); |
204 | fDenominator->Sumw2(); |
205 | |
206 | } |
207 | AliHBTTwoPartFctn2D::~AliHBTTwoPartFctn2D() |
208 | { |
209 | delete fNumerator; |
210 | delete fDenominator; |
211 | } |
212 | void AliHBTTwoPartFctn2D::ProcessSameEventParticles(AliHBTPair* pair) |
213 | { |
214 | pair = CheckPair(pair); |
215 | if(pair) |
216 | { |
217 | Double_t x,y; |
218 | GetValues(pair,x,y); |
219 | fNumerator->Fill(y,x); |
220 | } |
221 | } |
222 | |
223 | void AliHBTTwoPartFctn2D::ProcessDiffEventParticles(AliHBTPair* pair) |
224 | { |
225 | pair = CheckPair(pair); |
226 | if(pair) |
227 | { |
228 | Double_t x,y; |
229 | GetValues(pair,x,y); |
230 | fDenominator->Fill(y,x); |
231 | } |
232 | |
233 | } |
234 | |
235 | |
236 | /******************************************************************/ |
237 | /******************************************************************/ |
238 | /******************************************************************/ |
239 | |
240 | ClassImp( AliHBTTwoPartFctn3D) |
241 | |
242 | AliHBTTwoPartFctn3D:: |
243 | AliHBTTwoPartFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval, |
244 | Int_t nYbins, Double_t maxYval, Double_t minYval, |
245 | Int_t nZbins, Double_t maxZval, Double_t minZval) |
246 | |
247 | { |
248 | TString numstr = fName + " Numerator"; //title and name of the |
249 | //numerator histogram |
250 | TString denstr = fName + " Denominator";//title and name of the |
251 | //denominator histogram |
252 | |
253 | fNumerator = new TH3D(numstr.Data(),numstr.Data(), |
254 | nXbins,minXval,maxXval, |
255 | nYbins,minYval,maxYval, |
256 | nZbins,minZval,maxZval); |
257 | |
258 | fDenominator = new TH3D(denstr.Data(),denstr.Data(), |
259 | nXbins,minXval,maxXval, |
260 | nYbins,minYval,maxYval, |
261 | nZbins,minZval,maxZval); |
262 | |
263 | fNumerator->Sumw2(); |
264 | fDenominator->Sumw2(); |
265 | |
266 | } |
267 | |
268 | |
269 | AliHBTTwoPartFctn3D::~AliHBTTwoPartFctn3D() |
270 | { |
271 | delete fNumerator; |
272 | delete fDenominator; |
273 | } |
274 | |
275 | |
276 | /******************************************************************/ |
277 | /******************************************************************/ |
278 | /******************************************************************/ |
279 | ClassImp( AliHBTFourPartFctn2D) |
280 | |
281 | |
282 | AliHBTFourPartFctn2D:: |
283 | AliHBTFourPartFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , |
284 | Int_t nYbins, Double_t maxYval, Double_t minYval) |
285 | |
286 | { |
287 | TString numstr = fName + " Numerator"; //title and name of the |
288 | //numerator histogram |
289 | TString denstr = fName + " Denominator";//title and name of the |
290 | //denominator histogram |
291 | |
292 | fNumerator = new TH2D(numstr.Data(),numstr.Data(), |
293 | nXbins,minXval,maxXval, |
294 | nYbins,minYval,maxYval); |
295 | |
296 | fDenominator = new TH2D(denstr.Data(),denstr.Data(), |
297 | nXbins,minXval,maxXval, |
298 | nYbins,minYval,maxYval); |
299 | |
300 | fNumerator->Sumw2(); |
301 | fDenominator->Sumw2(); |
302 | |
303 | } |
304 | AliHBTFourPartFctn2D::~AliHBTFourPartFctn2D() |
305 | { |
306 | delete fNumerator; |
307 | delete fDenominator; |
308 | } |
309 | void AliHBTFourPartFctn2D:: |
310 | ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) |
311 | { |
312 | partpair = CheckPair(partpair); |
313 | trackpair = CheckPair(trackpair); |
314 | if( partpair && trackpair) |
315 | { |
316 | Double_t x,y; |
317 | GetValues(trackpair,partpair,x,y); |
318 | fNumerator->Fill(y,x); |
319 | } |
320 | } |
321 | |
322 | void AliHBTFourPartFctn2D:: |
323 | ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) |
324 | { |
325 | partpair = CheckPair(partpair); |
326 | trackpair = CheckPair(trackpair); |
327 | if( partpair && trackpair) |
328 | { |
329 | Double_t x,y; |
330 | GetValues(trackpair,partpair,x,y); |
331 | fDenominator->Fill(y,x); |
332 | } |
333 | |
334 | } |
335 | |