41{
45
49
50 try {
51
53
56
58
60 zap[
'f'] =
make_field(inputFile,
"input file (output from JCalibrateK40).");
63
65 }
66 catch(const exception &error) {
68 }
69
70
72
74
76
77 map_type zmap;
78
79
81
83
84 TFile in(i->c_str(),
"read");
85
86
87
89 FATAL(
"Histogram does not contain weights histogram." <<
endl);
90 }
91
93
95
97
98 } else {
99
100
101
103
106 FATAL(
"Number of y-bins does not match for this file " << *i <<
endl);
107 }
108
111 FATAL(
"TMax_ns is not the same for this file " << *i <<
endl);
112 }
113
114
115
119 }
120
121
123
125
127 TString(
key->GetName()).EndsWith(
_1B) ||
128 TString(
key->GetName()).EndsWith(
_1L)) {
129
130 TH1* h1 =
dynamic_cast<TH1*
>(
key->ReadObj());
131
132 map_type::iterator p = zmap.find(h1->GetName());
133
134 if (p == zmap.end()) {
135
136 DEBUG(
"Clone " << h1->GetName() <<
endl);
137
138 p = zmap.insert(
make_pair(h1->GetName(), (
TH1*) h1->Clone())).first;
139
140 } else {
141
143
144 p->second->Add(h1);
145 }
146 }
147 }
148
150
151 for (map_type::iterator i = zmap.begin(); i != zmap.end(); ++i) {
152 i->second->SetDirectory(0);
153 }
154
155 in.Close();
156 }
157
158
161 }
162
163
164
165
167
170
171 for (map_type::iterator i = zmap.begin(); i != zmap.end(); ++i) {
172
173 if (i->first.EndsWith(
_2S)) {
174
176
177 if (h2s->GetEntries() != 0) {
178
179 TH1D* h1b = (
TH1D*) zmap.find(TString(i->first).ReplaceAll(
_2S,
_1B))->second;
180 TH1D* h1L = (
TH1D*) zmap.find(TString(i->first).ReplaceAll(
_2S,
_1L))->second;
181
182
183
184
185
186 for (
int ix = 1;
ix <= h2s->GetXaxis()->GetNbins(); ++
ix) {
187
188
189
190
191
193
194 h1b->SetBinContent(
ix, 0.0);
195 h1b->SetBinError (
ix, 0.0);
196
197 for (
int iy = 1;
iy <= h2s->GetYaxis()->GetNbins(); ++
iy) {
198 h2s->SetBinContent(
ix,
iy, 0.0);
200 }
201
202 } else {
203
204 const double Y = h1b->GetBinContent(
ix) / h1L->GetBinContent(
ix) /
WB;
205 const double W = h1b->GetBinError (
ix) / h1L->GetBinContent(
ix) /
WB;
206
207 h1b->SetBinContent(
ix, Y);
208 h1b->SetBinError (
ix, W);
209
210 for (
int iy = 1;
iy <= h2s->GetYaxis()->GetNbins(); ++
iy) {
211
212 double y = h2s->GetBinContent(
ix,
iy) / h1L->GetBinContent(
ix) /
WS;
213 double w = h2s->GetBinError (
ix,
iy) / h1L->GetBinContent(
ix) /
WS;
214
215 if (w == 0.0) {
216
217
218
219 w = 1.0 / h1L->GetBinContent(
ix) /
WS;
220 }
221
222 h2s->SetBinContent(
ix,
iy, y - Y);
223 h2s->SetBinError (
ix,
iy, sqrt(w*w + W*W));
224 }
225 }
226 }
227
228
229
230 for (
int ix = 0;
ix <= h2s->GetXaxis()->GetNbins() + 1; ++
ix) {
231 h2s->SetBinContent(
ix, 0, 0.0); h2s->SetBinContent(
ix, h2s->GetYaxis()->GetNbins() + 1, 0.0);
232 h2s->SetBinError (
ix, 0, 0.0); h2s->SetBinError (
ix, h2s->GetYaxis()->GetNbins() + 1, 0.0);
233 }
234
235 for (
int iy = 0;
iy <= h2s->GetYaxis()->GetNbins() + 1; ++
iy) {
236 h2s->SetBinContent(0,
iy, 0.0); h2s->SetBinContent(h2s->GetXaxis()->GetNbins() + 1,
iy, 0.0);
237 h2s->SetBinError (0,
iy, 0.0); h2s->SetBinError (h2s->GetXaxis()->GetNbins() + 1,
iy, 0.0);
238 }
239
240 NOTICE(
"Biased coincidence rate [Hz] " << h2s->GetName() <<
' ' << h2s->GetSumOfWeights() *
WS <<
endl);
241
242 h2s->SetName(TString(i->first).ReplaceAll(
_2S,
_2R));
243
244 h2s->Write();
245 }
246 }
247 }
248
250
252
254
257 }
258 }
259
260 out.Write();
261 out.Close();
262}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Template definition of a multi-dimensional oscillation probability interpolation table.
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.
static const char *const weights_hist_t
Histogram naming.
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.
static const char *const _1L
Name extension for 1D live time.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
KM3NeT DAQ data structures and auxiliaries.
std::map< int, range_type > map_type
Empty structure for specification of parser element that is initialised (i.e. does not require input)...