CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Fields
src
XF.cc
Go to the documentation of this file.
1
#include "CLHEP/Fields/XF.h"
2
#include <assert.h>
3
#include <iostream>
4
namespace
XF
5
{
6
7
8
9
//------------------------------------------------------------------//
10
// //
11
// Implementation of Function //
12
// //
13
//------------------------------------------------------------------//
14
15
Function::Function
()
16
{
17
}
18
19
Function::~Function ()
20
{
21
}
22
23
Product
operator *
(
const
Function
&
a
,
const
Function
&
b
)
24
{
25
return
Product
(&
a
, &
b
);
26
}
27
28
PreMult
operator *
(
const
HepGeom::Transform3D
& xf,
const
Function
&
b
)
29
{
30
return
PreMult
(xf, &
b
);
31
}
32
33
PostMult
operator *
(
const
Function
&
a
,
const
HepGeom::Transform3D
& xf)
34
{
35
return
PostMult
(&
a
, xf);
36
}
37
38
unsigned
int
Function::dimensionality
()
const
39
{
40
return
1;
41
}
42
43
//------------------------------------------------------------------//
44
// //
45
// Implementation of Product //
46
// //
47
//------------------------------------------------------------------//
48
49
Product::Product
(
const
Function
* arg1,
50
const
Function
* arg2):_arg1 (arg1->clone ()),
51
_arg2 (arg2->clone ())
52
{
53
if
(arg1->
dimensionality
() != arg2->
dimensionality
())
54
{
55
std::cout <<
"Warning: dimension mismatch in XF::Product"
<< std::endl;
56
assert(0);
57
}
58
}
59
60
61
// Every function must override this:
62
Product
*
Product::clone
()
const
63
{
64
return
new
Product
(*
this
);
65
}
66
67
// Copy constructor:
68
Product::Product
(
const
Product
& right):
Function
(),
69
_arg1 (right._arg1->clone ()), _arg2 (right._arg2->clone ())
70
{
71
}
72
73
74
Product::~Product ()
75
{
76
delete
_arg1;
77
delete
_arg2;
78
}
79
80
unsigned
int
Product::dimensionality
()
const
81
{
82
return
_arg1->
dimensionality
();
83
}
84
85
HepGeom::Transform3D
Product::operator ()
(
double
x
)
const
86
{
87
return
(*_arg1) (
x
) * (*_arg2) (
x
);
88
}
89
90
HepGeom::Transform3D
Product::operator ()
(
const
Genfun::Argument
&
x
)
const
91
{
92
return
(*_arg1) (
x
) * (*_arg2) (
x
);
93
}
94
95
96
97
//------------------------------------------------------------------//
98
// //
99
// Implementation of PreMult //
100
// //
101
//------------------------------------------------------------------//
102
103
PreMult::PreMult
(
const
HepGeom::Transform3D
& arg1,
104
const
Function
* arg2):_arg1 (arg1),
105
_arg2 (arg2->clone ())
106
{
107
}
108
109
110
// Every function must override this:
111
PreMult
*
PreMult::clone
()
const
112
{
113
return
new
PreMult
(*
this
);
114
}
115
116
// Copy constructor:
117
PreMult::PreMult
(
const
PreMult
& right):
Function
(), _arg1 (right._arg1),
118
_arg2 (right._arg2->clone ())
119
{
120
}
121
122
123
PreMult::~PreMult ()
124
{
125
delete
_arg2;
126
}
127
128
unsigned
int
PreMult::dimensionality
()
const
129
{
130
return
_arg2->
dimensionality
();
131
}
132
133
HepGeom::Transform3D
PreMult::operator ()
(
double
x
)
const
134
{
135
return
_arg1 * (*_arg2) (
x
);
136
}
137
138
HepGeom::Transform3D
PreMult::operator ()
(
const
Genfun::Argument
&
x
)
const
139
{
140
return
_arg1 * (*_arg2) (
x
);
141
}
142
143
144
//------------------------------------------------------------------//
145
// //
146
// Implementation of PostMult //
147
// //
148
//------------------------------------------------------------------//
149
150
PostMult::PostMult
(
const
Function
* arg1,
151
const
HepGeom::Transform3D
& arg2):_arg1 (arg1->clone ()),
152
_arg2 (arg2)
153
{
154
}
155
156
157
// Every function must override this:
158
PostMult
*
PostMult::clone
()
const
159
{
160
return
new
PostMult
(*
this
);
161
}
162
163
// Copy constructor:
164
PostMult::PostMult
(
const
PostMult
& right):
Function
(),
165
_arg1 (right._arg1->clone ()), _arg2 (right._arg2)
166
{
167
}
168
169
170
PostMult::~PostMult ()
171
{
172
delete
_arg1;
173
}
174
175
unsigned
int
PostMult::dimensionality
()
const
176
{
177
return
_arg1->
dimensionality
();
178
}
179
180
HepGeom::Transform3D
PostMult::operator ()
(
double
x
)
const
181
{
182
return
(*_arg1) (
x
) * _arg2;
183
}
184
185
HepGeom::Transform3D
PostMult::operator ()
(
const
Genfun::Argument
&
x
)
const
186
{
187
return
(*_arg1) (
x
) * _arg2;
188
}
189
190
191
Pow::Pow
(
const
HepGeom::Transform3D
& xform,
Genfun::GENFUNCTION
f
):xf (xform),
192
function (
f
.clone ())
193
{
194
}
195
196
Pow::~Pow ()
197
{
198
delete
function
;
199
}
200
201
HepGeom::Transform3D
Pow::operator ()
(
double
x
)
const
202
{
203
//
204
// Get the translation part and the rotation part:
205
//
206
CLHEP::HepRotation
rotate
= xf.
getRotation
();
207
CLHEP::Hep3Vector
translate = xf.
getTranslation
();
208
CLHEP::HepAxisAngle
aa =
rotate
.axisAngle ();
209
//
210
// Evaluate the function
211
//
212
double
nTimes = (*function) (
x
);
213
//
214
// Modify:
215
//
216
translate *= nTimes;
217
aa.
setDelta
(aa.
delta
() * nTimes);
218
//
219
// Now compose these and return a result:
220
//
221
return
HepGeom::Translate3D
(translate) *
HepGeom::Rotate3D
(aa.
delta
(),
222
aa.
axis
());
223
}
224
225
HepGeom::Transform3D
Pow::operator ()
(
const
Genfun::Argument
& argument)
const
226
{
227
return
operator ()
(argument[0]);
228
}
229
230
Pow
*
Pow::clone
()
const
231
{
232
return
new
Pow
(*
this
);
233
}
234
235
Pow::Pow
(
const
Pow
& right):
Function
(), xf (right.xf),
236
function (right.function->clone ())
237
{
238
}
239
240
}
CLHEP::HepAxisAngle
Definition:
Geometry/CLHEP/Vector/AxisAngle.h:37
XF::Product::operator()
virtual HepGeom::Transform3D operator()(double argument) const
Definition:
XF.cc:85
CLHEP::HepAxisAngle::axis
Hep3Vector axis() const
XF::PreMult
Definition:
XF.h:170
a
@ a
Definition:
testCategories.cc:125
XF::Product::clone
virtual Product * clone() const
Definition:
XF.cc:62
XF::PreMult::dimensionality
virtual unsigned int dimensionality() const
Definition:
XF.cc:128
XF::Pow::clone
Pow * clone() const
Definition:
XF.cc:230
b
@ b
Definition:
testCategories.cc:125
XF::PostMult::operator()
virtual HepGeom::Transform3D operator()(double argument) const
Definition:
XF.cc:180
rotate
Signatures of Hep3Vector::rotate For equivalent rotate() methods
Genfun::GENFUNCTION
const typedef AbsFunction & GENFUNCTION
Definition:
CLHEP/GenericFunctions/AbsFunction.hh:125
XF::Function::Function
Function()
Definition:
XF.cc:15
XF::PreMult::PreMult
PreMult(const HepGeom::Transform3D &arg1, const Function *arg2)
Definition:
XF.cc:103
CLHEP::HepRotation
Definition:
Geometry/CLHEP/Vector/Rotation.h:48
XF::Product::dimensionality
virtual unsigned int dimensionality() const
Definition:
XF.cc:80
XF::PostMult
Definition:
XF.h:201
XF::PreMult::clone
virtual PreMult * clone() const
Definition:
XF.cc:111
f
void f(void g())
Definition:
excDblThrow.cc:38
HepGeom::Transform3D::getTranslation
CLHEP::Hep3Vector getTranslation() const
XF::operator*
Product operator*(const Function &op1, const Function &op2)
Definition:
XF.cc:23
XF
Definition:
XF.h:52
HepGeom::Transform3D
Definition:
CLHEP/Geometry/Transform3D.h:172
Genfun::Argument
Definition:
CLHEP/GenericFunctions/Argument.hh:17
CLHEP::Hep3Vector
Definition:
Geometry/CLHEP/Vector/ThreeVector.h:41
XF::PostMult::dimensionality
virtual unsigned int dimensionality() const
Definition:
XF.cc:175
HepGeom::Translate3D
Definition:
CLHEP/Geometry/Transform3D.h:516
XF::Product::Product
Product(const Function *arg1, const Function *arg2)
Definition:
XF.cc:49
XF::PostMult::PostMult
PostMult(const Function *arg1, const HepGeom::Transform3D &arg2)
Definition:
XF.cc:150
XF::PostMult::clone
virtual PostMult * clone() const
Definition:
XF.cc:158
CLHEP::HepAxisAngle::setDelta
AA & setDelta(Scalar delta)
CLHEP::HepAxisAngle::delta
double delta() const
XF::PreMult::operator()
virtual HepGeom::Transform3D operator()(double argument) const
Definition:
XF.cc:133
XF::Pow::Pow
Pow(const HepGeom::Transform3D &, Genfun::GENFUNCTION f)
Definition:
XF.cc:191
XF::Function::dimensionality
virtual unsigned int dimensionality() const
Definition:
XF.cc:38
HepGeom::Rotate3D
Definition:
CLHEP/Geometry/Transform3D.h:375
HepGeom::Transform3D::getRotation
CLHEP::HepRotation getRotation() const
XF::Pow
Definition:
XF.h:99
x
any side effects of that construction would occur twice The semantics of throw x
Definition:
whyZMthrowRethrows.txt:37
XF::Function
Definition:
XF.h:61
XF::Pow::operator()
virtual HepGeom::Transform3D operator()(double argument) const
Definition:
XF.cc:201
XF::Product
Definition:
XF.h:139
Generated by
1.8.17