module.mk depends in addition on header.tpl, clean.tpl, and alibtool
[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
d289329c 91void AliHBTMonitorFunction::Init()
92 {
93 //Writes an function to disk
94 if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName());
95
96 if (GetResult() == 0x0)
97 {
98 Warning("Init","Function has NULL result histogram!");
99 return;
100 }
101 GetResult()->Reset();
102 GetResult()->SetDirectory(0x0);
103 if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
104 }
a57afe91 105/******************************************************************/
d289329c 106
a57afe91 107void AliHBTMonitorFunction::SetParticleCut(AliHBTParticleCut* cut)
108{
109//Sets new Particle Cut. Old one is deleted
110//Note that it is created new object instead of simple pointer set
111//I do not want to have pointer
112//to object created somewhere else
113//because in that case I could not believe that
114//it would always exist (sb could delete it)
115//so we have always own copy
116
117 if(!cut)
118 {
119 Error("AliHBTMonitorFunction::SetParticleCut","argument is NULL");
120 return;
121 }
122 delete fParticleCut;
123 fParticleCut = (AliHBTParticleCut*)cut->Clone();
124
125}
a57afe91 126/******************************************************************/
127
89c60e9f 128void AliHBTMonitorFunction::Rename(const Char_t * name)
a57afe91 129 {
130 //renames the function and histograms
131 SetName(name);
132 SetTitle(name);
133
134 TString numstr = fName + " Result"; //title and name of the
135 //result histogram
136 GetResult()->SetName(numstr.Data());
137 GetResult()->SetTitle(numstr.Data());
a57afe91 138 }
89c60e9f 139/******************************************************************/
a57afe91 140
89c60e9f 141void AliHBTMonitorFunction::Rename(const Char_t * name, const Char_t * title)
a57afe91 142 {
143 //renames and retitle the function and histograms
144
145 SetName(name);
146 SetTitle(title);
147
148 TString numstrn = fName + " Result"; //name of the
149 //result histogram
150
151 TString numstrt = fTitle + " Result"; //title of the
152 //result histogram
153
154
155 GetResult()->SetName(numstrn.Data());
156 GetResult()->SetTitle(numstrt.Data());
157
158 }
159
160/******************************************************************/
161/******************************************************************/
162/******************************************************************/
163ClassImp( AliHBTMonOneParticleFctn ) //z.ch.
164/******************************************************************/
165/******************************************************************/
166ClassImp( AliHBTMonTwoParticleFctn ) //z.ch.
167/******************************************************************/
168/******************************************************************/
169/******************************************************************/
170ClassImp( AliHBTMonOneParticleFctn1D )
89c60e9f 171AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D():
172 fResult(0x0)
a57afe91 173 {
89c60e9f 174 //ctor
a57afe91 175 }
89c60e9f 176/******************************************************************/
a57afe91 177
89c60e9f 178AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval)
a57afe91 179 {
89c60e9f 180 //ctor
a57afe91 181 TString numstr = fName + " Result"; //title and name of the
182 //result histogram
a57afe91 183 fResult = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
184 }
185
89c60e9f 186AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
a57afe91 187 Int_t nbins, Double_t maxXval, Double_t minXval)
188 :AliHBTMonOneParticleFctn(name,title)
189{
89c60e9f 190 //ctor
a57afe91 191 TString numstr = fName + " Result"; //title and name of the
192 //result histogram
193
194 fResult = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
cfa5b555 195 fResult->SetDirectory(0x0);
196
a57afe91 197}
198/******************************************************************/
199AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
200{
89c60e9f 201 //dtor
202 delete fResult;
a57afe91 203}
204/******************************************************************/
205
e4f2b1da 206void AliHBTMonOneParticleFctn1D::Process(AliHBTParticle* particle)
a57afe91 207{
208 //Fills the result
209 particle = CheckParticle(particle);
210 if(particle) fResult->Fill(GetValue(particle));
211}
212/******************************************************************/
213/******************************************************************/
214
215ClassImp( AliHBTMonOneParticleFctn2D )
216
89c60e9f 217AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
a57afe91 218 Int_t nYbins, Double_t maxYval, Double_t minYval)
219
220{
89c60e9f 221 //ctor
a57afe91 222 TString numstr = fName + " Result"; //title and name of the
223 //result histogram
224
225 fResult = new TH2D(numstr.Data(),numstr.Data(),
226 nXbins,minXval,maxXval,
227 nYbins,minYval,maxYval);
cfa5b555 228 fResult->SetDirectory(0x0);
a57afe91 229}
89c60e9f 230/******************************************************************/
a57afe91 231
232AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
233{
89c60e9f 234 //dtor
a57afe91 235 delete fResult;
236}
e4f2b1da 237void AliHBTMonOneParticleFctn2D::Process(AliHBTParticle* particle)
a57afe91 238{
89c60e9f 239 //fills the function for one particle
a57afe91 240 particle = CheckParticle(particle);
241 if(particle)
242 {
243 Double_t x,y;
244 GetValues(particle,x,y);
245 fResult->Fill(x,y);
246 }
247}
248
249/******************************************************************/
250/******************************************************************/
251/******************************************************************/
252
253ClassImp( AliHBTMonOneParticleFctn3D)
254
255AliHBTMonOneParticleFctn3D::
256AliHBTMonOneParticleFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
257 Int_t nYbins, Double_t maxYval, Double_t minYval,
258 Int_t nZbins, Double_t maxZval, Double_t minZval)
259
260{
89c60e9f 261 //ctor
a57afe91 262 TString numstr = fName + " Result"; //title and name of the
263 //result histogram
264
265 fResult = new TH3D(numstr.Data(),numstr.Data(),
266 nXbins,minXval,maxXval,
267 nYbins,minYval,maxYval,
268 nZbins,minZval,maxZval);
cfa5b555 269 fResult->SetDirectory(0x0);
a57afe91 270
271}
272/******************************************************************/
273
274AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
275{
89c60e9f 276 //dtor
a57afe91 277 delete fResult;
278}
279/******************************************************************/
280
281
282/******************************************************************/
283/******************************************************************/
284/******************************************************************/
285ClassImp( AliHBTMonTwoParticleFctn1D)
286
287AliHBTMonTwoParticleFctn1D::
288AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
289 {
89c60e9f 290 //ctor
a57afe91 291 TString numstr = fName + " Result"; //title and name of the
292 //result histogram
293
294 fResult = new TH1D(numstr.Data(),numstr.Data(),
295 nbins,minval,maxval);
cfa5b555 296 fResult->SetDirectory(0x0);
a57afe91 297 }
298
299AliHBTMonTwoParticleFctn1D::
300AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
301 Int_t nbins, Double_t maxval, Double_t minval)
302 :AliHBTMonTwoParticleFctn(name,title)
303 {
89c60e9f 304 //ctor
a57afe91 305 TString numstr = fName + " Result"; //title and name of the
306 //result histogram
307
308 fResult = new TH1D(numstr.Data(),numstr.Data(),
309 nbins,minval,maxval);
cfa5b555 310 fResult->SetDirectory(0x0);
a57afe91 311 }
312
313
314/******************************************************************/
315AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
316{
89c60e9f 317 //dtor
a57afe91 318 delete fResult;
319}
320/******************************************************************/
321void AliHBTMonTwoParticleFctn1D::
e4f2b1da 322Process(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
a57afe91 323{
89c60e9f 324 //fills the function for one particle
a57afe91 325 partparticle = CheckParticle(partparticle);
326 trackparticle = CheckParticle(trackparticle);
327 if( partparticle && trackparticle)
328 {
329 Double_t x = GetValue(trackparticle,partparticle);
330 fResult->Fill(x);
331 }
332}
333/******************************************************************/
334/******************************************************************/
335/******************************************************************/
336ClassImp( AliHBTMonTwoParticleFctn2D)
337
338
339AliHBTMonTwoParticleFctn2D::
340AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
341 Int_t nYbins, Double_t maxYval, Double_t minYval)
342
343{
89c60e9f 344 //ctor
a57afe91 345 TString numstr = fName + " Result"; //title and name of the
346 //result histogram
347
348 fResult = new TH2D(numstr.Data(),numstr.Data(),
349 nXbins,minXval,maxXval,
350 nYbins,minYval,maxYval);
cfa5b555 351 fResult->SetDirectory(0x0);
a57afe91 352}
353/******************************************************************/
354AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
355{
89c60e9f 356 //dtor
a57afe91 357 delete fResult;
358}
359/******************************************************************/
360void AliHBTMonTwoParticleFctn2D::
e4f2b1da 361Process(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
a57afe91 362{
89c60e9f 363 //fills the function for one particle
a57afe91 364 partparticle = CheckParticle(partparticle);
365 trackparticle = CheckParticle(trackparticle);
366 if( partparticle && trackparticle)
367 {
368 Double_t x,y;
369 GetValues(trackparticle,partparticle,x,y);
370 fResult->Fill(x,y);
371 }
372}
373/******************************************************************/
374/******************************************************************/
375/******************************************************************/
376ClassImp(AliHBTMonTwoParticleFctn3D)
377
378void AliHBTMonTwoParticleFctn3D::
e4f2b1da 379Process(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
a57afe91 380{
89c60e9f 381 //fills the function for one particle
a57afe91 382 partparticle = CheckParticle(partparticle);
383 trackparticle = CheckParticle(trackparticle);
384 if( partparticle && trackparticle)
385 {
386 Double_t x,y,z;
387 GetValues(trackparticle,partparticle,x,y,z);
388 fResult->Fill(x,y,z);
389 }
390}
391/******************************************************************/
392/******************************************************************/
393/******************************************************************/
394/******************************************************************/
395