CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
GenericFunctions
src
PhaseSpace.cc
Go to the documentation of this file.
1
#include "
CLHEP/GenericFunctions/PhaseSpace.hh
"
2
#include <vector>
3
4
// Three classes are defined here:
5
6
// 1) Classical::PhaseSpace::Component::Clockwork
7
// 2) Classical::PhaseSpace::Component
8
// 2) Classical::PhaseSpace
9
10
11
namespace
Classical
{
12
13
//------------------------------------------------//
14
// //
15
// 1. Classical::PhaseSpace::Component::Clockwork //
16
// This class just holds variables: //
17
// //
18
//------------------------------------------------//
19
class
PhaseSpace::Component::Clockwork
{
20
21
public
:
22
23
// Constructor:
24
Clockwork
(){};
25
26
// Destructor
27
~Clockwork
() {
for
(
size_t
i
=0;
i
<
functions
.size();
i
++)
delete
functions
[
i
];}
28
29
//
30
std::vector<const Genfun::Variable *>
functions
;
31
32
};
33
34
//------------------------------------------------//
35
// //
36
// 2. Classical::PhaseSpace::Component //
37
// This class gives access to the variables that //
38
// make up the coordinates and momenta. //
39
// //
40
//------------------------------------------------//
41
42
PhaseSpace::Component::Component(
unsigned
int
NDIM,
bool
isMomenta) : c(new
Clockwork
()) {
43
for
(
unsigned
int
i
=0;
i
<NDIM;
i
++) {
44
int
offset= isMomenta ? NDIM:0;
45
c->functions.push_back(
new
Genfun::Variable
(
i
+offset, 2*NDIM));
46
}
47
}
48
49
PhaseSpace::Component::~Component() {
50
delete
c;
51
}
52
53
Genfun::Variable
PhaseSpace::Component::operator[]
(
unsigned
int
i
)
const
{
54
return
*(c->
functions
[
i
]);
55
}
56
57
PhaseSpace::PhaseSpace
(
unsigned
int
NDIM):
58
_coordinates(NDIM,false),_momenta(NDIM,true),_q0(NDIM),_p0(NDIM),DIM(NDIM)
59
{
60
}
61
62
PhaseSpace::~PhaseSpace
()
63
{
64
}
65
66
const
PhaseSpace::Component
&
PhaseSpace::coordinates
()
const
{
67
return
_coordinates;
68
}
69
70
const
PhaseSpace::Component
&
PhaseSpace::momenta
()
const
{
71
return
_momenta;
72
}
73
74
75
void
PhaseSpace::start
(
const
Genfun::Variable
&
v
,
double
value){
76
unsigned
int
index =
v
.index();
77
if
(index<DIM) {
78
_q0[index] = value;
79
}
80
else
81
{
82
_p0[index-DIM] = value;
83
}
84
}
85
86
87
double
PhaseSpace::startValue
(
const
Genfun::Variable
&
v
)
const
{
88
unsigned
int
index =
v
.index();
89
if
(index<DIM) {
90
return
_q0[index];
91
}
92
else
93
{
94
return
_p0[index-DIM];
95
}
96
}
97
98
unsigned
int
PhaseSpace::dim
()
const
{
99
return
DIM;
100
}
101
}
Classical::PhaseSpace::Component::Clockwork::~Clockwork
~Clockwork()
Definition:
PhaseSpace.cc:27
Classical::PhaseSpace::momenta
const Component & momenta() const
Definition:
PhaseSpace.cc:70
Genfun::Variable
Definition:
CLHEP/GenericFunctions/Variable.hh:19
Classical::PhaseSpace::Component
Definition:
CLHEP/GenericFunctions/PhaseSpace.hh:48
Classical::PhaseSpace::Component::Clockwork::Clockwork
Clockwork()
Definition:
PhaseSpace.cc:24
Classical::PhaseSpace::start
void start(const Genfun::Variable &variable, double value)
Definition:
PhaseSpace.cc:75
PhaseSpace.hh
Classical::PhaseSpace::PhaseSpace
PhaseSpace(unsigned int NDIM)
Definition:
PhaseSpace.cc:57
v
they are gone ZOOM Features Discontinued The following features of the ZOOM package were felt to be extreme overkill These have been after checking that no existing user code was utilizing as in SpaceVector v
Definition:
keyMergeIssues.doc:324
Classical
Definition:
CLHEP/GenericFunctions/ClassicalSolver.hh:23
Classical::PhaseSpace::~PhaseSpace
~PhaseSpace()
Definition:
PhaseSpace.cc:62
Classical::PhaseSpace::Component::operator[]
Genfun::Variable operator[](unsigned int i) const
Definition:
PhaseSpace.cc:53
Classical::PhaseSpace::Component::Clockwork
Definition:
PhaseSpace.cc:19
i
long i
Definition:
JamesRandomSeeding.txt:27
Classical::PhaseSpace::dim
unsigned int dim() const
Definition:
PhaseSpace.cc:98
Classical::PhaseSpace::coordinates
const Component & coordinates() const
Definition:
PhaseSpace.cc:66
Classical::PhaseSpace::Component::Clockwork::functions
std::vector< const Genfun::Variable * > functions
Definition:
PhaseSpace.cc:30
Classical::PhaseSpace::startValue
double startValue(const Genfun::Variable &component) const
Definition:
PhaseSpace.cc:87
Generated by
1.8.17