Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
JShowerNPE.hh
Go to the documentation of this file.
1#ifndef __JFIT__JSHOWERNPE__
2#define __JFIT__JSHOWERNPE__
3
4#include <cmath>
5
6#include "JPhysics/JConstants.hh"
7#include "JPhysics/JPDFToolkit.hh"
8
9#include "JFit/JK40.hh"
10#include "JFit/JFitToolkit.hh"
11
12
13/**
14 * \author mdejong, adomi
15 */
16
17namespace JFIT {}
18namespace JPP { using namespace JFIT; }
19
20namespace JFIT {
21
22 /**
23 * Auxiliary class for handling EM shower light yield.
24 */
25 struct JShowerNPE :
26 public JK40
27 {
28 /**
29 * Default constructor.
30 */
32 JK40(),
33 y1(0.0)
34 {}
35
36
37 /**
38 * Constructor.
39 *
40 * \param y0 light yield due to random background [npe]
41 * \param y1 light yield due to shower [npe/GeV]
42 */
43 JShowerNPE(const double y0,
44 const double y1) :
45 JK40(y0),
46 y1(y1)
47 {}
48
49
50 /**
51 * Get light yield due to shower.
52 *
53 * \return light yield [npe/GeV]
54 */
55 double getY1() const
56 {
57 return y1;
58 }
59
60
61 /**
62 * Expected number of photo-electrons for shower hypothesis as a function of shower energy.
63 *
64 * \param E_GeV energy [GeV]
65 * \return light yield [npe]
66 */
67 inline double getH1(const double E_GeV) const
68 {
69 return E_GeV * this->getY1();
70 }
71
72
73 /**
74 * Get probability for observing a hit or not as a function of shower energy.
75 *
76 * \param E_GeV energy [GeV]
77 * \param hit hit
78 * \return probability
79 */
80 double getP(const double E_GeV, const bool hit) const
81 {
82 return JFIT::getP(this->getH1(E_GeV) + this->getH0(), hit);
83 }
84
85
86 /**
87 * Get chi2 for observing a hit or not as a function of shower energy.
88 *
89 * \param E_GeV energy [GeV]
90 * \param hit hit
91 * \return probability
92 */
93 double getChi2(const double E_GeV, const bool hit) const
94 {
95 return JFIT::getChi2(this->getH1(E_GeV) + this->getH0(), hit);
96 }
97
98 protected:
99 double y1; //!< light yield due to shower [npe/GeV]
100 };
101}
102
103#endif
Auxiliary methods to evaluate Poisson probabilities and chi2.
Auxiliary classes and methods for linear and iterative data regression.
Definition JEnergy.hh:15
double getChi2(const double P)
Get chi2 corresponding to given probability.
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.
Auxiliary class for handling light yields due to K40 decays.
Definition JK40.hh:25
double getH0() const
Expected number of photo-electrons for random background hypothesis.
Definition JK40.hh:60
double y0
light yield due to random background [npe]
Definition JK40.hh:90
Auxiliary class for handling EM shower light yield.
Definition JShowerNPE.hh:27
double getY1() const
Get light yield due to shower.
Definition JShowerNPE.hh:55
JShowerNPE(const double y0, const double y1)
Constructor.
Definition JShowerNPE.hh:43
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:80
JShowerNPE()
Default constructor.
Definition JShowerNPE.hh:31
double y1
light yield due to shower [npe/GeV]
Definition JShowerNPE.hh:99
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:93
double getH1(const double E_GeV) const
Expected number of photo-electrons for shower hypothesis as a function of shower energy.
Definition JShowerNPE.hh:67