34 struct experiment_type {
50 friend inline std::istream&
operator>>(std::istream& in, experiment_type& experiment)
52 return in >> experiment.HS
56 >> experiment.nuisance;
67 friend inline std::ostream&
operator<<(std::ostream& out,
const experiment_type& experiment)
69 return out << experiment.HS <<
' '
70 << experiment.HB <<
' '
71 << experiment.Hs <<
' '
72 << experiment.Hb <<
' '
73 << experiment.nuisance;
88 printer(
const char*
const title,
101 friend inline std::ostream&
operator<<(std::ostream& out,
const printer& printer)
106 out << setw(16) << left << printer.title << right;
108 if (printer.ps != NULL) {
110 out <<
' ' << setw(16) << left << printer.ps->GetName() << right;
112 const TH1* h1 =
dynamic_cast<const TH1*
>(printer.ps);
115 out <<
' ' <<
FIXED(10,3) << h1->GetSumOfWeights();
123 const char*
const title;
144 size_t numberOfTests;
159 "douplets of signal and background histograms and doublets of signal and background nuisances, \n"
160 <<
"\teach of which defined by <file name>:<histogram name> and <type> (values), respectively, \n"
163 zap[
'n'] =
make_field(numberOfTests,
"number of tests");
164 zap[
'M'] =
make_field(M,
"lookup table for CDFs") = 0;
165 zap[
'R'] =
make_field(SNR,
"signal-to-noise ratio") = 0.0;
166 zap[
'x'] =
make_field(X,
"x-axis likelihood histogram") = histogram_type(100, -1.0e3, +1.0e3);
167 zap[
'p'] =
make_field(precision,
"precision") = 1.0e-4;
173 catch(
const exception& error) {
174 FATAL(error.what() << endl);
180 JExperiment::setSNR(SNR);
182 const double Q = 0.9;
186 for (
const auto& i : setup) {
188 const TObject* pS = getObject(i.HS);
189 const TObject* pB = getObject(i.HB);
190 const TObject* ps = getObject(i.Hs);
191 const TObject* pb = getObject(i.Hb);
193 STATUS(printer(
"Signal for generation:", pS) << endl);
194 STATUS(printer(
"Background for generation:", pB) << endl);
195 STATUS(printer(
"Signal for evaluation:", ps) << endl);
196 STATUS(printer(
"Background for evaluation:", pb) << endl);
211 STATUS(
"Number of tests: " << setw(10) << numberOfTests << endl);
218 TH1D h0(
"h0", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
219 TH1D h1(
"h1", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
226 for (
size_t i = 0; i != numberOfTests; ++i) {
232 h0.Fill(aspera(
true).signal);
238 for (
size_t i = 0; i != numberOfTests; ++i) {
240 if ((i*10) < numberOfTests || (i*10)%numberOfTests == 0) {
254 for (
const double x : mu_up) {
258 sort(mu_up.begin(), mu_up.end());
260 cout <<
"<mu> " <<
FIXED(7,3) << mu_up[mu_up.size() / 2] << endl;
int main(int argc, char **argv)
Set of pseudo experments.
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
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.
Auxiliary data structure to fit signal strength using likelihood ratio for multiple pseudo experiment...
virtual stats_type run(JAspera &out) const
Generate pseudo experiment and transfer S/N 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.
void configure(size_t N)
Configure lookup tables.
double getBackground() const
Get total background.
dictionary_type & getDictionary()
Get dictionary.
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.
struct JASTRONOMY::JPseudoExperiment::parameters_type nuisance
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Template definition of random value generator.