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