Incrementing class versions
[u/mrichter/AliRoot.git] / HBTAN / AliHBTasCorrFctn.cxx
CommitLineData
94a709e1 1#include "AliHBTasCorrFctn.h"
2#include <TH1.h>
265f04f7 3#include <Riostream.h>
94a709e1 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{
265f04f7 119//fills denumerator with data from different events
94a709e1 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
265f04f7 141void AliHBTasCorrFctn::SetParams(Int_t nbins, Float_t maxXval, Float_t minXval)
142{
143//sets parameters for histograms
144 fnbins=nbins;
94a709e1 145 fmaxXval= maxXval;
146 fminXval=minXval;
147}
148TH1* AliHBTasCorrFctn::GetResult()
149{
265f04f7 150//does nothing, it can as well have nothing inside, its just for class to work normally
94a709e1 151 TH1D *den = ((TH1D*)fDen->UncheckedAt(1));
152 return den;
153 }
154
155
156
157ClassImp(AliHBTQOutasCorrFctn)
158
159 AliHBTQOutasCorrFctn::AliHBTQOutasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
160AliHBTasCorrFctn(name,title,nbins,maxXval,minXval)
161
162{
163//ct0r
164}
165
166void AliHBTQOutasCorrFctn::BuildHistos()
167{
265f04f7 168//builds histograms
94a709e1 169 Int_t i;
170 int n=GetNumberOfIntervals();
171
172 int nbins=Getnbins();
173
174 double max = GetmaxXval();
175 double min = GetminXval();
176 char buff[10];
177
178
179
265f04f7 180 TH1D *num;
181 TH1D *den;
182 TH1D *rat;
94a709e1 183
184 TString nameNum = "NumOut";
185 TString nameDen = "DenOut";
186 TString nameRat = "RatOut";
187
188 for(i=0;i<n;i++){
189
190 sprintf(buff,"%d",i);
191
192 nameNum +=TString(buff);
193
194 nameDen +=TString(buff);
195 nameRat +=TString(buff);
196
197
265f04f7 198 num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max);
199 den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max);
200 rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max);
94a709e1 201
265f04f7 202 num->Sumw2();
203 den->Sumw2();
204 rat->Sumw2();
94a709e1 205
265f04f7 206 num->Reset();
207 den->Reset();
208 rat->Reset();
94a709e1 209
265f04f7 210 fNum->Add(num);
211 fDen->Add(den);
212 fRat->Add(rat);
94a709e1 213
214 nameNum = TString("NumOut");
215 nameDen = TString("DenOut");
216 nameRat = TString("RatOut");
217
218 }
219
220
221 }
222
223ClassImp(AliHBTQSideasCorrFctn)
224
225 AliHBTQSideasCorrFctn::AliHBTQSideasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
226AliHBTasCorrFctn(name,title,nbins,maxXval,minXval)
227
228{
229//ct0r
230}
231
232void AliHBTQSideasCorrFctn::BuildHistos()
233{
265f04f7 234//builds histograms
94a709e1 235 Int_t i;
236 int n=GetNumberOfIntervals();
237 int nbins=Getnbins();
238
239 double max = GetmaxXval();
240 double min = GetminXval();
241 char buff[10];
242
243
244
265f04f7 245 TH1D *num;
246 TH1D *den;
247 TH1D *rat;
94a709e1 248
249 TString nameNum = "NumSide";
250 TString nameDen = "DenSide";
251 TString nameRat = "RatSide";
252
253 for(i=0;i<n;i++){
254
255 sprintf(buff,"%d",i);
256
257 nameNum +=TString(buff);
258
259 nameDen +=TString(buff);
260 nameRat +=TString(buff);
261
262
265f04f7 263 num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max);
264 den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max);
265 rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max);
94a709e1 266
265f04f7 267 num->Sumw2();
268 den->Sumw2();
269 rat->Sumw2();
94a709e1 270
265f04f7 271 num->Reset();
272 den->Reset();
273 rat->Reset();
94a709e1 274
265f04f7 275 fNum->Add(num);
276 fDen->Add(den);
277 fRat->Add(rat);
94a709e1 278
279 nameNum = TString("NumSide");
280 nameDen = TString("DenSide");
281 nameRat = TString("RatSide");
282
283 }
284
285
286 }
287
288ClassImp(AliHBTQLongasCorrFctn)
289
290 AliHBTQLongasCorrFctn::AliHBTQLongasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
291AliHBTasCorrFctn(name,title,nbins,maxXval,minXval)
292
293{
294//ct0r
295}
296
297void AliHBTQLongasCorrFctn::BuildHistos()
298{
265f04f7 299//builds histograms
94a709e1 300 Int_t i;
301 int n=GetNumberOfIntervals();
302 int nbins=Getnbins();
303
304 double max = GetmaxXval();
305 double min = GetminXval();
306 char buff[10];
307
308
309
265f04f7 310 TH1D *num;
311 TH1D *den;
312 TH1D *rat;
94a709e1 313
314 TString nameNum = "NumLong";
315 TString nameDen = "DenLong";
316 TString nameRat = "RatLong";
317
318 for(i=0;i<n;i++){
319
320 sprintf(buff,"%d",i);
321
322 nameNum +=TString(buff);
323
324 nameDen +=TString(buff);
325 nameRat +=TString(buff);
326
327
265f04f7 328 num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max);
329 den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max);
330 rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max);
94a709e1 331
265f04f7 332 num->Sumw2();
333 den->Sumw2();
334 rat->Sumw2();
94a709e1 335
265f04f7 336 num->Reset();
337 den->Reset();
338 rat->Reset();
94a709e1 339
265f04f7 340 fNum->Add(num);
341 fDen->Add(den);
342 fRat->Add(rat);
94a709e1 343
344 nameNum = TString("NumLong");
345 nameDen = TString("DenLong");
346 nameRat = TString("RatLong");
347
348 }
349
350
351 }