136{
139
141
144 size_t numberOfTests;
145 size_t M;
146 double SNR;
147 histogram_type X;
149 double precision;
151
152 try {
153
155
157
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;
170
171 zap(argc, argv);
172 }
173 catch(const exception& error) {
174 FATAL(error.what() << endl);
175 }
176
177
178 seed.set(gRandom);
179
180 JExperiment::setSNR(SNR);
181
182 const double Q = 0.9;
183
185
186 for (const auto& i : setup) {
187
192
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);
197
199
200 pi.nuisance = i.nuisance;
201
202 px.push_back(pi);
203 }
204
205 if (M != 0) {
207 }
208
211 STATUS(
"Number of tests: " << setw(10) << numberOfTests << endl);
212
213
215
216 out << *gRandom;
217
218 TH1D h0("h0", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
219 TH1D h1("h1", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
220
221
222
223
225
226 for (size_t i = 0; i != numberOfTests; ++i) {
227
229
231
232 h0.Fill(aspera(true).signal);
233 }
234
235
237
238 for (size_t i = 0; i != numberOfTests; ++i) {
239
240 if ((i*10) < numberOfTests || (i*10)%numberOfTests == 0) {
242 }
243
245
247
249
251 }
253
254 for (const double x : mu_up) {
255 h1.Fill(x);
256 }
257
258 sort(mu_up.begin(), mu_up.end());
259
260 cout <<
"<mu> " <<
FIXED(7,3) << mu_up[mu_up.size() / 2] << endl;
261
262 out.Write();
263 out.Close();
264}
#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.
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.
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.