DetectorDescription
Core
src
Cons.cc
Go to the documentation of this file.
1
#include "
DetectorDescription/Core/src/Cons.h
"
2
#include "
DataFormats/Math/interface/GeantUnits.h
"
3
4
#include <cmath>
5
#include <ostream>
6
#include <vector>
7
8
#include "
DetectorDescription/Core/interface/DDSolidShapes.h
"
9
#include "
DetectorDescription/Core/src/Solid.h
"
10
11
using namespace
geant_units
;
12
using namespace
geant_units::operators
;
13
14
DDI::Cons::Cons
(
double
zhalf,
15
double
rInMinusZ,
16
double
rOutMinusZ,
17
double
rInPlusZ,
18
double
rOutPlusZ,
19
double
startPhi,
20
double
deltaPhi
)
21
:
Solid
(
DDSolidShape
::
ddcons
) {
22
p_
.emplace_back(zhalf);
23
p_
.emplace_back(rInMinusZ);
24
p_
.emplace_back(rOutMinusZ);
25
p_
.emplace_back(rInPlusZ);
26
p_
.emplace_back(rOutPlusZ);
27
p_
.emplace_back(startPhi);
28
p_
.emplace_back(
deltaPhi
);
29
}
30
31
void
DDI::Cons::stream
(std::ostream& os)
const
{
32
os <<
" zhalf="
<<
convertMmToCm
(p_[0]) <<
" rIn-Z="
<<
convertMmToCm
(p_[1]) <<
" rOut-Z="
<<
convertMmToCm
(p_[2])
33
<<
" rIn+Z="
<<
convertMmToCm
(p_[3]) <<
" rOut+Z="
<<
convertMmToCm
(p_[4])
34
<<
" startPhi="
<<
convertRadToDeg
(p_[5]) <<
" deltaPhi="
<<
convertRadToDeg
(p_[6]);
35
}
36
37
double
DDI::Cons::volume
()
const
{
38
/* zhalf is the half length of the cone,
39
phiTo is always clockwise rotated from phiFrom
40
rInMinusZ is always smaller than rOutMinusZ (same for r*PlusZ)
41
They are the distances relative to the rotation axes */
42
43
/* calculation normalize from 0 to z */
44
45
/* The function f=rInMinusZ+((rInPlusZ-rInMinusZ)/z)*x defines
46
the radius of the the rotation from 0 to z. Raised to the power
47
of 2 integrated on x from 0 to z. Multiplied by pi, gives the
48
volume that needs to substracted from the other volume */
49
50
/* f^2=rInMinusZ*rInMinusZ+2*rInMinusZ*((rInPlusZ-rInMinusZ)/z)*x+((rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*x*x)/(z*z) */
51
52
/* primitive of f^2 is: rInMinusZ*rInMinusZ*x+rInMinusZ*((rInPlusZ-rInMinusZ)/z)*(x*x)+(rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*(x*x*x)/(3*z*z) */
53
54
/*integration from 0 to z yields: pi*( rInMinusZ*rInMinusZ*z+rInMinusZ*(rInPlusZ-rInMinusZ)*z+((rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*z)/(3) ) */
55
56
double
zhalf = p_[0];
57
double
rInMinusZ = p_[1];
58
double
rOutMinusZ = p_[2];
59
double
rInPlusZ = p_[3];
60
double
rOutPlusZ = p_[4];
61
//double phiFrom=p_[5]/rad;
62
double
deltaPhi
=
std::abs
(p_[6]);
63
double
z = 2 * zhalf;
64
65
double
volume1 = 1_pi * (rInPlusZ * rInPlusZ + rInMinusZ * rInMinusZ + rInMinusZ * rInPlusZ) * z / 3;
66
67
double
volume2 = 1_pi * (rOutPlusZ * rOutPlusZ + rOutMinusZ * rOutMinusZ + rOutMinusZ * rOutPlusZ) * z / 3;
68
69
double
slice
=
deltaPhi
/ (2_pi);
70
double
volume =
slice
* (volume2 - volume1);
71
72
return
volume;
73
}
DDSolidShapes.h
DDSolidShape
DDSolidShape
Definition:
DDSolidShapes.h:6
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition:
angle_units.h:21
Cons.h
geant_units::operators
Definition:
GeantUnits.h:18
DDI::Cons::Cons
Cons(double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double startPhi, double deltaPhi)
Definition:
Cons.cc:14
Solid.h
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition:
SiPixelRawToDigiRegional_cfi.py:9
GeantUnits.h
DDSolidShape::ddcons
DDI::Cons::volume
double volume() const override
Definition:
Cons.cc:37
DDI::Solid
Definition:
Solid.h:10
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition:
GeantUnits.h:62
geant_units
Definition:
GeantUnits.h:11
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
mergeAndRegister.slice
slice
Definition:
mergeAndRegister.py:121
DDI::Solid::p_
std::vector< double > p_
Definition:
Solid.h:30
DDI::Cons::stream
void stream(std::ostream &) const override
Definition:
Cons.cc:31
Generated for CMSSW Reference Manual by
1.8.16