Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JPMTParametersToolkit.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JPMTPARAMETERSTOOLKIT__
2#define __JDETECTOR__JPMTPARAMETERSTOOLKIT__
3
4#include <limits>
5
8#include "JLang/JException.hh"
9#include "JLang/JThrow.hh"
10
11
12/**
13 * \author mdejong
14 * \file
15 * Auxiliary methods to convert hit probability to QE and vice versa.
16 */
17
18namespace JDETECTOR {}
19namespace JPP { using namespace JDETECTOR; }
20
21namespace JDETECTOR {
22
24
25
26 /**
27 * Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assuming QE = 1.
28 *
29 * \param parameters PMT parameters
30 * \return probability
31 */
32 inline double getSurvivalProbability(const JPMTParameters& parameters)
33 {
34 JPMTParameters data = parameters;
35 const int NPE = 1;
36
37 data.QE = 1.0;
38
40 }
41
42
43 /**
44 * Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.\n
45 * The ratio corresponds to the hit probability with given QE divided by that with QE = 1.\n
46 * The expectation value is defined for a two-fold (or higher) coincidence.
47 *
48 * \param QE QE
49 * \param mu expectation value
50 * \return ratio
51 */
52 inline double getHitProbability(const double QE, const double mu)
53 {
54 if (mu > 0.0)
55 return (1.0 - exp(-QE*mu)) / (1.0 - exp(-mu));
56 else
57 return QE;
58 }
59
60
61 /**
62 * Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.\n
63 * The ratio corresponds to the hit probability with infinite QE divided by that with QE = 1.\n
64 * The expectation value is defined for a two-fold (or higher) coincidence.
65 *
66 * \param mu expectation value
67 * \return ratio
68 */
69 inline double getMaximalHitProbability(const double mu)
70 {
71 using namespace std;
72
73 if (mu > 0.0)
74 return 1.0 / (1.0 - exp(-mu));
75 else
76 return numeric_limits<double>::max();
77 }
78
79
80 /**
81 * Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons.\n
82 * The ratio corresponds to the hit probability with given QE divided by that with QE = 1.\n
83 * The expectation value is defined for a two-fold (or higher) coincidence.
84 *
85 * \param R ratio
86 * \param mu expectation value
87 * \return QE
88 */
89 inline double getQE(const double R, const double mu)
90 {
91 if (R < getMaximalHitProbability(mu)) {
92
93 if (mu > 0.0)
94 return -log(1.0 - R*(1.0 - exp(-mu))) / mu;
95 else
96 return R;
97
98 } else {
99
100 THROW(JValueOutOfRange, "Inconsistent arguments at method getQE(" << R << "," << mu <<")");
101 }
102 }
103}
104
105#endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
PMT analogue signal processor.
Exception handling.
Data structure for PMT parameters.
Exception for accessing a value in a collection that is outside of its range.
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
double getMaximalHitProbability(const double mu)
Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-elec...
double getHitProbability(const double QE, const double mu)
Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons.
double getSurvivalProbability(const JPMTParameters &parameters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
virtual double getSurvivalProbability(const int NPE) const override
Probability that a hit survives the simulation of the PMT.