14 string parentName =
args.parentName();
15 int detectorN =
args.integer(
"DetectorNumber");
16 double detTilt =
args.dble(
"DetTilt");
17 double fullHeight =
args.dble(
"FullHeight");
18 string boxFrameName =
args.str(
"BoxFrameName");
19 double boxFrameHeight =
args.dble(
"BoxFrameHeight");
20 double boxFrameWidth =
args.dble(
"BoxFrameWidth");
21 double dlTop =
args.dble(
"DlTop");
22 double dlBottom =
args.dble(
"DlBottom");
23 double dlHybrid =
args.dble(
"DlHybrid");
24 vector<double> boxFrameZ =
args.vecDble(
"BoxFrameZ");
25 double bottomFrameHeight =
args.dble(
"BottomFrameHeight");
26 double bottomFrameOver =
args.dble(
"BottomFrameOver");
27 double topFrameHeight =
args.dble(
"TopFrameHeight");
28 double topFrameOver =
args.dble(
"TopFrameOver");
30 vector<string> sideFrameName =
args.vecStr(
"SideFrameName");
31 vector<double> sideFrameZ =
args.vecDble(
"SideFrameZ");
32 vector<string> sideFrameRot =
args.vecStr(
34 double sideFrameWidth =
args.dble(
"SideFrameWidth");
35 double sideFrameOver =
args.dble(
"SideFrameOver");
37 vector<string> kaptonName =
args.vecStr(
"KaptonName");
38 vector<double> kaptonZ =
args.vecDble(
"KaptonZ");
39 vector<string> kaptonRot =
args.vecStr(
41 vector<string> waferName =
args.vecStr(
"WaferName");
42 vector<double> waferZ =
args.vecDble(
"WaferZ");
43 vector<string> waferRot =
args.vecStr(
"WaferRotation");
44 string hybridName =
args.str(
"HybridName");
45 double hybridHeight =
args.dble(
"HybridHeight");
46 vector<double> hybridZ =
args.vecDble(
"HybridZ");
47 vector<string> pitchName =
args.vecStr(
"PitchName");
48 double pitchHeight =
args.dble(
"PitchHeight");
49 vector<double> pitchZ =
args.vecDble(
"PitchZ");
50 vector<string> pitchRot =
args.vecStr(
"PitchRotation");
51 string coolName =
args.str(
"CoolInsertName");
52 double coolHeight =
args.dble(
"CoolInsertHeight");
53 double coolZ =
args.dble(
"CoolInsertZ");
54 double coolWidth =
args.dble(
"CoolInsertWidth");
55 vector<double> coolRadShift =
args.vecDble(
"CoolInsertShift");
58 ::toupper(
args.str(
"DoSpacers")[0]) !=
'N';
59 string botSpacersName =
args.str(
"BottomSpacersName");
60 double botSpacersHeight =
args.dble(
"BottomSpacersHeight");
61 double botSpacersZ =
args.dble(
"BottomSpacersZ");
62 string sidSpacersName =
args.str(
"SideSpacersName");
63 double sidSpacersHeight =
args.dble(
"SideSpacersHeight");
64 double sidSpacersZ =
args.dble(
"SideSpacersZ");
65 double sidSpacersWidth =
args.dble(
"SideSpacersWidth");
66 double sidSpacersRadShift =
args.dble(
"SideSpacersShift");
68 LogDebug(
"TIDGeom") <<
"Parent " << parentName <<
" Detector Planes " << detectorN;
70 << dlTop <<
" dl(Bottom) " << dlBottom <<
" dl(Hybrid) " << dlHybrid;
71 LogDebug(
"TIDGeom") << boxFrameName <<
" positioned at Z";
72 for (
int i = 0;
i < detectorN;
i++)
73 LogDebug(
"TIDGeom") <<
"\tboxFrameZ[" <<
i <<
"] = " << boxFrameZ[
i];
74 LogDebug(
"TIDGeom") <<
"\t Extra Height at Bottom " << bottomFrameHeight <<
" Overlap " << bottomFrameOver;
75 for (
int i = 0;
i < detectorN;
i++)
76 LogDebug(
"TIDGeom") <<
"\tsideFrame[" <<
i <<
"] = " << sideFrameName[
i] <<
" positioned at Z " << sideFrameZ[
i]
77 <<
" with rotation " << sideFrameRot[
i];
78 for (
int i = 0;
i < detectorN;
i++)
79 LogDebug(
"TIDGeom") <<
"\tkapton[" <<
i <<
"] = " << kaptonName[
i] <<
" positioned at Z " << kaptonZ[
i]
80 <<
" with rotation " << kaptonRot[
i];
81 for (
int i = 0;
i < detectorN;
i++)
82 LogDebug(
"TIDGeom") << waferName[
i] <<
" positioned at Z " << waferZ[
i] <<
" with rotation " << waferRot[
i];
83 LogDebug(
"TIDGeom") << hybridName <<
" Height " << hybridHeight <<
" Z";
84 for (
int i = 0;
i < detectorN;
i++)
85 LogDebug(
"TIDGeom") <<
"\thybridZ[" <<
i <<
"] = " << hybridZ[
i];
86 LogDebug(
"TIDGeom") <<
"Pitch Adapter Height " << pitchHeight;
87 for (
int i = 0;
i < detectorN;
i++)
88 LogDebug(
"TIDGeom") << pitchName[
i] <<
" position at Z " << pitchZ[
i] <<
" with rotation " << pitchRot[
i];
94 if (dlHybrid > dlTop) {
96 topfr = topFrameHeight - pitchHeight - topFrameOver;
97 botfr = bottomFrameHeight - bottomFrameOver;
98 kaptonHeight = fullHeight + botfr;
101 topfr = topFrameHeight - topFrameOver;
102 botfr = bottomFrameHeight - bottomFrameOver - pitchHeight;
103 kaptonHeight = fullHeight + topfr;
106 double sideFrameHeight = fullHeight + pitchHeight + botfr + topfr;
107 double zCenter = 0.5 * (sideFrameHeight + boxFrameHeight);
110 double sidfr = sideFrameWidth - sideFrameOver;
111 double dxbot = 0.5 * dlBottom + sidfr;
112 double dxtop = 0.5 * dlTop + sidfr;
113 double dxtopenv, dxbotenv;
115 double tanWafer = (dxtop - dxbot) / fullHeight;
116 double thetaWafer = atan(tanWafer);
118 if (dlHybrid > dlTop) {
120 dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + pitchHeight + topfr + hybridHeight) / fullHeight;
121 dxbotenv = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
124 dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
128 double tanEnv = (dxtopenv - dxbotenv) / (sideFrameHeight + boxFrameHeight);
141 Volume parentVol = ns.volume(parentName);
143 for (
int j1 = 0; j1 < 2; j1++) {
145 if (dlHybrid > dlTop) {
146 zCool = sideFrameHeight + boxFrameHeight - coolRadShift[j1];
148 zCool -= 0.5 * coolHeight;
150 zCool = coolRadShift[j1];
152 zCool += 0.5 * coolHeight;
156 xpos = -0.5 * (boxFrameWidth - coolWidth);
158 xpos = -(dxbotenv + (zCool - 0.5 * coolHeight) * tanEnv - 0.5 * coolWidth);
161 zpos = zCool - zCenter;
162 for (
int j2 = 0; j2 < 2; j2++) {
165 LogDebug(
"TIDGeom") <<
name <<
" number " <<
copy <<
" positioned in " << parentName <<
" at "
173 name = botSpacersName;
176 if (dlHybrid > dlTop) {
177 zBotSpacers = sideFrameHeight + boxFrameHeight - 0.5 * botSpacersHeight;
179 zBotSpacers = 0.5 * botSpacersHeight;
181 zpos = zBotSpacers - zCenter;
182 parentVol.placeVolume(ns.volume(
name), 1,
Position(0.0, ypos, zpos));
183 LogDebug(
"TIDGeom") <<
name <<
" number " << 1 <<
" positioned in " << parentName <<
" at "
184 <<
Position(0.0, ypos, zpos) <<
" with no rotation";
186 name = sidSpacersName;
189 if (dlHybrid > dlTop) {
190 zSideSpacers = sideFrameHeight + boxFrameHeight - sidSpacersRadShift;
192 zSideSpacers = sidSpacersRadShift;
194 zpos = zSideSpacers - zCenter;
197 xpos = dxbotenv + (zSideSpacers - 0.5 * sidSpacersHeight) * tanEnv - 0.5 * sidSpacersWidth + sideFrameOver;
199 double phiy = 0e0, phiz = 0e0;
200 double phix = 0._deg;
205 double thetay = 90._deg;
206 double thetaz = thetaWafer;
208 for (
int j1 = 0; j1 < 2; j1++) {
211 thetax = 90._deg + thetaz;
213 parentVol.placeVolume(ns.volume(
name),
copy, Transform3D(
rot,
Position(xpos, ypos, zpos)));
214 LogDebug(
"TIDGeom") <<
name <<
" number " <<
copy <<
" positioned in " << parentName <<
" at "
222 for (
int k = 0;
k < detectorN;
k++) {
228 if (dlHybrid > dlTop) {
229 zWafer = botfr + 0.5 * fullHeight;
231 zWafer = boxFrameHeight + botfr + pitchHeight + 0.5 * fullHeight;
233 zpos = zWafer - zCenter;
235 rot = ns.rotation(waferRot[
k]);
237 parentVol.placeVolume(ns.volume(
name),
k + 1, Transform3D(
rot, tran));
238 LogDebug(
"TIDGeom") <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName <<
" at " << tran <<
" with "
246 xpos = 0.5 * fullHeight *
sin(detTilt);
250 if (dlHybrid > dlTop) {
251 zPitch = botfr + fullHeight + 0.5 * pitchHeight;
253 zPitch = boxFrameHeight + botfr + 0.5 * pitchHeight;
255 zpos = zPitch - zCenter;
256 rot = ns.rotation(pitchRot[
k]);
258 parentVol.placeVolume(ns.volume(
name),
k + 1, Transform3D(
rot, tran));
259 LogDebug(
"TIDGeom") <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName <<
" at " << tran <<
" with "
266 if (dlHybrid > dlTop) {
267 zHybrid = botfr + fullHeight + pitchHeight + 0.5 * hybridHeight;
269 zHybrid = 0.5 * hybridHeight;
271 zpos = zHybrid - zCenter;
273 parentVol.placeVolume(ns.volume(
name),
k + 1, tran);
274 LogDebug(
"TIDGeom") <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName <<
" at " << tran;
280 if (dlHybrid > dlTop) {
281 zBoxFrame = sideFrameHeight + 0.5 * boxFrameHeight;
283 zBoxFrame = 0.5 * boxFrameHeight;
285 zpos = zBoxFrame - zCenter;
287 parentVol.placeVolume(ns.volume(
name),
k + 1, tran);
288 LogDebug(
"TIDGeom") <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName <<
" at " << tran;
291 name = sideFrameName[
k];
292 ypos = sideFrameZ[
k];
294 if (dlHybrid > dlTop) {
295 zSideFrame = 0.5 * sideFrameHeight;
297 zSideFrame = boxFrameHeight + 0.5 * sideFrameHeight;
299 zpos = zSideFrame - zCenter;
300 rot = ns.rotation(sideFrameRot[
k]);
302 parentVol.placeVolume(ns.volume(
name),
k + 1, Transform3D(
rot, tran));
303 LogDebug(
"TIDGeom") <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName <<
" at " << tran <<
" with "
306 name = kaptonName[
k];
309 double kaptonExtraHeight = 0;
310 if (dlHybrid > dlTop) {
312 kaptonExtraHeight = dlTop *
sin(detTilt) - fullHeight * (1 -
cos(detTilt));
313 kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
314 zKapton = 0.5 * (kaptonHeight + kaptonExtraHeight);
317 kaptonExtraHeight = dlBottom *
sin(detTilt) - fullHeight * (1 -
cos(detTilt));
318 kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
319 zKapton = boxFrameHeight + sideFrameHeight - 0.5 * (kaptonHeight + kaptonExtraHeight);
321 zpos = zKapton - zCenter;
322 rot = ns.rotation(kaptonRot[
k]);
324 parentVol.placeVolume(ns.volume(
name),
k + 1, Transform3D(
rot, tran));
325 LogDebug(
"TIDGeom") <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName <<
" at " << tran <<
" with "
328 LogDebug(
"TIDGeom") <<
"<<== End of DDTIDModulePosAlgo positioning ...";