Jpp
17.3.1
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
JTools
JSphere3D.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
JTools/JMapList.hh
"
6
#include "
JTools/JFunction1D_t.hh
"
7
#include "
JTools/JFunctionalMap_t.hh
"
8
#include "
JTools/JMultiFunction.hh
"
9
#include "
JTools/JToolsToolkit.hh
"
10
#include "
JTools/JFunctionalMap.hh
"
11
12
#include "
Jeep/JPrint.hh
"
13
#include "
Jeep/JParser.hh
"
14
#include "
Jeep/JMessage.hh
"
15
16
17
/**
18
* \file
19
*
20
* Example program to test 3D integration of sphere.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
24
{
25
using namespace
std;
26
27
unsigned
int
numberOfBins
;
28
int
debug
;
29
30
try
{
31
32
JParser<>
zap(
"Example program to test 3D integration of sphere."
);
33
34
zap[
'N'
] =
make_field
(
numberOfBins
) = 101;
35
zap[
'd'
] =
make_field
(
debug
) = 3;
36
37
zap(argc, argv);
38
}
39
catch
(
const
exception &error) {
40
FATAL
(error.what() << endl);
41
}
42
43
44
using namespace
JPP;
45
46
47
const
double
R
= 1.0;
48
49
typedef
JGridPolint3Function1D_t JFunction1D_t;
50
typedef
JMapList<JPolint3FunctionalGridMap> JMaplist_t;
51
typedef
JMultiFunction<JFunction1D_t, JMaplist_t> JMultiFunction_t;
52
53
54
JMultiFunction_t ga;
55
JMultiFunction_t gb;
56
57
const
double
xmin
= -
R
* 1.05;
58
const
double
xmax
= +
R
* 1.05;
59
const
double
dx = (
xmax
-
xmin
) / (
numberOfBins
- 1);
60
61
for
(
double
x
=
xmin
;
x
<
xmax
+ 0.5*dx;
x
+= dx) {
62
for
(
double
y =
xmin
; y <
xmax
+ 0.5*dx; y += dx) {
63
64
const
double
z =
R
*
R
-
x
*
x
- y*y;
65
66
if
(z > 0.0) {
67
ga[
x
][y] = -sqrt(z);
68
gb[
x
][y] = +sqrt(z);
69
}
else
{
70
ga[
x
][y] = 0.0;
71
gb[
x
][y] = 0.0;
72
}
73
}
74
}
75
76
ga.compile();
77
gb.compile();
78
79
cout <<
"Volume (real) "
<<
SCIENTIFIC
(12,4) << 4.0*
PI
*
R
*
R
*
R
/3.0 << endl;
80
cout <<
"Volume (calc) "
<<
SCIENTIFIC
(12,4) <<
getIntegral
(gb) -
getIntegral
(ga) << endl;
81
}
GAUSS_LEGENDRE::xmax
const double xmax
Definition:
JQuadrature.cc:24
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1517
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
x
then chmod x
Definition:
JEvtReweightMupageParameterScan.sh:413
JFunctionalMap_t.hh
Various implementations of functional maps.
JFunction1D_t.hh
JPrint.hh
I/O formatting auxiliaries.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1993
JToolsToolkit.hh
This include file contains various recursive methods to operate on multi-dimensional collections...
JMATH::PI
static const double PI
Mathematical constants.
Definition:
JMath/JConstants.hh:20
JFunctionalMap.hh
JMessage.hh
General purpose messaging.
JMapList.hh
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
R
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition:
JDataQuality.sh:41
GAUSS_LEGENDRE::xmin
const double xmin
Definition:
JQuadrature.cc:23
JParser.hh
Utility class to parse command line options.
SCIENTIFIC
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:484
numberOfBins
int numberOfBins
number of bins for average CDF integral of optical module
Definition:
JSirene.cc:69
JMultiFunction.hh
JTOOLS::getIntegral
JContainer_t::ordinate_type getIntegral(const JContainer_t &input)
Get integral of input data points.
Definition:
JToolsToolkit.hh:133
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5