]>
Commit | Line | Data |
---|---|---|
9edefa04 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2002, 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 | ||
16 | /* $Id$ */ | |
17 | ||
94a709e1 | 18 | #include <TH1.h> |
9edefa04 | 19 | #include <TObjArray.h> |
265f04f7 | 20 | #include <Riostream.h> |
94a709e1 | 21 | |
9edefa04 | 22 | #include "AliHBTasCorrFctn.h" |
23 | ||
94a709e1 | 24 | /////////////////////////////////////////////////////// |
25 | // // | |
26 | // AliHBTasCorrFctn.h // | |
27 | // // | |
28 | // Class for calculating 3D as correlation // | |
29 | // functions // | |
30 | // // | |
31 | /////////////////////////////////////////////////////// | |
32 | ||
33 | ClassImp(AliHBTasCorrFctn) | |
34 | ||
35 | AliHBTasCorrFctn::AliHBTasCorrFctn(const char* name, const char* title): | |
36 | AliHBTOnePairFctn1D(name,title), | |
37 | ||
38 | fNum(0x0), | |
39 | fDen(0x0), | |
4b1c9620 | 40 | fRat(0x0), |
41 | fnbins(0), | |
42 | fNumberOfIntervals(0), | |
43 | fmaxXval(0), | |
44 | fminXval(0) | |
94a709e1 | 45 | |
46 | { | |
47 | //ctor | |
48 | } | |
49 | ||
50 | /******************************************************************/ | |
51 | AliHBTasCorrFctn::AliHBTasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval): | |
52 | AliHBTOnePairFctn1D(name,title,nbins,maxXval,minXval), | |
53 | ||
54 | ||
55 | fNum(new TObjArray()), | |
56 | fDen(new TObjArray()), | |
4b1c9620 | 57 | fRat(new TObjArray()), |
58 | fnbins(0), | |
59 | fNumberOfIntervals(0), | |
60 | fmaxXval(0), | |
61 | fminXval(0) | |
94a709e1 | 62 | { |
63 | SetParams(nbins,maxXval, minXval); | |
64 | } | |
65 | ||
66 | /******************************************************************/ | |
67 | AliHBTasCorrFctn::AliHBTasCorrFctn(const AliHBTasCorrFctn& in): | |
68 | AliHBTOnePairFctn1D(in), | |
69 | ||
70 | ||
71 | ||
72 | fNum((in.fNum)?(TObjArray*)in.fNum->Clone():0x0), | |
73 | fDen((in.fDen)?(TObjArray*)in.fDen->Clone():0x0), | |
4b1c9620 | 74 | fRat((in.fRat)?(TObjArray*)in.fRat->Clone():0x0), |
75 | fnbins(in.fnbins), | |
76 | fNumberOfIntervals(in.fNumberOfIntervals), | |
77 | fmaxXval(in.fmaxXval), | |
78 | fminXval(in.fminXval) | |
79 | ||
94a709e1 | 80 | { |
81 | //ctor | |
82 | } | |
83 | ||
84 | /******************************************************************/ | |
85 | ||
86 | AliHBTasCorrFctn::~AliHBTasCorrFctn() | |
87 | { | |
88 | //dtor | |
89 | ||
90 | delete fNum; | |
91 | delete fDen; | |
92 | delete fRat; | |
93 | ||
94 | } | |
95 | ||
96 | /******************************************************************/ | |
3c1edb34 | 97 | Int_t AliHBTasCorrFctn::Write(const char*,Int_t, Int_t) |
94a709e1 | 98 | { |
99 | //out | |
100 | Int_t i; | |
101 | // Int_t n=GetNumberOfIntervals(); | |
102 | Double_t scale; | |
103 | ||
104 | for(i=0;i<fNumberOfIntervals;i++){ | |
105 | TH1D *num = ((TH1D*)fNum->At(i)); | |
106 | TH1D *den = ((TH1D*)fDen->At(i)); | |
107 | TH1D &rat = *((TH1D*)fRat->At(i)); | |
108 | scale = Scale(num,den); | |
109 | Info("Write():","Scale in interval %d = %lf",i,scale); | |
110 | rat.Divide(num,den,scale); | |
111 | ||
112 | ||
113 | num->Write(); | |
114 | den->Write(); | |
115 | rat.Write(); | |
116 | } | |
3c1edb34 | 117 | return 0; |
94a709e1 | 118 | } |
119 | ||
120 | //------------------------------------- | |
121 | void AliHBTasCorrFctn::ProcessSameEventParticles(AliHBTPair* pair) | |
122 | { | |
123 | //Fills the numerator using pair from the same event | |
124 | pair = CheckPair(pair); | |
125 | if(pair == 0x0) return; | |
126 | // int n = GetNumberOfIntervals(); | |
127 | int n = fNumberOfIntervals; | |
128 | Double_t rplane=0.; //reaction plane angle - 2 B determined | |
129 | Double_t phi=(pair->Particle1()->Phi()+pair->Particle2()->Phi())/2.-rplane; //deltaphi bo nie mam nic innego pod reka | |
130 | phi=phi*360/(2*TMath::Pi()); | |
131 | Double_t q=GetValue(pair); | |
132 | Int_t ntv; | |
133 | ntv = (int)(phi*n/(360.)); | |
134 | ||
135 | TH1D *num = ((TH1D*)fNum->At(ntv)); | |
136 | ||
137 | num->Fill(q); | |
138 | ||
139 | } | |
140 | ||
141 | /****************************************************************/ | |
142 | void AliHBTasCorrFctn::Init() | |
143 | { | |
144 | BuildHistos(); | |
145 | } | |
146 | /****************************************************************/ | |
147 | ||
148 | ||
149 | void AliHBTasCorrFctn::ProcessDiffEventParticles(AliHBTPair* pair) | |
150 | { | |
265f04f7 | 151 | //fills denumerator with data from different events |
94a709e1 | 152 | Double_t rplane=0.; //reaction plane angle - 2 B determined |
153 | Double_t phi=(pair->Particle1()->Phi()+pair->Particle2()->Phi())/2.-rplane; //deltaphi bo nie mam nic innego pod reka | |
154 | phi=phi*360/(2*TMath::Pi()); | |
155 | Double_t qout=GetValue(pair); | |
156 | ||
157 | // int n=GetNumberOfIntervals(); | |
158 | int n = fNumberOfIntervals; | |
159 | ||
160 | Int_t ntv; | |
161 | ntv = (int)(phi*n/(360.)); | |
162 | ||
163 | TH1D &den = *((TH1D*)fDen->At(ntv)); | |
164 | ||
165 | ||
166 | den.Fill(qout); | |
167 | } | |
168 | ||
169 | ||
170 | /******************************************************************/ | |
171 | ||
172 | ||
265f04f7 | 173 | void AliHBTasCorrFctn::SetParams(Int_t nbins, Float_t maxXval, Float_t minXval) |
174 | { | |
175 | //sets parameters for histograms | |
176 | fnbins=nbins; | |
94a709e1 | 177 | fmaxXval= maxXval; |
178 | fminXval=minXval; | |
179 | } | |
180 | TH1* AliHBTasCorrFctn::GetResult() | |
181 | { | |
265f04f7 | 182 | //does nothing, it can as well have nothing inside, its just for class to work normally |
94a709e1 | 183 | TH1D *den = ((TH1D*)fDen->UncheckedAt(1)); |
184 | return den; | |
185 | } | |
186 | ||
187 | ||
188 | ||
189 | ClassImp(AliHBTQOutasCorrFctn) | |
190 | ||
191 | AliHBTQOutasCorrFctn::AliHBTQOutasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval): | |
192 | AliHBTasCorrFctn(name,title,nbins,maxXval,minXval) | |
193 | ||
194 | { | |
195 | //ct0r | |
196 | } | |
197 | ||
198 | void AliHBTQOutasCorrFctn::BuildHistos() | |
199 | { | |
265f04f7 | 200 | //builds histograms |
94a709e1 | 201 | Int_t i; |
202 | int n=GetNumberOfIntervals(); | |
203 | ||
204 | int nbins=Getnbins(); | |
205 | ||
206 | double max = GetmaxXval(); | |
207 | double min = GetminXval(); | |
208 | char buff[10]; | |
209 | ||
210 | ||
211 | ||
265f04f7 | 212 | TH1D *num; |
213 | TH1D *den; | |
214 | TH1D *rat; | |
94a709e1 | 215 | |
216 | TString nameNum = "NumOut"; | |
217 | TString nameDen = "DenOut"; | |
218 | TString nameRat = "RatOut"; | |
219 | ||
220 | for(i=0;i<n;i++){ | |
221 | ||
222 | sprintf(buff,"%d",i); | |
223 | ||
224 | nameNum +=TString(buff); | |
225 | ||
226 | nameDen +=TString(buff); | |
227 | nameRat +=TString(buff); | |
228 | ||
229 | ||
265f04f7 | 230 | num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max); |
231 | den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max); | |
232 | rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max); | |
94a709e1 | 233 | |
265f04f7 | 234 | num->Sumw2(); |
235 | den->Sumw2(); | |
236 | rat->Sumw2(); | |
94a709e1 | 237 | |
265f04f7 | 238 | num->Reset(); |
239 | den->Reset(); | |
240 | rat->Reset(); | |
94a709e1 | 241 | |
265f04f7 | 242 | fNum->Add(num); |
243 | fDen->Add(den); | |
244 | fRat->Add(rat); | |
94a709e1 | 245 | |
246 | nameNum = TString("NumOut"); | |
247 | nameDen = TString("DenOut"); | |
248 | nameRat = TString("RatOut"); | |
249 | ||
250 | } | |
251 | ||
252 | ||
253 | } | |
254 | ||
255 | ClassImp(AliHBTQSideasCorrFctn) | |
256 | ||
257 | AliHBTQSideasCorrFctn::AliHBTQSideasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval): | |
258 | AliHBTasCorrFctn(name,title,nbins,maxXval,minXval) | |
259 | ||
260 | { | |
261 | //ct0r | |
262 | } | |
263 | ||
264 | void AliHBTQSideasCorrFctn::BuildHistos() | |
265 | { | |
265f04f7 | 266 | //builds histograms |
94a709e1 | 267 | Int_t i; |
268 | int n=GetNumberOfIntervals(); | |
269 | int nbins=Getnbins(); | |
270 | ||
271 | double max = GetmaxXval(); | |
272 | double min = GetminXval(); | |
273 | char buff[10]; | |
274 | ||
275 | ||
276 | ||
265f04f7 | 277 | TH1D *num; |
278 | TH1D *den; | |
279 | TH1D *rat; | |
94a709e1 | 280 | |
281 | TString nameNum = "NumSide"; | |
282 | TString nameDen = "DenSide"; | |
283 | TString nameRat = "RatSide"; | |
284 | ||
285 | for(i=0;i<n;i++){ | |
286 | ||
287 | sprintf(buff,"%d",i); | |
288 | ||
289 | nameNum +=TString(buff); | |
290 | ||
291 | nameDen +=TString(buff); | |
292 | nameRat +=TString(buff); | |
293 | ||
294 | ||
265f04f7 | 295 | num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max); |
296 | den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max); | |
297 | rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max); | |
94a709e1 | 298 | |
265f04f7 | 299 | num->Sumw2(); |
300 | den->Sumw2(); | |
301 | rat->Sumw2(); | |
94a709e1 | 302 | |
265f04f7 | 303 | num->Reset(); |
304 | den->Reset(); | |
305 | rat->Reset(); | |
94a709e1 | 306 | |
265f04f7 | 307 | fNum->Add(num); |
308 | fDen->Add(den); | |
309 | fRat->Add(rat); | |
94a709e1 | 310 | |
311 | nameNum = TString("NumSide"); | |
312 | nameDen = TString("DenSide"); | |
313 | nameRat = TString("RatSide"); | |
314 | ||
315 | } | |
316 | ||
317 | ||
318 | } | |
319 | ||
320 | ClassImp(AliHBTQLongasCorrFctn) | |
321 | ||
322 | AliHBTQLongasCorrFctn::AliHBTQLongasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval): | |
323 | AliHBTasCorrFctn(name,title,nbins,maxXval,minXval) | |
324 | ||
325 | { | |
326 | //ct0r | |
327 | } | |
328 | ||
329 | void AliHBTQLongasCorrFctn::BuildHistos() | |
330 | { | |
265f04f7 | 331 | //builds histograms |
94a709e1 | 332 | Int_t i; |
333 | int n=GetNumberOfIntervals(); | |
334 | int nbins=Getnbins(); | |
335 | ||
336 | double max = GetmaxXval(); | |
337 | double min = GetminXval(); | |
338 | char buff[10]; | |
339 | ||
340 | ||
341 | ||
265f04f7 | 342 | TH1D *num; |
343 | TH1D *den; | |
344 | TH1D *rat; | |
94a709e1 | 345 | |
346 | TString nameNum = "NumLong"; | |
347 | TString nameDen = "DenLong"; | |
348 | TString nameRat = "RatLong"; | |
349 | ||
350 | for(i=0;i<n;i++){ | |
351 | ||
352 | sprintf(buff,"%d",i); | |
353 | ||
354 | nameNum +=TString(buff); | |
355 | ||
356 | nameDen +=TString(buff); | |
357 | nameRat +=TString(buff); | |
358 | ||
359 | ||
265f04f7 | 360 | num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max); |
361 | den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max); | |
362 | rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max); | |
94a709e1 | 363 | |
265f04f7 | 364 | num->Sumw2(); |
365 | den->Sumw2(); | |
366 | rat->Sumw2(); | |
94a709e1 | 367 | |
265f04f7 | 368 | num->Reset(); |
369 | den->Reset(); | |
370 | rat->Reset(); | |
94a709e1 | 371 | |
265f04f7 | 372 | fNum->Add(num); |
373 | fDen->Add(den); | |
374 | fRat->Add(rat); | |
94a709e1 | 375 | |
376 | nameNum = TString("NumLong"); | |
377 | nameDen = TString("DenLong"); | |
378 | nameRat = TString("RatLong"); | |
379 | ||
380 | } | |
381 | ||
382 | ||
383 | } |