Jpp
Functions | Variables
JResultPDF.cc File Reference
#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

◆ main()

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 }

Variable Documentation

◆ numberOfPoints

int numberOfPoints

Definition at line 22 of file JResultPDF.cc.

◆ quadrature

bool quadrature

Definition at line 23 of file JResultPDF.cc.

◆ debug

int debug

debug level

Definition at line 24 of file JResultPDF.cc.

quadrature
bool quadrature
Definition: JResultPDF.cc:23
numberOfPoints
int numberOfPoints
Definition: JResultPDF.cc:22
g1
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
debug
int debug
debug level
Definition: JResultPDF.cc:24
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
G1
Double_t G1(const Double_t x)
Integral of method g1.
Definition: JQuantiles.cc:37
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37