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