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