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