Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JRealExperiment.cc File Reference

Test application for pseudo experiment generation and likelihood ratio evaluations. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <exception>
#include <algorithm>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TH3D.h"
#include "TRandom3.h"
#include "JAstronomy/JRealExperiment.hh"
#include "JGizmo/JGizmoToolkit.hh"
#include "Jeep/JParser.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Test application for pseudo experiment generation and likelihood ratio evaluations.

Author
mdejong

Definition in file JRealExperiment.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 119 of file JRealExperiment.cc.

120{
121 using namespace std;
122 using namespace JPP;
123
125 int debug;
126
127 try {
128
129 JParser<> zap;
130
131 zap['E'] = make_field(setup,
132 "triplets of data, signal and background histograms, "\
133 "each of which defined by <file name>:<histogram name>");
134 zap['d'] = make_field(debug) = 1;
135
136 zap(argc, argv);
137 }
138 catch(const exception& error) {
139 FATAL(error.what() << endl);
140 }
141
142
144
145 for (const auto& i : setup) {
146
147 const TObject* pd = getObject(i.Hd);
148 const TObject* ps = getObject(i.Hs);
149 const TObject* pb = getObject(i.Hb);
150
151 STATUS(printer("Data:", pd) << endl);
152 STATUS(printer("Signal:", ps) << endl);
153 STATUS(printer("Background:", pb) << endl);
154
155 rx.add(pd, ps, pb);
156 }
157
158
159 const JRealExperiment::fit_type result = rx();
160
161
162 cout << "signal: " << FIXED(9,3) << rx.getSignal() << "/" << setw(6) << rx.size() << endl;
163 cout << "derivative: " << FIXED(9,3) << rx.getDerivative(0.0) << endl;
164
165 if (debug >= debug_t) {
166
167 size_t n = 0;
168
169 for (double x : rx) {
170
171 cout << SCIENTIFIC(12,3) << 1.0/x << ((n + 1)%10 == 0 ? "\n" : " ");
172
173 n += 1;
174 }
175 cout << endl;
176 }
177
178 cout << "result: "
179 << FIXED(12,5) << result.likelihood << ' '
180 << FIXED(12,5) << result.signal << endl;
181}
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const int n
Definition JPolint.hh:791
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
double getSignal() const
Get total signal strength.
Definition JAspera.hh:198
double getDerivative(const double p) const
Get derivative of likelihood for given signal strength.
Definition JAspera.hh:99
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 data structure for floating point format specification.
Definition JManip.hh:488