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 edm::LogVerbatim(
"TOBGeom") <<
"Parent " << parentName <<
" Central " << central <<
" NameSpace " << ns.
name()
69 <<
"\tShift " <<
shift;
70 for (
int i = 0;
i < (int)(sideRod.size());
i++) {
71 edm::LogVerbatim(
"TOBGeom") << sideRod[
i] <<
" to be positioned " << sideRodX.size()
72 <<
" times at y = " << sideRodY[
i] <<
" z = " << sideRodZ[
i] <<
" and x";
73 for (
double j : sideRodX)
77 <<
"positioned " << endRod1Y.size() <<
" times at";
78 for (
int i = 0;
i < (int)(endRod1Y.size());
i++)
79 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\ty = " << endRod1Y[
i] <<
"\tz = " << endRod1Z[
i];
81 <<
"positioned at y = " << endRod2Y <<
" z = " << endRod2Z;
83 <<
"positioned at z = " << cableZ;
85 <<
"positioned " << clampX.size() <<
" times at";
86 for (
int i = 0;
i < (int)(clampX.size());
i++)
87 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << clampX[
i] <<
"\tz = " << clampZ[
i];
89 <<
"positioned " << sideCoolX.size() <<
" times at";
90 for (
int i = 0;
i < (int)(sideCoolX.size());
i++)
91 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << sideCoolX[
i] <<
"\ty = " << sideCoolY[
i]
92 <<
"\tz = " << sideCoolZ[
i];
94 <<
"positioned with " << endCoolRot <<
" rotation at"
95 <<
" y = " << endCoolY <<
" z = " << endCoolZ;
97 <<
"positioned " << optFibreX.size() <<
" times at";
98 for (
int i = 0;
i < (int)(optFibreX.size());
i++)
99 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << optFibreX[
i] <<
"\tz = " << optFibreZ[
i];
101 <<
"positioned " << sideClampX.size() <<
" times at";
102 for (
int i = 0;
i < (int)(sideClampX.size());
i++)
103 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << sideClampX[
i] <<
"\tdz = " << sideClamp1DZ[
i];
105 <<
"positioned " << sideClampX.size() <<
" times at";
106 for (
int i = 0;
i < (int)(sideClampX.size());
i++)
107 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tx = " << sideClampX[
i] <<
"\tdz = " << sideClamp2DZ[
i];
108 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRodAlgo debug:\t" << module <<
" positioned " << moduleRot.size() <<
" times";
109 for (
int i = 0;
i < (int)(moduleRot.size());
i++)
110 edm::LogVerbatim(
"TOBGeom") <<
"\tRotation " << moduleRot[
i] <<
"\ty = " << moduleY[
i] <<
"\tz = " << moduleZ[
i];
111 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRodAlgo debug:\t" << connect.size() <<
" ICC positioned with no rotation";
112 for (
int i = 0;
i < (int)(connect.size());
i++)
113 edm::LogVerbatim(
"TOBGeom") <<
"\t" << connect[
i] <<
"\ty = " << connectY[
i] <<
"\tz = " << connectZ[
i];
114 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRodAlgo debug:\t" << aohName <<
" AOH will be positioned on ICC's";
115 for (
int i = 0;
i < (int)(aohCopies.size());
i++)
116 edm::LogVerbatim(
"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++) {
129 rod.placeVolume(ns.
volume(child), j + 1,
r);
130 edm::LogVerbatim(
"TOBGeom") << child <<
" number " << j + 1 <<
" positioned in " << rodName <<
" at " << r
131 <<
" with no rotation";
135 for (
int i = 0;
i < (int)(clampX.size());
i++) {
138 rod.placeVolume(ns.
volume(child), i + 1,
r);
139 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << centName <<
" at " << r
184 <<
" with no rotation";
188 cent.placeVolume(ns.
volume(child), 1,
r1);
190 <<
"positioned in " << centName <<
" at " << r1 <<
" with no rotation";
194 const Rotation3D& rot2 = ns.
rotation(endCoolRot);
196 cent.placeVolume(ns.
volume(child), 1, Transform3D(rot2, r2));
198 <<
"positioned in " << centName <<
" at " << r2 <<
" with " << rot2;
203 cent.placeVolume(ns.
volume(child), 1, r3);
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 edm::LogVerbatim(
"TOBGeom") << child <<
" number " << i + 1 <<
" positioned in " << centName <<
" at " << r
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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"TOBGeom") << child <<
" number " << copyNumber <<
" positioned in " << centName <<
" at "
267 << rr <<
" with no rotation";
Log< level::Info, true > LogVerbatim
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::string_view name() const
#define DECLARE_DDCMS_DETELEMENT(name, func)
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.
std::string parentName() const
Access value of rParent child node.
std::string str(const std::string &nam) const
Shortcut to access string arguments.