19 #include "CLHEP/Units/GlobalSystemOfUnits.h"
26 using namespace SurfaceOrientation;
33 template <
class NumType>
34 inline constexpr NumType convertUnits(NumType millimeters)
48 string volName =
name;
49 volName.erase(0, volName.rfind(
'_') + 1);
52 for (
int i = 0;
i < 6; ++
i) {
64 double halfX = convertUnits(box.
halfX());
65 double halfY = convertUnits(box.
halfY());
66 double halfZ = convertUnits(box.
halfZ());
70 double x1 = convertUnits(trap.
x1());
71 double x2 = convertUnits(trap.
x2());
72 double x3 = convertUnits(trap.
x3());
73 double x4 = convertUnits(trap.
x4());
74 double y1 = convertUnits(trap.
y1());
75 double y2 = convertUnits(trap.
y2());
78 double halfZ = convertUnits(trap.
halfZ());
79 double alpha1 = trap.
alpha1();
80 double alpha2 = trap.
alpha2();
81 buildTrap(x1, x2, x3, x4, y1, y2, theta, phi, halfZ, alpha1, alpha2);
84 double zhalf = convertUnits(cons.
zhalf());
85 double rInMinusZ = convertUnits(cons.
rInMinusZ());
86 double rOutMinusZ = convertUnits(cons.
rOutMinusZ());
87 double rInPlusZ = convertUnits(cons.
rInPlusZ());
88 double rOutPlusZ = convertUnits(cons.
rOutPlusZ());
89 double startPhi = cons.
phiFrom();
91 buildCons(zhalf, rInMinusZ, rOutMinusZ, rInPlusZ, rOutPlusZ, startPhi, deltaPhi);
94 double zhalf = convertUnits(tubs.
zhalf());
95 double rIn = convertUnits(tubs.
rIn());
96 double rOut = convertUnits(tubs.
rOut());
99 buildTubs(zhalf, rIn, rOut, startPhi, deltaPhi);
102 double x1 = convertUnits(ptrap.
x1());
103 double x2 = convertUnits(ptrap.
x2());
104 double y1 = convertUnits(ptrap.
y1());
105 double y2 = convertUnits(ptrap.
y2());
106 double halfZ = convertUnits(ptrap.
halfZ());
112 double zhalf = convertUnits(tubs.
zHalf());
113 double rIn = convertUnits(tubs.
rIn());
114 double rOut = convertUnits(tubs.
rOut());
117 double cutAtStart = convertUnits(tubs.
cutAtStart());
118 double cutAtDelta = convertUnits(tubs.
cutAtDelta());
120 buildTruncTubs(zhalf, rIn, rOut, startPhi, deltaPhi, cutAtStart, cutAtDelta, cutInside);
192 cout <<
" Orientation of surfaces:";
193 std::string sideName[3] = {
"positiveSide",
"negativeSide",
"onSurface"};
194 for (
int i = 0;
i < 6; ++
i) {
235 fv.
rotation().GetComponents(x, y, z);
237 if (x.Cross(y).Dot(z) < 0.5) {
238 cout <<
"*** WARNING: Rotation is not RH " << endl;
257 cout <<
"Refplane pos " << refPlane->position() << endl;
264 if (refPlane->toGlobal(globalZdir).z() < 0.) {
265 globalZdir = -globalZdir;
270 cout <<
"*** WARNING RefPlane check failed!***" << chk << endl;
275 std::vector<VolumeSide>
result;
276 for (
int i = 0;
i < 6; ++
i) {
293 using namespace magneticfield;
295 #include "buildBox.icc"
296 #include "buildTrap.icc"
297 #include "buildTubs.icc"
298 #include "buildCons.icc"
299 #include "buildPseudoTrap.icc"
300 #include "buildTruncTubs.icc"
double cutAtStart(void) const
truncation at begin of the tube-section
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
double halfZ(void) const
half of the z-Axis
MagGeoBuilderFromDDD::volumeHandle volumeHandle
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
Local3DVector LocalVector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
A truncated tube section.
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
double zHalf(void) const
half of the z-Axis
double y2(void) const
half length along y on +z
void buildTrap(double x1, double x2, double x3, double x4, double y1, double y2, double theta, double phi, double halfZ, double alpha1, double alpha2)
double deltaPhi(void) const
angular span of the tube-section
double phi(void) const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
volumeHandle(const DDExpandedView &fv, bool expand2Pi=false, bool debugVal=false)
std::vector< VolumeSide > sides() const override
The surfaces and they orientation, as required to build a MagVolume.
Geom::Phi< T > phi() const
double cutAtDelta(void) const
truncation at end of the tube-section
double phiFrom(void) const
Geom::Theta< T > theta() const
double rIn(void) const
inner radius
double rOutMinusZ(void) const
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
double rOutPlusZ(void) const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
unsigned short volumeno
volume number
double y1(void) const
half length along y on -z
unsigned short copyno
copy number
static const char *const name(DDSolidShape s)
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
void buildBox(double halfX, double halfY, double halfZ)
double halfZ(void) const
half of the z-Axis
double startPhi(void) const
Surface::GlobalPoint GlobalPoint
Interface to a Trapezoid.
double y1(void) const
Half-length along y of the face at -pDz.
double rInMinusZ(void) const
int masterSector
The sector for which an interpolator for this class of volumes should be built.
void buildCons(double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double startPhi, double deltaPhi)
DDSolidShape shape(void) const
The type of the solid.
void referencePlane(const DDExpandedView &fv)
const DDTranslation & translation() const
The absolute translation of the current node.
const GlobalPoint & center() const
Return the center of the volume.
double deltaPhi(void) const
double deltaPhi(void) const
constexpr NumType convertMmToCm(NumType millimeters)
int copyno() const
Copy number associated with the current node.
void buildTruncTubs(double zhalf, double rIn, double rOut, double startPhi, double deltaPhi, double cutAtStart, double cutAtDelta, bool cutInside)
void buildPseudoTrap(double x1, double x2, double y1, double y2, double halfZ, double radius, bool atMinusZ)
std::string name
Name of the volume.
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
double alpha2(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy2 to the centre at y=+pDy2 of t...
double startPhi(void) const
angular start of the tube-section
DDSolidShape shape() const override
Shape of the solid.
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
double y2(void) const
Half-length along y of the face at +pDz.
double rInPlusZ(void) const
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
double x2(void) const
half length along x on +z
double rOut(void) const
outer radius
double theta(void) const
Polar angle of the line joining the centres of the faces at -/+pDz.
Provides an exploded view of the detector (tree-view)
const std::string & name() const
Returns the name.
void buildTubs(double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
std::string magFile
Name of magnetic field table file.
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
double x1(void) const
half length along x on -z
Global3DVector GlobalVector
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)