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