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