Jpp  17.3.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
JResultPDF.cc File Reference

Example program to test interpolations for PDF. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TMath.h"
#include "TString.h"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JQuadrature.hh"
#include "JTools/JGrid.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

int numberOfPoints
 
bool quadrature
 
int debug
 debug level More...
 

Detailed Description

Example program to test interpolations for PDF.

Author
mdejong

Definition in file JResultPDF.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 119 of file JResultPDF.cc.

120 {
121  using namespace std;
122  using namespace JPP;
123 
124  string outputFile;
125 
126  try {
127 
128  JParser<> zap("Example program to test interpolations for PDF.");
129 
130  zap['o'] = make_field(outputFile);
131  zap['N'] = make_field(numberOfPoints) = 15;
132  zap['Q'] = make_field(quadrature);
133  zap['d'] = make_field(debug) = 3;
134 
135  zap(argc, argv);
136  }
137  catch(const exception &error) {
138  FATAL(error.what() << endl);
139  }
140 
141 
142  TFile out(outputFile.c_str(), "recreate");
143 
144  const int nx = 1000;
145  const double xmin = -3.5;
146  const double xmax = +3.5;
147 
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);
151 
152  for (int i = 1; i <= f0.GetNbinsX(); ++i) {
153 
154  const Double_t x = f0.GetBinCenter(i);
155 
156  f0.SetBinContent(i, f1(x));
157  g0.SetBinContent(i, g1(x));
158  G0.SetBinContent(i, G1(x));
159  }
160 
161  {
162  const int N = 4;
163 
164  typedef JPolintFunction1D<N, JPolintElement2S<double, double>, JCollection, JResultPDF<double> > JFunction1D_t;
165 
166  test<JFunction1D_t>("Polint");
167  }
168 
169  {
170  typedef JSplineFunction1S_t JFunction1D_t;
171 
172  test<JFunction1D_t>("Spline");
173  }
174 
175  out.Write();
176  out.Close();
177 }
const double xmax
Definition: JQuadrature.cc:24
Utility class to parse command line options.
Definition: JParser.hh:1517
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
string outputFile
bool quadrature
Definition: JResultPDF.cc:23
const JPolynome f1(1.0, 2.0, 3.0)
Function.
Double_t G1(const Double_t x)
Integral of method g1.
Definition: JQuantiles.cc:37
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define FATAL(A)
Definition: JMessage.hh:67
const double xmin
Definition: JQuadrature.cc:23
int numberOfPoints
Definition: JResultPDF.cc:22
int debug
debug level
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25

Variable Documentation

int numberOfPoints

Definition at line 22 of file JResultPDF.cc.

bool quadrature

Definition at line 23 of file JResultPDF.cc.

int debug

debug level

Definition at line 24 of file JResultPDF.cc.