54{
57
58 string inputFile;
60 int numberOfEvents;
63
64 try {
65
66 JParser<> zap(
"Example program to test 3D histogram.");
67
73
74 zap(argc, argv);
75 }
76 catch(const exception &error) {
77 FATAL(error.what() << endl);
78 }
79
80
81 if (numberOfEvents <= 0) {
82 FATAL(
"No events." << endl);
83 }
84
88
89
91
94
96
97
98 JMultiHistogram_t histogram;
99
101
102
103
104
105 for (int i = 0; i != numberOfEvents; ++i) {
106
107 if (i%1000 == 0) {
108 STATUS(
"event: " << setw(10) << i <<
'\r');
DEBUG(endl);
109 }
110
111 const double x = gRandom->Gaus(0.0, 1.0);
112 const double y = gRandom->Gaus(0.0, 1.0);
113 const double z = gRandom->Gaus(0.0, 1.0);
114 const double w = 1.0;
115
116 histogram.fill(x, y, z, w);
117 }
119
120 histogram.div((double) numberOfEvents);
121
122
123 try {
124
125 JMultiPDF_t pdf(histogram);
126
128 }
131 }
132 }
133
134
135 if (inputFile != "") {
136
137 JMultiPDF_t pdf;
138
140
142
143 for (int i = 0; i != numberOfEvents; ++i) {
144
145 const double x = gRandom->Gaus(0.0, 1.0);
146 const double y = gRandom->Gaus(0.0, 1.0);
147 const double z = gRandom->Gaus(0.0, 1.0);
148
149 try {
150
151 const double u = g3 (x, y, z);
152 const double v = pdf(x, y, z);
153
155 }
156 catch(const std::exception& error) {}
157 }
158
162
163 cout <<
"normalisation " <<
FIXED(5,3) <<
getIntegral(
static_cast<const JMultiFunction_t&
>(pdf)) << endl;
164 cout <<
"efficiency " <<
FIXED(5,3) << (double) Q.
getCount() / (double) numberOfEvents << endl;
165
167 }
168}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int numberOfBins
number of bins for average CDF integral of optical module
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
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.
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.