28{
31
35 int NPE;
36 int numberOfHits;
37 double precision;
39
40 try {
41
42 JParser<> zap(
"Example program to histogram time over threshold distributions.");
43
51
53 }
54 catch(const exception &error) {
56 }
57
59
64
67
68
70
71 const double dx = 1.0;
72 const double xmin = 0.0 - 0.5 *
dx;
74 const int nx = (
int) ((xmax - xmin) /
dx);
75
80
81 h1.Sumw2();
82 h2.Sumw2();
83
85
86 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
87
88 const double x = h0.GetBinCenter(i);
89 const double y = cpu.getTimeOverThresholdProbability(x,NPE);
90
92 <<
FIXED(7,3) << x <<
" "
94
95 h0.SetBinContent(i, y);
96 }
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 double tot_ns;
108
109 try {
110 tot_ns = cpu.getTimeOverThreshold(npe);
112 continue;
113 }
114
115 if (tot_ns > 0.0) {
116
118
119 h1.Fill(tot_ns);
120
121 }
122 }
123
125 }
126
127
128 if (numberOfHits > 0) {
129
131
132 const double t_ns = 25.0;
133
134 for (int i = 0; i != numberOfHits; ++i) {
135
136 input .clear();
137 output.clear();
138
140
142
144
146
147 h2.Fill(
hit->tot_ns);
149 }
150 }
151
153 }
154
155 out.Write();
156 out.Close();
157
159
160 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
161
163 const Double_t y0 = h0.GetBinContent(i);
164 const Double_t y1 = h1.GetBinContent(i);
165 const Double_t y2 = h2.GetBinContent(i);
166
168 <<
FIXED(5,1) << x <<
' '
169 <<
FIXED(6,4) << y0 <<
' '
170 <<
FIXED(6,4) << y1 <<
' '
172
173 ASSERT(fabs(y0 - y1) < precision);
174 ASSERT(fabs(y0 - y2) < precision);
175 }
176}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for time calibration.
std::vector< JElement_t >::const_iterator const_iterator
Auxiliary class for map of PMT parameters.
Data structure for PMT parameters.
double saturation
saturation [ns]
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.
Data structure for PMT analogue signal.
Auxiliary class for handling status.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...