15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 #include <CLHEP/Geometry/Point3D.h>
18 #include <CLHEP/Geometry/Vector3D.h>
19 #include <CLHEP/Geometry/Transform3D.h>
30 #include "CLHEP/Geometry/Transform3D.h"
35 typedef HepGeom::Point3D<double>
Pt3D;
36 typedef HepGeom::Transform3D
Tf3D;
37 typedef HepGeom::ReflectZ3D
RfZ3D;
38 typedef HepGeom::Translate3D
Tl3D;
39 typedef HepGeom::Rotate3D
Ro3D;
40 typedef HepGeom::RotateZ3D
RoZ3D;
41 typedef HepGeom::RotateY3D
RoY3D;
42 typedef HepGeom::RotateX3D
RoX3D;
44 typedef CLHEP::Hep3Vector
Vec3;
45 typedef CLHEP::HepRotation
Rota;
424 void web(
unsigned int iWeb,
946 m_vecIlyPipeLength(),
962 m_IlyFanOutLength(0),
963 m_IlyFanOutHeight(0),
1004 m_BackSideLength(0),
1005 m_BackSideHeight(0),
1011 m_BackPlateName(
""),
1013 m_BackPlateLength(0),
1014 m_BackPlateThick(0),
1015 m_BackPlateWidth(0),
1017 m_BackPlate2Name(
""),
1018 m_BackPlate2Thick(0),
1019 m_BackPlate2Mat(
""),
1026 m_vecGrilleHeight(),
1028 m_GrEdgeSlotName(
""),
1029 m_GrEdgeSlotMat(
""),
1030 m_GrEdgeSlotHere(0),
1031 m_GrEdgeSlotHeight(0),
1032 m_GrEdgeSlotWidth(0),
1033 m_GrMidSlotName(
""),
1036 m_GrMidSlotWidth(0),
1038 m_vecGrMidSlotHeight(),
1041 m_vecBackPipeDiam(),
1042 m_vecBackPipeThick(),
1044 m_BackPipeWaterMat(
""),
1046 m_vecBackCoolName(),
1048 m_BackCoolBarHere(0),
1049 m_BackCoolBarWidth(0),
1050 m_BackCoolBarHeight(0),
1052 m_BackCoolBarName(
""),
1053 m_BackCoolBarThick(0),
1054 m_BackCoolBarMat(
""),
1055 m_BackCoolBarSSName(
""),
1056 m_BackCoolBarSSThick(0),
1057 m_BackCoolBarSSMat(
""),
1058 m_BackCoolBarWaName(
""),
1059 m_BackCoolBarWaThick(0),
1060 m_BackCoolBarWaMat(
""),
1061 m_BackCoolVFEHere(0),
1062 m_BackCoolVFEName(
""),
1063 m_BackCoolVFEMat(
""),
1066 m_vecBackVFELyrThick(),
1067 m_vecBackVFELyrName(),
1068 m_vecBackVFELyrMat(),
1069 m_vecBackCoolNSec(),
1070 m_vecBackCoolSecSep(),
1071 m_vecBackCoolNPerSec(),
1074 m_vecBackMiscThick(),
1075 m_vecBackMiscName(),
1078 m_PatchPanelHere(0),
1079 m_PatchPanelName(
""),
1080 m_vecPatchPanelThick(),
1081 m_vecPatchPanelNames(),
1082 m_vecPatchPanelMat(),
1083 m_BackCoolTankHere(0),
1084 m_BackCoolTankName(
""),
1085 m_BackCoolTankWidth(0),
1086 m_BackCoolTankThick(0),
1087 m_BackCoolTankMat(
""),
1088 m_BackCoolTankWaName(
""),
1089 m_BackCoolTankWaWidth(0),
1090 m_BackCoolTankWaMat(
""),
1091 m_BackBracketName(
""),
1092 m_BackBracketHeight(0),
1093 m_BackBracketMat(
""),
1095 m_DryAirTubeHere(0),
1096 m_DryAirTubeName(
""),
1098 m_DryAirTubeInnDiam(0),
1099 m_DryAirTubeOutDiam(0),
1100 m_DryAirTubeMat(
""),
1101 m_MBCoolTubeHere(0),
1102 m_MBCoolTubeName(
""),
1103 m_MBCoolTubeInnDiam(0),
1104 m_MBCoolTubeOutDiam(0),
1105 m_MBCoolTubeMat(
""),
1108 m_MBManifInnDiam(0),
1109 m_MBManifOutDiam(0),
1117 m_PincerRodName(
""),
1119 m_vecPincerRodAzimuth(),
1120 m_PincerEnvName(
""),
1122 m_PincerEnvWidth(0),
1123 m_PincerEnvHeight(0),
1124 m_PincerEnvLength(0),
1125 m_vecPincerEnvZOff(),
1126 m_PincerBlkName(
""),
1128 m_PincerBlkLength(0),
1129 m_PincerShim1Name(
""),
1130 m_PincerShimHeight(0),
1131 m_PincerShim2Name(
""),
1132 m_PincerShimMat(
""),
1133 m_PincerShim1Width(0),
1134 m_PincerShim2Width(0),
1135 m_PincerCutName(
""),
1137 m_PincerCutWidth(0),
1138 m_PincerCutHeight(0)
1141 LogDebug(
"EcalGeom") <<
"DDEcalBarrelAlgo info: Creating an instance";
1151 LogDebug(
"EcalGeom") <<
"DDEcalBarrelAlgo info: Initialize";
1178 m_SpmNPerHalf = static_cast<unsigned int>(nArgs[
"SpmNPerHalf"]);
1229 m_NCryTypes = static_cast<unsigned int>(nArgs[
"NCryTypes"]);
1354 m_NFawPerSupm = static_cast<unsigned int>(nArgs[
"NFawPerSupm"]);
1509 LogDebug(
"EcalGeom") <<
"DDEcalBarrelAlgo info: end initialize";
1517 LogDebug(
"EcalGeom") <<
"******** DDEcalBarrelAlgo execute!" << std::endl;
1520 const unsigned int copyOne(1);
1521 const unsigned int copyTwo(2);
1550 const std::vector<double>& cutBoxParms(spmCutBox.
parameters());
1578 const std::vector<double>& sideParms(sideSolid.
parameters());
1583 for (
unsigned int icopy(1); icopy <= 2; ++icopy) {
1587 const Tl3D tr(tvec[0], tvec[1], tvec[2]);
1588 const RoZ3D ro(rang);
1597 const Tl3D trSide(tvec[0],
1598 tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) +
1601 const RoZ3D roSide(rang);
1626 const double dphi(360. * deg / (1. *
spmNPerHalf()));
1640 const unsigned int offr(4 *
iphi);
1641 const unsigned int offt(3 *
iphi);
1648 const Tf3D both(rotaExtra * rotaBase);
1664 for (
unsigned int ilyx(0); ilyx !=
vecIlyThick().size(); ++ilyx) {
1676 for (
unsigned int iPipeType(0); iPipeType !=
vecIlyPipeLength().size(); ++iPipeType) {
1722 for (
unsigned int ily(0); ily !=
vecIlyThick().size(); ++ily) {
1723 const double ilyRMax(ilyRMin +
vecIlyThick()[ily]);
1733 unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1737 unsigned int ptmCopy(0);
1738 for (
unsigned int ilyPTM(0); ilyPTM !=
vecIlyPTMZ().size(); ++ilyPTM) {
1748 myrot(ilyPTMLog.
name().
name() +
"_rot" + std::to_string(ptmCopy), CLHEP::HepRotationZ(
phi)));
1752 unsigned int fanOutCopy(0);
1753 for (
unsigned int ilyFO(0); ilyFO !=
vecIlyFanOutZ().size(); ++ilyFO) {
1763 myrot(ilyFanOutLog.
name().
name() +
"_rot" + std::to_string(fanOutCopy),
1764 CLHEP::HepRotationZ(
phi) * CLHEP::HepRotationY(180 * deg)));
1766 unsigned int femCopy(0);
1767 for (
unsigned int ilyFEM(0); ilyFEM !=
vecIlyFEMZ().size(); ++ilyFEM) {
1777 myrot(ilyFEMLog.
name().
name() +
"_rot" + std::to_string(femCopy), CLHEP::HepRotationZ(
phi)));
1780 for (
unsigned int iPipe(0); iPipe !=
vecIlyPipePhi().size(); ++iPipe) {
1785 for (
unsigned int ly(0); ly != 2; ++ly) {
1808 std::vector<double> cri;
1809 std::vector<double> cro;
1810 std::vector<double> czz;
1842 const double beta1(atan((BNom1 - bNom1) / LNom1));
1844 const double sinbeta1(
sin(beta1));
1846 const double tana_hawR((BNom1 - bNom1) / LNom1);
1850 const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1));
1851 const double B_hawR(a_hawR + H_hawR * tana_hawR);
1852 const double b_hawR(a_hawR + h_hawR * tana_hawR);
1855 const Trap trapHAWR(a_hawR / 2.,
1870 const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) +
M_PI_2);
1873 const Trap trapFAW(a_hawR,
1891 const double hawBoxClr(1 * mm);
1896 const std::vector<double>& hawBoxParms(hawCutBox.
parameters());
1899 const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1900 const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1901 const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]);
1905 const Tf3D hawCutForm(
b1,
1910 Pt3D(vHAW[0].
x() - hawBoxClr, vHAW[0].
y(), vHAW[0].
z() - zDel));
1917 hawCutForm.getTranslation().x(), hawCutForm.getTranslation().y(), hawCutForm.getTranslation().z()),
1918 myrot(hawCutName.
name() +
"R", hawCutForm.getRotation())));
1925 const std::vector<double>& fawBoxParms(fawCutBox.
parameters());
1928 const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1929 const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1930 const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]);
1932 const Tf3D fawCutForm(bb1,
1935 vFAW[2] +
Pt3D(2 * hawBoxClr, -5 * mm, 0),
1936 vFAW[1] +
Pt3D(-2 * hawBoxClr, -5 * mm, 0),
1937 Pt3D(vFAW[1].
x() - 2 * hawBoxClr, vFAW[1].
y() - trapFAW.
h(), vFAW[1].z() - zDel));
1944 fawCutForm.getTranslation().x(), fawCutForm.getTranslation().y(), fawCutForm.getTranslation().z()),
1945 myrot(fawCutName.
name() +
"R", fawCutForm.getRotation())));
1948 const Tf3D hawRform(vHAW[3],
1952 0.5 * (vFAW[0] + vFAW[3]),
1953 0.5 * (vFAW[1] + vFAW[2]));
1958 DDTranslation(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()),
1965 DDTranslation(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z()),
1967 CLHEP::HepRotationY(180 * deg) *
1968 CLHEP::HepRep3x3(1, 0, 0, 0, 1, 0, 0, 0, -1)));
1979 for (
unsigned int iPhi(1); iPhi <=
nFawPerSupm(); ++iPhi) {
1989 DDTranslation(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z()),
1990 myrot(
fawName().
name() +
"_Rot" + std::to_string(iPhi), fawform.getRotation()));
1999 const Trap trapGrid((B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,
2000 (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,
2004 (L_hawR - 8 * cm) / 2.,
2015 const Tf3D gridForm(vGrid[4],
2018 vHAW[5] -
Pt3D(0, h_Grid, 0),
2027 DDTranslation(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z()),
2058 double theta(90 * deg);
2060 double side(0 * mm);
2061 double zeta(0 * deg);
2063 for (
unsigned int cryType(1); cryType <=
nCryTypes(); ++cryType) {
2066 LogDebug(
"EcalGeom") <<
"Crytype=" << cryType;
2073 const double alfCry(90 * deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd)));
2075 const Trap trapCry((ANom - AUnd) / 2.,
2082 aNom - aUnd - ANom + AUnd,
2083 hNom - hUnd - HNom + HUnd
2091 const unsigned int copyCap(1);
2105 const unsigned int copySGL(1);
2113 unsigned int copyCER(0);
2121 const unsigned int copyBSi(1);
2129 const unsigned int copyATJ(1);
2137 const unsigned int copyAGL(1);
2145 const unsigned int copyAND(1);
2153 const unsigned int copyAPD(1);
2156 const double delta(atan((HNom - hNom) / LNom));
2160 const double gamma(atan((ANom - aNom) / LNom));
2164 const double beta(atan((BNom - bNom) / LNom));
2166 const double sinbeta(
sin(
beta));
2169 const double alfClr(90 * deg + atan((bNom - aNom) / (hNom + sClr)));
2171 const Trap trapClr((ANom + sClr + rClr * singamma) / 2.,
2172 (aNom + sClr - fClr * singamma) / 2.,
2173 (bNom + sClr - fClr * sinbeta) / 2.,
2174 (HNom + sClr + rClr * sindelta) / 2.,
2175 (hNom + sClr - fClr * sindelta) / 2.,
2176 (LNom + fClr + rClr) / 2.,
2188 const double alfWrap(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap)));
2190 const Trap trapWrap((trapClr.
A() + 2 * sWrap + rWrap * singamma) / 2,
2191 (trapClr.
a() + 2 * sWrap - fWrap * singamma) / 2,
2192 (trapClr.
b() + 2 * sWrap - fWrap * sinbeta) / 2,
2193 (trapClr.
H() + 2 * sWrap + rWrap * sindelta) / 2,
2194 (trapClr.
h() + 2 * sWrap - fWrap * sindelta) / 2,
2195 (trapClr.
L() + fWrap + rWrap) / 2.,
2197 aNom - ANom - (cryType > 9 ? 0 : 0.020 * mm),
2202 const DDSolid wrapSolid(
mytrap(wrapDDName.name(), trapWrap));
2207 const double alfWall(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap + 2 * sWall)));
2209 const Trap trapWall((trapWrap.A() + 2 * sWall + rWall * singamma) / 2,
2210 (trapWrap.a() + 2 * sWall - fWall * singamma) / 2,
2211 (trapWrap.b() + 2 * sWall - fWall * sinbeta) / 2,
2212 (trapWrap.H() + 2 * sWall + rWall * sindelta) / 2,
2213 (trapWrap.h() + 2 * sWall - fWall * sindelta) / 2,
2214 (trapWrap.L() + fWall + rWall) / 2.,
2216 aNom - ANom - (cryType < 10 ? 0.150 * mm : 0.100 * mm),
2221 const DDSolid wallSolid(
mytrap(wallDDName.name(), trapWall));
2268 const Vec3 cryToClr(0, 0, (rClr - fClr) / 2);
2298 for (
unsigned int ijkl(0); ijkl != 2; ++ijkl) {
2315 const Vec3 clrToWrap(0, 0, (rWrap - fWrap) / 2);
2324 const Vec3 wrapToWall1(0, 0, (rWall - fWall) / 2);
2325 const Vec3 wrapToWall(
Vec3((cryType > 9 ? 0 : 0.005 * mm), 0, 0) + wrapToWall1);
2336 const double sidePrime((trapWall.a() - trapCry.
a()) / 2);
2337 const double frontPrime(fWall + fWrap + fClr + LUnd / 2);
2358 for (
unsigned int etaAlv(1); etaAlv <=
nCryPerAlvEta(); ++etaAlv) {
2359 LogDebug(
"EcalGeom") <<
"theta=" <<
theta / deg <<
", sidePrime=" << sidePrime <<
", frontPrime=" << frontPrime
2360 <<
", zeta=" << zeta <<
", delta=" <<
delta <<
", zee=" << zee;
2362 zee += 0.075 * mm + (side *
cos(zeta) + trapWall.h() - sidePrime) /
sin(
theta);
2364 LogDebug(
"EcalGeom") <<
"New zee=" << zee;
2368 const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall);
2370 const Pt3D trap3(trap2 +
Pt3D(0, -trapCry.
h(), 0));
2371 const Pt3D trap1(trap3 +
Pt3D(-trapCry.
a(), 0, 0));
2375 const Pt3D wedge1(wedge3 +
Pt3D(trapCry.
a(), 0, 0));
2377 const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3);
2379 const double xx(0.050 * mm);
2381 const Tf3D tForm(HepGeom::Translate3D(
xx, 0, 0) * tForm1);
2386 DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
2387 myrot(wallLog.
name().
name() +
"_" + std::to_string(etaAlv), tForm.getRotation()));
2393 if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType)
2395 const unsigned int webIndex(cryType / 4);
2440 const std::vector<double>& backPlateParms(backPlateSolid.
parameters());
2458 outtra + backPlateTra,
2493 outtra + backSideTra1,
2494 myrot(
backSideName().
name() +
"Rot8", CLHEP::HepRotationX(180 * deg) * CLHEP::HepRotationZ(90 * deg)));
2500 outtra + backSideTra2,
2518 const double manifCut(2 * mm);
2526 mBManifWaName, backCoolWidth / 2. - manifCut, 0,
mBManifInnDiam() / 2, 0 * deg, 360 * deg));
2542 const double deltaY(-5 * mm);
2548 unsigned int edgeSlotCopy(0);
2549 unsigned int midSlotCopy(0);
2562 const DDTranslation gTra(outtra + backPlateTra + grilleTra);
2565 if (0 == (iGr - 1) % 2) {
2571 cpv.
position(grMidSlotLog[(iGr - 1) / 2],
2577 cpv.
position(grMidSlotLog[(iGr - 1) / 2],
2679 offTra += 2 * backVFELyrTra;
2723 unsigned int iCVFECopy(1);
2724 unsigned int iSep(0);
2725 unsigned int iNSec(0);
2727 for (
unsigned int iMod(0); iMod != 4; ++iMod) {
2730 const double pipeZPos(
vecGrilleZOff()[2 * iMod + 1] - pipeLength / 2 - 1.5 * mm);
2735 for (
unsigned int iMisc(0); iMisc != nMisc; ++iMisc) {
2739 for (
unsigned int iMB(0); iMB !=
vecMBLyrThick().size(); ++iMB) {
2759 const double halfZTank(halfZBCool - 5 * cm);
2769 DDTranslation(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick,
2805 for (
unsigned int j(0);
j != nMisc; ++
j)
2821 bSumTra += 2 * bTra;
2862 -backCoolHeight / 2.0 +
mBCoolTubeOutDiam() / 2., -bHalfWidth + (
j + 1) * bHalfWidth / 5, 0),
2931 dryAirTubeTra1.z());
2944 const unsigned int numSec(static_cast<unsigned int>(
vecBackCoolNSec()[iMod]));
2945 for (
unsigned int jSec(0); jSec != numSec; ++jSec) {
2947 for (
unsigned int iBar(0); iBar !=
nMax; ++iBar) {
2952 if (jSec != numSec - 1)
2974 double patchHeight(0);
2984 const std::vector<double>& patchParms(patchSolid.
parameters());
3029 const std::vector<double>& envParms(envSolid.
parameters());
3034 const std::vector<double>& blkParms(blkSolid.parameters());
3044 const std::vector<double>& cutParms(cutSolid.
parameters());
3056 const std::vector<double>& shim2Parms(shim2Solid.
parameters());
3060 DDTranslation(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0),
3069 const std::vector<double>& shim1Parms(shim1Solid.
parameters());
3074 DDTranslation(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2]),
3111 LogDebug(
"EcalGeom") <<
"******** DDEcalBarrelAlgo test: end it...";
3118 std::make_unique<DDRotationMatrix>(
r.xx(),
r.xy(),
r.xz(),
r.yx(),
r.yy(),
r.yz(),
r.zx(),
r.zy(),
r.zz()));
3125 if (
temp.second.empty()) {
3134 ddname(
s),
t.dz(),
t.theta(),
t.phi(),
t.h1(),
t.bl1(),
t.tl1(),
t.alp1(),
t.h2(),
t.bl2(),
t.tl2(),
t.alp2());
3142 const HepGeom::Point3D<double>&
corner,
3149 const unsigned int copyOne(1);
3153 const double BWebx(bWeb + (BWeb - bWeb) * LWebx / LWeb);
3156 const Trap trapWebClr(BWebx / 2,
3170 const Trap trapWebPl(trapWebClr.
A() / 2,
3175 trapWebClr.
L() / 2.,
3177 trapWebClr.
b() - trapWebClr.
B(),
3181 const DDSolid webPlSolid(
mytrap(webPlDDName.fullname(), trapWebPl));
3201 const Pt3D wedge1(wedge3 +
Pt3D(trapWebClr.
a(), 0, 0));
3203 LogDebug(
"EcalGeom") <<
"trap1=" << vWeb[0] <<
", trap2=" << vWeb[2] <<
", trap3=" << vWeb[3];
3205 LogDebug(
"EcalGeom") <<
"wedge1=" << wedge1 <<
", wedge2=" << wedge2 <<
", wedge3=" << wedge3;
3207 const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3);
3213 DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
3214 myrot(webClrLog.
name().
name() + std::to_string(iWeb), tForm.getRotation()));