Jpp
18.5.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
JGeometry3D
JGeometry3D/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 "
JGeometry3D/JQuaternion3D.hh
"
11
#include "
JGeometry3D/JEigen3D.hh
"
12
13
#include "
JTools/JQuantile.hh
"
14
15
#include "
Jeep/JParser.hh
"
16
#include "
Jeep/JMessage.hh
"
17
18
19
/**
20
* \file
21
*
22
* Example program to test Legendre polynome.
23
* \author mdejong
24
*/
25
int
main
(
int
argc,
char
**argv)
26
{
27
using namespace
std;
28
using namespace
JPP;
29
30
const
double
xmin
= -10.0;
31
const
double
xmax
= +10.0;
32
33
typedef
JLegendre<JQuaternion3D> JLegendre_t;
34
35
unsigned
int
numberOfEvents;
36
unsigned
int
numberOfBins
;
37
JLegendre_t
f1
(
xmin
,
xmax
);
38
int
debug
;
39
40
try
{
41
42
JParser<>
zap(
"Example program to test Legendre polynome."
);
43
44
zap[
'n'
] =
make_field
(numberOfEvents) = 0;
45
zap[
'N'
] =
make_field
(
numberOfBins
) = 10;
46
zap[
'L'
] =
make_field
(f1);
47
zap[
'd'
] =
make_field
(
debug
) = 3;
48
49
zap(argc, argv);
50
}
51
catch
(
const
exception &error) {
52
FATAL
(error.what() << endl);
53
}
54
55
56
for
(JLegendre_t::iterator
i
= f1.begin();
i
!= f1.end(); ++
i
) {
57
58
i
->normalise();
59
60
STATUS
(
"function: "
<< *
i
<< endl);
61
}
62
63
64
map<double, JQuaternion3D>
data
;
65
66
for
(
unsigned
int
i
= 0;
i
!=
numberOfBins
; ++
i
) {
67
68
const
double
x
=
xmin
+
i
* (
xmax
-
xmin
) / (
numberOfBins
- 1);
69
70
data
[
x
] =
f1
(x);
71
}
72
73
74
for
(
map<double, JQuaternion3D>::const_iterator
i
=
data
.begin();
i
!=
data
.end(); ++
i
) {
75
DEBUG
(
"data: "
76
<<
FIXED
(7,3) <<
i
->first <<
" "
77
<<
i
->second <<
"; "
78
<< 360.0 * acos(
i
->second.getA()) /
PI
<< endl);
79
}
80
81
82
const
size_t
N
= 2;
83
84
JLegendre<JQuaternion3D, N>
g1
(
data
.begin(),
data
.end());
85
86
for
(
size_t
n
= 0;
n
!=
N
+ 1; ++
n
) {
87
88
STATUS
(
"Legendre: "
<< setw(2) <<
n
<<
' '
<<
g1
[
n
]);
89
90
if
(n < f1.size()) {
91
STATUS
(
' '
<<
FIXED
(7,3) <<
getAngle
(f1[n],
g1
[n]));
92
}
93
94
STATUS
(endl);
95
}
96
97
98
if
(numberOfEvents > 0) {
99
100
JQuantile
Q
;
101
102
for
(
unsigned
int
i
= 0;
i
!= numberOfEvents; ++
i
) {
103
104
const
double
x
= gRandom->Uniform(
xmin
,
xmax
);
105
const
JQuaternion3D
y
=
f1
(x);
106
const
JQuaternion3D z =
g1
(x);
107
108
Q.put(
getAngle
(y,z));
109
}
110
111
Q.print(cout);
112
}
113
114
return
0;
115
}
GAUSS_LEGENDRE::xmax
const double xmax
Definition:
JQuadrature.cc:24
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
JGEOMETRY3D::getAngle
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions.
Definition:
JQuaternion3D.hh:1165
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:786
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
JQuaternion3D.hh
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
JMATH::PI
static const double PI
Mathematical constants.
Definition:
JMath/JConstants.hh:20
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
JEigen3D.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