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);
69 int 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;
111 JMAPLIST<JHistogramGridMap_t,
113 JHistogramMap_t>::maplist> JMultiHistogram_t;
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);
154 timer.print(cout,
true,
micro_t);
161 JLANG::store<JIO::JFileStreamWriter>(
outputFile.c_str(), histogram);
165 catch(
const JException& error) {
166 FATAL(error.what() << endl);
171 if (inputFile !=
"") {
174 JMAPLIST<JHistogramMap_t>::maplist> JHistogram2D_t;
176 typedef JMultiHistogram<JHistogram2D_t,
177 JMAPLIST<JHistogramGridMap_t,
178 JHistogramGridMap_t>::maplist> JMultiHistogram_t;
180 JMultiHistogram_t histogram;
184 NOTICE(
"loading input to file " << inputFile <<
"... " << flush);
186 JLANG::load<JIO::JFileStreamReader>(inputFile.c_str(), histogram);
190 catch(
const JException& error) {
191 FATAL(error.what() << endl);
195 typedef JMultiPDF<JPolint1Function1D_t,
196 JMAPLIST<JPolint1FunctionalMap>::maplist> JFunction2D_t;
198 typedef JMultiFunction<JFunction2D_t,
199 JMAPLIST<JPolint1FunctionalGridMap,
200 JPolint1FunctionalGridMap>::maplist> JMultiFunction_t;
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 "
235 <<
FIXED(6,4) << V.getMean() <<
" +/- "
236 <<
FIXED(6,4) << V.getSTDev() << endl;
237 cout <<
"efficiency "
238 <<
FIXED(5,3) << (double) Q.getCount() / (double) numberOfEvents << endl;
240 cout <<
"mean " <<
SCIENTIFIC(10,2) << Q.getMean() << endl;
241 cout <<
"RMS " <<
SCIENTIFIC(10,2) << Q.getSTDev() << endl;
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Auxiliary classes for numerical integration.
Utility class to parse command line options.
General methods for loading and storing a single object from and to a file, respectively.
Auxiliary data structure for floating point format specification.
int numberOfBins
number of bins for average CDF integral of optical module
#define DEBUG(A)
Message macros.