65 JParser<> zap(
"Example program to test 3D histogram.");
75 catch(
const exception &error) {
76 FATAL(error.what() << endl);
80 if (numberOfEvents <= 0) {
81 FATAL(
"No events." << endl);
87 typedef JMultiPDF<JPolint1Function1D_t,
88 JMAPLIST<JPolint1FunctionalMap,
89 JPolint1FunctionalMap>::maplist> JMultiPDF_t;
94 typedef JMAPLIST<JHistogramMap_t,
95 JHistogramMap_t>::maplist JMapList_t;
97 typedef JMultiHistogram<JHistogram1D_t, JMapList_t> JMultiHistogram_t;
100 JMultiHistogram_t histogram;
107 for (
int i = 0; i != numberOfEvents; ++i) {
110 STATUS(
"event: " << setw(10) << i <<
'\r');
DEBUG(endl);
113 const double x = gRandom->Gaus(0.0, 1.0);
114 const double y = gRandom->Gaus(0.0, 1.0);
115 const double z = gRandom->Gaus(0.0, 1.0);
116 const double w = 1.0;
118 histogram.fill(x, y, z, w);
122 histogram.div((
double) numberOfEvents);
127 JMultiPDF_t pdf(histogram);
129 JLANG::store<JIO::JFileStreamWriter>(
outputFile.c_str(), pdf);
131 catch(
const JException& error) {
132 FATAL(error.what() << endl);
137 if (inputFile !=
"") {
141 JLANG::load<JIO::JFileStreamReader>(inputFile.c_str(), pdf);
145 for (
int i = 0; i != numberOfEvents; ++i) {
147 const double x = gRandom->Gaus(0.0, 1.0);
148 const double y = gRandom->Gaus(0.0, 1.0);
149 const double z = gRandom->Gaus(0.0, 1.0);
153 const double u = g3 (x, y, z);
154 const double v = pdf(x, y, z);
158 catch(
const std::exception& error) {}
161 typedef JMultiFunction<JPolint1Function1D_t,
162 JMapList<JPolint1FunctionalMap,
163 JMapList<JPolint1FunctionalMap> > > JMultiFunction_t;
165 cout <<
"normalisation " <<
FIXED(5,3) <<
getIntegral(static_cast<const JMultiFunction_t&>(pdf)) << endl;
166 cout <<
"efficiency " <<
FIXED(5,3) << (double) Q.getCount() / (double) numberOfEvents << endl;
Utility class to parse command line options.
Auxiliary data structure for floating point format specification.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
T make_set(T __begin, T __end, JResult_t std::iterator_traits< T >::value_type::*value, const JComparator_t &comparator)
Method to exclude outliers from already sorted data.
#define DEBUG(A)
Message macros.