36 struct experiment_type {
48 friend inline std::istream&
operator>>(std::istream& in, experiment_type& experiment)
50 return in >> experiment.Hs
62 friend inline std::ostream&
operator<<(std::ostream& out,
const experiment_type& experiment)
64 return out << experiment.Hs <<
' '
80 printer(
const char*
const title,
93 friend inline std::ostream&
operator<<(std::ostream& out,
const printer& printer)
98 out << setw(16) << left << printer.title << right;
100 if (printer.ps != NULL) {
102 out <<
' ' << setw(16) << left << printer.ps->GetName() << right;
104 const TH1* h1 =
dynamic_cast<const TH1*
>(printer.ps);
107 out <<
' ' <<
FIXED(10,3) << h1->GetSumOfWeights();
115 const char*
const title;
136 size_t numberOfTests;
150 "douplets of signal and background histograms, "
151 <<
"each of which defined by <file name>:<histogram name>");
153 zap[
'n'] =
make_field(numberOfTests,
"number of tests");
154 zap[
'B'] =
make_field(boost,
"boost livetime of experiment") = 1.0;
155 zap[
'M'] =
make_field(M,
"lookup table for CDFs") = 0;
156 zap[
'R'] =
make_field(SNR,
"signal-to-noise ratio") = 0.0;
157 zap[
'x'] =
make_field(X,
"x-axis signal histogram") = histogram_type(100, -1.0e3, +1.0e3);
158 zap[
'p'] =
make_field(precision,
"precision") = 1.0e-4;
164 catch(
const exception& error) {
165 FATAL(error.what() << endl);
171 JExperiment::setSNR(SNR);
173 const double Q = 0.9;
177 for (
const auto& i : setup) {
182 dynamic_cast<TH1*
>(ps)->Scale(boost);
183 dynamic_cast<TH1*
>(pb)->Scale(boost);
185 STATUS(printer(
"Signal:", ps) << endl);
186 STATUS(printer(
"Background:", pb) << endl);
197 STATUS(
"Number of tests: " << setw(10) << numberOfTests << endl);
204 TH1D h0(
"h0", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
205 TH1D h1(
"h1", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
212 for (
size_t i = 0; i != numberOfTests; ++i) {
218 h0.Fill(aspera(
true).signal);
224 for (
size_t i = 0; i != numberOfTests; ++i) {
226 if ((i*10) < numberOfTests || (i*10)%numberOfTests == 0) {
240 for (
const double x : mu_up) {
244 sort(mu_up.begin(), mu_up.end());
246 cout <<
"<mu> " <<
FIXED(7,3) << mu_up[mu_up.size() / 2] << endl;
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Auxiliary methods for mathematics.
#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.
Auxiliary data structure to fit signal strength using likelihood ratio.
double getSignalStrengthForUpperLimit(const JAspera &aspera, const double Q, const size_t numberOfTests, const double precision=1.0e-4)
Get signal strength given result of experiment and probability of upper limit.
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.
virtual stats_type run(JAspera &out) const
Generate pseudo experiment and transfer values to fit method.
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.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Template definition of random value generator.