9 #include "DD4hep/DetFactoryHelper.h" 23 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo info: Creating an instance...";
25 double zBend =
args.value<
double>(
"ZBend");
26 double zEnd =
args.value<
double>(
"ZEnd");
27 double rMin =
args.value<
double>(
"RMin");
28 double rMax =
args.value<
double>(
"RMax");
29 double rTop =
args.value<
double>(
"RTop");
30 double width =
args.value<
double>(
"Width");
31 double thick =
args.value<
double>(
"Thick");
32 std::vector<double>
angles =
args.value<std::vector<double>>(
"Angles");
33 std::vector<double> zposWheel =
args.value<std::vector<double>>(
"ZPosWheel");
34 std::vector<double> zposRing =
args.value<std::vector<double>>(
"ZPosRing");
40 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo debug: Parameters for creating " << (zposWheel.size() + 2)
41 <<
" axial cables and positioning" <<
angles.size() <<
"copies in Service volume" 42 <<
"\nzBend " << zBend <<
"\nzEnd " << zEnd <<
"\nrMin " <<
rMin <<
"\nrMax " <<
rMax 48 LogVerbatim(
"TIDGeom") <<
"\nWheels " << zposWheel.size() <<
" at Z";
50 for (
int i = 0;
i < (
int)(zposWheel.size());
i++)
51 LogVerbatim(
"TIDGeom") <<
"\n\tzposWheel[" <<
i <<
"] = " << zposWheel[
i];
53 LogVerbatim(
"TIDGeom") <<
"\neach with " << zposRing.size() <<
" Rings at Z";
55 for (
int i = 0;
i < (
int)(zposRing.size());
i++)
56 LogVerbatim(
"TIDGeom") <<
"\tzposRing[" <<
i <<
"] = " << zposRing[
i];
60 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo debug: Parent " << mother.name() <<
"\tChild " << childName
61 <<
" NameSpace " << ns.name() <<
"\tMaterial " << matIn <<
" and " << matOut;
63 std::vector<Volume> logs;
64 const double thk = thick / zposRing.size();
70 for (
int k = 0;
k < (
int)(zposWheel.size());
k++) {
71 std::vector<double> pconZ, pconRmin, pconRmax;
73 for (
int i = 0;
i < (
int)(zposRing.size());
i++) {
75 z = zposWheel[
k] + zposRing[
i] - 0.5 * thk;
78 pconZ.emplace_back(z);
79 pconRmin.emplace_back(r);
80 pconRmax.emplace_back(
rMax);
84 pconZ.emplace_back(z);
85 pconRmin.emplace_back(r);
86 pconRmax.emplace_back(
rMax);
89 pconZ.emplace_back(z);
90 pconRmin.emplace_back(r);
91 pconRmax.emplace_back(
rMax);
94 pconZ.emplace_back(z);
95 pconRmin.emplace_back(r);
96 pconRmax.emplace_back(
rMax);
99 if (
k >= ((
int)(zposWheel.size()) - 1))
102 z = zposWheel[
k + 1] + zposRing[0] - 0.5 * thk;
104 pconZ.emplace_back(z);
105 pconRmin.emplace_back(r);
106 pconRmax.emplace_back(
rMax);
110 Solid solid = ns.addSolid(ns.prepend(
name), Polycone(-0.5 *
width,
width, pconRmin, pconRmax, pconZ));
112 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: " << solid.name() <<
" Polycone made of " << matIn
114 <<
" and with " << pconZ.size() <<
" sections ";
116 for (
int i = 0;
i < (
int)(pconZ.size());
i++)
117 LogVerbatim(
"TIDGeom") <<
"\t[" <<
i <<
"]\tZ = " << pconZ[
i] <<
"\tRmin = " << pconRmin[
i]
118 <<
"\tRmax = " << pconRmax[
i];
120 logs.emplace_back(
Volume(solid.name(), solid, ns.material(
"materials:Air")));
124 std::vector<double> pconZ, pconRmin, pconRmax;
125 r = thktot *
rMax / rTop;
127 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: Thk " << thk <<
" Total " << thktot <<
" rMax " <<
rMax 128 <<
" rTop " << rTop <<
" dR " <<
r <<
" z " <<
z;
130 pconZ.emplace_back(z);
131 pconRmin.emplace_back(
rMax);
132 pconRmax.emplace_back(
rMax);
135 pconZ.emplace_back(z);
136 pconRmin.emplace_back(
rMax);
137 pconRmax.emplace_back(rTop);
139 pconZ.emplace_back(zBend);
140 pconRmin.emplace_back(
rMax);
141 pconRmax.emplace_back(rTop);
145 Solid solid = ns.addSolid(ns.prepend(
name), Polycone(-0.5 *
width,
width, pconRmin, pconRmax, pconZ));
147 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: " << solid.name() <<
" Polycone made of " << matIn <<
" from " 149 << pconZ.size() <<
" sections ";
151 for (
int i = 0;
i < (
int)(pconZ.size());
i++)
152 LogVerbatim(
"TIDGeom") <<
"\t[" <<
i <<
"]\tZ = " << pconZ[
i] <<
"\tRmin = " << pconRmin[
i]
153 <<
"\tRmax = " << pconRmax[
i];
155 logs.emplace_back(
Volume(solid.name(), solid, ns.material(matIn)));
160 solid = ns.addSolid(ns.prepend(
name), Tube(r, rTop, 0.5 * (zEnd - zBend), -0.5 *
width,
width));
162 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: " << solid.name() <<
" Tubs made of " << matOut <<
" from " 164 <<
r <<
" Rout " << rTop <<
" ZHalf " << 0.5 * (zEnd - zBend);
166 logs.emplace_back(
Volume(solid.name(), solid, ns.material(matOut)));
169 constexpr
double theta = 90_deg;
173 double phiy = phix + 90_deg;
176 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: Creating a new " 180 for (
int k = 0;
k < (
int)(logs.size());
k++) {
183 if (
k == ((
int)(logs.size()) - 1))
184 tran =
Position(0., 0., 0.5 * (zEnd + zBend));
186 mother.placeVolume(logs[
k],
i + 1, Transform3D(
rotation, tran));
188 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test " << logs[
k].name() <<
" number " <<
i + 1
189 <<
" positioned in " << mother.name() <<
" at " << tran <<
" with " <<
rotation;
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
std::string to_string(const V &value)
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
Namespace of DDCMS conversion namespace.
Geom::Theta< T > theta() const