]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HBTAN/AliHBTPIDPurityFctns.cxx
Updating
[u/mrichter/AliRoot.git] / HBTAN / AliHBTPIDPurityFctns.cxx
CommitLineData
becde6ce 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
a22a56ec 19/******************************************************************/
becde6ce 20/******************************************************************/
21/******************************************************************/
22
23ClassImp(AliHBTMonPIDPurityVsPtFctn)
24
25AliHBTMonPIDPurityVsPtFctn::AliHBTMonPIDPurityVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
26 AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
81b40753 27 fGood(0x0),
28 fAll(0x0)
becde6ce 29{
30 //ctor
31 Rename("pidpurityvspt","PIDPurityVsPt");
32
33}
34/******************************************************************/
35
36AliHBTMonPIDPurityVsPtFctn::~AliHBTMonPIDPurityVsPtFctn()
37{
38 //dtor
39 delete fGood;
81b40753 40 delete fAll;
becde6ce 41}
42/******************************************************************/
43void AliHBTMonPIDPurityVsPtFctn::Write()
44{
45 AliHBTMonitorFunction::Write();
46 fGood->Write();
81b40753 47 fAll->Write();
becde6ce 48}
49/******************************************************************/
50
51void 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
81b40753 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
becde6ce 78 fResult->Reset();
79 fResult->SetDirectory(0x0);
81b40753 80 fResult->Sumw2();
becde6ce 81 fGood->Reset();
82 fGood->SetDirectory(0x0);
81b40753 83 fGood->Sumw2();
84 fAll->Reset();
85 fAll->SetDirectory(0x0);
86 fAll->Sumw2();
becde6ce 87
88 if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
89}
90
91/******************************************************************/
92
93void 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 }
81b40753 111
112 if (fAll)
113 {
114 TString numstr = fName + " All";
115 fAll->SetName(numstr);
116 fAll->SetTitle(numstr);
117 }
becde6ce 118}
119/******************************************************************/
120
121void 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
81b40753 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
becde6ce 151}
152/******************************************************************/
153
154TH1* AliHBTMonPIDPurityVsPtFctn::GetResult()
155{
156 //Returns the result of the fuction
157 //that is histogram with effciency and contamination
158
81b40753 159 fResult->Divide(fGood,fAll);
becde6ce 160 return fResult;
161}
162/******************************************************************/
163
164void AliHBTMonPIDPurityVsPtFctn::Process(AliHBTParticle * track,AliHBTParticle * part)
165{
166 //process the particle/track
167 Double_t pt = part->Pt();
81b40753 168 fAll->Fill(pt);
becde6ce 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
183ClassImp(AliHBTMonPIDContaminationVsPtFctn)
184
185AliHBTMonPIDContaminationVsPtFctn::AliHBTMonPIDContaminationVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
186 AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
81b40753 187 fWrong(0x0),
188 fAll(0x0)
becde6ce 189{
190 //ctor
191 Rename("pidcontaminationvspt","PIDContaminationVsPt");
192}
193/******************************************************************/
194
195AliHBTMonPIDContaminationVsPtFctn::~AliHBTMonPIDContaminationVsPtFctn()
196{
197 //dtor
198 delete fWrong;
81b40753 199 delete fAll;
becde6ce 200}
201/******************************************************************/
202
203void AliHBTMonPIDContaminationVsPtFctn::Write()
204{
205 //Writes the function results
206 AliHBTMonitorFunction::Write();
207 fWrong->Write();
81b40753 208 fAll->Write();
becde6ce 209}
210/******************************************************************/
211
212void 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
81b40753 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 }
becde6ce 238 fResult->Reset();
239 fResult->SetDirectory(0x0);
81b40753 240 fResult->Sumw2();
becde6ce 241 fWrong->Reset();
242 fWrong->SetDirectory(0x0);
81b40753 243 fWrong->Sumw2();
244 fAll->Reset();
245 fAll->SetDirectory(0x0);
246 fAll->Sumw2();
247
becde6ce 248 if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName());
249}
250
251/******************************************************************/
252
253void 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 }
81b40753 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 }
becde6ce 279}
280/******************************************************************/
281
282void 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 }
81b40753 303
304 if (fAll)
305 {
306 TString numstr = fName + " All";
307 fAll->SetName(numstr);
308 fAll->SetTitle(numstr);
309 }
310
becde6ce 311}
312/******************************************************************/
313
314TH1* AliHBTMonPIDContaminationVsPtFctn::GetResult()
315{
316 //Returns the result of the fuction
317 //that is histogram with effciency and contamination
318
81b40753 319 fResult->Divide(fWrong,fAll);
becde6ce 320 return fResult;
321}
322/******************************************************************/
323
324void AliHBTMonPIDContaminationVsPtFctn::Process(AliHBTParticle * track, AliHBTParticle * part)
325{
326 //process the particle/track
327 Double_t pt = part->Pt();
81b40753 328 fAll->Fill(pt);
becde6ce 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/******************************************************************/
a22a56ec 339/******************************************************************/
340/******************************************************************/
341
becde6ce 342ClassImp(AliHBTPairPIDProbVsQInvFctn)
343
344AliHBTPairPIDProbVsQInvFctn::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
352TH1* AliHBTPairPIDProbVsQInvFctn::GetResult()
353{
354 //returns the scaled ratio
355 delete fRatio;
356 fRatio = GetRatio(Scale());
357 return fRatio;
358}
359/******************************************************************/
360
361void 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
369void 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
a22a56ec 376/******************************************************************/
377/******************************************************************/
378/******************************************************************/
becde6ce 379
380ClassImp(AliHBTPairPIDProbVsQOutSQideQLongFctn)
381
382AliHBTPairPIDProbVsQOutSQideQLongFctn::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}
a22a56ec 391/***************1**********************************************/
becde6ce 392
393void 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
406void 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
419TH1* AliHBTPairPIDProbVsQOutSQideQLongFctn::GetResult()
420{
421 //returns the scaled ratio
a22a56ec 422
becde6ce 423 delete fRatio;
424 fRatio = GetRatio(Scale());
425 return fRatio;
426}