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