17 #include <DD4hep/DD4hepUnits.h>
34 :
BaseVolumeHandle(expand2Pi, debugVal), theShape(fv.legacyShape(fv.shape())), solid(fv) {
37 const auto *
const transArray = fv.
trans();
40 center_ =
GlobalPoint(transArray[0] / dd4hep::cm, transArray[1] / dd4hep::cm, transArray[2] / dd4hep::cm);
43 string volName =
name;
44 volName.erase(0, volName.rfind(
'_') + 1);
45 volumeno = static_cast<unsigned short>(std::atoi(volName.c_str()));
47 for (
int i = 0;
i < 6; ++
i) {
55 double halfX = box.x() / dd4hep::cm;
56 double halfY = box.y() / dd4hep::cm;
57 double halfZ = box.z() / dd4hep::cm;
62 double x1 = trap.bottomLow1() / dd4hep::cm;
63 double x2 = trap.topLow1() / dd4hep::cm;
64 double x3 = trap.bottomLow2() / dd4hep::cm;
65 double x4 = trap.topLow2() / dd4hep::cm;
66 double y1 = trap.high1() / dd4hep::cm;
67 double y2 = trap.high2() / dd4hep::cm;
68 double theta = trap.theta();
69 double phi = trap.phi();
70 double halfZ = trap.dZ() / dd4hep::cm;
71 double alpha1 = trap.alpha1();
72 double alpha2 = trap.alpha2();
73 buildTrap(
x1,
x2, x3, x4,
y1,
y2,
theta, phi, halfZ, alpha1, alpha2);
78 double zhalf = cons.dZ() / dd4hep::cm;
79 double rInMinusZ = cons.rMin1() / dd4hep::cm;
80 double rOutMinusZ = cons.rMax1() / dd4hep::cm;
81 double rInPlusZ = cons.rMin2() / dd4hep::cm;
82 double rOutPlusZ = cons.rMax2() / dd4hep::cm;
83 double startPhi = cons.startPhi();
89 double zhalf = tubs.dZ() / dd4hep::cm;
90 double rIn = tubs.rMin() / dd4hep::cm;
91 double rOut = tubs.rMax() / dd4hep::cm;
93 double deltaPhi = tubs.endPhi() - startPhi;
111 LogTrace(
"MagGeoBuilder") <<
" Pseudo trap params raw = " <<
d[0] <<
", " <<
d[1] <<
", " <<
d[2] <<
", "
112 <<
d[3] <<
", " <<
d[4] <<
", " <<
d[5] <<
", " <<
d[6];
115 transform(
d.begin(), --(
d.end()),
d.begin(), [](
double val) {
return val / dd4hep::cm; });
118 LogTrace(
"MagGeoBuilder") <<
" Pseudo trap params converted = " <<
d[0] <<
", " <<
d[1] <<
", " <<
d[2] <<
", "
119 <<
d[3] <<
", " <<
d[4] <<
", " <<
d[5] <<
", " <<
d[6];
125 double zhalf = tubs.dZ() / dd4hep::cm;
126 double rIn = tubs.rMin() / dd4hep::cm;
127 double rOut = tubs.rMax() / dd4hep::cm;
130 double cutAtStart = tubs.cutAtStart() / dd4hep::cm;
131 double cutAtDelta = tubs.cutAtDelta() / dd4hep::cm;
132 bool cutInside = tubs.cutInside();
136 LogError(
"magneticfield::volumeHandle")
137 <<
"ctor: Unexpected shape # " << static_cast<int>(
theShape) <<
" for vol " <<
name;
141 if (fv.
volume().material().density() > 3.)
148 LogTrace(
"MagGeoBuilder") <<
"*** WARNING: wrong RMin/RN/RMax";
155 LogTrace(
"MagGeoBuilder") <<
" Orientation of surfaces:";
156 std::string sideName[3] = {
"positiveSide",
"negativeSide",
"onSurface"};
157 for (
int i = 0;
i < 6; ++
i) {
198 dd4hep::Rotation3D refRot;
200 refRot.GetComponents(x, y, z);
202 if (x.Cross(y).Dot(z) < 0.5) {
203 LogTrace(
"MagGeoBuilder") <<
"*** WARNING: Rotation is not RH ";
232 globalZdir = -globalZdir;
236 LogTrace(
"MagGeoBuilder") <<
"*** WARNING RefPlane check failed!***" << chk;
241 std::vector<VolumeSide>
result;
242 for (
int i = 0;
i < 6; ++
i) {
258 #include "buildBox.icc"
259 #include "buildTrap.icc"
260 #include "buildTubs.icc"
261 #include "buildCons.icc"
262 #include "buildPseudoTrap.icc"
263 #include "buildTruncTubs.icc"