]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTMonitorFunction.cxx
- Adding handling of track info in digits.
[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    fResult->Sumw2();
204  }
205
206 AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
207                     Int_t nbins, Double_t maxXval, Double_t minXval)
208         :AliHBTMonOneParticleFctn(name,title)
209 {
210   //ctor
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);
215    fResult->Sumw2();
216    fResult->SetDirectory(0x0);
217    
218 }
219 /******************************************************************/
220 AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
221 {
222  //dtor
223  delete fResult;
224 }
225 /******************************************************************/
226
227 void AliHBTMonOneParticleFctn1D::Process(AliVAODParticle* particle)
228 {
229  //Fills the result
230    particle = CheckParticle(particle);
231    if(particle) fResult->Fill(GetValue(particle));
232 }
233 /******************************************************************/
234 /******************************************************************/
235  
236 ClassImp( AliHBTMonOneParticleFctn2D )
237
238 AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
239                     Int_t nYbins, Double_t maxYval, Double_t minYval)
240
241 {
242   //ctor
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);
249    fResult->Sumw2();
250    fResult->SetDirectory(0x0);
251 }         
252 /******************************************************************/
253
254 AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
255 {
256   //dtor
257   delete fResult;
258 }
259 void AliHBTMonOneParticleFctn2D::Process(AliVAODParticle* particle)
260 {
261   //fills the function for one particle
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
275 ClassImp( AliHBTMonOneParticleFctn3D)
276
277 AliHBTMonOneParticleFctn3D::
278 AliHBTMonOneParticleFctn3D(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 {
283   //ctor
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);
291    fResult->Sumw2();
292    fResult->SetDirectory(0x0);
293
294 }         
295 /******************************************************************/
296
297 AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
298 {
299   //dtor
300   delete fResult;
301 }
302 /******************************************************************/
303
304
305 /******************************************************************/
306 /******************************************************************/
307 /******************************************************************/
308 ClassImp( AliHBTMonTwoParticleFctn1D)
309
310 AliHBTMonTwoParticleFctn1D::
311 AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
312  {
313    //ctor
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);
319    fResult->Sumw2();
320    fResult->SetDirectory(0x0);
321  }
322
323 AliHBTMonTwoParticleFctn1D::
324 AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
325                     Int_t nbins, Double_t maxval, Double_t minval)
326         :AliHBTMonTwoParticleFctn(name,title)
327  {
328    //ctor
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);
334    fResult->Sumw2();
335    fResult->SetDirectory(0x0);
336  }
337
338
339 /******************************************************************/
340 AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
341 {
342   //dtor
343   delete fResult;
344 }
345 /******************************************************************/
346 void AliHBTMonTwoParticleFctn1D::
347 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
348 {
349   //fills the function for one particle
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 /******************************************************************/
361 ClassImp( AliHBTMonTwoParticleFctn2D)
362
363
364 AliHBTMonTwoParticleFctn2D::
365 AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
366                     Int_t nYbins, Double_t maxYval, Double_t minYval)
367
368 {
369   //ctor
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);
376    fResult->Sumw2();
377    fResult->SetDirectory(0x0);
378 }         
379 /******************************************************************/
380 AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
381 {
382   //dtor
383   delete fResult;
384 }
385 /******************************************************************/
386 void AliHBTMonTwoParticleFctn2D::
387 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
388 {
389   //fills the function for one particle
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 /******************************************************************/
402 ClassImp(AliHBTMonTwoParticleFctn3D)
403
404 void AliHBTMonTwoParticleFctn3D::
405 Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
406 {
407   //fills the function for one particle
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