32 inline Double_t
g1(
const Double_t x)
34 return TMath::Gaus(x, 0.0, 1.0, kTRUE);
44 inline Double_t
G1(
const Double_t x)
46 return 0.5 * (1.0 + TMath::Erf(sqrt(0.5)*x));
57int main(
int argc,
char **argv)
71 JParser<> zap(
"Example program to test 1D histogram.");
82 catch(
const exception &error) {
83 FATAL(error.what() << endl);
87 if (numberOfEvents <= 0) {
88 FATAL(
"No events." << endl);
92 const Int_t nx = 1000;
93 const Double_t xmin = -5.0;
94 const Double_t xmax = +5.0;
105 histogram.configure(make_grid(
numberOfBins, xmin, xmax));
112 for (
int i = 0; i != numberOfEvents; ++i) {
113 histogram.
fill(gRandom->Gaus(0.0, 1.0), 1.0);
116 histogram.
div((
double) numberOfEvents);
127 integrate(histogram, F1);
134 makePDF(histogram, f1);
138 f1.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
139 F1.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
144 TH1D h0(
"h0", NULL, nx, xmin, xmax);
145 TH1D h1(
"h1", NULL, nx, xmin, xmax);
146 TH1D h2(
"h2", NULL, nx, xmin, xmax);
148 TH1D i0(
"i0", NULL, nx, xmin, xmax);
149 TH1D i1(
"i1", NULL, nx, xmin, xmax);
151 for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
153 const Double_t x = h0.GetBinCenter(i);
155 h0.SetBinContent(i,
g1(x));
156 i0.SetBinContent(i,
G1(x));
159 h1.SetBinContent(i, get_value(F1(x).fp));
160 h2.SetBinContent(i, get_value(f1(x)));
161 i1.SetBinContent(i, get_value(F1(x)));
163 catch(
const exception& error) {
164 ERROR(error.what() << endl);
General purpose class for a collection of sorted elements.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary classes for numerical integration.
Double_t g1(const Double_t x)
Function.
Double_t G1(const Double_t x)
Integral of method g1.
int numberOfBins
number of bins for average CDF integral of optical module
Utility class to parse command line options.
static const JZero zero
Function object to assign zero value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).