]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTPIDPurityFctns.cxx
3625b3c1dc426b71d478f338c64b586cd1f2ab2e
[u/mrichter/AliRoot.git] / HBTAN / AliHBTPIDPurityFctns.cxx
1 #include "AliHBTPIDPurityFctns.h"
2 //_______________________________________________________________________________
3 /////////////////////////////////////////////////////////////////////////////////
4 //
5 // class AliHBTMonPhiResolutionVsPtFctn;
6 // class AliHBTMonThetaResolutionVsPtFctn;
7 //
8 // file: AliHBTPIDPurityFctns.cxx AliHBTPIDPurityFctns.h
9 //
10 // Caution: On 2D plots on X axis in simulated values
11 // That is contrary to two-particle resolutions where it is reconstructed one
12 //
13 // added by Piotr.Skowronski@cern.ch
14 // 
15 //
16 //////////////////////////////////////////////////////////////////////////////////
17
18
19 /******************************************************************/
20 /******************************************************************/
21 /******************************************************************/
22
23 ClassImp(AliHBTMonPIDPurityVsPtFctn)
24
25 AliHBTMonPIDPurityVsPtFctn::AliHBTMonPIDPurityVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
26  AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
27  fGood(0x0),
28  fAll(0x0)
29 {
30   //ctor
31   Rename("pidpurityvspt","PIDPurityVsPt");
32   
33 }
34 /******************************************************************/
35
36 AliHBTMonPIDPurityVsPtFctn::~AliHBTMonPIDPurityVsPtFctn()
37 {
38  //dtor
39   delete fGood;
40   delete fAll;
41 }
42 /******************************************************************/
43 void AliHBTMonPIDPurityVsPtFctn::Write()
44 {
45  AliHBTMonitorFunction::Write();
46  fGood->Write();
47  fAll->Write();
48 }
49 /******************************************************************/
50
51 void AliHBTMonPIDPurityVsPtFctn::Init()
52 {
53 //Initializes fuction
54   if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName());
55
56   if (fResult == 0x0)
57    {   
58       Warning("Init","Function has NULL result histogram!");
59       return;
60    }
61   
62   if (fGood == 0x0)
63    {
64      TString numstr = fName + " Good";  //title and name of the
65                                            //result histogram
66      TAxis* xax = fResult->GetXaxis();
67      fGood = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
68    }
69
70   if (fAll == 0x0)
71    {
72      TString numstr = fName + " All";  //title and name of the
73                                            //result histogram
74      TAxis* xax = fResult->GetXaxis();
75      fAll = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
76    }
77
78   fResult->Reset();
79   fResult->SetDirectory(0x0);
80   fResult->Sumw2();
81   fGood->Reset();
82   fGood->SetDirectory(0x0);
83   fGood->Sumw2();
84   fAll->Reset();
85   fAll->SetDirectory(0x0);
86   fAll->Sumw2();
87
88   if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
89 }
90
91 /******************************************************************/
92
93 void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name)
94
95   //Rename fuctions and all histograms belonging to it
96   SetName(name);
97   SetTitle(name);
98   
99   if (fResult)
100    {
101      TString numstr = fName + " Result";  //title and name of the result histogram
102      fResult->SetName(numstr);
103      fResult->SetTitle(numstr);
104    }
105   if (fGood)
106    {
107      TString numstr = fName + " Good";
108      fGood->SetName(numstr);
109      fGood->SetTitle(numstr);
110    }
111    
112   if (fAll)
113    {
114      TString numstr = fName + " All";
115      fAll->SetName(numstr);
116      fAll->SetTitle(numstr);
117    }
118 }
119 /******************************************************************/
120
121 void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name, const Char_t * title)
122 {
123  //renames and retitle the function and histograms
124  
125   SetName(name);
126   SetTitle(title);
127   
128   if (fResult)
129    {
130      TString numstrn = fName + " Result";  //name of the result histogram
131      TString numstrt = fTitle + " Result";  //title of the result histogram
132      fResult->SetName(numstrn);
133      fResult->SetTitle(numstrt);
134    }
135   if (fGood)
136    {
137      TString numstrn = fName + " Good";  //name of the Good histogram
138      TString numstrt = fTitle + " Good";  //title of the Good histogram
139      fGood->SetName(numstrn);
140      fGood->SetTitle(numstrt);
141    }
142
143   if (fAll)
144    {
145      TString numstrn = fName + " All";  //name of the All histogram
146      TString numstrt = fTitle + " All";  //title of the All histogram
147      fAll->SetName(numstrn);
148      fAll->SetTitle(numstrt);
149    }
150
151 }
152 /******************************************************************/
153
154 TH1* AliHBTMonPIDPurityVsPtFctn::GetResult()
155 {
156   //Returns the result of the fuction
157   //that is histogram with effciency and contamination
158   
159   fResult->Divide(fGood,fAll);
160   return fResult;
161 }
162 /******************************************************************/
163
164 void AliHBTMonPIDPurityVsPtFctn::Process(AliHBTParticle * track,AliHBTParticle * part)
165 {
166  //process the particle/track
167  Double_t pt = part->Pt();
168  fAll->Fill(pt);
169  if (track->GetPdgCode() == part->GetPdgCode()) 
170   {
171     fGood->Fill(pt);
172   }
173 // else
174 //  {
175 //    Info("Process","Catched pid impurity ...");
176 //  }
177 }
178
179 /******************************************************************/
180 /******************************************************************/
181 /******************************************************************/
182
183 ClassImp(AliHBTMonPIDContaminationVsPtFctn)
184
185 AliHBTMonPIDContaminationVsPtFctn::AliHBTMonPIDContaminationVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
186  AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
187  fWrong(0x0),
188  fAll(0x0)
189 {
190   //ctor
191   Rename("pidcontaminationvspt","PIDContaminationVsPt");
192 }
193 /******************************************************************/
194
195 AliHBTMonPIDContaminationVsPtFctn::~AliHBTMonPIDContaminationVsPtFctn()
196 {
197  //dtor
198   delete fWrong;
199   delete fAll;
200 }
201 /******************************************************************/
202
203 void AliHBTMonPIDContaminationVsPtFctn::Write()
204 {
205  //Writes the function results
206  AliHBTMonitorFunction::Write();
207  fWrong->Write();
208  fAll->Write();
209 }
210 /******************************************************************/
211
212 void AliHBTMonPIDContaminationVsPtFctn::Init()
213 {
214 //Initializes fuction
215   if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName());
216
217   if (fResult == 0x0)
218    {   
219       Warning("Init","Function has NULL result histogram!");
220       return;
221    }
222   
223   if (fWrong == 0x0)
224    {
225      TString numstr = fName + " Wrong";  //title and name of the
226                                            //result histogram
227      TAxis* xax = fResult->GetXaxis();
228      fWrong = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
229    }
230
231   if (fAll == 0x0)
232    {
233      TString numstr = fName + " All";  //title and name of the
234                                            //result histogram
235      TAxis* xax = fResult->GetXaxis();
236      fAll = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
237    }
238   fResult->Reset();
239   fResult->SetDirectory(0x0);
240   fResult->Sumw2();
241   fWrong->Reset();
242   fWrong->SetDirectory(0x0);
243   fWrong->Sumw2();
244   fAll->Reset();
245   fAll->SetDirectory(0x0);
246   fAll->Sumw2();
247   
248   if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
249 }
250
251 /******************************************************************/
252
253 void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name)
254
255   //Rename fuctions and all histograms belonging to it
256   SetName(name);
257   SetTitle(name);
258   
259   if (fResult)
260    {
261      TString numstr = fName + " Result";  //title and name of the result histogram
262      fResult->SetName(numstr);
263      fResult->SetTitle(numstr);
264    }
265   if (fWrong)
266    {
267      TString numstr = fName + " Wrong";
268      fWrong->SetName(numstr);
269      fWrong->SetTitle(numstr);
270    }
271
272   if (fAll)
273    {
274      TString numstrn = fName + " All";  //name of the All histogram
275      TString numstrt = fTitle + " All";  //title of the All histogram
276      fAll->SetName(numstrn);
277      fAll->SetTitle(numstrt);
278    }
279 }
280 /******************************************************************/
281
282 void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name, const Char_t * title)
283 {
284  //renames and retitle the function and histograms
285  
286   SetName(name);
287   SetTitle(title);
288   
289   if (fResult)
290    {
291      TString numstrn = fName + " Result";  //name of the result histogram
292      TString numstrt = fTitle + " Result";  //title of the result histogram
293      fResult->SetName(numstrn);
294      fResult->SetTitle(numstrt);
295    }
296   if (fWrong)
297    {
298      TString numstrn = fName + " Wrong";  //name of the Wrong histogram
299      TString numstrt = fTitle + " Wrong";  //title of the Wrong histogram
300      fWrong->SetName(numstrn);
301      fWrong->SetTitle(numstrt);
302    }
303    
304   if (fAll)
305    {
306      TString numstr = fName + " All";
307      fAll->SetName(numstr);
308      fAll->SetTitle(numstr);
309    }
310
311 }
312 /******************************************************************/
313
314 TH1* AliHBTMonPIDContaminationVsPtFctn::GetResult()
315 {
316   //Returns the result of the fuction
317   //that is histogram with effciency and contamination
318   
319   fResult->Divide(fWrong,fAll);
320   return fResult;
321 }
322 /******************************************************************/
323
324 void AliHBTMonPIDContaminationVsPtFctn::Process(AliHBTParticle * track, AliHBTParticle * part)
325 {
326  //process the particle/track
327  Double_t pt = part->Pt();
328  fAll->Fill(pt);
329  
330  if (track->GetPdgCode() != part->GetPdgCode()) 
331   {
332 //    Info("Process","Catched contamination");
333 //    track->Print();part->Print();
334     fWrong->Fill(pt);
335   }
336 }
337
338 /******************************************************************/
339 /******************************************************************/
340 /******************************************************************/
341
342 ClassImp(AliHBTPairPIDProbVsQInvFctn)
343
344 AliHBTPairPIDProbVsQInvFctn::AliHBTPairPIDProbVsQInvFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
345  AliHBTOnePairFctn1D(nbins,maxXval,minXval)
346 {
347  fWriteNumAndDen = kTRUE;//change default behaviour
348  Rename("qinvpidpur","Q_{inv}  Function");
349 }
350 /******************************************************************/
351
352 TH1* AliHBTPairPIDProbVsQInvFctn::GetResult()
353 {
354  //returns the scaled ratio
355  delete fRatio;
356  fRatio = GetRatio(Scale());
357  return fRatio;
358 }
359 /******************************************************************/
360
361 void AliHBTPairPIDProbVsQInvFctn::ProcessSameEventParticles(AliHBTPair* pair)
362 {
363  //Fills the numerator using pair from the same event
364    pair = CheckPair(pair);
365    if(pair) fNumerator->Fill(pair->GetQInv(),pair->GetPIDProb());
366 }
367 /******************************************************************/
368
369 void AliHBTPairPIDProbVsQInvFctn::ProcessDiffEventParticles(AliHBTPair* pair)
370  {
371   //Fills the denumerator using mixed pairs
372    pair = CheckPair(pair);
373    if(pair) fDenominator->Fill(pair->GetQInv(),pair->GetPIDProb());
374   }
375
376 /******************************************************************/
377 /******************************************************************/
378 /******************************************************************/
379
380 ClassImp(AliHBTPairPIDProbVsQOutSQideQLongFctn)
381
382 AliHBTPairPIDProbVsQOutSQideQLongFctn::AliHBTPairPIDProbVsQOutSQideQLongFctn(Int_t nXbins, Double_t maxXval, Double_t minXval,
383                                                    Int_t nYbins, Double_t maxYval, Double_t minYval,
384                                                    Int_t nZbins, Double_t maxZval, Double_t minZval):
385  AliHBTOnePairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
386 {
387   //ctor
388   fWriteNumAndDen = kTRUE;//change default behaviour
389   Rename("qoslpidpur","Pair PID Probablilty .vs. Q_{out}-Q_{side}-Q_{long} Fctn");
390 }
391 /***************1**********************************************/
392
393 void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessSameEventParticles(AliHBTPair* pair)
394 {
395 //Fills numerator
396   pair  = CheckPair(pair);
397   if (pair == 0x0) return;
398   Double_t weight = pair->GetPIDProb();
399   Double_t out = TMath::Abs(pair->GetQOutCMSLC());
400   Double_t side = TMath::Abs(pair->GetQSideCMSLC());
401   Double_t lon = TMath::Abs(pair->GetQLongCMSLC());
402   fNumerator->Fill(out,side,lon,weight);
403 }
404 /*************************************************************/
405
406 void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessDiffEventParticles(AliHBTPair* pair)
407 {
408 //Fills numerator
409   pair  = CheckPair(pair);
410   if (pair == 0x0) return;
411   Double_t weight = pair->GetPIDProb();
412   Double_t out = TMath::Abs(pair->GetQOutCMSLC());
413   Double_t side = TMath::Abs(pair->GetQSideCMSLC());
414   Double_t lon = TMath::Abs(pair->GetQLongCMSLC());
415   fDenominator->Fill(out,side,lon,weight);
416 }
417 /*************************************************************/
418
419 TH1* AliHBTPairPIDProbVsQOutSQideQLongFctn::GetResult()
420 {
421  //returns the scaled ratio
422  
423  delete fRatio;
424  fRatio = GetRatio(Scale());
425  return fRatio;
426 }