35 inline Double_t f1(
const Double_t
x)
37 return TMath::Gaus(x, 0.0, 1.0, kTRUE);
47 inline Double_t
g1(
const Double_t x)
59 inline Double_t
G1(
const Double_t x)
61 return 0.5 * (1.0 + TMath::Erf(sqrt(0.5)*x));
68 template<
class JFunction1D_t>
69 void test(
const char* title)
76 const double xmin = -3.5;
77 const double xmax = +3.5;
86 TH1D f0(TString(
"f0[") + title +
"]", NULL, nx, xmin, xmax);
87 TH1D g0(TString(
"g0[") + title +
"]", NULL, nx, xmin, xmax);
88 TH1D G0(TString(
"G0[") + title +
"]", NULL, nx, xmin, xmax);
90 for (
int i = 1; i <= f0.GetNbinsX(); ++i) {
92 const Double_t x = f0.GetBinCenter(i);
96 const typename JFunction1D_t::result_type
result = buffer(x);
98 f0.SetBinContent(i, result.f);
99 g0.SetBinContent(i, result.fp);
100 G0.SetBinContent(i, result.v);
102 catch(
const std::exception& error) {
119 int main(
int argc,
char **argv)
128 JParser<> zap(
"Example program to test interpolations for PDF.");
137 catch(
const exception &error) {
138 FATAL(error.what() << endl);
145 const double xmin = -3.5;
146 const double xmax = +3.5;
148 TH1D f0(TString(
"f0[") +
"true" +
"]", NULL, nx, xmin, xmax);
149 TH1D g0(TString(
"g0[") +
"true" +
"]", NULL, nx, xmin, xmax);
150 TH1D G0(TString(
"G0[") +
"true" +
"]", NULL, nx, xmin, xmax);
152 for (
int i = 1; i <= f0.GetNbinsX(); ++i) {
154 const Double_t
x = f0.GetBinCenter(i);
156 f0.SetBinContent(i, f1(x));
157 g0.SetBinContent(i,
g1(x));
158 G0.SetBinContent(i,
G1(x));
164 typedef JPolintFunction1D<N, JPolintElement2S<double, double>, JCollection, JResultPDF<double> > JFunction1D_t;
166 test<JFunction1D_t>(
"Polint");
170 typedef JSplineFunction1S_t JFunction1D_t;
172 test<JFunction1D_t>(
"Spline");
Utility class to parse command line options.
int main(int argc, char *argv[])
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Double_t G1(const Double_t x)
Integral of method g1.
#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.
Double_t g1(const Double_t x)
Function.