14 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 #include <CLHEP/Geometry/Point3D.h>
17 #include <CLHEP/Geometry/Vector3D.h>
18 #include <CLHEP/Geometry/Transform3D.h>
29 #include "CLHEP/Geometry/Transform3D.h"
36 typedef HepGeom::Point3D<double>
Pt3D;
37 typedef HepGeom::Transform3D
Tf3D;
38 typedef HepGeom::ReflectZ3D
RfZ3D;
39 typedef HepGeom::Translate3D
Tl3D;
40 typedef HepGeom::Rotate3D
Ro3D;
41 typedef HepGeom::RotateZ3D
RoZ3D;
42 typedef HepGeom::RotateY3D
RoY3D;
43 typedef HepGeom::RotateX3D
RoX3D;
45 typedef CLHEP::Hep3Vector
Vec3;
46 typedef CLHEP::HepRotation
Rota;
425 void web(
unsigned int iWeb,
947 m_vecIlyPipeLength(),
963 m_IlyFanOutLength(0),
964 m_IlyFanOutHeight(0),
1005 m_BackSideLength(0),
1006 m_BackSideHeight(0),
1012 m_BackPlateName(
""),
1014 m_BackPlateLength(0),
1015 m_BackPlateThick(0),
1016 m_BackPlateWidth(0),
1018 m_BackPlate2Name(
""),
1019 m_BackPlate2Thick(0),
1020 m_BackPlate2Mat(
""),
1027 m_vecGrilleHeight(),
1029 m_GrEdgeSlotName(
""),
1030 m_GrEdgeSlotMat(
""),
1031 m_GrEdgeSlotHere(0),
1032 m_GrEdgeSlotHeight(0),
1033 m_GrEdgeSlotWidth(0),
1034 m_GrMidSlotName(
""),
1037 m_GrMidSlotWidth(0),
1039 m_vecGrMidSlotHeight(),
1042 m_vecBackPipeDiam(),
1043 m_vecBackPipeThick(),
1045 m_BackPipeWaterMat(
""),
1047 m_vecBackCoolName(),
1049 m_BackCoolBarHere(0),
1050 m_BackCoolBarWidth(0),
1051 m_BackCoolBarHeight(0),
1053 m_BackCoolBarName(
""),
1054 m_BackCoolBarThick(0),
1055 m_BackCoolBarMat(
""),
1056 m_BackCoolBarSSName(
""),
1057 m_BackCoolBarSSThick(0),
1058 m_BackCoolBarSSMat(
""),
1059 m_BackCoolBarWaName(
""),
1060 m_BackCoolBarWaThick(0),
1061 m_BackCoolBarWaMat(
""),
1062 m_BackCoolVFEHere(0),
1063 m_BackCoolVFEName(
""),
1064 m_BackCoolVFEMat(
""),
1067 m_vecBackVFELyrThick(),
1068 m_vecBackVFELyrName(),
1069 m_vecBackVFELyrMat(),
1070 m_vecBackCoolNSec(),
1071 m_vecBackCoolSecSep(),
1072 m_vecBackCoolNPerSec(),
1075 m_vecBackMiscThick(),
1076 m_vecBackMiscName(),
1079 m_PatchPanelHere(0),
1080 m_PatchPanelName(
""),
1081 m_vecPatchPanelThick(),
1082 m_vecPatchPanelNames(),
1083 m_vecPatchPanelMat(),
1084 m_BackCoolTankHere(0),
1085 m_BackCoolTankName(
""),
1086 m_BackCoolTankWidth(0),
1087 m_BackCoolTankThick(0),
1088 m_BackCoolTankMat(
""),
1089 m_BackCoolTankWaName(
""),
1090 m_BackCoolTankWaWidth(0),
1091 m_BackCoolTankWaMat(
""),
1092 m_BackBracketName(
""),
1093 m_BackBracketHeight(0),
1094 m_BackBracketMat(
""),
1096 m_DryAirTubeHere(0),
1097 m_DryAirTubeName(
""),
1099 m_DryAirTubeInnDiam(0),
1100 m_DryAirTubeOutDiam(0),
1101 m_DryAirTubeMat(
""),
1102 m_MBCoolTubeHere(0),
1103 m_MBCoolTubeName(
""),
1104 m_MBCoolTubeInnDiam(0),
1105 m_MBCoolTubeOutDiam(0),
1106 m_MBCoolTubeMat(
""),
1109 m_MBManifInnDiam(0),
1110 m_MBManifOutDiam(0),
1118 m_PincerRodName(
""),
1120 m_vecPincerRodAzimuth(),
1121 m_PincerEnvName(
""),
1123 m_PincerEnvWidth(0),
1124 m_PincerEnvHeight(0),
1125 m_PincerEnvLength(0),
1126 m_vecPincerEnvZOff(),
1127 m_PincerBlkName(
""),
1129 m_PincerBlkLength(0),
1130 m_PincerShim1Name(
""),
1131 m_PincerShimHeight(0),
1132 m_PincerShim2Name(
""),
1133 m_PincerShimMat(
""),
1134 m_PincerShim1Width(0),
1135 m_PincerShim2Width(0),
1136 m_PincerCutName(
""),
1138 m_PincerCutWidth(0),
1139 m_PincerCutHeight(0)
1143 edm::LogVerbatim(
"EcalGeom") <<
"DDEcalBarrelAlgo info: Creating an instance";
1183 m_SpmNPerHalf = static_cast<unsigned int>(nArgs[
"SpmNPerHalf"]);
1234 m_NCryTypes = static_cast<unsigned int>(nArgs[
"NCryTypes"]);
1359 m_NFawPerSupm = static_cast<unsigned int>(nArgs[
"NFawPerSupm"]);
1525 edm::LogVerbatim(
"EcalGeom") <<
"******** DDEcalBarrelAlgo execute!" << std::endl;
1528 const unsigned int copyOne(1);
1529 const unsigned int copyTwo(2);
1561 const std::vector<double>& cutBoxParms(spmCutBox.
parameters());
1589 const std::vector<double>& sideParms(sideSolid.
parameters());
1594 for (
unsigned int icopy(1); icopy <= 2; ++icopy) {
1598 const Tl3D tr(tvec[0], tvec[1], tvec[2]);
1599 const RoZ3D ro(rang);
1608 const Tl3D trSide(tvec[0],
1609 tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) +
1612 const RoZ3D roSide(rang);
1628 edm::LogVerbatim(
"EcalGeom") << spmCutLog.name().name() <<
":" << icopy <<
" positioned in "
1643 const double dphi(360. * deg / (1. *
spmNPerHalf()));
1657 const unsigned int offr(4 *
iphi);
1658 const unsigned int offt(3 *
iphi);
1665 const Tf3D both(rotaExtra * rotaBase);
1685 for (
unsigned int ilyx(0); ilyx !=
vecIlyThick().size(); ++ilyx) {
1699 for (
unsigned int iPipeType(0); iPipeType !=
vecIlyPipeLength().size(); ++iPipeType) {
1755 for (
unsigned int ily(0); ily !=
vecIlyThick().size(); ++ily) {
1756 const double ilyRMax(ilyRMin +
vecIlyThick()[ily]);
1768 unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1772 unsigned int ptmCopy(0);
1773 for (
unsigned int ilyPTM(0); ilyPTM !=
vecIlyPTMZ().size(); ++ilyPTM) {
1783 myrot(ilyPTMLog.
name().
name() +
"_rot" + std::to_string(ptmCopy), CLHEP::HepRotationZ(
phi)));
1786 << ilyPTMLog.
name().
name() <<
":" << ptmCopy <<
" positioned in " << xilyLog.
name().
name();
1791 unsigned int fanOutCopy(0);
1792 for (
unsigned int ilyFO(0); ilyFO !=
vecIlyFanOutZ().size(); ++ilyFO) {
1802 myrot(ilyFanOutLog.
name().
name() +
"_rot" + std::to_string(fanOutCopy),
1803 CLHEP::HepRotationZ(
phi) * CLHEP::HepRotationY(180 * deg)));
1806 << ilyFanOutLog.
name().
name() <<
":" << fanOutCopy <<
" positioned in " << xilyLog.
name().
name();
1809 unsigned int femCopy(0);
1810 for (
unsigned int ilyFEM(0); ilyFEM !=
vecIlyFEMZ().size(); ++ilyFEM) {
1820 myrot(ilyFEMLog.
name().
name() +
"_rot" + std::to_string(femCopy), CLHEP::HepRotationZ(
phi)));
1823 << ilyFEMLog.
name().
name() <<
":" << femCopy <<
" positioned in " << xilyLog.
name().
name();
1827 for (
unsigned int iPipe(0); iPipe !=
vecIlyPipePhi().size(); ++iPipe) {
1832 for (
unsigned int ly(0); ly != 2; ++ly) {
1848 <<
" positioned in " << xilyLog.
name().
name();
1859 std::vector<double> cri;
1860 std::vector<double> cro;
1861 std::vector<double> czz;
1896 const double beta1(atan((BNom1 - bNom1) / LNom1));
1898 const double sinbeta1(
sin(beta1));
1900 const double tana_hawR((BNom1 - bNom1) / LNom1);
1904 const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1));
1905 const double B_hawR(a_hawR + H_hawR * tana_hawR);
1906 const double b_hawR(a_hawR + h_hawR * tana_hawR);
1909 const Trap trapHAWR(a_hawR / 2.,
1924 const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) +
M_PI_2);
1927 const Trap trapFAW(a_hawR,
1945 const double hawBoxClr(1 * mm);
1950 const std::vector<double>& hawBoxParms(hawCutBox.
parameters());
1953 const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1954 const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1955 const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]);
1959 const Tf3D hawCutForm(
b1,
1964 Pt3D(vHAW[0].
x() - hawBoxClr, vHAW[0].
y(), vHAW[0].
z() - zDel));
1971 hawCutForm.getTranslation().x(), hawCutForm.getTranslation().y(), hawCutForm.getTranslation().z()),
1972 myrot(hawCutName.
name() +
"R", hawCutForm.getRotation())));
1979 const std::vector<double>& fawBoxParms(fawCutBox.
parameters());
1982 const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1983 const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1984 const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]);
1986 const Tf3D fawCutForm(bb1,
1989 vFAW[2] +
Pt3D(2 * hawBoxClr, -5 * mm, 0),
1990 vFAW[1] +
Pt3D(-2 * hawBoxClr, -5 * mm, 0),
1991 Pt3D(vFAW[1].
x() - 2 * hawBoxClr, vFAW[1].
y() - trapFAW.
h(), vFAW[1].z() - zDel));
1998 fawCutForm.getTranslation().x(), fawCutForm.getTranslation().y(), fawCutForm.getTranslation().z()),
1999 myrot(fawCutName.
name() +
"R", fawCutForm.getRotation())));
2002 const Tf3D hawRform(vHAW[3],
2006 0.5 * (vFAW[0] + vFAW[3]),
2007 0.5 * (vFAW[1] + vFAW[2]));
2012 DDTranslation(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()),
2015 edm::LogVerbatim(
"EcalGeom") << hawRLog.name().name() <<
":" << copyOne <<
" positioned in "
2016 << fawLog.name().name();
2022 DDTranslation(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z()),
2024 CLHEP::HepRotationY(180 * deg) *
2025 CLHEP::HepRep3x3(1, 0, 0, 0, 1, 0, 0, 0, -1)));
2027 edm::LogVerbatim(
"EcalGeom") << hawRLog.name().name() <<
":" << copyTwo <<
" positioned in "
2028 << fawLog.name().name();
2039 for (
unsigned int iPhi(1); iPhi <=
nFawPerSupm(); ++iPhi) {
2049 DDTranslation(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z()),
2050 myrot(
fawName().
name() +
"_Rot" + std::to_string(iPhi), fawform.getRotation()));
2062 const Trap trapGrid((B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,
2063 (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,
2067 (L_hawR - 8 * cm) / 2.,
2078 const Tf3D gridForm(vGrid[4],
2081 vHAW[5] -
Pt3D(0, h_Grid, 0),
2090 DDTranslation(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z()),
2094 << hawRLog.name().name();
2124 double theta(90 * deg);
2126 double side(0 * mm);
2127 double zeta(0 * deg);
2129 for (
unsigned int cryType(1); cryType <=
nCryTypes(); ++cryType) {
2141 const double alfCry(90 * deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd)));
2143 const Trap trapCry((ANom - AUnd) / 2.,
2150 aNom - aUnd - ANom + AUnd,
2151 hNom - hUnd - HNom + HUnd
2159 const unsigned int copyCap(1);
2173 const unsigned int copySGL(1);
2181 unsigned int copyCER(0);
2189 const unsigned int copyBSi(1);
2197 const unsigned int copyATJ(1);
2205 const unsigned int copyAGL(1);
2213 const unsigned int copyAND(1);
2221 const unsigned int copyAPD(1);
2224 const double delta(atan((HNom - hNom) / LNom));
2228 const double gamma(atan((ANom - aNom) / LNom));
2232 const double beta(atan((BNom - bNom) / LNom));
2234 const double sinbeta(
sin(
beta));
2237 const double alfClr(90 * deg + atan((bNom - aNom) / (hNom + sClr)));
2239 const Trap trapClr((ANom + sClr + rClr * singamma) / 2.,
2240 (aNom + sClr - fClr * singamma) / 2.,
2241 (bNom + sClr - fClr * sinbeta) / 2.,
2242 (HNom + sClr + rClr * sindelta) / 2.,
2243 (hNom + sClr - fClr * sindelta) / 2.,
2244 (LNom + fClr + rClr) / 2.,
2256 const double alfWrap(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap)));
2258 const Trap trapWrap((trapClr.
A() + 2 * sWrap + rWrap * singamma) / 2,
2259 (trapClr.
a() + 2 * sWrap - fWrap * singamma) / 2,
2260 (trapClr.
b() + 2 * sWrap - fWrap * sinbeta) / 2,
2261 (trapClr.
H() + 2 * sWrap + rWrap * sindelta) / 2,
2262 (trapClr.
h() + 2 * sWrap - fWrap * sindelta) / 2,
2263 (trapClr.
L() + fWrap + rWrap) / 2.,
2265 aNom - ANom - (cryType > 9 ? 0 : 0.020 * mm),
2270 const DDSolid wrapSolid(
mytrap(wrapDDName.name(), trapWrap));
2275 const double alfWall(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap + 2 * sWall)));
2277 const Trap trapWall((trapWrap.A() + 2 * sWall + rWall * singamma) / 2,
2278 (trapWrap.a() + 2 * sWall - fWall * singamma) / 2,
2279 (trapWrap.b() + 2 * sWall - fWall * sinbeta) / 2,
2280 (trapWrap.H() + 2 * sWall + rWall * sindelta) / 2,
2281 (trapWrap.h() + 2 * sWall - fWall * sindelta) / 2,
2282 (trapWrap.L() + fWall + rWall) / 2.,
2284 aNom - ANom - (cryType < 10 ? 0.150 * mm : 0.100 * mm),
2289 const DDSolid wallSolid(
mytrap(wallDDName.name(), trapWall));
2336 const Vec3 cryToClr(0, 0, (rClr - fClr) / 2);
2388 for (
unsigned int ijkl(0); ijkl != 2; ++ijkl) {
2412 const Vec3 clrToWrap(0, 0, (rWrap - fWrap) / 2);
2425 const Vec3 wrapToWall1(0, 0, (rWall - fWall) / 2);
2426 const Vec3 wrapToWall(
Vec3((cryType > 9 ? 0 : 0.005 * mm), 0, 0) + wrapToWall1);
2440 const double sidePrime((trapWall.a() - trapCry.
a()) / 2);
2441 const double frontPrime(fWall + fWrap + fClr + LUnd / 2);
2462 for (
unsigned int etaAlv(1); etaAlv <=
nCryPerAlvEta(); ++etaAlv) {
2465 <<
", frontPrime=" << frontPrime <<
", zeta=" << zeta <<
", delta=" <<
delta
2468 zee += 0.075 * mm + (side *
cos(zeta) + trapWall.h() - sidePrime) /
sin(
theta);
2475 const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall);
2477 const Pt3D trap3(trap2 +
Pt3D(0, -trapCry.
h(), 0));
2478 const Pt3D trap1(trap3 +
Pt3D(-trapCry.
a(), 0, 0));
2482 const Pt3D wedge1(wedge3 +
Pt3D(trapCry.
a(), 0, 0));
2484 const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3);
2486 const double xx(0.050 * mm);
2488 const Tf3D tForm(HepGeom::Translate3D(
xx, 0, 0) * tForm1);
2493 DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
2494 myrot(wallLog.
name().
name() +
"_" + std::to_string(etaAlv), tForm.getRotation()));
2497 << hawRLog.name().name();
2503 if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType)
2505 const unsigned int webIndex(cryType / 4);
2550 const std::vector<double>& backPlateParms(backPlateSolid.
parameters());
2571 outtra + backPlateTra,
2574 edm::LogVerbatim(
"EcalGeom") << backPlateLog.name().name() <<
":" << copyOne <<
" positioned in "
2610 outtra + backSideTra1,
2611 myrot(
backSideName().
name() +
"Rot8", CLHEP::HepRotationX(180 * deg) * CLHEP::HepRotationZ(90 * deg)));
2620 outtra + backSideTra2,
2642 const double manifCut(2 * mm);
2650 mBManifWaName, backCoolWidth / 2. - manifCut, 0,
mBManifInnDiam() / 2, 0 * deg, 360 * deg));
2669 const double deltaY(-5 * mm);
2675 unsigned int edgeSlotCopy(0);
2676 unsigned int midSlotCopy(0);
2689 const DDTranslation gTra(outtra + backPlateTra + grilleTra);
2692 if (0 == (iGr - 1) % 2) {
2698 cpv.
position(grMidSlotLog[(iGr - 1) / 2],
2705 edm::LogVerbatim(
"EcalGeom") << grMidSlotLog[(iGr - 1) / 2].
name().name() <<
":" << midSlotCopy
2706 <<
" positioned in " << gName.
name();
2709 cpv.
position(grMidSlotLog[(iGr - 1) / 2],
2716 edm::LogVerbatim(
"EcalGeom") << grMidSlotLog[(iGr - 1) / 2].
name().name() <<
":" << midSlotCopy
2717 <<
" positioned in " << gName.
name();
2847 offTra += 2 * backVFELyrTra;
2904 unsigned int iCVFECopy(1);
2905 unsigned int iSep(0);
2906 unsigned int iNSec(0);
2908 for (
unsigned int iMod(0); iMod != 4; ++iMod) {
2911 const double pipeZPos(
vecGrilleZOff()[2 * iMod + 1] - pipeLength / 2 - 1.5 * mm);
2916 for (
unsigned int iMisc(0); iMisc != nMisc; ++iMisc) {
2920 for (
unsigned int iMB(0); iMB !=
vecMBLyrThick().size(); ++iMB) {
2944 const double halfZTank(halfZBCool - 5 * cm);
2954 DDTranslation(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick,
2960 << backCName.
name();
2973 << bTankName.
name();
2990 << backCName.
name();
3004 for (
unsigned int j(0);
j != nMisc; ++
j)
3021 << backCName.
name();
3024 bSumTra += 2 * bTra;
3043 << backCName.
name();
3071 -backCoolHeight / 2.0 +
mBCoolTubeOutDiam() / 2., -bHalfWidth + (
j + 1) * bHalfWidth / 5, 0),
3075 << backCName.
name();
3126 << bPipeName.
name();
3159 dryAirTubeTra1.z());
3176 const unsigned int numSec(static_cast<unsigned int>(
vecBackCoolNSec()[iMod]));
3177 for (
unsigned int jSec(0); jSec != numSec; ++jSec) {
3179 for (
unsigned int iBar(0); iBar !=
nMax; ++iBar) {
3183 << backCName.
name();
3188 if (jSec != numSec - 1)
3210 double patchHeight(0);
3220 const std::vector<double>& patchParms(patchSolid.
parameters());
3228 edm::LogVerbatim(
"EcalGeom") << patchLog.name().name() <<
":" << copyOne <<
" positioned in "
3272 const std::vector<double>& envParms(envSolid.
parameters());
3277 const std::vector<double>& blkParms(blkSolid.parameters());
3291 const std::vector<double>& cutParms(cutSolid.
parameters());
3307 const std::vector<double>& shim2Parms(shim2Solid.
parameters());
3311 DDTranslation(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0),
3324 const std::vector<double>& shim1Parms(shim1Solid.
parameters());
3329 DDTranslation(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2]),
3378 edm::LogVerbatim(
"EcalGeom") <<
"******** DDEcalBarrelAlgo test: end it...";
3386 std::make_unique<DDRotationMatrix>(
r.xx(),
r.xy(),
r.xz(),
r.yx(),
r.yy(),
r.yz(),
r.zx(),
r.zy(),
r.zz()));
3393 if (
temp.second.empty()) {
3402 ddname(
s),
t.dz(),
t.theta(),
t.phi(),
t.h1(),
t.bl1(),
t.tl1(),
t.alp1(),
t.h2(),
t.bl2(),
t.tl2(),
t.alp2());
3410 const HepGeom::Point3D<double>&
corner,
3417 const unsigned int copyOne(1);
3421 const double BWebx(bWeb + (BWeb - bWeb) * LWebx / LWeb);
3424 const Trap trapWebClr(BWebx / 2,
3438 const Trap trapWebPl(trapWebClr.
A() / 2,
3443 trapWebClr.
L() / 2.,
3445 trapWebClr.
b() - trapWebClr.
B(),
3449 const DDSolid webPlSolid(
mytrap(webPlDDName.fullname(), trapWebPl));
3471 const Pt3D wedge1(wedge3 +
Pt3D(trapWebClr.
a(), 0, 0));
3474 edm::LogVerbatim(
"EcalGeom") <<
"trap1=" << vWeb[0] <<
", trap2=" << vWeb[2] <<
", trap3=" << vWeb[3];
3476 edm::LogVerbatim(
"EcalGeom") <<
"wedge1=" << wedge1 <<
", wedge2=" << wedge2 <<
", wedge3=" << wedge3;
3478 const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3);
3484 DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
3485 myrot(webClrLog.
name().
name() + std::to_string(iWeb), tForm.getRotation()));