]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTPIDPurityFctns.cxx
New version including TOF
[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 ClassImp(AliHBTMonPIDPurityVsPtFctn)
23
24 AliHBTMonPIDPurityVsPtFctn::AliHBTMonPIDPurityVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
25  AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
26  fGood(0x0)
27 {
28   //ctor
29   Rename("pidpurityvspt","PIDPurityVsPt");
30   
31 }
32 /******************************************************************/
33
34 AliHBTMonPIDPurityVsPtFctn::~AliHBTMonPIDPurityVsPtFctn()
35 {
36  //dtor
37   delete fGood;
38 }
39 /******************************************************************/
40 void AliHBTMonPIDPurityVsPtFctn::Write()
41 {
42  AliHBTMonitorFunction::Write();
43  fGood->Write();
44 }
45 /******************************************************************/
46
47 void AliHBTMonPIDPurityVsPtFctn::Init()
48 {
49 //Initializes fuction
50   if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName());
51
52   if (fResult == 0x0)
53    {   
54       Warning("Init","Function has NULL result histogram!");
55       return;
56    }
57   
58   if (fGood == 0x0)
59    {
60      TString numstr = fName + " Good";  //title and name of the
61                                            //result histogram
62      TAxis* xax = fResult->GetXaxis();
63      fGood = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
64    }
65
66   fResult->Reset();
67   fResult->SetDirectory(0x0);
68   fGood->Reset();
69   fGood->SetDirectory(0x0);
70
71   if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
72 }
73
74 /******************************************************************/
75
76 void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name)
77
78   //Rename fuctions and all histograms belonging to it
79   SetName(name);
80   SetTitle(name);
81   
82   if (fResult)
83    {
84      TString numstr = fName + " Result";  //title and name of the result histogram
85      fResult->SetName(numstr);
86      fResult->SetTitle(numstr);
87    }
88   if (fGood)
89    {
90      TString numstr = fName + " Good";
91      fGood->SetName(numstr);
92      fGood->SetTitle(numstr);
93    }
94 }
95 /******************************************************************/
96
97 void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name, const Char_t * title)
98 {
99  //renames and retitle the function and histograms
100  
101   SetName(name);
102   SetTitle(title);
103   
104   if (fResult)
105    {
106      TString numstrn = fName + " Result";  //name of the result histogram
107      TString numstrt = fTitle + " Result";  //title of the result histogram
108      fResult->SetName(numstrn);
109      fResult->SetTitle(numstrt);
110    }
111   if (fGood)
112    {
113      TString numstrn = fName + " Good";  //name of the Good histogram
114      TString numstrt = fTitle + " Good";  //title of the Good histogram
115      fGood->SetName(numstrn);
116      fGood->SetTitle(numstrt);
117    }
118
119 }
120 /******************************************************************/
121
122 TH1* AliHBTMonPIDPurityVsPtFctn::GetResult()
123 {
124   //Returns the result of the fuction
125   //that is histogram with effciency and contamination
126   
127   TH1D* htmp = (TH1D*)fResult->Clone("PIDPurityHTMP");
128   fResult->Reset();
129   fResult->Divide(fGood,htmp);
130   return fResult;
131 }
132 /******************************************************************/
133
134 void AliHBTMonPIDPurityVsPtFctn::Process(AliHBTParticle * track,AliHBTParticle * part)
135 {
136  //process the particle/track
137  Double_t pt = part->Pt();
138  fResult->Fill(pt);
139  if (track->GetPdgCode() == part->GetPdgCode()) 
140   {
141     fGood->Fill(pt);
142   }
143 // else
144 //  {
145 //    Info("Process","Catched pid impurity ...");
146 //  }
147 }
148
149 /******************************************************************/
150 /******************************************************************/
151 /******************************************************************/
152
153 ClassImp(AliHBTMonPIDContaminationVsPtFctn)
154
155 AliHBTMonPIDContaminationVsPtFctn::AliHBTMonPIDContaminationVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
156  AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
157  fWrong(0x0)
158 {
159   //ctor
160   Rename("pidcontaminationvspt","PIDContaminationVsPt");
161 }
162 /******************************************************************/
163
164 AliHBTMonPIDContaminationVsPtFctn::~AliHBTMonPIDContaminationVsPtFctn()
165 {
166  //dtor
167   delete fWrong;
168 }
169 /******************************************************************/
170
171 void AliHBTMonPIDContaminationVsPtFctn::Write()
172 {
173  //Writes the function results
174  AliHBTMonitorFunction::Write();
175  fWrong->Write();
176 }
177 /******************************************************************/
178
179 void AliHBTMonPIDContaminationVsPtFctn::Init()
180 {
181 //Initializes fuction
182   if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName());
183
184   if (fResult == 0x0)
185    {   
186       Warning("Init","Function has NULL result histogram!");
187       return;
188    }
189   
190   if (fWrong == 0x0)
191    {
192      TString numstr = fName + " Wrong";  //title and name of the
193                                            //result histogram
194      TAxis* xax = fResult->GetXaxis();
195      fWrong = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
196    }
197
198   fResult->Reset();
199   fResult->SetDirectory(0x0);
200   fWrong->Reset();
201   fWrong->SetDirectory(0x0);
202
203   if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
204 }
205
206 /******************************************************************/
207
208 void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name)
209
210   //Rename fuctions and all histograms belonging to it
211   SetName(name);
212   SetTitle(name);
213   
214   if (fResult)
215    {
216      TString numstr = fName + " Result";  //title and name of the result histogram
217      fResult->SetName(numstr);
218      fResult->SetTitle(numstr);
219    }
220   if (fWrong)
221    {
222      TString numstr = fName + " Wrong";
223      fWrong->SetName(numstr);
224      fWrong->SetTitle(numstr);
225    }
226 }
227 /******************************************************************/
228
229 void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name, const Char_t * title)
230 {
231  //renames and retitle the function and histograms
232  
233   SetName(name);
234   SetTitle(title);
235   
236   if (fResult)
237    {
238      TString numstrn = fName + " Result";  //name of the result histogram
239      TString numstrt = fTitle + " Result";  //title of the result histogram
240      fResult->SetName(numstrn);
241      fResult->SetTitle(numstrt);
242    }
243   if (fWrong)
244    {
245      TString numstrn = fName + " Wrong";  //name of the Wrong histogram
246      TString numstrt = fTitle + " Wrong";  //title of the Wrong histogram
247      fWrong->SetName(numstrn);
248      fWrong->SetTitle(numstrt);
249    }
250 }
251 /******************************************************************/
252
253 TH1* AliHBTMonPIDContaminationVsPtFctn::GetResult()
254 {
255   //Returns the result of the fuction
256   //that is histogram with effciency and contamination
257   
258   TH1D* htmp = (TH1D*)fResult->Clone("PIDContaminationHTMP");
259   fResult->Reset();
260   fResult->Divide(fWrong,htmp);
261   return fResult;
262 }
263 /******************************************************************/
264
265 void AliHBTMonPIDContaminationVsPtFctn::Process(AliHBTParticle * track, AliHBTParticle * part)
266 {
267  //process the particle/track
268  Double_t pt = part->Pt();
269  fResult->Fill(pt);
270  
271  if (track->GetPdgCode() != part->GetPdgCode()) 
272   {
273 //    Info("Process","Catched contamination");
274 //    track->Print();part->Print();
275     fWrong->Fill(pt);
276   }
277 }
278
279 /******************************************************************/
280 ClassImp(AliHBTPairPIDProbVsQInvFctn)
281
282 AliHBTPairPIDProbVsQInvFctn::AliHBTPairPIDProbVsQInvFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
283  AliHBTOnePairFctn1D(nbins,maxXval,minXval)
284 {
285  fWriteNumAndDen = kTRUE;//change default behaviour
286  Rename("qinvpidpur","Q_{inv}  Function");
287 }
288 /******************************************************************/
289
290 TH1* AliHBTPairPIDProbVsQInvFctn::GetResult()
291 {
292  //returns the scaled ratio
293  delete fRatio;
294  fRatio = GetRatio(Scale());
295  return fRatio;
296 }
297 /******************************************************************/
298
299 void AliHBTPairPIDProbVsQInvFctn::ProcessSameEventParticles(AliHBTPair* pair)
300 {
301  //Fills the numerator using pair from the same event
302    pair = CheckPair(pair);
303    if(pair) fNumerator->Fill(pair->GetQInv(),pair->GetPIDProb());
304 }
305 /******************************************************************/
306
307 void AliHBTPairPIDProbVsQInvFctn::ProcessDiffEventParticles(AliHBTPair* pair)
308  {
309   //Fills the denumerator using mixed pairs
310    pair = CheckPair(pair);
311    if(pair) fDenominator->Fill(pair->GetQInv(),pair->GetPIDProb());
312   }
313
314
315 ClassImp(AliHBTPairPIDProbVsQOutSQideQLongFctn)
316
317 AliHBTPairPIDProbVsQOutSQideQLongFctn::AliHBTPairPIDProbVsQOutSQideQLongFctn(Int_t nXbins, Double_t maxXval, Double_t minXval,
318                                                    Int_t nYbins, Double_t maxYval, Double_t minYval,
319                                                    Int_t nZbins, Double_t maxZval, Double_t minZval):
320  AliHBTOnePairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
321 {
322   //ctor
323   fWriteNumAndDen = kTRUE;//change default behaviour
324   Rename("qoslpidpur","Pair PID Probablilty .vs. Q_{out}-Q_{side}-Q_{long} Fctn");
325 }
326 /*************************************************************/
327
328 void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessSameEventParticles(AliHBTPair* pair)
329 {
330 //Fills numerator
331   pair  = CheckPair(pair);
332   if (pair == 0x0) return;
333   Double_t weight = pair->GetPIDProb();
334   Double_t out = TMath::Abs(pair->GetQOutCMSLC());
335   Double_t side = TMath::Abs(pair->GetQSideCMSLC());
336   Double_t lon = TMath::Abs(pair->GetQLongCMSLC());
337   fNumerator->Fill(out,side,lon,weight);
338 }
339 /*************************************************************/
340
341 void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessDiffEventParticles(AliHBTPair* pair)
342 {
343 //Fills numerator
344   pair  = CheckPair(pair);
345   if (pair == 0x0) return;
346   Double_t weight = pair->GetPIDProb();
347   Double_t out = TMath::Abs(pair->GetQOutCMSLC());
348   Double_t side = TMath::Abs(pair->GetQSideCMSLC());
349   Double_t lon = TMath::Abs(pair->GetQLongCMSLC());
350   fDenominator->Fill(out,side,lon,weight);
351 }
352 /*************************************************************/
353
354 TH1* AliHBTPairPIDProbVsQOutSQideQLongFctn::GetResult()
355 {
356  //returns the scaled ratio
357  delete fRatio;
358  fRatio = GetRatio(Scale());
359  return fRatio;
360 }