Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JShowerNPE.hh
Go to the documentation of this file.
1 #ifndef __JFIT__JSHOWERNPE__
2 #define __JFIT__JSHOWERNPE__
3 
4 #include <cmath>
5 
6 #include "JTools/JConstants.hh"
8 #include "JFit/JK40.hh"
9 #include "JFit/JFitToolkit.hh"
10 
11 
12 /**
13  * \author mdejong, adomi
14  */
15 
16 namespace JFIT {}
17 namespace JPP { using namespace JFIT; }
18 
19 namespace JFIT {
20 
21  /**
22  * Auxiliary class for handling EM shower light yield.
23  * Note that the effective light yield due to bremsstrahlung is proportional to the EM shower energy.
24  */
25  struct JShowerNPE :
26  public JK40
27  {
28 
29  using JK40::getP;
30 
31 
32  /**
33  * Default constructor.
34  */
36  JK40(),
37  __y(0.0)
38  {}
39 
40 
41  /**
42  * Constructor.
43  *
44  * \param k40 K40 light yields [npe]
45  * \param y light yield due to bremsstrahlung [npe/GeV]
46  */
47  JShowerNPE(const JK40& k40,
48  const double y) :
49  JK40(k40),
50  __y(y)
51  {}
52 
53 
54  /**
55  * Get light yield due to bremsstrahlung.
56  *
57  * \return light yield [npe/GeV]
58  */
59  double getY() const
60  {
61  return __y;
62  }
63 
64  /**
65  * Expected number of photo-electrons for random background hypothesis.
66  *
67  * \return light yield [npe]
68  */
69  inline double getH0() const
70  {
71  return this->getY0();
72  }
73 
74 
75  /**
76  * Expected number of photo-electrons for random background hypothesis.
77  *
78  * \param M multiplicity
79  * \return light yield [npe]
80  */
81  inline double getH0(const size_t M) const
82  {
83  return this->getY1(M);
84  }
85 
86 
87  /**
88  * Expected number of photo-electrons for EM shower hypothesis as a function of shower energy.
89  *
90  * \param E_GeV energy [GeV]
91  * \return light yield [npe]
92  */
93  inline double getH1(const double E_GeV) const
94  {
95  using namespace JTOOLS;
96  using namespace JPHYSICS;
97 
98  return E_GeV * this->getY();
99  }
100 
101 
102  /**
103  * Get probability for observing a hit or not as a function of shower energy.
104  *
105  * \param E_GeV energy [GeV]
106  * \param hit hit
107  * \return probability
108  */
109  double getP(const double E_GeV, const bool hit) const
110  {
111  return JFIT::getP(this->getH1(E_GeV) + this->getH0(), hit);
112  }
113 
114 
115  /**
116  * Get chi2 for observing a hit or not as a function of shower energy.
117  *
118  * \param E_GeV energy [GeV]
119  * \param hit hit
120  * \return probability
121  */
122  double getChi2(const double E_GeV, const bool hit) const
123  {
124  return JFIT::getChi2(this->getH1(E_GeV) + this->getH0(), hit);
125  }
126 
127  protected:
128  double __y; //!< light yield [npe/GeV]
129  };
130 }
131 
132 #endif
Auxiliary methods to evaluate Poisson probabilities and chi2.
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
Auxiliary methods for PDF calculations.
double getChi2(const double E_GeV, const bool hit) const
Get chi2 for observing a hit or not as a function of shower energy.
Definition: JShowerNPE.hh:122
JShowerNPE(const JK40 &k40, const double y)
Constructor.
Definition: JShowerNPE.hh:47
double getY0() const
Get expectation value for number of single hits.
Definition: JK40.hh:101
Auxiliary class for converting various rates to expectation values of the number of hits within a giv...
Definition: JK40.hh:30
double getP(const double E_GeV, const bool hit) const
Get probability for observing a hit or not as a function of shower energy.
Definition: JShowerNPE.hh:109
double getH0() const
Expected number of photo-electrons for random background hypothesis.
Definition: JShowerNPE.hh:69
Constants.
double getY1(const size_t M) const
Get expectation value for number of multiple hits.
Definition: JK40.hh:113
double getY() const
Get light yield due to bremsstrahlung.
Definition: JShowerNPE.hh:59
double getP(size_t M) const
Get probability to observe a hit with given multiplicity.
Definition: JK40.hh:129
double __y
light yield [npe/GeV]
Definition: JShowerNPE.hh:128
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits...
Definition: JFitToolkit.hh:36
JShowerNPE()
Default constructor.
Definition: JShowerNPE.hh:35
double getH1(const double E_GeV) const
Expected number of photo-electrons for EM shower hypothesis as a function of shower energy...
Definition: JShowerNPE.hh:93
Auxiliary class for handling EM shower light yield.
Definition: JShowerNPE.hh:25
double getChi2(const double P)
Get chi2 corresponding to given probability.
Definition: JFitToolkit.hh:79
double getH0(const size_t M) const
Expected number of photo-electrons for random background hypothesis.
Definition: JShowerNPE.hh:81