Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JCalibrateK40.hh
Go to the documentation of this file.
1#ifndef __JCALIBRATE_JCALIBRATEK40__
2#define __JCALIBRATE_JCALIBRATEK40__
3
4#include <cmath>
5#include <algorithm>
6
10
11/**
12 * \author mdejong
13 */
14
15namespace JCALIBRATE {}
16namespace JPP { using namespace JCALIBRATE; }
17
18namespace JCALIBRATE {
19
22
23
24 /**
25 * Histogram naming.
26 */
27 static const char* const weights_hist_t = "weights_hist"; //!< Name of histogram with normalisation constants.
28
29 static const char* const W1_overall_t = "W1_overall"; //!< Named bin for duration of the run
30 static const char* const WS_t = "WS"; //!< Named bin for time residual bin width
31 static const char* const WB_t = "WB"; //!< Named bin for value of TMax_ns in JCalibrateK40
32
33 static const char* const _2S = ".2S"; //!< Name extension for 2D counts
34 static const char* const _1B = ".1B"; //!< Name extension for 1D background
35 static const char* const _1L = ".1L"; //!< Name extension for 1D live time
36 static const char* const _2R = ".2R"; //!< Name extension for 2D rate measured
37 static const char* const _2F = ".2F"; //!< Name extension for 2F rate fitted
38 static const char* const _1D = ".1D"; //!< Name extension for 1D time offset
39 static const char* const _1F = ".1F"; //!< Name extension for 1D time offset fit
40
42
43
44 /**
45 * Auxiliary class to sort pairs of PMT addresses within optical module.
46 */
48 /**
49 * Constructor.
50 *
51 * \param module detector module
52 * \param epsilon precision
53 */
55 const double epsilon = 1.0e-5) :
56 module (module),
58 {}
59
60
61 /**
62 * Comparison of two pairs of PMT addresses.
63 *
64 * \param first first pair of PMT addresses
65 * \param second second pair of PMT addresses
66 * \return true if first pair has larger space angle; else false
67 */
68 inline bool operator()(const pair_type& first, const pair_type& second) const
69 {
70 using namespace std;
71
72 if (fabs(this->getDot(first) - this->getDot(second)) > epsilon)
73 return this->getDot(first) < this->getDot(second);
74 else if (max(first.first, first.second) == max(second.first, second.second))
75 return min(first.first, first.second) < min(second.first, second.second);
76 else
77 return max(first.first, first.second) < max(second.first, second.second);
78 }
79
80
81 /**
82 * Get cosine of space angle between PMT axes.
83 *
84 * \param pair pair of PMT addresses
85 * \return cosine
86 */
87 inline double getDot(const pair_type& pair) const
88 {
90 module.getPMT(pair.second).getDirection());
91 }
92
93 protected:
95 const double epsilon;
96 };
97
98
99 /**
100 * PMT combinatorics for optical module.
101 */
103 public JCombinatorics
104 {
105 /**
106 * Default constructor.
107 */
110
111
112 /**
113 * Constructor.
114 *
115 * \param module detector module
116 */
118 {
119 this->configure(module.size());
120
121 this->sort(JPairwiseComparator(module));
122 }
123 };
124
125
126 /**
127 * Get coincidence probability of two PMTs within one module due to random background.
128 *
129 * \param E1 expected counts of 1st PMT
130 * \param E2 expected counts of 2nd PMT
131 * \param ED expected counts of module, excluding PMT 1 and PMT 2
132 * \param M_min multiplicity lower limit
133 * \param M_max multiplicity upper limit
134 * \return probability
135 */
136 inline double getP(const double E1, const double E2, const double ED, const int M_min, const int M_max)
137 {
138 // 1st, always calculate the probability for twofold multiplicity
139
140 double P = E1 * E2 * exp(-(E1 + E2 + ED));
141
142 // 2nd, calculate the probability of multiplicity at lower limit
143
144 int MD = 1;
145
146 for ( ; MD + 2 <= M_min; ++MD) {
147 P *= ED/MD;
148 }
149
150 // 3rd, add the probabilities of multiplicities up to upper limit
151
152 double P_sum = P;
153
154 for ( ; MD + 2 <= M_max; ++MD) {
155 P *= ED/MD;
156 P_sum += P;
157 }
158
159 return P_sum;
160 }
161}
162
163#endif
Binary methods for member methods.
Data structure for optical module.
Data structure for a composite optical module.
Definition JModule.hh:76
const JPMT & getPMT(const int index) const
Get PMT.
Definition JModule.hh:173
const JDirection3D & getDirection() const
Get direction.
Auxiliary class to convert pair of indices to unique index and back.
void configure(const int numberOfIndices)
Configure.
void sort(JComparator_t comparator)
Sort address pairs.
Auxiliary classes and methods for PMT calibration.
static const char *const _1F
Name extension for 1D time offset fit.
static const char *const _2S
Name extension for 2D counts.
static const char *const WB_t
Named bin for value of TMax_ns in JCalibrateK40.
double getP(const double E1, const double E2, const double ED, const int M_min, const int M_max)
Get coincidence probability of two PMTs within one module due to random background.
static const char *const weights_hist_t
Histogram naming.
static const char *const _2F
Name extension for 2F rate fitted.
static const char *const _1D
Name extension for 1D time offset.
static const char *const _1B
Name extension for 1D background.
static const char *const WS_t
Named bin for time residual bin width.
static const char *const _2R
Name extension for 2D rate measured.
static const char *const W1_overall_t
Named bin for duration of the run.
JCombinatorics::pair_type pair_type
static const char *const _1L
Name extension for 1D live time.
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
PMT combinatorics for optical module.
JCombinatorics_t()
Default constructor.
JCombinatorics_t(const JModule &module)
Constructor.
Auxiliary class to sort pairs of PMT addresses within optical module.
double getDot(const pair_type &pair) const
Get cosine of space angle between PMT axes.
JPairwiseComparator(const JModule &module, const double epsilon=1.0e-5)
Constructor.
bool operator()(const pair_type &first, const pair_type &second) const
Comparison of two pairs of PMT addresses.
Data structure for a pair of indices.