31 int do_main(
int argc,
char **argv)
36 unsigned int numberOfEvents;
42 JParser<> zap(
"Example program to test 1D interpolation of a polynome.");
50 catch(
const exception &error) {
51 FATAL(error.what() << endl);
55 FATAL(
"Number of degrees " <<
N <<
" < 1." << endl);
65 for (
int i = 1; i !=
N + 1; ++i) {
66 f1.push_back(f1.rbegin()->getDerivative());
70 typedef JResultPolynome<N, double> JResult_t;
71 typedef JPolintFunction1D<N, JElement2D<double, double>, JCollection, JResult_t> JFunction1D_t;
75 const double xmin = 0.0;
76 const double xmax =
PI;
79 const double dx = 0.0 *
PI;
81 const JGrid<double> grid(
numberOfBins + 1, xmin - dx, xmax + dx);
83 polint.configure(grid, f1[0]);
87 polint.setExceptionHandler(
new typename JFunction1D_t::JDefaultResult(
JMATH::zero));
90 if (numberOfEvents != 0) {
94 for (
int i = 0; i !=
sizeof(
Q)/
sizeof(Q[0]); ++i) {
100 Q[i].setTitle(os.str());
103 for (
unsigned int i = 0; i != numberOfEvents; ++i) {
105 const double x = gRandom->Uniform(xmin, xmax);
106 const JResult_t
result = polint(x);
108 for (
int i = 0; i !=
sizeof(
Q)/
sizeof(Q[0]); ++i) {
109 Q[i].put(f1[i](x) - result.y[i]);
113 cout <<
"\nInterpolation with " <<
N <<
" degrees polynomial:" << endl;
115 for (
int i = 0; i !=
sizeof(
Q)/
sizeof(Q[0]); ++i) {
116 Q[i].print(cout, i == 0);
130 int main(
int argc,
char **argv)
132 if (do_main<2>(argc, argv) != 0) {
return 1; }
133 if (do_main<3>(argc, argv) != 0) {
return 1; }
134 if (do_main<4>(argc, argv) != 0) {
return 1; }
135 if (do_main<5>(argc, argv) != 0) {
return 1; }
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
static const JZero zero
Function object to assign zero value.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const double PI
Mathematical constants.
General purpose messaging.
Utility class to parse command line options.
int numberOfBins
number of bins for average CDF integral of optical module