Jpp
18.0.1-rc.2
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JMath
JMath/JLegendre.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "TRandom3.h"
6
7
#include "
JMath/JLegendre.hh
"
8
#include "
JMath/JMathSupportkit.hh
"
9
10
#include "
JTools/JQuantile.hh
"
11
12
#include "
Jeep/JParser.hh
"
13
#include "
Jeep/JMessage.hh
"
14
15
16
/**
17
* \file
18
*
19
* Example program to test Legendre polynome.
20
* \author mdejong
21
*/
22
int
main
(
int
argc,
char
**argv)
23
{
24
using namespace
std;
25
using namespace
JPP;
26
27
const
double
xmin
= -10.0;
28
const
double
xmax
= +10.0;
29
30
typedef
JLegendre<double> JLegendre_t;
31
32
unsigned
int
numberOfEvents;
33
unsigned
int
numberOfBins
;
34
JLegendre_t
f1
(
xmin
,
xmax
);
35
int
debug
;
36
37
try
{
38
39
JParser<>
zap(
"Example program to test Legendre polynome."
);
40
41
zap[
'n'
] =
make_field
(numberOfEvents) = 0;
42
zap[
'N'
] =
make_field
(
numberOfBins
) = 10;
43
zap[
'L'
] =
make_field
(f1);
44
zap[
'd'
] =
make_field
(
debug
) = 3;
45
46
zap(argc, argv);
47
}
48
catch
(
const
exception &error) {
49
FATAL
(error.what() << endl);
50
}
51
52
53
map<double, double>
data
;
54
55
for
(
unsigned
int
i
= 0;
i
!=
numberOfBins
; ++
i
) {
56
57
const
double
x
=
xmin
+
i
* (
xmax
-
xmin
) / (
numberOfBins
- 1);
58
59
data
[
x
] =
f1
(x);
60
}
61
62
for
(
map<double, double>::const_iterator
i
=
data
.begin();
i
!=
data
.end(); ++
i
) {
63
DEBUG
(
"data: "
<<
FIXED
(7,3) <<
i
->first <<
' '
<<
FIXED
(7,3) <<
i
->second << endl);
64
}
65
66
67
const
size_t
N
= 3;
68
69
JLegendre<double, N>
g1
(
data
.begin(),
data
.end());
70
71
for
(
size_t
n
= 0;
n
!=
N
+ 1; ++
n
) {
72
STATUS
(
"Legendre: "
<< setw(2) <<
n
<<
' '
<<
FIXED
(7,3) <<
g1
[
n
] << endl);
73
}
74
75
if
(numberOfEvents > 0) {
76
77
JQuantile
Q
;
78
79
for
(
unsigned
int
i
= 0;
i
!= numberOfEvents; ++
i
) {
80
81
const
double
x
= gRandom->Uniform(
xmin
,
xmax
);
82
const
double
y
=
f1
(x);
83
const
double
z =
g1
(x);
84
85
Q.put(y - z);
86
}
87
88
Q.print(cout);
89
}
90
91
return
0;
92
}
GAUSS_LEGENDRE::xmax
const double xmax
Definition:
JQuadrature.cc:24
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
i
then rm i
Definition:
JEvtReweightGSeaGenParameterScan.sh:337
Q
Q(UTCMax_s-UTCMin_s)-livetime_s
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JMathSupportkit.hh
Auxiliary methods for mathematics.
std::map
Definition:
JSTDTypes.hh:16
STATUS
#define STATUS(A)
Definition:
JMessage.hh:63
JLegendre.hh
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:446
GAUSS_LEGENDRE::f1
const JPolynome f1(1.0, 2.0, 3.0)
Function.
JTOOLS::n
const int n
Definition:
JPolint.hh:697
makedeclinationtable.x
tuple x
Definition:
makedeclinationtable.py:44
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
makedeclinationtable.y
tuple y
Definition:
makedeclinationtable.py:51
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
GAUSS_LEGENDRE::xmin
const double xmin
Definition:
JQuadrature.cc:23
N
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition:
JMuonPostfit.sh:40
JParser.hh
Utility class to parse command line options.
JQuantile.hh
applications.data
tuple data
Definition:
applications.py:8
numberOfBins
int numberOfBins
number of bins for average CDF integral of optical module
Definition:
JSirene.cc:69
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
g1
Double_t g1(const Double_t x)
Function.
Definition:
JQuantiles.cc:25
Generated by
1.8.5