Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
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
 

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
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}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Double_t g1(const Double_t x)
Function.
Definition JQuantiles.cc:25
Double_t G1(const Double_t x)
Integral of method g1.
Definition JQuantiles.cc:37
int numberOfPoints
Definition JResultPDF.cc:22
bool quadrature
Definition JResultPDF.cc:23
int debug
debug level
Definition JResultPDF.cc:24
Utility class to parse command line options.
Definition JParser.hh:1698
General purpose class for collection of elements, see: <a href="JTools.PDF";>Collection of elements....
Definition JSet.hh:22
Template class for polynomial interpolation in 1D.
Definition JPolint.hh:1095
const JPolynome f1(1.0, 2.0, 3.0)
Function.
const double xmax
const double xmin
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Data structure for result including value, first derivative and integrals of function.
Definition JResult.hh:339
Type definition of a spline interpolation method based on a JCollection with JResultPDF result type.

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.