1 #include "DD4hep/DetFactoryHelper.h" 16 vector<string> sideRod = args.
vecStr(
"SideRodName");
17 vector<double> sideRodX = args.
vecDble(
"SideRodX");
18 vector<double> sideRodY = args.
vecDble(
"SideRodY");
19 vector<double> sideRodZ = args.
vecDble(
"SideRodZ");
20 string endRod1 = args.
str(
"EndRod1Name");
21 vector<double> endRod1Y = args.
vecDble(
"EndRod1Y");
22 vector<double> endRod1Z = args.
vecDble(
"EndRod1Z");
23 string endRod2 = args.
str(
"EndRod2Name");
24 double endRod2Y = args.
dble(
"EndRod2Y");
25 double endRod2Z = args.
dble(
"EndRod2Z");
27 string cable = args.
str(
"CableName");
28 double cableZ = args.
dble(
"CableZ");
30 string clamp = args.
str(
"ClampName");
31 vector<double> clampX = args.
vecDble(
"ClampX");
32 vector<double> clampZ = args.
vecDble(
"ClampZ");
33 string sideCool = args.
str(
"SideCoolName");
34 vector<double> sideCoolX = args.
vecDble(
"SideCoolX");
35 vector<double> sideCoolY =
37 vector<double> sideCoolZ = args.
vecDble(
"SideCoolZ");
38 string endCool = args.
str(
"EndCoolName");
39 string endCoolRot = args.
str(
"EndCoolRot");
40 double endCoolY = args.
dble(
"EndCoolY");
41 double endCoolZ = args.
dble(
"EndCoolZ");
43 string optFibre = args.
str(
"OptFibreName");
44 vector<double> optFibreX = args.
vecDble(
"optFibreX");
45 vector<double> optFibreZ = args.
vecDble(
"optFibreZ");
47 string sideClamp1 = args.
str(
"SideClamp1Name");
48 vector<double> sideClampX = args.
vecDble(
"SideClampX");
49 vector<double> sideClamp1DZ = args.
vecDble(
"SideClamp1DZ");
50 string sideClamp2 = args.
str(
"SideClamp2Name");
51 vector<double> sideClamp2DZ = args.
vecDble(
"SideClamp2DZ");
54 vector<string> moduleRot = args.
vecStr(
"ModuleRot");
55 vector<double> moduleY = args.
vecDble(
"ModuleY");
56 vector<double> moduleZ = args.
vecDble(
"ModuleZ");
59 vector<double> connectY = args.
vecDble(
"ICCY");
60 vector<double> connectZ = args.
vecDble(
"ICCZ");
62 string aohName = args.
str(
"AOHName");
63 vector<double> aohCopies = args.
vecDble(
"AOHCopies");
64 vector<double> aohX = args.
vecDble(
"AOHx");
65 vector<double> aohY = args.
vecDble(
"AOHy");
66 vector<double> aohZ = args.
vecDble(
"AOHz");
68 LogDebug(
"TOBGeom") <<
"Parent " << parentName <<
" Central " << central <<
" NameSpace " << ns.
name() <<
"\tShift " 70 for (
int i = 0;
i < (
int)(sideRod.size());
i++) {
71 LogDebug(
"TOBGeom") << sideRod[
i] <<
" to be positioned " << sideRodX.size() <<
" times at y = " << sideRodY[
i]
72 <<
" z = " << sideRodZ[
i] <<
" and x";
73 for (
double j : sideRodX)
74 LogDebug(
"TOBGeom") <<
"\tsideRodX[" <<
i <<
"] = " <<
j;
76 LogDebug(
"TOBGeom") << endRod1 <<
" to be " 77 <<
"positioned " << endRod1Y.size() <<
" times at";
78 for (
int i = 0;
i < (
int)(endRod1Y.size());
i++)
79 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\ty = " << endRod1Y[
i] <<
"\tz = " << endRod1Z[
i];
80 LogDebug(
"TOBGeom") << endRod2 <<
" to be " 81 <<
"positioned at y = " << endRod2Y <<
" z = " << endRod2Z;
82 LogDebug(
"TOBGeom") << cable <<
" to be " 83 <<
"positioned at z = " << cableZ;
84 LogDebug(
"TOBGeom") << clamp <<
" to be " 85 <<
"positioned " << clampX.size() <<
" times at";
86 for (
int i = 0;
i < (
int)(clampX.size());
i++)
87 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << clampX[
i] <<
"\tz = " << clampZ[
i];
88 LogDebug(
"TOBGeom") << sideCool <<
" to be " 89 <<
"positioned " << sideCoolX.size() <<
" times at";
90 for (
int i = 0;
i < (
int)(sideCoolX.size());
i++)
91 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << sideCoolX[
i] <<
"\ty = " << sideCoolY[
i]
92 <<
"\tz = " << sideCoolZ[
i];
93 LogDebug(
"TOBGeom") << endCool <<
" to be " 94 <<
"positioned with " << endCoolRot <<
" rotation at" 95 <<
" y = " << endCoolY <<
" z = " << endCoolZ;
96 LogDebug(
"TOBGeom") << optFibre <<
" to be " 97 <<
"positioned " << optFibreX.size() <<
" times at";
98 for (
int i = 0;
i < (
int)(optFibreX.size());
i++)
99 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << optFibreX[
i] <<
"\tz = " << optFibreZ[
i];
100 LogDebug(
"TOBGeom") << sideClamp1 <<
" to be " 101 <<
"positioned " << sideClampX.size() <<
" times at";
102 for (
int i = 0;
i < (
int)(sideClampX.size());
i++)
103 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << sideClampX[
i] <<
"\tdz = " << sideClamp1DZ[
i];
104 LogDebug(
"TOBGeom") << sideClamp2 <<
" to be " 105 <<
"positioned " << sideClampX.size() <<
" times at";
106 for (
int i = 0;
i < (
int)(sideClampX.size());
i++)
107 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << sideClampX[
i] <<
"\tdz = " << sideClamp2DZ[
i];
108 LogDebug(
"TOBGeom") <<
"DDTOBRodAlgo debug:\t" << module <<
" positioned " << moduleRot.size() <<
" times";
109 for (
int i = 0;
i < (
int)(moduleRot.size());
i++)
110 LogDebug(
"TOBGeom") <<
"\tRotation " << moduleRot[
i] <<
"\ty = " << moduleY[
i] <<
"\tz = " << moduleZ[
i];
111 LogDebug(
"TOBGeom") <<
"DDTOBRodAlgo debug:\t" << connect.size() <<
" ICC positioned with no rotation";
112 for (
int i = 0;
i < (
int)(connect.size());
i++)
113 LogDebug(
"TOBGeom") <<
"\t" << connect[
i] <<
"\ty = " << connectY[
i] <<
"\tz = " << connectZ[
i];
114 LogDebug(
"TOBGeom") <<
"DDTOBRodAlgo debug:\t" << aohName <<
" AOH will be positioned on ICC's";
115 for (
int i = 0;
i < (
int)(aohCopies.size());
i++)
116 LogDebug(
"TOBGeom") <<
" copies " << aohCopies[
i] <<
"\tx = " << aohX[
i] <<
"\ty = " << aohY[
i]
117 <<
"\tz = " << aohZ[
i];
119 const string& centName =
central;
121 const string& rodName = parentName;
125 for (
int i = 0;
i < (
int)(sideRod.size());
i++) {
126 for (
int j = 0;
j < (
int)(sideRodX.size());
j++) {
127 Position
r(sideRodX[
j], sideRodY[
i], sideRodZ[i]);
129 rod.placeVolume(ns.
volume(child), j + 1,
r);
130 LogDebug(
"TOBGeom") << child <<
" number " << j + 1 <<
" positioned in " << rodName <<
" at " << r
131 <<
" with no rotation";
135 for (
int i = 0;
i < (
int)(clampX.size());
i++) {
136 Position
r(clampX[
i], 0, shift + clampZ[i]);
138 rod.placeVolume(ns.
volume(child), i + 1,
r);
139 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << rodName <<
" at " << r
140 <<
" with no rotation";
143 for (
int i = 0;
i < (
int)(sideCoolX.size());
i++) {
144 Position
r(sideCoolX[
i], sideCoolY[i], shift + sideCoolZ[i]);
146 rod.placeVolume(ns.
volume(child), i + 1,
r);
147 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << rodName <<
" at " << r
148 <<
" with no rotation";
151 for (
int i = 0;
i < (
int)(optFibreX.size());
i++) {
152 Position
r(optFibreX[
i], 0, shift + optFibreZ[i]);
154 rod.placeVolume(ns.
volume(child), i + 1,
r);
155 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << rodName <<
" at " << r
156 <<
" with no rotation";
160 for (
int i = 0;
i < (
int)(sideClamp1DZ.size());
i++) {
162 Position
r(sideClampX[
i], moduleY[j], shift + moduleZ[j] + sideClamp1DZ[i]);
164 rod.placeVolume(ns.
volume(child), i + 1,
r);
165 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << rodName <<
" at " << r
166 <<
" with no rotation";
168 for (
int i = 0;
i < (
int)(sideClamp2DZ.size());
i++) {
170 Position
r(sideClampX[
i], moduleY[j], shift + moduleZ[j] + sideClamp2DZ[i]);
172 rod.placeVolume(ns.
volume(child), i + 1,
r);
173 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << rodName <<
" at " << r
174 <<
" with no rotation";
179 for (
int i = 0;
i < (
int)(endRod1Y.size());
i++) {
180 Position
r(0, endRod1Y[
i], shift + endRod1Z[i]);
182 cent.placeVolume(ns.
volume(child), i + 1,
r);
183 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << centName <<
" at " << r
184 <<
" with no rotation";
186 Position
r1(0, endRod2Y, shift + endRod2Z);
188 cent.placeVolume(ns.
volume(child), 1,
r1);
189 LogDebug(
"TOBGeom") << child <<
" number 1 " 190 <<
"positioned in " << centName <<
" at " << r1 <<
" with no rotation";
193 Position
r2(0, endCoolY, shift + endCoolZ);
194 const Rotation3D& rot2 = ns.
rotation(endCoolRot);
196 cent.placeVolume(ns.
volume(child), 1, Transform3D(rot2, r2));
197 LogDebug(
"TOBGeom") << child <<
" number 1 " 198 <<
"positioned in " << centName <<
" at " << r2 <<
" with " << rot2;
201 Position r3(0, 0, shift + cableZ);
203 cent.placeVolume(ns.
volume(child), 1, r3);
204 LogDebug(
"TOBGeom") << child <<
" number 1 " 205 <<
"positioned in " << centName <<
" at " << r3 <<
" with no rotation";
208 for (
int i = 0;
i < (
int)(moduleRot.size());
i++) {
209 Position
r(0, moduleY[
i], shift + moduleZ[i]);
212 cent.placeVolume(ns.
volume(child), i + 1, Transform3D(rot, r));
213 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << centName <<
" at " << r <<
" with " 218 for (
int i = 0;
i < (
int)(connect.size());
i++) {
219 Position
r(0, connectY[
i], shift + connectZ[i]);
221 cent.placeVolume(ns.
volume(child), i + 1,
r);
222 LogDebug(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << centName <<
" at " << r
223 <<
" with no rotation";
228 for (
int i = 0;
i < (
int)(aohCopies.size());
i++) {
229 if (aohCopies[
i] != 0) {
232 Position
r(aohX[
i] + 0, aohY[
i] + connectY[
i], aohZ[i] + shift + connectZ[i]);
234 cent.placeVolume(ns.
volume(child), copyNumber,
r);
235 LogDebug(
"TOBGeom") << child <<
" number " << copyNumber <<
" positioned in " << centName <<
" at " << r
236 <<
" with no rotation";
238 if (aohCopies[i] == 2) {
240 r = Position(-aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift + connectZ[i]);
242 cent.placeVolume(ns.
volume(child), copyNumber,
r);
243 LogDebug(
"TOBGeom") << child <<
" number " << copyNumber <<
" positioned in " << centName <<
" at " << r
244 <<
" with no rotation";
247 if (aohCopies[i] == 4) {
249 for (
unsigned int j = 1;
j < 4;
j++) {
254 rr = Position(-aohX[i] + 0, aohY[i] + connectY[i], +aohZ[i] + shift + connectZ[i]);
255 cent.placeVolume(ns.
volume(child), copyNumber,
rr);
258 rr = Position(-aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift + connectZ[i]);
259 cent.placeVolume(ns.
volume(child), copyNumber,
rr);
262 rr = Position(+aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift + connectZ[i]);
263 cent.placeVolume(ns.
volume(child), copyNumber,
rr);
266 LogDebug(
"TOBGeom") << child <<
" number " << copyNumber <<
" positioned in " << centName <<
" at " << rr
267 <<
" with no rotation";
272 LogDebug(
"TOBGeom") <<
"<<== End of DDTOBRodAlgo construction ...";
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::string_view name() const
Namespace of DDCMS conversion namespace.
static long algorithm(Detector &, cms::DDParsingContext &ctxt, xml_h e, SensitiveDetector &)
const dd4hep::Rotation3D & rotation(const std::string &name) const
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
double dble(const std::string &nam) const
Shortcut to access double arguments.
static unsigned int const shift
std::vector< std::string > vecStr(const std::string &nam) const
Shortcut to access vector<string> arguments.
#define DECLARE_DDCMS_DETELEMENT(name, func)
std::string parentName() const
Access value of rParent child node.
std::string str(const std::string &nam) const
Shortcut to access string arguments.