54{
56
57 string inputFile;
59 int numberOfEvents;
62
63 try {
64
65 JParser<> zap(
"Example program to test 3D histogram.");
66
72
73 zap(argc, argv);
74 }
75 catch(const exception &error) {
76 FATAL(error.what() << endl);
77 }
78
79
80 if (numberOfEvents <= 0) {
81 FATAL(
"No events." << endl);
82 }
83
85
86
90
91
93
96
98
99
100 JMultiHistogram_t histogram;
101
103
104
105
106
107 for (int i = 0; i != numberOfEvents; ++i) {
108
109 if (i%1000 == 0) {
110 STATUS(
"event: " << setw(10) << i <<
'\r');
DEBUG(endl);
111 }
112
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;
117
118 histogram.fill(x, y, z, w);
119 }
121
122 histogram.div((double) numberOfEvents);
123
124
125 try {
126
127 JMultiPDF_t pdf(histogram);
128
130 }
133 }
134 }
135
136
137 if (inputFile != "") {
138
139 JMultiPDF_t pdf;
140
142
144
145 for (int i = 0; i != numberOfEvents; ++i) {
146
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);
150
151 try {
152
153 const double u = g3 (x, y, z);
154 const double v = pdf(x, y, z);
155
157 }
158 catch(const std::exception& error) {}
159 }
160
164
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;
167
169 }
170}
#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.