34 struct experiment_type {
46 friend inline std::istream&
operator>>(std::istream& in, experiment_type& experiment)
48 return in >> experiment.Hs
60 friend inline std::ostream&
operator<<(std::ostream& out,
const experiment_type& experiment)
62 return out << experiment.Hs <<
' '
78 printer(
const char*
const title,
91 friend inline std::ostream&
operator<<(std::ostream& out,
const printer& printer)
96 out << setw(16) << left << printer.title << right;
98 if (printer.ps != NULL) {
100 out <<
' ' << setw(16) << left << printer.ps->GetName() << right;
102 const TH1* h1 =
dynamic_cast<const TH1*
>(printer.ps);
105 out <<
' ' <<
FIXED(10,3) << h1->GetSumOfWeights();
113 const char*
const title;
137 size_t numberOfTests;
151 "douplets of signal and background histograms, "
152 <<
"each of which defined by <file name>:<histogram name>");
154 zap[
'n'] =
make_field(numberOfTests,
"number of tests");
156 zap[
'b'] =
make_field(Fb,
"background strength") = 1.0;
158 "signal and background nuisances, "
159 <<
"each of which defined by <type> (values), \n"
160 <<
"\twhere <type> can be:"
162 zap[
'x'] =
make_field(X,
"x-axis likelihood histogram") = histogram_type(110, -10.0, +100.0);
163 zap[
'Q'] =
make_field(Q,
"minimal likelihood ratio") = 0.0;
164 zap[
'P'] =
make_field(P,
"maximal probability") = 0.0;
170 catch(
const exception& error) {
171 FATAL(error.what() << endl);
178 for (
const auto& i : setup) {
180 const TObject* ps = getObject(i.Hs);
181 const TObject* pb = getObject(i.Hb);
183 STATUS(printer(
"Signal:", ps) << endl);
184 STATUS(printer(
"Background:", pb) << endl);
193 STATUS(
"Number of tests: " << setw(10) << numberOfTests << endl);
200 TH1D hl(
"hl", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
201 TH1D hn(
"hn", NULL, 100, -15.0, +15.0);
204 if (P > 0.0 || Q > 0.0) {
209 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
211 for (
size_t i = 0; i != numberOfTests; ++i) {
212 storage.
put(px().likelihood);
215 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
217 STATUS(
"Average time: " << setw(6) << (t1 - t0) / chrono::nanoseconds(numberOfTests) <<
" [ns]" << endl);
220 for (
const auto& result : storage) {
221 for (
const auto x : result.second) {
226 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
230 const double x = storage.
getValue(P);
233 cout <<
"Minimal likelihood ratio: " <<
FIXED(9,5) << x <<
' ' <<
SCIENTIFIC(12,3) << p << endl;
239 const double x = storage.
getValue(p);
241 cout <<
"Maximal probability: " <<
SCIENTIFIC(12,3) << p <<
' ' <<
FIXED(9,5) << x << endl;
244 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
246 STATUS(
"Time to result: " << setw(6) << (t1 - t0) / chrono::microseconds(1) <<
" [us]" << endl);
252 const chrono::high_resolution_clock::time_point t0 = chrono::high_resolution_clock::now();
256 const chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
258 STATUS(
"Average time: " << setw(6) << (t1 - t0) / chrono::nanoseconds(storage.size()) <<
" [ns]" << endl);
260 for (
const auto& result : storage) {
263 << setw(3) << result.ns <<
' '
264 << setw(3) << result.nb <<
' '
265 <<
FIXED(12,5) << result.likelihood <<
' '
266 <<
FIXED(12,5) << result.signal << endl);
268 hl.Fill(result.likelihood);
269 hn.Fill(result.signal - result.ns);
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
Auxiliary class to handle file name, ROOT directory and object name.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JWriter & operator<<(JWriter &out, const JDAQChronometer &chronometer)
Write DAQ chronometer to output.
Auxiliary data structure for floating point format specification.
const dictionary_type & getDictionary() const
Get dictionary.
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.
void set(const double fS, const double fB)
Set scaling factors of signal and background strengths.
double getBackground() const
Get total background.
Auxiliary container for statistical analysis of a large number of values.
double getProbability(const double value) const
Get maximal probability corresponding given minimal value.
void put(const T value)
Add value to container.
T getValue(const double P) const
Get minimal value corresponding given maximal probability.
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
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.