140{
143
145 size_t numberOfTests;
146 size_t M;
147 double SNR;
148 bool add;
150 double testsignal;
151
152 try {
153
155
157
159 "quintuplets of signal and background histograms (generation then evaluation) and data, \n"
160 << "\teach of which defined by <file name>:<histogram name> and <type> (values), respectively, \n"
161 <<
"\twhere <type> can be:" <<
get_keys(nuisance_helper));
162 zap[
'n'] =
make_field(numberOfTests,
"number of tests for upper limit calculation") = 0;
163 zap[
'M'] =
make_field(M,
"lookup table for CDFs") = 0;
164 zap[
'R'] =
make_field(SNR,
"signal-to-noise ratio") = 0.0;
165 zap[
'A'] =
make_field(add,
"add remnant signal and noise");
166 zap[
's'] =
make_field(testsignal,
"signal to test") = -1.;
168
169 zap(argc, argv);
170 }
171 catch(const exception& error) {
172 FATAL(error.what() << endl);
173 }
174
175
176 JExperiment::setSNR(SNR);
177
180
181 for (const auto& i : setup) {
182
188
190
191 pi.nuisance = i.nuisance;
192
193 px.push_back(pi);
195
196 STATUS(printer(
"Signal for generation: ", pS) << endl);
197 STATUS(printer(
"Background for generation:", pB) << endl);
198 STATUS(printer(
"Signal for evaluation: ", ps) << endl);
199 STATUS(printer(
"Background for evaluation:", pb) << endl);
200 STATUS(printer(
"Data: ", pd) << endl);
201 STATUS(
"Nuisance: " << pi.nuisance << endl);
202 }
203
204 if (M != 0) {
206 }
207
208 if (add) {
210 }
211
212 const JRealExperiment::fit_type
result = rx();
213
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;
218 }
219
220 if (
debug >= debug_t) {
221
223
224 for (double x : rx) {
225
226 cout <<
SCIENTIFIC(12,3) << 1.0/
x << ((
n + 1)%10 == 0 ?
"\n" :
" ");
227
229 }
230 cout << endl;
231 }
232
233 cout << "result: "
236
237 if (numberOfTests != 0) {
238
239 const double Q = 0.9;
240
242
243 cout <<
"upper limit: " <<
FIXED(12,5) << mu << endl;
244 }
245}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
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 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.
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.