]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTMonitorFunction.cxx
Streamline the different messages output by the code using the AliLog, Remove warning...
[u/mrichter/AliRoot.git] / HBTAN / AliHBTMonitorFunction.cxx
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"
19 #include "AliHBTMonitorFunction.h"
20
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 //
40 /******************************************************************/
41 /*
42 Base 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
57 Zbigniew.Chajecki@cern.ch
58
59 */
60 ///////////////////////////////////////////////////////////////////////
61
62
63 ClassImp( AliHBTMonitorFunction )
64
65 AliHBTMonitorFunction::AliHBTMonitorFunction():
66  fParticleCut(new AliAODParticleEmptyCut())
67 {
68   //ctor
69 }
70 /******************************************************************/
71 AliHBTMonitorFunction::AliHBTMonitorFunction(const char* name,const char* title):
72  TNamed(name,title),
73  fParticleCut(new AliAODParticleEmptyCut())
74 {
75   //ctor
76 }
77 /******************************************************************/
78 AliHBTMonitorFunction::AliHBTMonitorFunction(const AliHBTMonitorFunction& /*in*/):
79  TNamed(),
80  fParticleCut(new AliAODParticleEmptyCut())
81 {
82   //cpy ctor
83   // We cannot copy because it is a mess with names (histogram and functions)
84   MayNotUse("AliHBTMonitorFunction(const AliHBTMonitorFunction&");
85 }
86 /******************************************************************/
87 AliHBTMonitorFunction& AliHBTMonitorFunction::operator=(const AliHBTMonitorFunction& /*in*/)
88 {
89   //assigment operator 
90   // We cannot copy because it is a mess with names (histogram and functions)
91   MayNotUse("operator=");
92   return *this;
93 }
94 /******************************************************************/
95
96 AliHBTMonitorFunction::~AliHBTMonitorFunction()
97  {
98   //dtor
99   delete fParticleCut;
100  }
101 /******************************************************************/
102
103 void AliHBTMonitorFunction::Write()
104  {
105    //Writes an function to disk
106    if (GetResult()) GetResult()->Write();
107  }
108 /******************************************************************/
109
110 void AliHBTMonitorFunction::Init()
111  {
112    //Writes an function to disk
113    AliDebug(1,"Entering");
114    
115    if (GetResult() == 0x0)
116     {
117       Warning("Init","Function has NULL result histogram!");
118       return;
119     }
120    GetResult()->Reset();
121    GetResult()->SetDirectory(0x0);
122    AliDebug(1,"Done");
123  }
124 /******************************************************************/
125
126 void AliHBTMonitorFunction::SetParticleCut(AliAODParticleCut* cut)
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;
142  fParticleCut = (AliAODParticleCut*)cut->Clone();
143  
144 }
145 /******************************************************************/
146
147 void AliHBTMonitorFunction::Rename(const Char_t * name)
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());
157  }
158 /******************************************************************/
159
160 void AliHBTMonitorFunction::Rename(const Char_t * name, const Char_t * title)
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 /******************************************************************/
182 ClassImp( AliHBTMonOneParticleFctn )  //z.ch.
183 /******************************************************************/
184 /******************************************************************/
185 ClassImp( AliHBTMonTwoParticleFctn )  //z.ch.
186 /******************************************************************/
187 /******************************************************************/
188 /******************************************************************/
189 ClassImp( AliHBTMonOneParticleFctn1D )
190 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D():
191  fResult(0x0)
192  {
193    //ctor
194  }
195 /******************************************************************/
196
197 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval)
198  {
199    //ctor
200    TString numstr = fName + " Result";  //title and name of the 
201                                            //result histogram
202    fResult   = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
203  }
204
205 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
206                     Int_t nbins, Double_t maxXval, Double_t minXval)
207         :AliHBTMonOneParticleFctn(name,title)
208 {
209   //ctor
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);
214    fResult->SetDirectory(0x0);
215    
216 }
217 /******************************************************************/
218 AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
219 {
220  //dtor
221  delete fResult;
222 }
223 /******************************************************************/
224
225 void AliHBTMonOneParticleFctn1D::Process(AliVAODParticle* particle)
226 {
227  //Fills the result
228    particle = CheckParticle(particle);
229    if(particle) fResult->Fill(GetValue(particle));
230 }
231 /******************************************************************/
232 /******************************************************************/
233  
234 ClassImp( AliHBTMonOneParticleFctn2D )
235
236 AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
237                     Int_t nYbins, Double_t maxYval, Double_t minYval)
238
239 {
240   //ctor
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);
247    fResult->SetDirectory(0x0);
248 }         
249 /******************************************************************/
250
251 AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
252 {
253   //dtor
254   delete fResult;
255 }
256 void AliHBTMonOneParticleFctn2D::Process(AliVAODParticle* particle)
257 {
258   //fills the function for one particle
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
272 ClassImp( AliHBTMonOneParticleFctn3D)
273
274 AliHBTMonOneParticleFctn3D::
275 AliHBTMonOneParticleFctn3D(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 {
280   //ctor
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);
288    fResult->SetDirectory(0x0);
289
290 }         
291 /******************************************************************/
292
293 AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
294 {
295   //dtor
296   delete fResult;
297 }
298 /******************************************************************/
299
300
301 /******************************************************************/
302 /******************************************************************/
303 /******************************************************************/
304 ClassImp( AliHBTMonTwoParticleFctn1D)
305
306 AliHBTMonTwoParticleFctn1D::
307 AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
308  {
309    //ctor
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);
315    fResult->SetDirectory(0x0);
316  }
317
318 AliHBTMonTwoParticleFctn1D::
319 AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
320                     Int_t nbins, Double_t maxval, Double_t minval)
321         :AliHBTMonTwoParticleFctn(name,title)
322  {
323    //ctor
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);
329    fResult->SetDirectory(0x0);
330  }
331
332
333 /******************************************************************/
334 AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
335 {
336   //dtor
337   delete fResult;
338 }
339 /******************************************************************/
340 void AliHBTMonTwoParticleFctn1D::
341 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
342 {
343   //fills the function for one particle
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 /******************************************************************/
355 ClassImp( AliHBTMonTwoParticleFctn2D)
356
357
358 AliHBTMonTwoParticleFctn2D::
359 AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
360                     Int_t nYbins, Double_t maxYval, Double_t minYval)
361
362 {
363   //ctor
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);
370    fResult->SetDirectory(0x0);
371 }         
372 /******************************************************************/
373 AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
374 {
375   //dtor
376   delete fResult;
377 }
378 /******************************************************************/
379 void AliHBTMonTwoParticleFctn2D::
380 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
381 {
382   //fills the function for one particle
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 /******************************************************************/
395 ClassImp(AliHBTMonTwoParticleFctn3D)
396
397 void AliHBTMonTwoParticleFctn3D::
398 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
399 {
400   //fills the function for one particle
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