PandaRoot
PndPidProbability.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef PNDPIDPROBABILITY_H
14 #define PNDPIDPROBABILITY_H
15 // //
17 // PndPidProbability //
18 // //
19 // Definition of the Panda pid probabilities . //
20 // //
21 // Author: Ralf Kliemt, Dresden/Turin/Bonn, 01.09.09 //
22 // //
24 
25 #include <iostream>
26 #include "TObject.h"
27 
28 class PndPidProbability : public TObject {
29 
30  public:
32  PndPidProbability(Double_t e, Double_t mu, Double_t pi, Double_t k, Double_t p, Int_t idx = -1);
34 
35  Double_t GetElectronPdf() const { return fElectronPdf; }
36  Double_t GetMuonPdf() const { return fMuonPdf; }
37  Double_t GetPionPdf() const { return fPionPdf; }
38  Double_t GetKaonPdf() const { return fKaonPdf; }
39  Double_t GetProtonPdf() const { return fProtonPdf; }
40  Int_t GetIndex() const { return fIndex; }
41 
42  Double_t GetPdf(int pdgCode);
43  Double_t GetPidProb(int pdgCode);
44 
45  Double_t GetElectronPidProb(PndPidProbability *flux = nullptr) const
46  {
47  if (flux == nullptr)
48  return fElectronPdf / GetSumProb(flux);
49  else
50  return fElectronPdf * flux->GetElectronPdf() / GetSumProb(flux);
51  }
52  Double_t GetMuonPidProb(PndPidProbability *flux = nullptr) const
53  {
54  if (flux == nullptr)
55  return fMuonPdf / GetSumProb(flux);
56  else
57  return fMuonPdf * flux->GetMuonPdf() / GetSumProb(flux);
58  }
59  Double_t GetPionPidProb(PndPidProbability *flux = nullptr) const
60  {
61  if (flux == nullptr)
62  return fPionPdf / GetSumProb(flux);
63  else
64  return fPionPdf * flux->GetPionPdf() / GetSumProb(flux);
65  }
66  Double_t GetKaonPidProb(PndPidProbability *flux = nullptr) const
67  {
68  if (flux == nullptr)
69  return fKaonPdf / GetSumProb(flux);
70  else
71  return fKaonPdf * flux->GetKaonPdf() / GetSumProb(flux);
72  }
73  Double_t GetProtonPidProb(PndPidProbability *flux = nullptr) const
74  {
75  if (flux == nullptr)
76  return fProtonPdf / GetSumProb(flux);
77  else
78  return fProtonPdf * flux->GetProtonPdf() / GetSumProb(flux);
79  }
80 
81  Double_t GetSumProb(PndPidProbability *flux = nullptr) const
82  {
83  if (flux == nullptr)
85  else
86  return fElectronPdf * flux->GetElectronPdf() + fMuonPdf * flux->GetMuonPdf() + fPionPdf * flux->GetPionPdf() + fKaonPdf * flux->GetKaonPdf() +
87  fProtonPdf * flux->GetProtonPdf();
88  }
89 
90  void NormalizeTo(Double_t N = 1.);
91 
92  void SetElectronPdf(Double_t val) { fElectronPdf = (Double_t)val; }
93  void SetMuonPdf(Double_t val) { fMuonPdf = (Double_t)val; }
94  void SetPionPdf(Double_t val) { fPionPdf = (Double_t)val; }
95  void SetKaonPdf(Double_t val) { fKaonPdf = (Double_t)val; }
96  void SetProtonPdf(Double_t val) { fProtonPdf = (Double_t)val; }
97  void SetIndex(Int_t idx) { fIndex = idx; }
98 
101 
102  void Print();
103  void Reset();
104 
105  friend std::ostream &operator<<(std::ostream &out, PndPidProbability &pid)
106  {
107  pid.Print();
108  return out;
109  }
110 
111  protected:
112  Double_t fElectronPdf; // e Probability density function
113  Double_t fMuonPdf; // mu Probability density function
114  Double_t fPionPdf; // pi Probability density function
115  Double_t fKaonPdf; // k Probability density function
116  Double_t fProtonPdf; // p Probability density function
117  Int_t fIndex; // Candidate Index
118  ClassDef(PndPidProbability, 3) //
119 };
120 
121 #endif
Int_t GetIndex() const
friend std::ostream & operator<<(std::ostream &out, PndPidProbability &pid)
double pi
Definition: f_Init.h:53
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)