12 #include "CLHEP/Units/GlobalPhysicalConstants.h" 13 #include "CLHEP/Units/GlobalSystemOfUnits.h" 97 detectorN = (
int)(nArgs[
"DetectorNumber"]);
99 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: Parent " << parentName <<
" Detector Planes " << detectorN;
101 detTilt = nArgs[
"DetTilt"];
102 fullHeight = nArgs[
"FullHeight"];
103 dlTop = nArgs[
"DlTop"];
104 dlBottom = nArgs[
"DlBottom"];
105 dlHybrid = nArgs[
"DlHybrid"];
107 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: Detector Tilt " << detTilt / CLHEP::deg <<
" Height " << fullHeight
108 <<
" dl(Top) " << dlTop <<
" dl(Bottom) " << dlBottom <<
" dl(Hybrid) " << dlHybrid;
110 boxFrameName = sArgs[
"BoxFrameName"];
111 boxFrameHeight = nArgs[
"BoxFrameHeight"];
112 boxFrameWidth = nArgs[
"BoxFrameWidth"];
113 boxFrameZ = vArgs[
"BoxFrameZ"];
114 bottomFrameHeight = nArgs[
"BottomFrameHeight"];
115 bottomFrameOver = nArgs[
"BottomFrameOver"];
116 topFrameHeight = nArgs[
"TopFrameHeight"];
117 topFrameOver = nArgs[
"TopFrameOver"];
118 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: " << boxFrameName <<
" positioned at Z";
119 for (
i = 0;
i < detectorN;
i++)
120 LogDebug(
"TIDGeom") <<
"\tboxFrameZ[" <<
i <<
"] = " << boxFrameZ[
i];
121 LogDebug(
"TIDGeom") <<
"\t Extra Height at Bottom " << bottomFrameHeight <<
" Overlap " << bottomFrameOver;
123 sideFrameName = vsArgs[
"SideFrameName"];
124 sideFrameZ = vArgs[
"SideFrameZ"];
125 sideFrameRot = vsArgs[
"SideFrameRotation"];
126 sideFrameWidth = nArgs[
"SideFrameWidth"];
127 sideFrameOver = nArgs[
"SideFrameOver"];
128 for (
i = 0;
i < detectorN;
i++)
129 LogDebug(
"TIDGeom") <<
"\tsideFrame[" <<
i <<
"] = " << sideFrameName[
i] <<
" positioned at Z " << sideFrameZ[
i]
130 <<
" with rotation " << sideFrameRot[
i];
132 kaptonName = vsArgs[
"KaptonName"];
133 kaptonZ = vArgs[
"KaptonZ"];
134 kaptonRot = vsArgs[
"KaptonRotation"];
135 for (
i = 0;
i < detectorN;
i++)
136 LogDebug(
"TIDGeom") <<
"\tkapton[" <<
i <<
"] = " << kaptonName[
i] <<
" positioned at Z " << kaptonZ[
i]
137 <<
" with rotation " << kaptonRot[
i];
139 waferName = vsArgs[
"WaferName"];
140 waferZ = vArgs[
"WaferZ"];
141 waferRot = vsArgs[
"WaferRotation"];
142 for (
i = 0;
i < detectorN;
i++)
143 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: " << waferName[
i] <<
" positioned at Z " << waferZ[
i]
144 <<
" with rotation " << waferRot[
i];
146 hybridName = sArgs[
"HybridName"];
147 hybridHeight = nArgs[
"HybridHeight"];
148 hybridZ = vArgs[
"HybridZ"];
149 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: " << hybridName <<
" Height " << hybridHeight <<
" Z";
150 for (
i = 0;
i < detectorN;
i++)
151 LogDebug(
"TIDGeom") <<
"\thybridZ[" <<
i <<
"] = " << hybridZ[
i];
153 pitchName = vsArgs[
"PitchName"];
154 pitchHeight = nArgs[
"PitchHeight"];
155 pitchZ = vArgs[
"PitchZ"];
156 pitchRot = vsArgs[
"PitchRotation"];
157 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: Pitch Adapter Height " << pitchHeight;
158 for (
i = 0;
i < detectorN;
i++)
159 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo debug: " << pitchName[
i] <<
" position at Z " << pitchZ[
i]
160 <<
" with rotation " << pitchRot[
i];
162 coolName = sArgs[
"CoolInsertName"];
163 coolHeight = nArgs[
"CoolInsertHeight"];
164 coolZ = nArgs[
"CoolInsertZ"];
165 coolWidth = nArgs[
"CoolInsertWidth"];
166 coolRadShift = vArgs[
"CoolInsertShift"];
168 string comp = sArgs[
"DoSpacers"];
174 botSpacersName = sArgs[
"BottomSpacersName"];
175 botSpacersHeight = nArgs[
"BottomSpacersHeight"];
176 botSpacersZ = nArgs[
"BottomSpacersZ"];
177 sidSpacersName = sArgs[
"SideSpacersName"];
178 sidSpacersHeight = nArgs[
"SideSpacersHeight"];
179 sidSpacersZ = nArgs[
"SideSpacersZ"];
180 sidSpacersWidth = nArgs[
"SideSpacersWidth"];
181 sidSpacersRadShift = nArgs[
"SideSpacersShift"];
185 LogDebug(
"TIDGeom") <<
"==>> Constructing DDTIDModulePosAlgo...";
192 if (dlHybrid > dlTop) {
194 topfr = topFrameHeight - pitchHeight - topFrameOver;
195 botfr = bottomFrameHeight - bottomFrameOver;
196 kaptonHeight = fullHeight + botfr;
199 topfr = topFrameHeight - topFrameOver;
200 botfr = bottomFrameHeight - bottomFrameOver - pitchHeight;
201 kaptonHeight = fullHeight + topfr;
204 double sideFrameHeight = fullHeight + pitchHeight + botfr + topfr;
205 double zCenter = 0.5 * (sideFrameHeight + boxFrameHeight);
208 double sidfr = sideFrameWidth - sideFrameOver;
209 double dxbot = 0.5 * dlBottom + sidfr;
210 double dxtop = 0.5 * dlTop + sidfr;
211 double dxtopenv, dxbotenv;
213 double tanWafer = (dxtop - dxbot) / fullHeight;
214 double thetaWafer = atan(tanWafer);
216 if (dlHybrid > dlTop) {
218 dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + pitchHeight + topfr + hybridHeight) / fullHeight;
219 dxbotenv = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
222 dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
226 double tanEnv = (dxtopenv - dxbotenv) / (sideFrameHeight + boxFrameHeight);
240 for (
int j1 = 0; j1 < 2; j1++) {
242 if (dlHybrid > dlTop) {
243 zCool = sideFrameHeight + boxFrameHeight - coolRadShift[j1];
245 zCool -= 0.5 * coolHeight;
247 zCool = coolRadShift[j1];
249 zCool += 0.5 * coolHeight;
253 xpos = -0.5 * (boxFrameWidth - coolWidth);
255 xpos = -(dxbotenv + (zCool - 0.5 * coolHeight) * tanEnv - 0.5 * coolWidth);
258 zpos = zCool - zCenter;
259 for (
int j2 = 0; j2 < 2; j2++) {
262 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
copy <<
" positioned in " 263 << parentName <<
" at " <<
DDTranslation(xpos, ypos, zpos) <<
" with " <<
rot;
274 if (dlHybrid > dlTop) {
275 zBotSpacers = sideFrameHeight + boxFrameHeight - 0.5 * botSpacersHeight;
277 zBotSpacers = 0.5 * botSpacersHeight;
279 zpos = zBotSpacers - zCenter;
282 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " << 1 <<
" positioned in " << parentName
283 <<
" at " <<
DDTranslation(0.0, ypos, zpos) <<
" with no rotation";
290 if (dlHybrid > dlTop) {
291 zSideSpacers = sideFrameHeight + boxFrameHeight - sidSpacersRadShift;
293 zSideSpacers = sidSpacersRadShift;
295 zpos = zSideSpacers - zCenter;
298 xpos = dxbotenv + (zSideSpacers - 0.5 * sidSpacersHeight) * tanEnv - 0.5 * sidSpacersWidth + sideFrameOver;
300 double phix, phiy, phiz;
301 phix = 0. * CLHEP::deg;
302 phiy = 90. * CLHEP::deg;
303 phiz = 0. * CLHEP::deg;
305 double thetay, thetax;
306 thetay = 90. * CLHEP::deg;
307 double thetaz = thetaWafer;
309 for (
int j1 = 0; j1 < 2; j1++) {
313 thetax = 90. * CLHEP::deg + thetaz;
314 double thetadeg = thetax / CLHEP::deg;
321 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
copy <<
" positioned in " 322 << parentName <<
" at " <<
DDTranslation(xpos, ypos, zpos) <<
" with " <<
rot;
329 for (
int k = 0;
k < detectorN;
k++) {
335 if (dlHybrid > dlTop) {
336 zWafer = botfr + 0.5 * fullHeight;
338 zWafer = boxFrameHeight + botfr + pitchHeight + 0.5 * fullHeight;
340 zpos = zWafer - zCenter;
342 string rotstr =
DDSplit(waferRot[
k]).first;
344 if (rotstr !=
"NULL") {
345 rotns =
DDSplit(waferRot[
k]).second;
349 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName
350 <<
" at " << tran <<
" with " <<
rot;
357 xpos = 0.5 * fullHeight *
sin(detTilt);
361 if (dlHybrid > dlTop) {
362 zPitch = botfr + fullHeight + 0.5 * pitchHeight;
364 zPitch = boxFrameHeight + botfr + 0.5 * pitchHeight;
366 zpos = zPitch - zCenter;
367 rotstr =
DDSplit(pitchRot[
k]).first;
368 if (rotstr !=
"NULL") {
369 rotns =
DDSplit(pitchRot[
k]).second;
376 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName
377 <<
" at " << tran <<
" with " <<
rot;
383 if (dlHybrid > dlTop) {
384 zHybrid = botfr + fullHeight + pitchHeight + 0.5 * hybridHeight;
386 zHybrid = 0.5 * hybridHeight;
388 zpos = zHybrid - zCenter;
392 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName
393 <<
" at " << tran <<
" with " <<
rot;
399 if (dlHybrid > dlTop) {
400 zBoxFrame = sideFrameHeight + 0.5 * boxFrameHeight;
402 zBoxFrame = 0.5 * boxFrameHeight;
404 zpos = zBoxFrame - zCenter;
408 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName
409 <<
" at " << tran <<
" with " <<
rot;
413 ypos = sideFrameZ[
k];
415 if (dlHybrid > dlTop) {
416 zSideFrame = 0.5 * sideFrameHeight;
418 zSideFrame = boxFrameHeight + 0.5 * sideFrameHeight;
420 zpos = zSideFrame - zCenter;
421 rotstr =
DDSplit(sideFrameRot[
k]).first;
422 if (rotstr !=
"NULL") {
423 rotns =
DDSplit(sideFrameRot[
k]).second;
430 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName
431 <<
" at " << tran <<
" with " <<
rot;
437 double kaptonExtraHeight = 0;
438 if (dlHybrid > dlTop) {
440 kaptonExtraHeight = dlTop *
sin(detTilt) - fullHeight * (1 -
cos(detTilt));
441 kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
442 zKapton = 0.5 * (kaptonHeight + kaptonExtraHeight);
445 kaptonExtraHeight = dlBottom *
sin(detTilt) - fullHeight * (1 -
cos(detTilt));
446 kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
447 zKapton = boxFrameHeight + sideFrameHeight - 0.5 * (kaptonHeight + kaptonExtraHeight);
449 zpos = zKapton - zCenter;
450 rotstr =
DDSplit(kaptonRot[
k]).first;
451 if (rotstr !=
"NULL") {
452 rotns =
DDSplit(kaptonRot[
k]).second;
459 LogDebug(
"TIDGeom") <<
"DDTIDModulePosAlgo test: " <<
name <<
" number " <<
k + 1 <<
" positioned in " << parentName
460 <<
" at " << tran <<
" with " <<
rot;
463 LogDebug(
"TIDGeom") <<
"<<== End of DDTIDModulePosAlgo positioning ...";
static AlgebraicMatrix initialize()
void execute(DDCompactView &cpv) override
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
vector< string > pitchName
vector< string > waferRot
Sin< T >::type sin(const T &t)
vector< string > pitchRot
vector< string > sideFrameName
DDName is used to identify DDD entities uniquely.
std::string to_string(const V &value)
Compact representation of the geometrical detector hierarchy.
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
vector< string > sideFrameRot
vector< double > boxFrameZ
Cos< T >::type cos(const T &t)
vector< double > sideFrameZ
vector< double > coolRadShift
vector< string > kaptonName
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
vector< string > kaptonRot
~DDTIDModulePosAlgo() override
vector< string > waferName
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
double sidSpacersRadShift
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation