28{
31
35 int NPE;
36 int numberOfHits;
37 double precision;
39
40 try {
41
42 JParser<> zap(
"Example program to histogram charge distributions.");
43
51
53
54 }
55 catch(const exception &error) {
57 }
58
60
63
64 {
65 const double dx = JPMTSignalProcessorInterface::getQmin();
66 const double xmin = 0.0 - 0.5*
dx;
67 const int nx = (
int) ((10.0 - xmin) /
dx);
68
71 }
72 {
73 const double dx = 0.02;
75 const int nx = (
int) ((10.0 - xmin) /
dx);
76
79 }
80
83
84 int test = 1;
85
89 }) {
90
91 for (
int i=1; i <=
H0[test]->GetNbinsX(); ++i) {
92
93 const double npe =
H0[test]->GetBinCenter(i);
94 const double p = cpu->getChargeProbability(npe,NPE);
95
96 H0[test]->SetBinContent(i,p);
97 }
98
99 if (numberOfHits > 0) {
100
102
103 for (int i = 0; i != numberOfHits; ++i) {
104
105 const double npe = cpu->getRandomCharge(NPE);
106
107 try {
108
109 if (cpu->applyThreshold(npe)) {
110
112
114 }
115
117
118 DEBUG(exception.what());
119 continue;
120 }
121 }
122
123 const double dx = (
H1[test]->GetXaxis()->GetXmax() -
H1[test]->GetXaxis()->GetXmin()) /
H1[test]->
GetXaxis()->GetNbins();
124
126
127 delete cpu;
128
129 ++test;
130 }
131 }
132
134
135 for (
auto& i :
H0) { out << *i.second; }
136 for (
auto& i :
H1) { out << *i.second; }
137
138 out.Write();
139 out.Close();
140
141
142
144
145 for (int i = 1; i != test; ++i) {
146
148
149 for (
int ix = 1;
ix <=
H0[i]->GetNbinsX(); ++
ix) {
150
154
156 <<
FIXED(5,3) << x <<
' '
157 <<
FIXED(6,4) << y0 <<
' '
159
160 ASSERT(fabs(y0 - y1) < precision);
161 }
162 }
163
164 return 0;
165}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for map of PMT parameters.
Data structure for PMT parameters.
double thresholdBand
threshold-band [npe]
double threshold
threshold [npe]
PMT signal processor interface.
Exception for accessing a value in a collection that is outside of its range.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
PMT analogue signal processor.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...