15 #include "CLHEP/Units/GlobalPhysicalConstants.h"
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
110 genMat = sArgs[
"GeneralMaterial"];
111 detectorN = (int)(nArgs[
"DetectorNumber"]);
114 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: Parent " << parentName <<
" General Material " << genMat
115 <<
" Detector Planes " << detectorN;
117 moduleThick = nArgs[
"ModuleThick"];
118 detTilt = nArgs[
"DetTilt"];
119 fullHeight = nArgs[
"FullHeight"];
120 dlTop = nArgs[
"DlTop"];
121 dlBottom = nArgs[
"DlBottom"];
122 dlHybrid = nArgs[
"DlHybrid"];
123 string comp = sArgs[
"DoComponents"];
124 if (comp ==
"No" || comp ==
"NO" || comp ==
"no")
125 doComponents =
false;
129 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: ModuleThick " << moduleThick <<
" Detector Tilt "
130 << detTilt / CLHEP::deg <<
" Height " << fullHeight <<
" dl(Top) " << dlTop <<
" dl(Bottom) "
131 << dlBottom <<
" dl(Hybrid) " << dlHybrid <<
" doComponents " << doComponents;
133 boxFrameName = sArgs[
"BoxFrameName"];
134 boxFrameMat = sArgs[
"BoxFrameMaterial"];
135 boxFrameThick = nArgs[
"BoxFrameThick"];
136 boxFrameHeight = nArgs[
"BoxFrameHeight"];
137 boxFrameWidth = nArgs[
"BoxFrameWidth"];
138 bottomFrameHeight = nArgs[
"BottomFrameHeight"];
139 bottomFrameOver = nArgs[
"BottomFrameOver"];
140 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: " << boxFrameName <<
" Material " << boxFrameMat <<
" Thickness "
141 << boxFrameThick <<
" width " << boxFrameWidth <<
" height " << boxFrameHeight
142 <<
" Extra Height at Bottom " << bottomFrameHeight <<
" Overlap " << bottomFrameOver;
144 topFrameHeight = nArgs[
"TopFrameHeight"];
145 topFrameOver = nArgs[
"TopFrameOver"];
146 sideFrameName = vsArgs[
"SideFrameName"];
147 sideFrameMat = sArgs[
"SideFrameMaterial"];
148 sideFrameWidth = nArgs[
"SideFrameWidth"];
149 sideFrameThick = nArgs[
"SideFrameThick"];
150 sideFrameOver = nArgs[
"SideFrameOver"];
151 holeFrameName = vsArgs[
"HoleFrameName"];
152 holeFrameRot = vsArgs[
"HoleFrameRotation"];
153 for (i = 0; i < detectorN; i++)
154 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug : " << sideFrameName[
i] <<
" Material " << sideFrameMat <<
" Width "
155 << sideFrameWidth <<
" Thickness " << sideFrameThick <<
" Overlap " << sideFrameOver
156 <<
" Hole " << holeFrameName[
i];
158 kaptonName = vsArgs[
"KaptonName"];
159 kaptonMat = sArgs[
"KaptonMaterial"];
160 kaptonThick = nArgs[
"KaptonThick"];
161 kaptonOver = nArgs[
"KaptonOver"];
162 holeKaptonName = vsArgs[
"HoleKaptonName"];
163 holeKaptonRot = vsArgs[
"HoleKaptonRotation"];
164 for (i = 0; i < detectorN; i++)
165 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug : " << kaptonName[
i] <<
" Material " << kaptonMat <<
" Thickness "
166 << kaptonThick <<
" Overlap " << kaptonOver <<
" Hole " << holeKaptonName[
i];
168 waferName = vsArgs[
"WaferName"];
169 waferMat = sArgs[
"WaferMaterial"];
170 sideWidthTop = nArgs[
"SideWidthTop"];
171 sideWidthBottom = nArgs[
"SideWidthBottom"];
173 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: Wafer Material " << waferMat <<
" Side Width Top " << sideWidthTop
174 <<
" Side Width Bottom " << sideWidthBottom;
175 for (i = 0; i < detectorN; i++)
176 LogDebug(
"TIDGeom") <<
"\twaferName[" << i <<
"] = " << waferName[
i];
178 activeName = vsArgs[
"ActiveName"];
179 activeMat = sArgs[
"ActiveMaterial"];
180 activeHeight = nArgs[
"ActiveHeight"];
182 activeRot = sArgs[
"ActiveRotation"];
183 backplaneThick = vArgs[
"BackPlaneThick"];
184 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: Active Material " << activeMat <<
" Height " << activeHeight
185 <<
" rotated by " << activeRot;
186 for (i = 0; i < detectorN; i++)
187 LogDebug(
"TIDGeom") <<
" translated by (0," << -0.5 * backplaneThick[
i] <<
",0)\tactiveName[" << i
188 <<
"] = " << activeName[
i] <<
" of thickness " <<
waferThick[
i] - backplaneThick[
i];
190 hybridName = sArgs[
"HybridName"];
191 hybridMat = sArgs[
"HybridMaterial"];
192 hybridHeight = nArgs[
"HybridHeight"];
193 hybridWidth = nArgs[
"HybridWidth"];
194 hybridThick = nArgs[
"HybridThick"];
195 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: " << hybridName <<
" Material " << hybridMat <<
" Height "
196 << hybridHeight <<
" Width " << hybridWidth <<
" Thickness " << hybridThick;
198 pitchName = vsArgs[
"PitchName"];
199 pitchMat = sArgs[
"PitchMaterial"];
200 pitchHeight = nArgs[
"PitchHeight"];
201 pitchThick = nArgs[
"PitchThick"];
202 pitchStereoTol = nArgs[
"PitchStereoTolerance"];
204 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: Pitch Adapter Material " << pitchMat <<
" Height " << pitchHeight
205 <<
" Thickness " << pitchThick;
206 for (i = 0; i < detectorN; i++)
207 LogDebug(
"TIDGeom") <<
"\tpitchName[" << i <<
"] = " << pitchName[
i];
209 coolName = sArgs[
"CoolInsertName"];
210 coolMat = sArgs[
"CoolInsertMaterial"];
211 coolHeight = nArgs[
"CoolInsertHeight"];
212 coolThick = nArgs[
"CoolInsertThick"];
213 coolWidth = nArgs[
"CoolInsertWidth"];
214 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo debug: Cool Element Material " << coolMat <<
" Height " << coolHeight
215 <<
" Thickness " << coolThick <<
" Width " << coolWidth;
219 LogDebug(
"TIDGeom") <<
"==>> Constructing DDTIDModuleAlgo...";
223 double sidfr = sideFrameWidth - sideFrameOver;
227 if (dlHybrid > dlTop) {
229 topfr = topFrameHeight - pitchHeight - topFrameOver;
230 botfr = bottomFrameHeight - bottomFrameOver;
231 kaptonHeight = fullHeight + botfr;
234 topfr = topFrameHeight - topFrameOver;
235 botfr = bottomFrameHeight - bottomFrameOver - pitchHeight;
236 kaptonHeight = fullHeight + topfr;
239 double sideFrameHeight = fullHeight + pitchHeight + botfr + topfr;
240 double kaptonWidth = sidfr + kaptonOver;
242 double dxbot = 0.5 * dlBottom + sidfr;
243 double dxtop = 0.5 * dlTop + sidfr;
244 double dxtopenv, dxbotenv;
247 if (dlHybrid > dlTop) {
249 dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + pitchHeight + topfr + hybridHeight) / fullHeight;
250 dxbotenv = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
253 dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
256 double bl1 = dxbotenv;
257 double bl2 = dxtopenv;
258 double h1 = 0.5 * moduleThick;
259 double dz = 0.5 * (boxFrameHeight + sideFrameHeight);
262 DDSolid solid =
DDSolidFactory::trap(parentName, dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
265 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << genMat <<
" of dimensions "
266 << dz <<
", 0, 0, " << h1 <<
", " << bl1 <<
", " << bl1 <<
", 0, " << h1 <<
", " << bl2 <<
", "
272 double dx = 0.5 * boxFrameWidth;
273 double dy = 0.5 * boxFrameThick;
274 double dz = 0.5 * boxFrameHeight;
276 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Box made of " << matter.
ddname()
277 <<
" of dimensions " << dx <<
", " << dy <<
", " <<
dz;
282 dx = 0.5 * hybridWidth;
283 dy = 0.5 * hybridThick;
284 dz = 0.5 * hybridHeight;
286 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Box made of " << matter.ddname()
287 <<
" of dimensions " << dx <<
", " << dy <<
", " <<
dz;
292 dx = 0.5 * coolWidth;
293 dy = 0.5 * coolThick;
294 dz = 0.5 * coolHeight;
296 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Box made of " << matter.ddname()
297 <<
" of dimensions " << dx <<
", " << dy <<
", " <<
dz;
301 for (
int k = 0;
k < detectorN;
k++) {
306 if (dlHybrid > dlTop) {
308 bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
309 bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + pitchHeight + topfr) / fullHeight;
312 bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + pitchHeight + botfr) / fullHeight;
313 bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
315 h1 = 0.5 * sideFrameThick;
316 dz = 0.5 * sideFrameHeight;
329 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << matter.ddname()
330 <<
" of dimensions " << dz <<
", 0, 0, " << h1 <<
", " << bbl1 <<
", " << bbl1 <<
", 0, "
331 << h1 <<
", " << bbl2 <<
", " << bbl2 <<
", 0";
334 string rotstr, rotns;
340 dz = fullHeight - bottomFrameOver - topFrameOver;
341 bbl1 = dxbot - sideFrameWidth + bottomFrameOver * (dxtop - dxbot) / fullHeight;
342 bbl2 = dxtop - sideFrameWidth - topFrameOver * (dxtop - dxbot) / fullHeight;
343 if (dlHybrid > dlTop) {
345 zpos = -(topFrameHeight + 0.5 * dz - 0.5 * sideFrameHeight);
348 zpos = bottomFrameHeight + 0.5 * dz - 0.5 * sideFrameHeight;
363 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << matter.ddname()
364 <<
" of dimensions " << dz <<
", 0, 0, " << h1 <<
", " << bbl1 <<
", " << bbl1 <<
", 0, "
365 << h1 <<
", " << bbl2 <<
", " << bbl2 <<
", 0";
368 rotstr =
DDSplit(holeFrameRot[k]).first;
369 if (rotstr !=
"NULL") {
370 rotns =
DDSplit(holeFrameRot[k]).second;
376 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test: " << holeFrame.name() <<
" number 1 positioned in "
377 << sideFrame.name() <<
" at (0,0," << zpos <<
") with no rotation";
381 double kaptonExtraHeight = 0;
382 if (dlHybrid > dlTop) {
384 bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
386 kaptonExtraHeight = dlTop *
sin(detTilt) - fullHeight * (1 -
cos(detTilt));
387 kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
388 bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + kaptonExtraHeight) / fullHeight;
394 bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
396 kaptonExtraHeight = dlBottom *
sin(detTilt) - fullHeight * (1 -
cos(detTilt));
397 kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
398 bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + kaptonExtraHeight) / fullHeight;
403 h1 = 0.5 * kaptonThick;
404 dz = 0.5 * (kaptonHeight + kaptonExtraHeight);
409 string kaptonUncutName = kaptonName[
k] +
"Uncut";
424 string kaptonCutName = kaptonName[
k] +
"Cut";
426 if (dlHybrid > dlTop) {
431 h1 = 0.5 * kaptonThick;
432 bbl1 = fabs(dz *
sin(detTilt));
433 bbl2 = bbl1 * 0.000001;
434 double thet = atan((bbl1 - bbl2) / (2 * dz));
448 string aRot(
"tidmodpar:9PYX");
453 xpos = -0.5 * fullHeight *
sin(detTilt);
454 zpos = 0.5 * kaptonHeight - bbl2;
478 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" SUBTRACTION SOLID Trap made of "
479 << matter.ddname() <<
" of dimensions " << dz <<
", 0, 0, " << h1 <<
", " << bbl1 <<
", "
480 << bbl1 <<
", 0, " << h1 <<
", " << bbl2 <<
", " << bbl2 <<
", 0";
484 dz = fullHeight - kaptonOver;
486 if (dlHybrid > dlTop) {
488 bbl1 = dxbot - kaptonWidth + kaptonOver * (dxtop - dxbot) / fullHeight;
489 bbl2 = dxtop - kaptonWidth;
490 zpos = 0.5 * (kaptonHeight - kaptonExtraHeight -
dz);
492 zpos -= 0.5 * kaptonOver * (1 -
cos(detTilt));
493 xpos = -0.5 * kaptonOver *
sin(detTilt);
497 bbl1 = dxbot - kaptonWidth;
498 bbl2 = dxtop - kaptonWidth - kaptonOver * (dxtop - dxbot) / fullHeight;
499 zpos = -0.5 * (kaptonHeight - kaptonExtraHeight -
dz);
514 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << matter.ddname()
515 <<
" of dimensions " << dz <<
", 0, 0, " << h1 <<
", " << bbl1 <<
", " << bbl1 <<
", 0, "
516 << h1 <<
", " << bbl2 <<
", " << bbl2 <<
", 0";
519 rotstr =
DDSplit(holeKaptonRot[k]).first;
520 if (rotstr !=
"NULL") {
521 rotns =
DDSplit(holeKaptonRot[k]).second;
527 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test: " << holeKapton.name() <<
" number 1 positioned in "
528 << kapton.name() <<
" at (0,0," << zpos <<
") with no rotation";
532 if (k == 0 && dlHybrid < dlTop) {
534 bl2 = 0.5 * dlBottom;
536 bl1 = 0.5 * dlBottom;
540 dz = 0.5 * fullHeight;
542 DDName(
DDSplit(waferName[k]).first,
DDSplit(waferName[k]).second), dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
543 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << matter.ddname()
544 <<
" of dimensions " << dz <<
", 0, 0, " << h1 <<
", " << bl1 <<
", " << bl1 <<
", 0, " << h1
545 <<
", " << bl2 <<
", " << bl2 <<
", 0";
550 if (k == 0 && dlHybrid < dlTop) {
552 bl2 -= sideWidthBottom;
554 bl1 -= sideWidthBottom;
558 h1 = 0.5 * activeHeight;
571 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << matter.ddname()
572 <<
" of dimensions " << dz <<
", 0, 0, " << h1 <<
", " << bl2 <<
", " << bl1 <<
", 0, " << h1
573 <<
", " << bl2 <<
", " << bl1 <<
", 0";
575 rotstr =
DDSplit(activeRot).first;
576 if (rotstr !=
"NULL") {
577 rotns =
DDSplit(activeRot).second;
583 cpv.
position(active, wafer, 1, tran, rot);
584 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test: " << active.name() <<
" number 1 positioned in " << wafer.name()
585 <<
" at " << tran <<
" with " <<
rot;
589 if (dlHybrid > dlTop) {
596 dy = 0.5 * pitchThick;
597 dz = 0.5 * pitchHeight;
599 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Box made of " << matter.ddname()
601 <<
" " << dx <<
", " << dy <<
", " <<
dz;
603 h1 = 0.5 * pitchThick;
604 bl1 = 0.5 * pitchHeight + 0.5 * dz *
sin(detTilt);
605 bl2 = 0.5 * pitchHeight - 0.5 * dz *
sin(detTilt);
607 dz -= 0.5 * pitchStereoTol;
608 bl1 -= pitchStereoTol;
609 bl2 -= pitchStereoTol;
611 double thet = atan((bl1 - bl2) / (2. * dz));
624 LogDebug(
"TIDGeom") <<
"DDTIDModuleAlgo test:\t" << solid.
name() <<
" Trap made of " << matter.ddname()
626 <<
"dimensions " << dz <<
", " << thet / CLHEP::deg <<
", 0, " << h1 <<
", " << bl1 <<
", "
627 << bl1 <<
", 0, " << h1 <<
", " << bl2 <<
", " << bl2 <<
", 0";
632 LogDebug(
"TIDGeom") <<
"<<== End of DDTIDModuleAlgo construction ...";
void execute(DDCompactView &cpv) override
static AlgebraicMatrix initialize()
vector< string > holeKaptonName
vector< string > kaptonName
vector< string > holeFrameRot
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
vector< double > backplaneThick
DDMaterial is used to define and access material information.
Sin< T >::type sin(const T &t)
DDName is used to identify DDD entities uniquely.
vector< string > holeFrameName
Compact representation of the geometrical detector hierarchy.
vector< string > holeKaptonRot
vector< string > sideFrameName
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
vector< double > waferThick
vector< string > waferName
vector< string > pitchName
Cos< T >::type cos(const T &t)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
int32_t waferThick(const int32_t property)
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
vector< string > activeName
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
~DDTIDModuleAlgo() override
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override