]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTMonitorFunction.cxx
Add pkg to be able to inlude STAT to AliRoot compilation schema (Alexandru)
[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 Int_t AliHBTMonitorFunction::Write(const char*,Int_t, Int_t)
104  {
105    //Writes an function to disk
106    if (GetResult()) GetResult()->Write();
107    return 0;
108  }
109 /******************************************************************/
110
111 void AliHBTMonitorFunction::Init()
112  {
113    //Writes an function to disk
114    AliDebug(1,"Entering");
115    
116    if (GetResult() == 0x0)
117     {
118       Warning("Init","Function has NULL result histogram!");
119       return;
120     }
121    GetResult()->Reset();
122    GetResult()->SetDirectory(0x0);
123    AliDebug(1,"Done");
124  }
125 /******************************************************************/
126
127 void AliHBTMonitorFunction::SetParticleCut(AliAODParticleCut* cut)
128 {
129 //Sets new Particle Cut. Old one is deleted
130 //Note that it is created new object instead of simple pointer set
131 //I do not want to have pointer 
132 //to object created somewhere else
133 //because in that case I could not believe that 
134 //it would always exist (sb could delete it)
135 //so we have always own copy
136
137  if(!cut) 
138    {
139      Error("AliHBTMonitorFunction::SetParticleCut","argument is NULL");
140      return;
141    }
142  delete fParticleCut;
143  fParticleCut = (AliAODParticleCut*)cut->Clone();
144  
145 }
146 /******************************************************************/
147
148 void AliHBTMonitorFunction::Rename(const Char_t * name)
149  {
150  //renames the function and histograms
151   SetName(name);
152   SetTitle(name);
153   
154   TString numstr = fName + " Result";  //title and name of the 
155                                            //result histogram
156   GetResult()->SetName(numstr.Data());
157   GetResult()->SetTitle(numstr.Data());
158  }
159 /******************************************************************/
160
161 void AliHBTMonitorFunction::Rename(const Char_t * name, const Char_t * title)
162  {
163  //renames and retitle the function and histograms
164  
165   SetName(name);
166   SetTitle(title);
167   
168   TString numstrn = fName + " Result";  //name of the 
169                                            //result histogram
170
171   TString numstrt = fTitle + " Result";  //title of the 
172                                            //result histogram
173                    
174
175   GetResult()->SetName(numstrn.Data());
176   GetResult()->SetTitle(numstrt.Data());
177
178  }
179
180 /******************************************************************/
181 /******************************************************************/
182 /******************************************************************/
183 ClassImp( AliHBTMonOneParticleFctn )  //z.ch.
184 /******************************************************************/
185 /******************************************************************/
186 ClassImp( AliHBTMonTwoParticleFctn )  //z.ch.
187 /******************************************************************/
188 /******************************************************************/
189 /******************************************************************/
190 ClassImp( AliHBTMonOneParticleFctn1D )
191 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D():
192  fResult(0x0)
193  {
194    //ctor
195  }
196 /******************************************************************/
197
198 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval)
199  {
200    //ctor
201    TString numstr = fName + " Result";  //title and name of the 
202                                            //result histogram
203    fResult   = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
204    fResult->Sumw2();
205  }
206
207 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
208                     Int_t nbins, Double_t maxXval, Double_t minXval)
209         :AliHBTMonOneParticleFctn(name,title)
210 {
211   //ctor
212    TString numstr = fName + " Result";  //title and name of the 
213                                            //result histogram
214          
215    fResult   = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
216    fResult->Sumw2();
217    fResult->SetDirectory(0x0);
218    
219 }
220 /******************************************************************/
221 AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
222 {
223  //dtor
224  delete fResult;
225 }
226 /******************************************************************/
227
228 void AliHBTMonOneParticleFctn1D::Process(AliVAODParticle* particle)
229 {
230  //Fills the result
231    particle = CheckParticle(particle);
232    if(particle) fResult->Fill(GetValue(particle));
233 }
234 /******************************************************************/
235 /******************************************************************/
236  
237 ClassImp( AliHBTMonOneParticleFctn2D )
238
239 AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
240                     Int_t nYbins, Double_t maxYval, Double_t minYval)
241
242 {
243   //ctor
244    TString numstr = fName + " Result";  //title and name of the 
245                                            //result histogram
246         
247    fResult   = new TH2D(numstr.Data(),numstr.Data(),
248                            nXbins,minXval,maxXval,
249                nYbins,minYval,maxYval);
250    fResult->Sumw2();
251    fResult->SetDirectory(0x0);
252 }         
253 /******************************************************************/
254
255 AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
256 {
257   //dtor
258   delete fResult;
259 }
260 void AliHBTMonOneParticleFctn2D::Process(AliVAODParticle* particle)
261 {
262   //fills the function for one particle
263   particle = CheckParticle(particle);
264   if(particle) 
265    { 
266      Double_t x,y;
267      GetValues(particle,x,y);
268      fResult->Fill(x,y);
269    }
270 }
271
272 /******************************************************************/
273 /******************************************************************/
274 /******************************************************************/
275
276 ClassImp( AliHBTMonOneParticleFctn3D)
277
278 AliHBTMonOneParticleFctn3D::
279 AliHBTMonOneParticleFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval, 
280                     Int_t nYbins, Double_t maxYval, Double_t minYval, 
281                     Int_t nZbins, Double_t maxZval, Double_t minZval)
282
283 {
284   //ctor
285    TString numstr = fName + " Result";  //title and name of the 
286                                            //result histogram
287  
288    fResult   = new TH3D(numstr.Data(),numstr.Data(),
289                            nXbins,minXval,maxXval,
290                nYbins,minYval,maxYval,
291                nZbins,minZval,maxZval);
292    fResult->Sumw2();
293    fResult->SetDirectory(0x0);
294
295 }         
296 /******************************************************************/
297
298 AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
299 {
300   //dtor
301   delete fResult;
302 }
303 /******************************************************************/
304
305
306 /******************************************************************/
307 /******************************************************************/
308 /******************************************************************/
309 ClassImp( AliHBTMonTwoParticleFctn1D)
310
311 AliHBTMonTwoParticleFctn1D::
312 AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
313  {
314    //ctor
315    TString numstr = fName + " Result";  //title and name of the 
316                                            //result histogram
317          
318    fResult   = new TH1D(numstr.Data(),numstr.Data(),
319                            nbins,minval,maxval);
320    fResult->Sumw2();
321    fResult->SetDirectory(0x0);
322  }
323
324 AliHBTMonTwoParticleFctn1D::
325 AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
326                     Int_t nbins, Double_t maxval, Double_t minval)
327         :AliHBTMonTwoParticleFctn(name,title)
328  {
329    //ctor
330    TString numstr = fName + " Result";  //title and name of the 
331                                            //result histogram
332
333    fResult   = new TH1D(numstr.Data(),numstr.Data(),
334                            nbins,minval,maxval);
335    fResult->Sumw2();
336    fResult->SetDirectory(0x0);
337  }
338
339
340 /******************************************************************/
341 AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
342 {
343   //dtor
344   delete fResult;
345 }
346 /******************************************************************/
347 void AliHBTMonTwoParticleFctn1D::
348 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
349 {
350   //fills the function for one particle
351   partparticle  = CheckParticle(partparticle);
352   trackparticle = CheckParticle(trackparticle);
353   if( partparticle && trackparticle) 
354    { 
355      Double_t x = GetValue(trackparticle,partparticle);
356      fResult->Fill(x);
357    }
358 }
359 /******************************************************************/
360 /******************************************************************/
361 /******************************************************************/
362 ClassImp( AliHBTMonTwoParticleFctn2D)
363
364
365 AliHBTMonTwoParticleFctn2D::
366 AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
367                     Int_t nYbins, Double_t maxYval, Double_t minYval)
368
369 {
370   //ctor
371    TString numstr = fName + " Result";  //title and name of the 
372                                            //result histogram
373          
374    fResult   = new TH2D(numstr.Data(),numstr.Data(),
375                            nXbins,minXval,maxXval,
376                nYbins,minYval,maxYval);
377    fResult->Sumw2();
378    fResult->SetDirectory(0x0);
379 }         
380 /******************************************************************/
381 AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
382 {
383   //dtor
384   delete fResult;
385 }
386 /******************************************************************/
387 void AliHBTMonTwoParticleFctn2D::
388 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
389 {
390   //fills the function for one particle
391   partparticle  = CheckParticle(partparticle);
392   trackparticle = CheckParticle(trackparticle);
393   if( partparticle && trackparticle) 
394    { 
395      Double_t x,y;
396      GetValues(trackparticle,partparticle,x,y);
397      fResult->Fill(x,y);
398    }
399 }
400 /******************************************************************/
401 /******************************************************************/
402 /******************************************************************/
403 ClassImp(AliHBTMonTwoParticleFctn3D)
404
405 void AliHBTMonTwoParticleFctn3D::
406 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
407 {
408   //fills the function for one particle
409   partparticle  = CheckParticle(partparticle);
410   trackparticle = CheckParticle(trackparticle);
411   if( partparticle && trackparticle) 
412    { 
413      Double_t x,y,z;
414      GetValues(trackparticle,partparticle,x,y,z);
415      fResult->Fill(x,y,z);
416    }
417 }
418 /******************************************************************/
419 /******************************************************************/
420 /******************************************************************/
421 /******************************************************************/
422