Corrected charm and Beauty production (A.Dainese)
[u/mrichter/AliRoot.git] / HBTAN / AliHBTMonitorFunction.cxx
CommitLineData
b98bda8e 1#include "AliHBTMonitorFunction.h"
20527eee 2//__________________________________________________________________
3////////////////////////////////////////////////////////////////////
4//
5// class AliHBTMonitorFunction
6//
7// class AliHBTMonOneParticleFctn
8// class AliHBTMonTwoParticleFctn
9//
10// class AliHBTMonOneParticleFctn1D
11// class AliHBTMonOneParticleFctn2D
12// class AliHBTMonOneParticleFctn3D
13//
14// class AliHBTMonTwoParticleFctn1D
15// class AliHBTMonTwoParticleFctn2D
16// class AliHBTMonTwoParticleFctn3D
17//
18// Base Classes for monitoring functions
19// author: chajecki@if.pw.edu.pl
20//
a57afe91 21/******************************************************************/
22/*
23Base classes for monitor functions
24
25 monitor function
26 / \
27 / \
28 / \
29 / \
30 / \
31 / \
32 / \
33 one particle two particle
34 / | \ / | \
35 / | \ / | \
36 1D 2D 3D 1D 2D 3D
37
38Zbigniew.Chajecki@cern.ch
39
40*/
20527eee 41///////////////////////////////////////////////////////////////////////
42
a57afe91 43
a57afe91 44ClassImp( AliHBTMonitorFunction )
45
89c60e9f 46AliHBTMonitorFunction::AliHBTMonitorFunction():
47 fParticleCut(new AliHBTEmptyParticleCut())
a57afe91 48{
89c60e9f 49 //ctor
a57afe91 50}
51/******************************************************************/
89c60e9f 52AliHBTMonitorFunction::AliHBTMonitorFunction(const char* name,const char* title):
53 TNamed(name,title),
54 fParticleCut(new AliHBTEmptyParticleCut())
a57afe91 55{
89c60e9f 56 //ctor
a57afe91 57}
58/******************************************************************/
89c60e9f 59AliHBTMonitorFunction::AliHBTMonitorFunction(const AliHBTMonitorFunction& /*in*/):
60 TNamed(),
61 fParticleCut(new AliHBTEmptyParticleCut())
62{
63 //cpy ctor
20527eee 64 // We cannot copy because it is a mess with names (histogram and functions)
89c60e9f 65 MayNotUse("AliHBTMonitorFunction(const AliHBTMonitorFunction&");
66}
67/******************************************************************/
34914285 68AliHBTMonitorFunction& AliHBTMonitorFunction::operator=(const AliHBTMonitorFunction& /*in*/)
89c60e9f 69{
20527eee 70 //assigment operator
71 // We cannot copy because it is a mess with names (histogram and functions)
89c60e9f 72 MayNotUse("operator=");
73 return *this;
74}
20527eee 75/******************************************************************/
a57afe91 76
77AliHBTMonitorFunction::~AliHBTMonitorFunction()
78 {
89c60e9f 79 //dtor
20527eee 80 delete fParticleCut;
a57afe91 81 }
82/******************************************************************/
83
89c60e9f 84void AliHBTMonitorFunction::Write()
a57afe91 85 {
89c60e9f 86 //Writes an function to disk
a57afe91 87 if (GetResult()) GetResult()->Write();
88 }
89/******************************************************************/
90
91/******************************************************************/
92void AliHBTMonitorFunction::SetParticleCut(AliHBTParticleCut* cut)
93{
94//Sets new Particle Cut. Old one is deleted
95//Note that it is created new object instead of simple pointer set
96//I do not want to have pointer
97//to object created somewhere else
98//because in that case I could not believe that
99//it would always exist (sb could delete it)
100//so we have always own copy
101
102 if(!cut)
103 {
104 Error("AliHBTMonitorFunction::SetParticleCut","argument is NULL");
105 return;
106 }
107 delete fParticleCut;
108 fParticleCut = (AliHBTParticleCut*)cut->Clone();
109
110}
a57afe91 111/******************************************************************/
112
89c60e9f 113void AliHBTMonitorFunction::Rename(const Char_t * name)
a57afe91 114 {
115 //renames the function and histograms
116 SetName(name);
117 SetTitle(name);
118
119 TString numstr = fName + " Result"; //title and name of the
120 //result histogram
121 GetResult()->SetName(numstr.Data());
122 GetResult()->SetTitle(numstr.Data());
a57afe91 123 }
89c60e9f 124/******************************************************************/
a57afe91 125
89c60e9f 126void AliHBTMonitorFunction::Rename(const Char_t * name, const Char_t * title)
a57afe91 127 {
128 //renames and retitle the function and histograms
129
130 SetName(name);
131 SetTitle(title);
132
133 TString numstrn = fName + " Result"; //name of the
134 //result histogram
135
136 TString numstrt = fTitle + " Result"; //title of the
137 //result histogram
138
139
140 GetResult()->SetName(numstrn.Data());
141 GetResult()->SetTitle(numstrt.Data());
142
143 }
144
145/******************************************************************/
146/******************************************************************/
147/******************************************************************/
148ClassImp( AliHBTMonOneParticleFctn ) //z.ch.
149/******************************************************************/
150/******************************************************************/
151ClassImp( AliHBTMonTwoParticleFctn ) //z.ch.
152/******************************************************************/
153/******************************************************************/
154/******************************************************************/
155ClassImp( AliHBTMonOneParticleFctn1D )
89c60e9f 156AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D():
157 fResult(0x0)
a57afe91 158 {
89c60e9f 159 //ctor
a57afe91 160 }
89c60e9f 161/******************************************************************/
a57afe91 162
89c60e9f 163AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval)
a57afe91 164 {
89c60e9f 165 //ctor
a57afe91 166 TString numstr = fName + " Result"; //title and name of the
167 //result histogram
a57afe91 168 fResult = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
169 }
170
89c60e9f 171AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
a57afe91 172 Int_t nbins, Double_t maxXval, Double_t minXval)
173 :AliHBTMonOneParticleFctn(name,title)
174{
89c60e9f 175 //ctor
a57afe91 176 TString numstr = fName + " Result"; //title and name of the
177 //result histogram
178
179 fResult = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
180}
181/******************************************************************/
182AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
183{
89c60e9f 184 //dtor
185 delete fResult;
a57afe91 186}
187/******************************************************************/
188
e4f2b1da 189void AliHBTMonOneParticleFctn1D::Process(AliHBTParticle* particle)
a57afe91 190{
191 //Fills the result
192 particle = CheckParticle(particle);
193 if(particle) fResult->Fill(GetValue(particle));
194}
195/******************************************************************/
196/******************************************************************/
197
198ClassImp( AliHBTMonOneParticleFctn2D )
199
89c60e9f 200AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
a57afe91 201 Int_t nYbins, Double_t maxYval, Double_t minYval)
202
203{
89c60e9f 204 //ctor
a57afe91 205 TString numstr = fName + " Result"; //title and name of the
206 //result histogram
207
208 fResult = new TH2D(numstr.Data(),numstr.Data(),
209 nXbins,minXval,maxXval,
210 nYbins,minYval,maxYval);
a57afe91 211}
89c60e9f 212/******************************************************************/
a57afe91 213
214AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
215{
89c60e9f 216 //dtor
a57afe91 217 delete fResult;
218}
e4f2b1da 219void AliHBTMonOneParticleFctn2D::Process(AliHBTParticle* particle)
a57afe91 220{
89c60e9f 221 //fills the function for one particle
a57afe91 222 particle = CheckParticle(particle);
223 if(particle)
224 {
225 Double_t x,y;
226 GetValues(particle,x,y);
227 fResult->Fill(x,y);
228 }
229}
230
231/******************************************************************/
232/******************************************************************/
233/******************************************************************/
234
235ClassImp( AliHBTMonOneParticleFctn3D)
236
237AliHBTMonOneParticleFctn3D::
238AliHBTMonOneParticleFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
239 Int_t nYbins, Double_t maxYval, Double_t minYval,
240 Int_t nZbins, Double_t maxZval, Double_t minZval)
241
242{
89c60e9f 243 //ctor
a57afe91 244 TString numstr = fName + " Result"; //title and name of the
245 //result histogram
246
247 fResult = new TH3D(numstr.Data(),numstr.Data(),
248 nXbins,minXval,maxXval,
249 nYbins,minYval,maxYval,
250 nZbins,minZval,maxZval);
251
252}
253/******************************************************************/
254
255AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
256{
89c60e9f 257 //dtor
a57afe91 258 delete fResult;
259}
260/******************************************************************/
261
262
263/******************************************************************/
264/******************************************************************/
265/******************************************************************/
266ClassImp( AliHBTMonTwoParticleFctn1D)
267
268AliHBTMonTwoParticleFctn1D::
269AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
270 {
89c60e9f 271 //ctor
a57afe91 272 TString numstr = fName + " Result"; //title and name of the
273 //result histogram
274
275 fResult = new TH1D(numstr.Data(),numstr.Data(),
276 nbins,minval,maxval);
277
278 }
279
280AliHBTMonTwoParticleFctn1D::
281AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
282 Int_t nbins, Double_t maxval, Double_t minval)
283 :AliHBTMonTwoParticleFctn(name,title)
284 {
89c60e9f 285 //ctor
a57afe91 286 TString numstr = fName + " Result"; //title and name of the
287 //result histogram
288
289 fResult = new TH1D(numstr.Data(),numstr.Data(),
290 nbins,minval,maxval);
291
292 }
293
294
295/******************************************************************/
296AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
297{
89c60e9f 298 //dtor
a57afe91 299 delete fResult;
300}
301/******************************************************************/
302void AliHBTMonTwoParticleFctn1D::
e4f2b1da 303Process(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
a57afe91 304{
89c60e9f 305 //fills the function for one particle
a57afe91 306 partparticle = CheckParticle(partparticle);
307 trackparticle = CheckParticle(trackparticle);
308 if( partparticle && trackparticle)
309 {
310 Double_t x = GetValue(trackparticle,partparticle);
311 fResult->Fill(x);
312 }
313}
314/******************************************************************/
315/******************************************************************/
316/******************************************************************/
317ClassImp( AliHBTMonTwoParticleFctn2D)
318
319
320AliHBTMonTwoParticleFctn2D::
321AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
322 Int_t nYbins, Double_t maxYval, Double_t minYval)
323
324{
89c60e9f 325 //ctor
a57afe91 326 TString numstr = fName + " Result"; //title and name of the
327 //result histogram
328
329 fResult = new TH2D(numstr.Data(),numstr.Data(),
330 nXbins,minXval,maxXval,
331 nYbins,minYval,maxYval);
332
333}
334/******************************************************************/
335AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
336{
89c60e9f 337 //dtor
a57afe91 338 delete fResult;
339}
340/******************************************************************/
341void AliHBTMonTwoParticleFctn2D::
e4f2b1da 342Process(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
a57afe91 343{
89c60e9f 344 //fills the function for one particle
a57afe91 345 partparticle = CheckParticle(partparticle);
346 trackparticle = CheckParticle(trackparticle);
347 if( partparticle && trackparticle)
348 {
349 Double_t x,y;
350 GetValues(trackparticle,partparticle,x,y);
351 fResult->Fill(x,y);
352 }
353}
354/******************************************************************/
355/******************************************************************/
356/******************************************************************/
357ClassImp(AliHBTMonTwoParticleFctn3D)
358
359void AliHBTMonTwoParticleFctn3D::
e4f2b1da 360Process(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
a57afe91 361{
89c60e9f 362 //fills the function for one particle
a57afe91 363 partparticle = CheckParticle(partparticle);
364 trackparticle = CheckParticle(trackparticle);
365 if( partparticle && trackparticle)
366 {
367 Double_t x,y,z;
368 GetValues(trackparticle,partparticle,x,y,z);
369 fResult->Fill(x,y,z);
370 }
371}
372/******************************************************************/
373/******************************************************************/
374/******************************************************************/
375/******************************************************************/
376