PandaRoot
PndPidProbability.h
Go to the documentation of this file.
1 #ifndef PNDPIDPROBABILITY_H
2 #define PNDPIDPROBABILITY_H
3 // //
5 // PndPidProbability //
6 // //
7 // Definition of the Panda pid probabilities . //
8 // //
9 // Author: Ralf Kliemt, Dresden/Turin/Bonn, 01.09.09 //
10 // //
12 
13 #include <iostream>
14 #include "TObject.h"
15 
16 class PndPidProbability : public TObject {
17 
18  public:
20  PndPidProbability(Double_t e, Double_t mu, Double_t pi, Double_t k, Double_t p, Int_t idx = -1);
22 
23  Double_t GetElectronPdf() const { return fElectronPdf; }
24  Double_t GetMuonPdf() const { return fMuonPdf; }
25  Double_t GetPionPdf() const { return fPionPdf; }
26  Double_t GetKaonPdf() const { return fKaonPdf; }
27  Double_t GetProtonPdf() const { return fProtonPdf; }
28  Int_t GetIndex() const { return fIndex; }
29 
30  Double_t GetPdf(int pdgCode);
31  Double_t GetPidProb(int pdgCode);
32 
33  Double_t GetElectronPidProb(PndPidProbability *flux = nullptr) const
34  {
35  if (flux == nullptr)
36  return fElectronPdf / GetSumProb(flux);
37  else
38  return fElectronPdf * flux->GetElectronPdf() / GetSumProb(flux);
39  }
40  Double_t GetMuonPidProb(PndPidProbability *flux = nullptr) const
41  {
42  if (flux == nullptr)
43  return fMuonPdf / GetSumProb(flux);
44  else
45  return fMuonPdf * flux->GetMuonPdf() / GetSumProb(flux);
46  }
47  Double_t GetPionPidProb(PndPidProbability *flux = nullptr) const
48  {
49  if (flux == nullptr)
50  return fPionPdf / GetSumProb(flux);
51  else
52  return fPionPdf * flux->GetPionPdf() / GetSumProb(flux);
53  }
54  Double_t GetKaonPidProb(PndPidProbability *flux = nullptr) const
55  {
56  if (flux == nullptr)
57  return fKaonPdf / GetSumProb(flux);
58  else
59  return fKaonPdf * flux->GetKaonPdf() / GetSumProb(flux);
60  }
61  Double_t GetProtonPidProb(PndPidProbability *flux = nullptr) const
62  {
63  if (flux == nullptr)
64  return fProtonPdf / GetSumProb(flux);
65  else
66  return fProtonPdf * flux->GetProtonPdf() / GetSumProb(flux);
67  }
68 
69  Double_t GetSumProb(PndPidProbability *flux = nullptr) const
70  {
71  if (flux == nullptr)
73  else
74  return fElectronPdf * flux->GetElectronPdf() + fMuonPdf * flux->GetMuonPdf() + fPionPdf * flux->GetPionPdf() + fKaonPdf * flux->GetKaonPdf() +
75  fProtonPdf * flux->GetProtonPdf();
76  }
77 
78  void NormalizeTo(Double_t N = 1.);
79 
80  void SetElectronPdf(Double_t val) { fElectronPdf = (Double_t)val; }
81  void SetMuonPdf(Double_t val) { fMuonPdf = (Double_t)val; }
82  void SetPionPdf(Double_t val) { fPionPdf = (Double_t)val; }
83  void SetKaonPdf(Double_t val) { fKaonPdf = (Double_t)val; }
84  void SetProtonPdf(Double_t val) { fProtonPdf = (Double_t)val; }
85  void SetIndex(Int_t idx) { fIndex = idx; }
86 
89 
90  void Print();
91  void Reset();
92 
93  friend std::ostream &operator<<(std::ostream &out, PndPidProbability &pid)
94  {
95  pid.Print();
96  return out;
97  }
98 
99  protected:
100  Double_t fElectronPdf; // e Probability density function
101  Double_t fMuonPdf; // mu Probability density function
102  Double_t fPionPdf; // pi Probability density function
103  Double_t fKaonPdf; // k Probability density function
104  Double_t fProtonPdf; // p Probability density function
105  Int_t fIndex; // Candidate Index
106  ClassDef(PndPidProbability, 3) //
107 };
108 
109 #endif
Int_t GetIndex() const
friend std::ostream & operator<<(std::ostream &out, PndPidProbability &pid)
double pi
Definition: f_Init.h:29
Double_t GetElectronPidProb(PndPidProbability *flux=nullptr) const
void SetPionPdf(Double_t val)
Double_t GetProtonPdf() const
Double_t GetPdf(int pdgCode)
PndPidProbability operator*(const PndPidProbability &a)
Double_t GetPidProb(int pdgCode)
void SetKaonPdf(Double_t val)
void SetElectronPdf(Double_t val)
void SetMuonPdf(Double_t val)
PndPidProbability & operator*=(const PndPidProbability &a)
Double_t GetProtonPidProb(PndPidProbability *flux=nullptr) const
Double_t GetKaonPidProb(PndPidProbability *flux=nullptr) const
Double_t GetElectronPdf() const
void SetProtonPdf(Double_t val)
Double_t GetMuonPdf() const
void NormalizeTo(Double_t N=1.)
Double_t GetKaonPdf() const
Double_t GetPionPidProb(PndPidProbability *flux=nullptr) const
Double_t GetPionPdf() const
Double_t GetMuonPidProb(PndPidProbability *flux=nullptr) const
Double_t GetSumProb(PndPidProbability *flux=nullptr) const
void SetIndex(Int_t idx)