Sumw2 called by default
[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);
bb5117ea 203 fResult->Sumw2();
a57afe91 204 }
205
89c60e9f 206AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
a57afe91 207 Int_t nbins, Double_t maxXval, Double_t minXval)
208 :AliHBTMonOneParticleFctn(name,title)
209{
89c60e9f 210 //ctor
a57afe91 211 TString numstr = fName + " Result"; //title and name of the
212 //result histogram
213
214 fResult = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
bb5117ea 215 fResult->Sumw2();
cfa5b555 216 fResult->SetDirectory(0x0);
217
a57afe91 218}
219/******************************************************************/
220AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
221{
89c60e9f 222 //dtor
223 delete fResult;
a57afe91 224}
225/******************************************************************/
226
78d7c6d3 227void AliHBTMonOneParticleFctn1D::Process(AliVAODParticle* particle)
a57afe91 228{
229 //Fills the result
230 particle = CheckParticle(particle);
231 if(particle) fResult->Fill(GetValue(particle));
232}
233/******************************************************************/
234/******************************************************************/
235
236ClassImp( AliHBTMonOneParticleFctn2D )
237
89c60e9f 238AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
a57afe91 239 Int_t nYbins, Double_t maxYval, Double_t minYval)
240
241{
89c60e9f 242 //ctor
a57afe91 243 TString numstr = fName + " Result"; //title and name of the
244 //result histogram
245
246 fResult = new TH2D(numstr.Data(),numstr.Data(),
247 nXbins,minXval,maxXval,
248 nYbins,minYval,maxYval);
bb5117ea 249 fResult->Sumw2();
cfa5b555 250 fResult->SetDirectory(0x0);
a57afe91 251}
89c60e9f 252/******************************************************************/
a57afe91 253
254AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
255{
89c60e9f 256 //dtor
a57afe91 257 delete fResult;
258}
78d7c6d3 259void AliHBTMonOneParticleFctn2D::Process(AliVAODParticle* particle)
a57afe91 260{
89c60e9f 261 //fills the function for one particle
a57afe91 262 particle = CheckParticle(particle);
263 if(particle)
264 {
265 Double_t x,y;
266 GetValues(particle,x,y);
267 fResult->Fill(x,y);
268 }
269}
270
271/******************************************************************/
272/******************************************************************/
273/******************************************************************/
274
275ClassImp( AliHBTMonOneParticleFctn3D)
276
277AliHBTMonOneParticleFctn3D::
278AliHBTMonOneParticleFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
279 Int_t nYbins, Double_t maxYval, Double_t minYval,
280 Int_t nZbins, Double_t maxZval, Double_t minZval)
281
282{
89c60e9f 283 //ctor
a57afe91 284 TString numstr = fName + " Result"; //title and name of the
285 //result histogram
286
287 fResult = new TH3D(numstr.Data(),numstr.Data(),
288 nXbins,minXval,maxXval,
289 nYbins,minYval,maxYval,
290 nZbins,minZval,maxZval);
bb5117ea 291 fResult->Sumw2();
cfa5b555 292 fResult->SetDirectory(0x0);
a57afe91 293
294}
295/******************************************************************/
296
297AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
298{
89c60e9f 299 //dtor
a57afe91 300 delete fResult;
301}
302/******************************************************************/
303
304
305/******************************************************************/
306/******************************************************************/
307/******************************************************************/
308ClassImp( AliHBTMonTwoParticleFctn1D)
309
310AliHBTMonTwoParticleFctn1D::
311AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
312 {
89c60e9f 313 //ctor
a57afe91 314 TString numstr = fName + " Result"; //title and name of the
315 //result histogram
316
317 fResult = new TH1D(numstr.Data(),numstr.Data(),
318 nbins,minval,maxval);
bb5117ea 319 fResult->Sumw2();
cfa5b555 320 fResult->SetDirectory(0x0);
a57afe91 321 }
322
323AliHBTMonTwoParticleFctn1D::
324AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
325 Int_t nbins, Double_t maxval, Double_t minval)
326 :AliHBTMonTwoParticleFctn(name,title)
327 {
89c60e9f 328 //ctor
a57afe91 329 TString numstr = fName + " Result"; //title and name of the
330 //result histogram
331
332 fResult = new TH1D(numstr.Data(),numstr.Data(),
333 nbins,minval,maxval);
bb5117ea 334 fResult->Sumw2();
cfa5b555 335 fResult->SetDirectory(0x0);
a57afe91 336 }
337
338
339/******************************************************************/
340AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
341{
89c60e9f 342 //dtor
a57afe91 343 delete fResult;
344}
345/******************************************************************/
346void AliHBTMonTwoParticleFctn1D::
78d7c6d3 347Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
a57afe91 348{
89c60e9f 349 //fills the function for one particle
a57afe91 350 partparticle = CheckParticle(partparticle);
351 trackparticle = CheckParticle(trackparticle);
352 if( partparticle && trackparticle)
353 {
354 Double_t x = GetValue(trackparticle,partparticle);
355 fResult->Fill(x);
356 }
357}
358/******************************************************************/
359/******************************************************************/
360/******************************************************************/
361ClassImp( AliHBTMonTwoParticleFctn2D)
362
363
364AliHBTMonTwoParticleFctn2D::
365AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
366 Int_t nYbins, Double_t maxYval, Double_t minYval)
367
368{
89c60e9f 369 //ctor
a57afe91 370 TString numstr = fName + " Result"; //title and name of the
371 //result histogram
372
373 fResult = new TH2D(numstr.Data(),numstr.Data(),
374 nXbins,minXval,maxXval,
375 nYbins,minYval,maxYval);
bb5117ea 376 fResult->Sumw2();
cfa5b555 377 fResult->SetDirectory(0x0);
a57afe91 378}
379/******************************************************************/
380AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
381{
89c60e9f 382 //dtor
a57afe91 383 delete fResult;
384}
385/******************************************************************/
386void AliHBTMonTwoParticleFctn2D::
78d7c6d3 387Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
a57afe91 388{
89c60e9f 389 //fills the function for one particle
a57afe91 390 partparticle = CheckParticle(partparticle);
391 trackparticle = CheckParticle(trackparticle);
392 if( partparticle && trackparticle)
393 {
394 Double_t x,y;
395 GetValues(trackparticle,partparticle,x,y);
396 fResult->Fill(x,y);
397 }
398}
399/******************************************************************/
400/******************************************************************/
401/******************************************************************/
402ClassImp(AliHBTMonTwoParticleFctn3D)
403
404void AliHBTMonTwoParticleFctn3D::
78d7c6d3 405Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
a57afe91 406{
89c60e9f 407 //fills the function for one particle
a57afe91 408 partparticle = CheckParticle(partparticle);
409 trackparticle = CheckParticle(trackparticle);
410 if( partparticle && trackparticle)
411 {
412 Double_t x,y,z;
413 GetValues(trackparticle,partparticle,x,y,z);
414 fResult->Fill(x,y,z);
415 }
416}
417/******************************************************************/
418/******************************************************************/
419/******************************************************************/
420/******************************************************************/
421