9 #include "DD4hep/DetFactoryHelper.h" 25 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo info: Creating an instance...";
27 double zBend =
args.value<
double>(
"ZBend");
28 double zEnd =
args.value<
double>(
"ZEnd");
29 double rMin =
args.value<
double>(
"RMin");
30 double rMax =
args.value<
double>(
"RMax");
31 double rTop =
args.value<
double>(
"RTop");
32 double width =
args.value<
double>(
"Width");
33 double thick =
args.value<
double>(
"Thick");
34 std::vector<double>
angles =
35 args.value<std::vector<double>>(
"Angles");
36 std::vector<double> zposWheel =
37 args.value<std::vector<double>>(
"ZPosWheel");
38 std::vector<double> zposRing =
args.value<std::vector<double>>(
48 <<
"DDTIDAxialCableAlgo debug: Parameters for creating " 49 << (zposWheel.size() + 2) <<
" axial cables and positioning" 50 << angles.size() <<
"copies in Service volume" 51 <<
"\nzBend " << zBend <<
"\nzEnd " << zEnd <<
"\nrMin " << rMin
53 <<
"\nthickness " << thick <<
" with Angles";
55 for (
int i = 0;
i < (
int)(angles.size());
i++)
59 LogVerbatim(
"TIDGeom") <<
"\nWheels " << zposWheel.size() <<
" at Z";
61 for (
int i = 0;
i < (
int)(zposWheel.size());
i++)
62 LogVerbatim(
"TIDGeom") <<
"\n\tzposWheel[" <<
i <<
"] = " << zposWheel[
i];
64 LogVerbatim(
"TIDGeom") <<
"\neach with " << zposRing.size() <<
" Rings at Z";
66 for (
int i = 0;
i < (
int)(zposRing.size());
i++)
67 LogVerbatim(
"TIDGeom") <<
"\tzposRing[" <<
i <<
"] = " << zposRing[
i];
71 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo debug: Parent " 72 << mother.name() <<
"\tChild " << childName
73 <<
" NameSpace " << ns.name() <<
"\tMaterial " << matIn
76 std::vector<Volume> logs;
77 const double thk = thick / zposRing.size();
83 for (
int k = 0;
k < (
int)(zposWheel.size());
k++) {
84 std::vector<double> pconZ, pconRmin, pconRmax;
86 for (
int i = 0;
i < (
int)(zposRing.size());
i++) {
88 z = zposWheel[
k] + zposRing[
i] - 0.5 * thk;
91 pconZ.emplace_back(z);
92 pconRmin.emplace_back(r);
93 pconRmax.emplace_back(rMax);
97 pconZ.emplace_back(z);
98 pconRmin.emplace_back(r);
99 pconRmax.emplace_back(rMax);
102 pconZ.emplace_back(z);
103 pconRmin.emplace_back(r);
104 pconRmax.emplace_back(rMax);
107 pconZ.emplace_back(z);
108 pconRmin.emplace_back(r);
109 pconRmax.emplace_back(rMax);
112 if (
k >= ((
int)(zposWheel.size()) - 1))
115 z = zposWheel[
k + 1] + zposRing[0] - 0.5 * thk;
117 pconZ.emplace_back(z);
118 pconRmin.emplace_back(r);
119 pconRmax.emplace_back(rMax);
123 Solid solid = ns.addSolid(
124 name, Polycone(-0.5 * width, width, pconRmin, pconRmax, pconZ));
126 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: " << solid.name()
127 <<
" Polycone made of " << matIn <<
" from " 130 << pconZ.size() <<
" sections ";
132 for (
int i = 0;
i < (
int)(pconZ.size());
i++)
134 <<
"\t[" <<
i <<
"]\tZ = " << pconZ[
i] <<
"\tRmin = " << pconRmin[
i]
135 <<
"\tRmax = " << pconRmax[
i];
138 Volume(solid.name(), solid, ns.material(
"materials:Air")));
142 std::vector<double> pconZ, pconRmin, pconRmax;
143 r = thktot * rMax / rTop;
145 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: Thk " << thk <<
" Total " 146 << thktot <<
" rMax " << rMax <<
" rTop " << rTop
147 <<
" dR " << r <<
" z " << z;
149 pconZ.emplace_back(z);
150 pconRmin.emplace_back(rMax);
151 pconRmax.emplace_back(rMax);
154 pconZ.emplace_back(z);
155 pconRmin.emplace_back(rMax);
156 pconRmax.emplace_back(rTop);
158 pconZ.emplace_back(zBend);
159 pconRmin.emplace_back(rMax);
160 pconRmax.emplace_back(rTop);
162 std::string name = childName + std::to_string(zposWheel.size());
164 Solid solid = ns.addSolid(
165 name, Polycone(-0.5 * width, width, pconRmin, pconRmax, pconZ));
167 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: " << solid.name()
168 <<
" Polycone made of " << matIn <<
" from " 171 << pconZ.size() <<
" sections ";
173 for (
int i = 0;
i < (
int)(pconZ.size());
i++)
174 LogVerbatim(
"TIDGeom") <<
"\t[" <<
i <<
"]\tZ = " << pconZ[
i]
175 <<
"\tRmin = " << pconRmin[
i]
176 <<
"\tRmax = " << pconRmax[
i];
178 logs.emplace_back(
Volume(solid.name(), solid, ns.material(matIn)));
181 name = childName + std::to_string(zposWheel.size() + 1);
183 solid = ns.addSolid(name,
184 Tube(r, rTop, 0.5 * (zEnd - zBend), -0.5 * width, width));
186 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: " << solid.name()
187 <<
" Tubs made of " << matOut <<
" from " 190 <<
" Rout " << rTop <<
" ZHalf " 191 << 0.5 * (zEnd - zBend);
193 logs.emplace_back(
Volume(solid.name(), solid, ns.material(matOut)));
198 for (
int i = 0;
i < (
int)(angles.size());
i++) {
199 double phix = angles[
i];
200 double phiy = phix + 90_deg;
203 LogVerbatim(
"TIDGeom") <<
"DDTIDAxialCableAlgo test: Creating a new " 209 for (
int k = 0;
k < (
int)(logs.size());
k++) {
210 Position tran = Position(0., 0., 0.);
212 if (
k == ((
int)(logs.size()) - 1))
213 tran = Position(0., 0., 0.5 * (zEnd + zBend));
215 mother.placeVolume(logs[
k],
i + 1, Transform3D(rotation, tran));
218 <<
"DDTIDAxialCableAlgo test " << logs[
k].name() <<
" number " 219 <<
i + 1 <<
" positioned in " << mother.name() <<
" at " << tran
Geom::Theta< T > theta() const
constexpr NumType convertRadToDeg(NumType radians)
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
static constexpr long s_executed
Namespace of DDCMS conversion namespace.
#define DECLARE_DDCMS_DETELEMENT(name, func)