36 inline Double_t g2(
const Double_t x,
39 return (TMath::Gaus(x, 0.0, 1.0, kTRUE) *
40 TMath::Gaus(y, 0.0, 1.0, kTRUE));
53 inline Double_t g4(
const Double_t x0,
58 return g2(x2 - x0, x3 - x1);
69int main(
int argc,
char **argv)
81 JParser<> zap(
"Example program to test conditional probability density function.");
91 catch(
const exception &error) {
92 FATAL(error.what() << endl);
96 if (numberOfEvents <= 0) {
97 FATAL(
"No events." << endl);
103 const double xmin = -10.0;
104 const double xmax = +10.0;
115 JMultiHistogram_t histogram;
119 for (
double x0 = xmin; x0 <= xmax + 0.5*dx; x0 += dx) {
120 for (
double x1 = xmin; x1 <= xmax + 0.5*dx; x1 += dx) {
121 for (JGaussHermite::const_iterator x2 = bounds.begin(); x2 != bounds.end(); ++x2) {
122 for (JGaussHermite::const_iterator x3 = bounds.begin(); x3 != bounds.end(); ++x3) {
123 histogram[x0][x1][x0 + x2->getX()][x1 + x3->getX()] = 0.0;
131 JTimer timer(
"histogram");
133 for (
int i = 0; i != numberOfEvents; ++i) {
136 STATUS(
"event: " << setw(10) << i <<
'\r');
DEBUG(endl);
139 const double x0 = gRandom->Uniform(xmin, xmax);
140 const double x1 = gRandom->Uniform(xmin, xmax);
141 const double x2 = x0 + gRandom->Gaus(0.0, 1.0);
142 const double x3 = x1 + gRandom->Gaus(0.0, 1.0);
143 const double w = 1.0;
147 histogram.fill(x0, x1, x2, x3, w);
153 if (
debug >= status_t) {
154 timer.
print(cout,
true, micro_t);
171 if (inputFile !=
"") {
180 JMultiHistogram_t histogram;
184 NOTICE(
"loading input to file " << inputFile <<
"... " << flush);
203 JMultiFunction_t pdf(histogram);
210 for (
int i = 0; i != numberOfEvents; ++i) {
212 const double x0 = gRandom->Uniform(xmin, xmax);
213 const double x1 = gRandom->Uniform(xmin, xmax);
214 const double x2 = x0 + gRandom->Gaus(0.0, 1.0);
215 const double x3 = x1 + gRandom->Gaus(0.0, 1.0);
219 const double u = g4 (x0, x1, x2, x3);
220 const double v = pdf(x0, x1, x2, x3);
224 catch(
const std::exception& error) {}
230 for (JMultiFunction_t::super_const_iterator i = pdf.super_begin(); i != pdf.super_end(); ++i) {
231 V.
put(getIntegral((*i).getValue().getMultiFunction()));
234 cout <<
"normalisation "
237 cout <<
"efficiency "
238 <<
FIXED(5,3) << (double) Q.
getCount() / (double) numberOfEvents << endl;
General purpose messaging.
#define DEBUG(A)
Message macros.
int main(int argc, char **argv)
General methods for loading and storing a single object from and to a file, respectively.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
Auxiliary classes for numerical integration.
int numberOfBins
number of bins for average CDF integral of optical module
Auxiliary class for CPU timing and usage.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
void store(const std::string &file_name, const T &object)
Store object to output file.
void load(const std::string &file_name, T &object)
Load object from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Auxiliary data structure for floating point format specification.