128{
131
134
136
142 double boost;
145 bool add;
146 histogram_type X;
151
152 try {
153
155
157 "douplets of signal and background histograms, "
158 << "each of which defined by <file name>:<histogram name>");
163 zap[
'B'] =
make_field(boost,
"boost livetime of experiment") = 1.0;
168 "signal and background nuisances, "
169 << "each of which defined by <type> (values), \n"
171 zap[
'x'] =
make_field(X,
"x-axis likelihood histogram") = histogram_type(110, -10.0, +100.0);
176
178 }
179 catch(const exception& error) {
181 }
182
183
185
186 JExperiment::setSNR(
SNR);
187
188 for (const auto& i : setup) {
189
192
193 dynamic_cast<TH1*
>(ps)->
Scale(boost);
195
198
200 }
201
203
206 }
207
208 if (add) {
210 }
211
215
216
218
220
221 TH1D hl(
"hl",
NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
223
224
225 if (P.size() > 1) {
226
228
232
233 {
234 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
235
236 for ( ; ; ++nb) {
237
240
241 if (p > P[1]) {
242 continue;
243 }
244
245 if (n == 0) {
246 break;
247 }
248
251
252 }
253 for (
size_t i = 0; i !=
n; ++i) {
254 storage.
put(px(nb).likelihood);
255 }
256
258 }
259
260 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
261
262 STATUS(
"Total time: " <<
setw(8) << (t1 - t0) / chrono::milliseconds(1) <<
" [ms]" <<
endl);
264 }
265
267
269
271 double p = 0.0;
272
273 {
274 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
275
278
279 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
280
281 STATUS(
"Time to result: " <<
setw(6) << (t1 - t0) / chrono::nanoseconds(1) <<
" [ns]" <<
endl);
282 }
283
285
286 } else if (P.size() > 0 && Q > 0.0) {
287
288 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
289
291
292 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
293
294 STATUS(
"Total time: " <<
setw(8) << (t1 - t0) / chrono::milliseconds(1) <<
" [ms]" <<
endl);
295
297
298 } else if (P.size() > 0 || Q > 0.0) {
299
301
302 {
303 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
304
306 storage.
put(px().likelihood);
307 }
308
309 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
310
311 STATUS(
"Total time: " <<
setw(8) << (t1 - t0) / chrono::milliseconds(1) <<
" [ms]" <<
endl);
313 }
314
316
318 double p = 0.0;
319
320 {
321 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
322
323 if (P.size() == 1) {
326 }
327
328 if (Q > 0.0) {
331 }
332
333 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
334
335 STATUS(
"Time to result: " <<
setw(6) << (t1 - t0) / chrono::microseconds(1) <<
" [us]" <<
endl);
336 }
337
338 if (P.size() == 1) {
cout <<
"Minimal likelihood ratio: " <<
FIXED(9,5) <<
x <<
' ' <<
SCIENTIFIC(12,3) << p <<
endl; }
340
341 } else {
342
344
345 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
346
347 px(storage);
348
349 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
350
351 STATUS(
"Average time: " <<
setw(6) << (t1 - t0) / chrono::nanoseconds(storage.size()) <<
" [ns]" <<
endl);
352
353 for (const auto& result : storage) {
354
360
363 }
364 }
365
366 out.Write();
367 out.Close();
368}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
double getProbability(const T value) const
Get maximal probability corresponding given minimal value.
T getValue(const double P) const
Get minimal value corresponding given maximal probability.
void put(const T value)
Add value to container.
Pseudo experiment using CDF for combined generation and likelihood evaluation.
void add(const TObject *ps, const TObject *pb)
Add objects with PDFs of signal and background.
struct JASTRONOMY::JPseudoExperiment::parameters_type nuisance
double getSignal() const
Get total signal.
virtual void set(const double fS, const double fB=1.0) override
Set scaling factors of signal and background strengths.
double getBackground() const
Get total background.
void configure(size_t N)
Configure lookup tables.
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Template definition of random value generator.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.