33 struct experiment_type {
50 friend inline std::istream&
operator>>(std::istream& in, experiment_type& experiment)
52 return in >> experiment.HS
57 >> experiment.nuisance;
68 friend inline std::ostream&
operator<<(std::ostream& out,
const experiment_type& experiment)
70 return out << experiment.HS <<
' '
71 << experiment.HB <<
' '
72 << experiment.Hs <<
' '
73 << experiment.Hb <<
' '
74 << experiment.Hd <<
' '
75 << experiment.nuisance;
91 printer(
const char*
const title,
104 friend inline std::ostream&
operator<<(std::ostream& out,
const printer& printer)
109 out << setw(16) << left << printer.title << right;
111 if (printer.ps != NULL) {
113 out <<
' ' << setw(16) << left << printer.ps->GetName() << right;
115 const TH1* h1 =
dynamic_cast<const TH1*
>(printer.ps);
118 out <<
' ' <<
FIXED(10,3) << h1->GetSumOfWeights();
126 const char*
const title;
144 size_t numberOfTests;
158 "quintuplets of signal and background histograms (generation then evaluation) and data, \n"
159 <<
"\teach of which defined by <file name>:<histogram name> and <type> (values), respectively, \n"
160 <<
"\twhere <type> can be:" << get_keys(nuisance_helper));
161 zap[
'n'] =
make_field(numberOfTests,
"number of tests for upper limit calculation") = 0;
162 zap[
'M'] =
make_field(M,
"lookup table for CDFs") = 0;
163 zap[
'R'] =
make_field(SNR,
"signal-to-noise ratio") = 0.0;
164 zap[
'A'] =
make_field(add,
"add remnant signal and noise");
165 zap[
's'] =
make_field(testsignal,
"signal to test") = -1.;
170 catch(
const exception& error) {
171 FATAL(error.what() << endl);
175 JExperiment::setSNR(SNR);
180 for (
const auto& i : setup) {
182 const TObject* pS = getObject(i.HS);
183 const TObject* pB = getObject(i.HB);
184 const TObject* ps = getObject(i.Hs);
185 const TObject* pb = getObject(i.Hb);
186 const TObject* pd = getObject(i.Hd);
195 STATUS(printer(
"Signal for generation: ", pS) << endl);
196 STATUS(printer(
"Background for generation:", pB) << endl);
197 STATUS(printer(
"Signal for evaluation: ", ps) << endl);
198 STATUS(printer(
"Background for evaluation:", pb) << endl);
199 STATUS(printer(
"Data: ", pd) << endl);
212 const JRealExperiment::fit_type result = rx();
214 cout <<
"signal: " <<
FIXED(9,3) << rx.
getSignal() <<
"/" << setw(6) << rx.size() << endl;
216 if (testsignal >= 0) {
217 cout <<
"check TS: " <<
FIXED(12,5) << rx.
getLikelihood(testsignal) <<
' ' <<
FIXED(12,5) << testsignal << endl;
220 if (
debug >= debug_t) {
224 for (
double x : rx) {
226 cout <<
SCIENTIFIC(12,3) << 1.0/x << ((n + 1)%10 == 0 ?
"\n" :
" ");
234 <<
FIXED(12,5) << result.likelihood <<
' '
235 <<
FIXED(12,5) << result.signal << endl;
237 if (numberOfTests != 0) {
239 const double Q = 0.9;
243 cout <<
"upper limit: " <<
FIXED(12,5) << mu << endl;
Set of pseudo experments.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
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.
std::ostream & operator<<(std::ostream &out, const morphology_type &object)
Write morphology to output stream.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
double getSignal() const
Get total signal strength.
double getLikelihood(const double p) const
Get likelihood for given signal strength.
double getDerivative(const double p) const
Get derivative of likelihood for given signal strength.
Auxiliary data structure to fit signal strength using likelihood ratio for multiple pseudo experiment...
void add()
Add remnant signal and background.
void configure(size_t N)
Configure lookup tables.
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
Real experiment using PDF of signal and background.
void add(const TObject *pd, const TObject *ps, const TObject *pb)
Add objects with data and PDFs of signal and background.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Auxiliary data structure for floating point format specification.