128{
131
133
136 size_t numberOfTests;
137 double boost;
138 size_t M;
139 double SNR;
140 histogram_type X;
142 double precision;
144
145 try {
146
148
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;
161
162 zap(argc, argv);
163 }
164 catch(const exception& error) {
165 FATAL(error.what() << endl);
166 }
167
168
169 seed.set(gRandom);
170
171 JExperiment::setSNR(SNR);
172
173 const double Q = 0.9;
174
176
177 for (const auto& i : setup) {
178
181
182 dynamic_cast<TH1*>(ps)->Scale(boost);
183 dynamic_cast<TH1*>(pb)->Scale(boost);
184
185 STATUS(printer(
"Signal:", ps) << endl);
186 STATUS(printer(
"Background:", pb) << endl);
187
189 }
190
191 if (M != 0) {
193 }
194
197 STATUS(
"Number of tests: " << setw(10) << numberOfTests << endl);
198
200 FATAL(
"No background." << endl);
201 }
202
203
205
206 out << *gRandom;
207
208 TH1D h0("h0", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
209 TH1D h1("h1", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
210
211
212
213
215
216 for (size_t i = 0; i != numberOfTests; ++i) {
217
219
221
222 h0.Fill(aspera(true).signal);
223 }
224
225
227
228 for (size_t i = 0; i != numberOfTests; ++i) {
229
230 if ((i*10) < numberOfTests || (i*10)%numberOfTests == 0) {
232 }
233
235
237
239
241 }
243
244 for (const double x : mu_up) {
245 h1.Fill(x);
246 }
247
248 sort(mu_up.begin(), mu_up.end());
249
250 cout <<
"<mu> " <<
FIXED(7,3) << mu_up[mu_up.size() / 2] << endl;
251
252 out.Write();
253 out.Close();
254}
#define DEBUG(A)
Message macros.
#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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
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.