]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTPIDPurityFctns.cxx
- configure adapted to the new directory structure of the HOMER module in PubSub
[u/mrichter/AliRoot.git] / HBTAN / AliHBTPIDPurityFctns.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 "AliHBTPIDPurityFctns.h"
19 #include "AliLog.h"
20
21 //_______________________________________________________________________________
22 /////////////////////////////////////////////////////////////////////////////////
23 //
24 // class AliHBTMonPhiResolutionVsPtFctn;
25 // class AliHBTMonThetaResolutionVsPtFctn;
26 //
27 // file: AliHBTPIDPurityFctns.cxx AliHBTPIDPurityFctns.h
28 //
29 // Classes for calculating PID purity, efficiency and other things connected with PID
30 // xxx
31 // xxx
32 //
33 // added by Piotr.Skowronski@cern.ch
34 //
35 //////////////////////////////////////////////////////////////////////////////////
36
37
38 /******************************************************************/
39 /******************************************************************/
40 /******************************************************************/
41
42 ClassImp(AliHBTMonPIDPurityVsPtFctn)
43
44 AliHBTMonPIDPurityVsPtFctn::AliHBTMonPIDPurityVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
45  AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
46  fGood(0x0),
47  fAll(0x0)
48 {
49   //ctor
50   Rename("pidpurityvspt","PIDPurityVsPt");
51   
52 }
53 /******************************************************************/
54
55 AliHBTMonPIDPurityVsPtFctn::AliHBTMonPIDPurityVsPtFctn(const AliHBTMonPIDPurityVsPtFctn& /*in*/):
56  AliHBTMonTwoParticleFctn1D(),
57  AliHBTCorrelFunction(),
58  fGood(0x0),
59  fAll(0x0)
60 {
61   //cpy constructor
62   Error("AliHBTMonPIDPurityVsPtFctn(const AliHBTMonPIDPurityVsPtFctn&",
63         "Functions can not be copied because of histogram names clashes");
64 }
65
66 /******************************************************************/
67
68 AliHBTMonPIDPurityVsPtFctn::~AliHBTMonPIDPurityVsPtFctn()
69 {
70  //dtor
71   delete fGood;
72   delete fAll;
73 }
74 /******************************************************************/
75
76 AliHBTMonPIDPurityVsPtFctn& AliHBTMonPIDPurityVsPtFctn::operator=
77                                    (const AliHBTMonPIDPurityVsPtFctn& /*in*/)
78 {
79 //assigment operator
80   Error("operator=","Functions can not be copied because of histogram names clashes");
81   return *this;
82 }
83 /******************************************************************/
84
85 Int_t AliHBTMonPIDPurityVsPtFctn::Write(const char*,Int_t, Int_t)
86 {
87 //Writes a fucntion results
88  AliHBTMonitorFunction::Write();
89  fGood->Write();
90  fAll->Write();
91  return 0;
92 }
93 /******************************************************************/
94
95 void AliHBTMonPIDPurityVsPtFctn::Init()
96 {
97 //Initializes fuction
98   AliDebug(1,"Entering");
99
100   if (fResult == 0x0)
101    {   
102       AliWarning("Function has NULL result histogram!");
103       return;
104    }
105   
106   if (fGood == 0x0)
107    {
108      TString numstr = fName + " Good";  //title and name of the
109                                            //result histogram
110      TAxis* xax = fResult->GetXaxis();
111      fGood = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
112    }
113
114   if (fAll == 0x0)
115    {
116      TString numstr = fName + " All";  //title and name of the
117                                            //result histogram
118      TAxis* xax = fResult->GetXaxis();
119      fAll = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
120    }
121
122   fResult->Reset();
123   fResult->SetDirectory(0x0);
124   fResult->Sumw2();
125   fGood->Reset();
126   fGood->SetDirectory(0x0);
127   fGood->Sumw2();
128   fAll->Reset();
129   fAll->SetDirectory(0x0);
130   fAll->Sumw2();
131
132   AliDebug(1,"Done");
133 }
134
135 /******************************************************************/
136
137 void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name)
138
139   //Rename fuctions and all histograms belonging to it
140   SetName(name);
141   SetTitle(name);
142   
143   if (fResult)
144    {
145      TString numstr = fName + " Result";  //title and name of the result histogram
146      fResult->SetName(numstr);
147      fResult->SetTitle(numstr);
148    }
149    
150   if (fGood)
151    {
152      TString numstr = fName + " Good";
153      fGood->SetName(numstr);
154      fGood->SetTitle(numstr);
155    }
156    
157   if (fAll)
158    {
159      TString numstr = fName + " All";
160      fAll->SetName(numstr);
161      fAll->SetTitle(numstr);
162    }
163 }
164 /******************************************************************/
165
166 void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name, const Char_t * title)
167 {
168  //renames and retitle the function and histograms
169  
170   SetName(name);
171   SetTitle(title);
172   
173   if (fResult)
174    {
175      TString numstrn = fName + " Result";  //name of the result histogram
176      TString numstrt = fTitle + " Result";  //title of the result histogram
177      fResult->SetName(numstrn);
178      fResult->SetTitle(numstrt);
179    }
180   if (fGood)
181    {
182      TString numstrn = fName + " Good";  //name of the Good histogram
183      TString numstrt = fTitle + " Good";  //title of the Good histogram
184      fGood->SetName(numstrn);
185      fGood->SetTitle(numstrt);
186    }
187
188   if (fAll)
189    {
190      TString numstrn = fName + " All";  //name of the All histogram
191      TString numstrt = fTitle + " All";  //title of the All histogram
192      fAll->SetName(numstrn);
193      fAll->SetTitle(numstrt);
194    }
195
196 }
197 /******************************************************************/
198
199 TH1* AliHBTMonPIDPurityVsPtFctn::GetResult()
200 {
201   //Returns the result of the fuction
202   //that is histogram with effciency and contamination
203   
204   fResult->Divide(fGood,fAll);
205   return fResult;
206 }
207 /******************************************************************/
208
209 void AliHBTMonPIDPurityVsPtFctn::Process(AliVAODParticle * track,AliVAODParticle * part)
210 {
211  //process the particle/track
212  Double_t pt = part->Pt();
213  fAll->Fill(pt);
214  if (track->GetPdgCode() == part->GetPdgCode()) 
215   {
216     fGood->Fill(pt);
217   }
218 // else
219 //  {
220 //    Info("Process","Catched pid impurity ...");
221 //  }
222 }
223
224 /******************************************************************/
225 /******************************************************************/
226 /******************************************************************/
227
228 ClassImp(AliHBTMonPIDContaminationVsPtFctn)
229
230 AliHBTMonPIDContaminationVsPtFctn::AliHBTMonPIDContaminationVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
231  AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval),
232  fWrong(0x0),
233  fAll(0x0)
234 {
235   //ctor
236   Rename("pidcontaminationvspt","PIDContaminationVsPt");
237 }
238 /******************************************************************/
239
240 AliHBTMonPIDContaminationVsPtFctn::AliHBTMonPIDContaminationVsPtFctn
241                                           (const AliHBTMonPIDContaminationVsPtFctn& /*in*/):
242  AliHBTMonTwoParticleFctn1D(),
243  AliHBTCorrelFunction(),
244  fWrong(0x0),
245  fAll(0x0)
246 {
247   //cpy constructor
248   Error("AliHBTMonPIDContaminationVsPtFctn(const AliHBTMonPIDContaminationVsPtFctn&",
249         "Functions can not be copied because of histogram names clashes");
250 }
251
252 /******************************************************************/
253
254 AliHBTMonPIDContaminationVsPtFctn::~AliHBTMonPIDContaminationVsPtFctn()
255 {
256  //dtor
257   delete fWrong;
258   delete fAll;
259 }
260 /******************************************************************/
261
262 AliHBTMonPIDContaminationVsPtFctn& AliHBTMonPIDContaminationVsPtFctn::operator=
263                                            (const AliHBTMonPIDContaminationVsPtFctn& /*in*/)
264 {
265 //assigment operator
266   Error("operator=","Functions can not be copied because of histogram names clashes");
267   return *this;
268 }
269 /******************************************************************/
270
271 Int_t AliHBTMonPIDContaminationVsPtFctn::Write(const char*,Int_t, Int_t)
272 {
273  //Writes the function results
274  AliHBTMonitorFunction::Write();
275  fWrong->Write();
276  fAll->Write();
277  return 0;
278 }
279 /******************************************************************/
280
281 void AliHBTMonPIDContaminationVsPtFctn::Init()
282 {
283 //Initializes fuction
284   AliDebug(1,"Entering");
285
286   if (fResult == 0x0)
287    {   
288       AliWarning("Function has NULL result histogram!");
289       return;
290    }
291   
292   if (fWrong == 0x0)
293    {
294      TString numstr = fName + " Wrong";  //title and name of the
295                                            //result histogram
296      TAxis* xax = fResult->GetXaxis();
297      fWrong = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
298    }
299
300   if (fAll == 0x0)
301    {
302      TString numstr = fName + " All";  //title and name of the
303                                            //result histogram
304      TAxis* xax = fResult->GetXaxis();
305      fAll = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax());
306    }
307   fResult->Reset();
308   fResult->SetDirectory(0x0);
309   fResult->Sumw2();
310   fWrong->Reset();
311   fWrong->SetDirectory(0x0);
312   fWrong->Sumw2();
313   fAll->Reset();
314   fAll->SetDirectory(0x0);
315   fAll->Sumw2();
316   
317   AliDebug(1,"Done");
318 }
319
320 /******************************************************************/
321
322 void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name)
323
324   //Rename fuctions and all histograms belonging to it
325   SetName(name);
326   SetTitle(name);
327   
328   if (fResult)
329    {
330      TString numstr = fName + " Result";  //title and name of the result histogram
331      fResult->SetName(numstr);
332      fResult->SetTitle(numstr);
333    }
334   if (fWrong)
335    {
336      TString numstr = fName + " Wrong";
337      fWrong->SetName(numstr);
338      fWrong->SetTitle(numstr);
339    }
340
341   if (fAll)
342    {
343      TString numstrn = fName + " All";  //name of the All histogram
344      TString numstrt = fTitle + " All";  //title of the All histogram
345      fAll->SetName(numstrn);
346      fAll->SetTitle(numstrt);
347    }
348 }
349 /******************************************************************/
350
351 void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name, const Char_t * title)
352 {
353  //renames and retitle the function and histograms
354  
355   SetName(name);
356   SetTitle(title);
357   
358   if (fResult)
359    {
360      TString numstrn = fName + " Result";  //name of the result histogram
361      TString numstrt = fTitle + " Result";  //title of the result histogram
362      fResult->SetName(numstrn);
363      fResult->SetTitle(numstrt);
364    }
365   if (fWrong)
366    {
367      TString numstrn = fName + " Wrong";  //name of the Wrong histogram
368      TString numstrt = fTitle + " Wrong";  //title of the Wrong histogram
369      fWrong->SetName(numstrn);
370      fWrong->SetTitle(numstrt);
371    }
372    
373   if (fAll)
374    {
375      TString numstr = fName + " All";
376      fAll->SetName(numstr);
377      fAll->SetTitle(numstr);
378    }
379
380 }
381 /******************************************************************/
382
383 TH1* AliHBTMonPIDContaminationVsPtFctn::GetResult()
384 {
385   //Returns the result of the fuction
386   //that is histogram with effciency and contamination
387   
388   fResult->Divide(fWrong,fAll);
389   return fResult;
390 }
391 /******************************************************************/
392
393 void AliHBTMonPIDContaminationVsPtFctn::Process(AliVAODParticle * track, AliVAODParticle * part)
394 {
395  //process the particle/track
396  Double_t pt = part->Pt();
397  fAll->Fill(pt);
398  
399  if (track->GetPdgCode() != part->GetPdgCode()) 
400   {
401 //    Info("Process","Catched contamination");
402 //    track->Print();part->Print();
403     fWrong->Fill(pt);
404   }
405 }
406
407 /******************************************************************/
408 /******************************************************************/
409 /******************************************************************/
410 ClassImp(AliHBTQInvCorrelFctnPerfectPID)
411
412 AliHBTQInvCorrelFctnPerfectPID::AliHBTQInvCorrelFctnPerfectPID(Int_t nbins, Double_t maxXval, Double_t minXval):
413  AliHBTTwoPairFctn1D(nbins,maxXval,minXval)
414 {
415 //ctor
416  fWriteNumAndDen = kTRUE;//change default behaviour
417  Rename("qinvcfprfctpid","Q_{inv} Correlation Function Perfect PID");
418 }
419 /*************************************************************/
420
421 void AliHBTQInvCorrelFctnPerfectPID::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
422 {
423 //Fills numerator
424   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
425   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
426
427   trackpair  = CheckPair(trackpair);
428   if (trackpair == 0x0) return;
429 //  partpair  = CheckPair(partpair);
430   if (partpair == 0x0) return;
431
432   fNumerator->Fill(trackpair->GetQInv());
433 }
434
435 /*************************************************************/
436 void AliHBTQInvCorrelFctnPerfectPID::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
437 {
438 //Fills numerator
439   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
440   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
441
442   trackpair  = CheckPair(trackpair);
443   if (trackpair == 0x0) return;
444 //  partpair  = CheckPair(partpair);
445   if (partpair == 0x0) return;
446
447   fDenominator->Fill(trackpair->GetQInv());
448 }
449 /*************************************************************/
450
451 TH1* AliHBTQInvCorrelFctnPerfectPID::GetResult()
452 {
453  //returns the scaled ratio
454  
455  delete fRatio;
456  fRatio = GetRatio(Scale());
457  return fRatio;
458 }
459 /*************************************************************/
460 /******************************************************************/
461 /******************************************************************/
462 /******************************************************************/
463
464 ClassImp(AliHBTWeightQInvCorrelFctnPerfectPID)
465
466 AliHBTWeightQInvCorrelFctnPerfectPID::AliHBTWeightQInvCorrelFctnPerfectPID(Int_t nbins, Double_t maxXval, Double_t minXval):
467  AliHBTTwoPairFctn1D(nbins,maxXval,minXval)
468 {
469 //ctor
470  fWriteNumAndDen = kTRUE;//change default behaviour
471  Rename("wqinvcfprfctpid","Q_{inv} Weight Correlation Function Perfect PID");
472 }
473 /*************************************************************/
474
475 void AliHBTWeightQInvCorrelFctnPerfectPID::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
476 {
477 //Fills numerator
478   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
479   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
480
481   trackpair  = CheckPair(trackpair);
482   if (trackpair == 0x0) return;
483 //  partpair  = CheckPair(partpair);
484   if (partpair == 0x0) return;
485
486   fNumerator->Fill(trackpair->GetQInv(),partpair->GetWeight());
487 }
488
489 /*************************************************************/
490 void AliHBTWeightQInvCorrelFctnPerfectPID::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
491 {
492 //Fills numerator
493   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
494   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
495
496   trackpair  = CheckPair(trackpair);
497   if (trackpair == 0x0) return;
498 //  partpair  = CheckPair(partpair);
499   if (partpair == 0x0) return;
500   
501   fDenominator->Fill(trackpair->GetQInv());
502 }
503 /*************************************************************/
504
505 TH1* AliHBTWeightQInvCorrelFctnPerfectPID::GetResult()
506 {
507  //returns the scaled ratio
508  
509  delete fRatio;
510  fRatio = GetRatio(Scale());
511  return fRatio;
512 }
513
514
515 /******************************************************************/
516 /******************************************************************/
517 /******************************************************************/
518
519 ClassImp(AliHBTWeightQOutSQideQLongFctnPerfectPID)
520
521 AliHBTWeightQOutSQideQLongFctnPerfectPID::AliHBTWeightQOutSQideQLongFctnPerfectPID
522   (Int_t nXbins, Double_t maxXval, Double_t minXval,
523    Int_t nYbins, Double_t maxYval, Double_t minYval,
524    Int_t nZbins, Double_t maxZval, Double_t minZval):
525  AliHBTTwoPairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
526 {
527   //ctor
528   fWriteNumAndDen = kTRUE;//change default behaviour
529   Rename("wqoslprfctpid","Q_{out}-Q_{side}-Q_{long} Weight Fctn with perfect PID");
530 }
531 /*************************************************************/
532
533 void AliHBTWeightQOutSQideQLongFctnPerfectPID::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
534 {
535 //Fills numerator
536   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
537   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
538
539   trackpair  = CheckPair(trackpair);
540   if (trackpair == 0x0) return;
541 //  partpair  = CheckPair(partpair);
542   if (partpair == 0x0) return;
543
544
545   Double_t weight = partpair->GetWeight();
546   Double_t out = trackpair->GetQOutLCMS();
547   Double_t side = trackpair->GetQSideLCMS();
548   Double_t lon = trackpair->GetQLongLCMS();
549
550   if (fAbs)
551    {
552      out = TMath::Abs(out);
553      side = TMath::Abs(side);
554      lon = TMath::Abs(lon);
555    }
556   fNumerator->Fill(out,side,lon,weight);
557 }
558 /*************************************************************/
559
560 void AliHBTWeightQOutSQideQLongFctnPerfectPID::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
561 {
562 //Fills numerator
563   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
564   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
565
566   trackpair  = CheckPair(trackpair);
567   if (trackpair == 0x0) return;
568 //  partpair  = CheckPair(partpair);
569   if (partpair == 0x0) return;
570
571   Double_t out = trackpair->GetQOutLCMS();
572   Double_t side = trackpair->GetQSideLCMS();
573   Double_t lon = trackpair->GetQLongLCMS();
574
575   if (fAbs)
576    {
577      out = TMath::Abs(out);
578      side = TMath::Abs(side);
579      lon = TMath::Abs(lon);
580    }
581   fDenominator->Fill(out,side,lon);
582 }
583 /******************************************************************/
584
585 TH1* AliHBTWeightQOutSQideQLongFctnPerfectPID::GetResult()
586 {
587  //returns the scaled ratio
588  delete fRatio;
589  fRatio = GetRatio(Scale());
590  return fRatio;
591 }
592
593
594 /******************************************************************/
595 /******************************************************************/
596 /******************************************************************/
597
598 ClassImp(AliHBTQOutSQideQLongFctnPerfectPID)
599
600 AliHBTQOutSQideQLongFctnPerfectPID::AliHBTQOutSQideQLongFctnPerfectPID
601    (Int_t nXbins, Double_t maxXval, Double_t minXval,
602     Int_t nYbins, Double_t maxYval, Double_t minYval,
603     Int_t nZbins, Double_t maxZval, Double_t minZval):
604  AliHBTTwoPairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
605 {
606   //ctor
607   fWriteNumAndDen = kTRUE;//change default behaviour
608   Rename("qoslprfctpid","Q_{out}-Q_{side}-Q_{long} Fctn with perfect PID");
609 }
610 /*************************************************************/
611
612 void AliHBTQOutSQideQLongFctnPerfectPID::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
613 {
614 //Fills numerator
615   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
616   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
617
618   trackpair  = CheckPair(trackpair);
619   if (trackpair == 0x0) return;
620 //  partpair  = CheckPair(partpair);
621   if (partpair == 0x0) return;
622   
623   Double_t out = trackpair->GetQOutLCMS();
624   Double_t side = trackpair->GetQSideLCMS();
625   Double_t lon = trackpair->GetQLongLCMS();
626
627   if (fAbs)
628    {
629      out = TMath::Abs(out);
630      side = TMath::Abs(side);
631      lon = TMath::Abs(lon);
632    }
633   fNumerator->Fill(out,side,lon);
634 }
635 /*************************************************************/
636
637 void AliHBTQOutSQideQLongFctnPerfectPID::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
638 {
639 //Fills numerator
640   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
641   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
642
643   trackpair  = CheckPair(trackpair);
644   if (trackpair == 0x0) return;
645 //  partpair  = CheckPair(partpair);
646   if (partpair == 0x0) return;
647   
648   Double_t out = trackpair->GetQOutLCMS();
649   Double_t side = trackpair->GetQSideLCMS();
650   Double_t lon = trackpair->GetQLongLCMS();
651
652   if (fAbs)
653    {
654      out = TMath::Abs(out);
655      side = TMath::Abs(side);
656      lon = TMath::Abs(lon);
657    }
658   fDenominator->Fill(out,side,lon);
659 }
660 /******************************************************************/
661
662 TH1* AliHBTQOutSQideQLongFctnPerfectPID::GetResult()
663 {
664  //returns the scaled ratio
665  delete fRatio;
666  fRatio = GetRatio(Scale());
667  return fRatio;
668 }
669
670 /******************************************************************/
671 /******************************************************************/
672 /******************************************************************/
673
674
675
676 ClassImp(AliHBTPairPIDProbVsQInvFctn)
677
678 AliHBTPairPIDProbVsQInvFctn::AliHBTPairPIDProbVsQInvFctn(Int_t nbins, Double_t maxXval, Double_t minXval):
679  AliHBTOnePairFctn1D(nbins,maxXval,minXval)
680 {
681  fWriteNumAndDen = kTRUE;//change default behaviour
682  Rename("qinvpidpur","Q_{inv}  Function");
683 }
684 /******************************************************************/
685
686 TH1* AliHBTPairPIDProbVsQInvFctn::GetResult()
687 {
688  //returns the scaled ratio
689  delete fRatio;
690  fRatio = GetRatio(Scale());
691  return fRatio;
692 }
693 /******************************************************************/
694
695 void AliHBTPairPIDProbVsQInvFctn::ProcessSameEventParticles(AliHBTPair* pair)
696 {
697  //Fills the numerator using pair from the same event
698    pair = CheckPair(pair);
699    if(pair) fNumerator->Fill(pair->GetQInv(),pair->GetPIDProb());
700 }
701 /******************************************************************/
702
703 void AliHBTPairPIDProbVsQInvFctn::ProcessDiffEventParticles(AliHBTPair* pair)
704  {
705   //Fills the denumerator using mixed pairs
706    pair = CheckPair(pair);
707    if(pair) fDenominator->Fill(pair->GetQInv(),pair->GetPIDProb());
708   }
709
710 /******************************************************************/
711 /******************************************************************/
712 /******************************************************************/
713
714 ClassImp(AliHBTPairPIDProbVsQOutSQideQLongFctn)
715
716 AliHBTPairPIDProbVsQOutSQideQLongFctn::AliHBTPairPIDProbVsQOutSQideQLongFctn(Int_t nXbins, Double_t maxXval, Double_t minXval,
717                                                    Int_t nYbins, Double_t maxYval, Double_t minYval,
718                                                    Int_t nZbins, Double_t maxZval, Double_t minZval):
719  AliHBTOnePairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
720 {
721   //ctor
722   fWriteNumAndDen = kTRUE;//change default behaviour
723   Rename("qoslpidpur","Pair PID Probablilty .vs. Q_{out}-Q_{side}-Q_{long} Fctn");
724 }
725 /*************************************************************/
726
727 void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessSameEventParticles(AliHBTPair* pair)
728 {
729 //Fills numerator
730   pair  = CheckPair(pair);
731   if (pair == 0x0) return;
732   Double_t weight = pair->GetPIDProb();
733   Double_t out = pair->GetQOutLCMS();
734   Double_t side = pair->GetQSideLCMS();
735   Double_t lon = pair->GetQLongLCMS();
736
737   if (fAbs)
738    {
739      out = TMath::Abs(out);
740      side = TMath::Abs(side);
741      lon = TMath::Abs(lon);
742    }
743
744   fNumerator->Fill(out,side,lon,weight);
745 }
746 /*************************************************************/
747
748 void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessDiffEventParticles(AliHBTPair* pair)
749 {
750 //Fills numerator
751   pair  = CheckPair(pair);
752   if (pair == 0x0) return;
753   Double_t weight = pair->GetPIDProb();
754   Double_t out = pair->GetQOutLCMS();
755   Double_t side = pair->GetQSideLCMS();
756   Double_t lon = pair->GetQLongLCMS();
757
758   if (fAbs)
759    {
760      out = TMath::Abs(out);
761      side = TMath::Abs(side);
762      lon = TMath::Abs(lon);
763    }
764   
765   fDenominator->Fill(out,side,lon,weight);
766 }
767 /*************************************************************/
768
769 TH1* AliHBTPairPIDProbVsQOutSQideQLongFctn::GetResult()
770 {
771  //returns the scaled ratio
772  
773  delete fRatio;
774  fRatio = GetRatio(Scale());
775  return fRatio;
776 }
777
778 /******************************************************************/
779 /******************************************************************/
780 /******************************************************************/
781
782 ClassImp(AliHBTTwoTrackEffFctnPtThetaPhiPerfectPID)
783
784 AliHBTTwoTrackEffFctnPtThetaPhiPerfectPID::AliHBTTwoTrackEffFctnPtThetaPhiPerfectPID(Int_t nXbins, Double_t maxXval, Double_t minXval,
785                                                    Int_t nYbins, Double_t maxYval, Double_t minYval,
786                                                    Int_t nZbins, Double_t maxZval, Double_t minZval):
787  AliHBTTwoPairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
788 {
789 //ctor
790 //Set Axis Title
791  fWriteNumAndDen = kTRUE;
792  Rename("tteffptthetaphipfctPID","P_{t} \\theta \\phi Two Track Efficiency Function");
793  if(fNumerator)
794   {
795    fNumerator->GetXaxis()->SetTitle("\\Delta P_{t} [GeV]");
796    fNumerator->GetYaxis()->SetTitle("\\Delta \\theta [rad]");
797    fNumerator->GetZaxis()->SetTitle("\\Delta \\phi [rad]");
798   }
799
800  if(fDenominator)
801   {
802    fDenominator->GetXaxis()->SetTitle("\\Delta P_{t} [GeV]");
803    fDenominator->GetYaxis()->SetTitle("\\Delta \\theta [rad]");
804    fDenominator->GetZaxis()->SetTitle("\\Delta \\phi [rad]");
805   }
806 }
807 /******************************************************************/
808
809 void AliHBTTwoTrackEffFctnPtThetaPhiPerfectPID::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
810 {
811 //Fills numerator
812   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
813   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
814
815   trackpair  = CheckPair(trackpair);
816   if (trackpair == 0x0) return;
817 //  partpair  = CheckPair(partpair);
818   if (partpair == 0x0) return;
819
820   Double_t x = TMath::Abs(trackpair->GetDeltaPt());
821   Double_t y = TMath::Abs(trackpair->GetDeltaTheta());
822   Double_t z = TMath::Abs(trackpair->GetDeltaPhi());
823   fNumerator->Fill(x,y,z);
824 }
825 /******************************************************************/
826
827 void AliHBTTwoTrackEffFctnPtThetaPhiPerfectPID::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
828 {
829 //Fills numerator
830   if (trackpair->Particle1()->GetPdgCode() != partpair->Particle1()->GetPdgCode()) return;
831   if (trackpair->Particle2()->GetPdgCode() != partpair->Particle2()->GetPdgCode()) return;
832
833   trackpair  = CheckPair(trackpair);
834   if (trackpair == 0x0) return;
835 //  partpair  = CheckPair(partpair);
836   if (partpair == 0x0) return;
837
838   Double_t x = TMath::Abs(trackpair->GetDeltaPt());
839   Double_t y = TMath::Abs(trackpair->GetDeltaTheta());
840   Double_t z = TMath::Abs(trackpair->GetDeltaPhi());
841   fDenominator->Fill(x,y,z);
842 }
843 /******************************************************************/
844
845 TH1* AliHBTTwoTrackEffFctnPtThetaPhiPerfectPID::GetResult()
846 {
847 //returns ratio of numerator and denominator
848  delete fRatio;
849  fRatio = GetRatio(Scale());
850  if(fRatio)
851   {
852    fRatio->GetXaxis()->SetTitle("\\Delta P_{t} [GeV]");
853    fRatio->GetYaxis()->SetTitle("\\Delta \\theta [rad]");
854    fRatio->GetZaxis()->SetTitle("\\Delta \\phi [rad]");
855   }
856  return fRatio;
857 }
858 /******************************************************************/
859 /******************************************************************/
860 /******************************************************************/
861
862 ClassImp(AliHBTPairPIDProbVsPtThetaPhiFctn)
863
864 AliHBTPairPIDProbVsPtThetaPhiFctn::AliHBTPairPIDProbVsPtThetaPhiFctn(Int_t nXbins, Double_t maxXval, Double_t minXval,
865                                                    Int_t nYbins, Double_t maxYval, Double_t minYval,
866                                                    Int_t nZbins, Double_t maxZval, Double_t minZval):
867  AliHBTOnePairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval)
868 {
869   //ctor
870   fWriteNumAndDen = kTRUE;//change default behaviour
871   Rename("ptthetaphipidpur","Pair PID Probablilty .vs. \\Delta P_{t}-\\Delta \\theta-\\Delta \\phi Fctn");
872   if(fNumerator)
873    {
874     fNumerator->GetXaxis()->SetTitle("\\Delta P_{t} [GeV]");
875     fNumerator->GetYaxis()->SetTitle("\\Delta \\theta [rad]");
876     fNumerator->GetZaxis()->SetTitle("\\Delta \\phi [rad]");
877    }
878
879   if(fDenominator)
880    {
881     fDenominator->GetXaxis()->SetTitle("\\Delta P_{t} [GeV]");
882     fDenominator->GetYaxis()->SetTitle("\\Delta \\theta [rad]");
883     fDenominator->GetZaxis()->SetTitle("\\Delta \\phi [rad]");
884    }
885   
886 }
887 /*************************************************************/
888
889 void AliHBTPairPIDProbVsPtThetaPhiFctn::ProcessSameEventParticles(AliHBTPair* pair)
890 {
891 //Fills numerator
892   pair  = CheckPair(pair);
893   if (pair == 0x0) return;
894   Double_t weight = pair->GetPIDProb();
895   Double_t pt = TMath::Abs(pair->GetDeltaPt());
896   Double_t theta = TMath::Abs(pair->GetDeltaTheta());
897   Double_t phi = TMath::Abs(pair->GetDeltaPhi());
898   fNumerator->Fill(pt,theta,phi,weight);
899 }
900 /*************************************************************/
901
902 void AliHBTPairPIDProbVsPtThetaPhiFctn::ProcessDiffEventParticles(AliHBTPair* pair)
903 {
904 //Fills numerator
905   pair  = CheckPair(pair);
906   if (pair == 0x0) return;
907   Double_t weight = pair->GetPIDProb();
908   Double_t pt = TMath::Abs(pair->GetDeltaPt());
909   Double_t phi = TMath::Abs(pair->GetDeltaTheta());
910   Double_t theta = TMath::Abs(pair->GetDeltaPhi());
911   fDenominator->Fill(pt,theta,phi,weight);
912 }
913 /*************************************************************/
914
915 TH1* AliHBTPairPIDProbVsPtThetaPhiFctn::GetResult()
916 {
917  //returns the scaled ratio
918  
919  delete fRatio;
920  fRatio = GetRatio(Scale());
921  if(fRatio)
922   {
923    fRatio->GetXaxis()->SetTitle("\\Delta P_{t} [GeV]");
924    fRatio->GetYaxis()->SetTitle("\\Delta \\theta [rad]");
925    fRatio->GetZaxis()->SetTitle("\\Delta \\phi [rad]");
926   }
927  return fRatio;
928 }
929