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;
391 void web(
unsigned int iWeb,
845 m_vecIlyPipeLength(),
861 m_IlyFanOutLength(0),
862 m_IlyFanOutHeight(0),
912 m_BackPlateLength(0),
916 m_BackPlate2Name(
""),
917 m_BackPlate2Thick(0),
927 m_GrEdgeSlotName(
""),
930 m_GrEdgeSlotHeight(0),
931 m_GrEdgeSlotWidth(0),
937 m_vecGrMidSlotHeight(),
941 m_vecBackPipeThick(),
943 m_BackPipeWaterMat(
""),
947 m_BackCoolBarHere(0),
948 m_BackCoolBarWidth(0),
949 m_BackCoolBarHeight(0),
951 m_BackCoolBarName(
""),
952 m_BackCoolBarThick(0),
953 m_BackCoolBarMat(
""),
954 m_BackCoolBarSSName(
""),
955 m_BackCoolBarSSThick(0),
956 m_BackCoolBarSSMat(
""),
957 m_BackCoolBarWaName(
""),
958 m_BackCoolBarWaThick(0),
959 m_BackCoolBarWaMat(
""),
960 m_BackCoolVFEHere(0),
961 m_BackCoolVFEName(
""),
962 m_BackCoolVFEMat(
""),
965 m_vecBackVFELyrThick(),
966 m_vecBackVFELyrName(),
967 m_vecBackVFELyrMat(),
969 m_vecBackCoolSecSep(),
970 m_vecBackCoolNPerSec(),
973 m_vecBackMiscThick(),
978 m_PatchPanelName(
""),
979 m_vecPatchPanelThick(),
980 m_vecPatchPanelNames(),
981 m_vecPatchPanelMat(),
982 m_BackCoolTankHere(0),
983 m_BackCoolTankName(
""),
984 m_BackCoolTankWidth(0),
985 m_BackCoolTankThick(0),
986 m_BackCoolTankMat(
""),
987 m_BackCoolTankWaName(
""),
988 m_BackCoolTankWaWidth(0),
989 m_BackCoolTankWaMat(
""),
990 m_BackBracketName(
""),
991 m_BackBracketHeight(0),
992 m_BackBracketMat(
""),
995 m_DryAirTubeName(
""),
997 m_DryAirTubeInnDiam(0),
998 m_DryAirTubeOutDiam(0),
1000 m_MBCoolTubeHere(0),
1001 m_MBCoolTubeName(
""),
1002 m_MBCoolTubeInnDiam(0),
1003 m_MBCoolTubeOutDiam(0),
1004 m_MBCoolTubeMat(
""),
1007 m_MBManifInnDiam(0),
1008 m_MBManifOutDiam(0),
1016 m_PincerRodName(
""),
1018 m_vecPincerRodAzimuth(),
1019 m_PincerEnvName(
""),
1021 m_PincerEnvWidth(0),
1022 m_PincerEnvHeight(0),
1023 m_PincerEnvLength(0),
1024 m_vecPincerEnvZOff(),
1025 m_PincerBlkName(
""),
1027 m_PincerBlkLength(0),
1028 m_PincerShim1Name(
""),
1029 m_PincerShimHeight(0),
1030 m_PincerShim2Name(
""),
1031 m_PincerShimMat(
""),
1032 m_PincerShim1Width(0),
1033 m_PincerShim2Width(0),
1034 m_PincerCutName(
""),
1036 m_PincerCutWidth(0),
1037 m_PincerCutHeight(0)
1040 LogDebug(
"EcalGeom") <<
"DDEcalBarrelAlgo info: Creating an instance";
1050 LogDebug(
"EcalGeom") <<
"DDEcalBarrelAlgo info: Initialize";
1077 m_SpmNPerHalf = static_cast<unsigned int>(nArgs[
"SpmNPerHalf"]);
1128 m_NCryTypes = static_cast<unsigned int>(nArgs[
"NCryTypes"]);
1219 m_NFawPerSupm = static_cast<unsigned int>(nArgs[
"NFawPerSupm"]);
1374 LogDebug(
"EcalGeom") <<
"DDEcalBarrelAlgo info: end initialize";
1382 LogDebug(
"EcalGeom") <<
"******** DDEcalBarrelAlgo execute!" << std::endl;
1385 const unsigned int copyOne(1);
1386 const unsigned int copyTwo(2);
1415 const std::vector<double>& cutBoxParms(spmCutBox.
parameters());
1430 const std::vector<double>& sideParms(sideSolid.
parameters());
1435 for (
unsigned int icopy(1); icopy <= 2; ++icopy) {
1439 const Tl3D tr(tvec[0], tvec[1], tvec[2]);
1440 const RoZ3D ro(rang);
1449 const Tl3D trSide(tvec[0],
1450 tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) +
1453 const RoZ3D roSide(rang);
1478 const double dphi(360. * deg / (1. *
spmNPerHalf()));
1492 const unsigned int offr(4 *
iphi);
1493 const unsigned int offt(3 *
iphi);
1500 const Tf3D both(rotaExtra * rotaBase);
1516 for (
unsigned int ilyx(0); ilyx !=
vecIlyThick().size(); ++ilyx) {
1528 for (
unsigned int iPipeType(0); iPipeType !=
vecIlyPipeLength().size(); ++iPipeType) {
1574 for (
unsigned int ily(0); ily !=
vecIlyThick().size(); ++ily) {
1575 const double ilyRMax(ilyRMin +
vecIlyThick()[ily]);
1585 unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1589 unsigned int ptmCopy(0);
1590 for (
unsigned int ilyPTM(0); ilyPTM !=
vecIlyPTMZ().size(); ++ilyPTM) {
1600 myrot(ilyPTMLog.
name().
name() +
"_rot" + std::to_string(ptmCopy), CLHEP::HepRotationZ(
phi)));
1604 unsigned int fanOutCopy(0);
1605 for (
unsigned int ilyFO(0); ilyFO !=
vecIlyFanOutZ().size(); ++ilyFO) {
1615 myrot(ilyFanOutLog.
name().
name() +
"_rot" + std::to_string(fanOutCopy),
1616 CLHEP::HepRotationZ(
phi) * CLHEP::HepRotationY(180 * deg)));
1618 unsigned int femCopy(0);
1619 for (
unsigned int ilyFEM(0); ilyFEM !=
vecIlyFEMZ().size(); ++ilyFEM) {
1629 myrot(ilyFEMLog.
name().
name() +
"_rot" + std::to_string(femCopy), CLHEP::HepRotationZ(
phi)));
1632 for (
unsigned int iPipe(0); iPipe !=
vecIlyPipePhi().size(); ++iPipe) {
1637 for (
unsigned int ly(0); ly != 2; ++ly) {
1660 std::vector<double> cri;
1661 std::vector<double> cro;
1662 std::vector<double> czz;
1694 const double beta1(atan((BNom1 - bNom1) / LNom1));
1696 const double sinbeta1(
sin(beta1));
1698 const double tana_hawR((BNom1 - bNom1) / LNom1);
1702 const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1));
1703 const double B_hawR(a_hawR + H_hawR * tana_hawR);
1704 const double b_hawR(a_hawR + h_hawR * tana_hawR);
1707 const Trap trapHAWR(a_hawR / 2.,
1722 const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) +
M_PI_2);
1725 const Trap trapFAW(a_hawR,
1743 const double hawBoxClr(1 * mm);
1748 const std::vector<double>& hawBoxParms(hawCutBox.
parameters());
1751 const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1752 const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1753 const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]);
1757 const Tf3D hawCutForm(
b1,
1762 Pt3D(vHAW[0].
x() - hawBoxClr, vHAW[0].
y(), vHAW[0].
z() - zDel));
1769 hawCutForm.getTranslation().x(), hawCutForm.getTranslation().y(), hawCutForm.getTranslation().z()),
1770 myrot(hawCutName.
name() +
"R", hawCutForm.getRotation())));
1777 const std::vector<double>& fawBoxParms(fawCutBox.
parameters());
1780 const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1781 const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1782 const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]);
1784 const Tf3D fawCutForm(bb1,
1787 vFAW[2] +
Pt3D(2 * hawBoxClr, -5 * mm, 0),
1788 vFAW[1] +
Pt3D(-2 * hawBoxClr, -5 * mm, 0),
1789 Pt3D(vFAW[1].
x() - 2 * hawBoxClr, vFAW[1].
y() - trapFAW.
h(), vFAW[1].z() - zDel));
1796 fawCutForm.getTranslation().x(), fawCutForm.getTranslation().y(), fawCutForm.getTranslation().z()),
1797 myrot(fawCutName.
name() +
"R", fawCutForm.getRotation())));
1800 const Tf3D hawRform(vHAW[3],
1804 0.5 * (vFAW[0] + vFAW[3]),
1805 0.5 * (vFAW[1] + vFAW[2]));
1810 DDTranslation(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()),
1817 DDTranslation(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z()),
1819 CLHEP::HepRotationY(180 * deg) *
1820 CLHEP::HepRep3x3(1, 0, 0, 0, 1, 0, 0, 0, -1)));
1831 for (
unsigned int iPhi(1); iPhi <=
nFawPerSupm(); ++iPhi) {
1841 DDTranslation(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z()),
1842 myrot(
fawName().
name() +
"_Rot" + std::to_string(iPhi), fawform.getRotation()));
1851 const Trap trapGrid((B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,
1852 (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,
1856 (L_hawR - 8 * cm) / 2.,
1867 const Tf3D gridForm(vGrid[4],
1870 vHAW[5] -
Pt3D(0, h_Grid, 0),
1879 DDTranslation(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z()),
1910 double theta(90 * deg);
1912 double side(0 * mm);
1913 double zeta(0 * deg);
1915 for (
unsigned int cryType(1); cryType <=
nCryTypes(); ++cryType) {
1918 LogDebug(
"EcalGeom") <<
"Crytype=" << cryType;
1925 const double alfCry(90 * deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd)));
1927 const Trap trapCry((ANom - AUnd) / 2.,
1934 aNom - aUnd - ANom + AUnd,
1935 hNom - hUnd - HNom + HUnd
1964 unsigned int copyAPD(0);
1967 const double delta(atan((HNom - hNom) / LNom));
1971 const double gamma(atan((ANom - aNom) / LNom));
1975 const double beta(atan((BNom - bNom) / LNom));
1977 const double sinbeta(
sin(
beta));
1980 const double alfClr(90 * deg + atan((bNom - aNom) / (hNom + sClr)));
1982 const Trap trapClr((ANom + sClr + rClr * singamma) / 2.,
1983 (aNom + sClr - fClr * singamma) / 2.,
1984 (bNom + sClr - fClr * sinbeta) / 2.,
1985 (HNom + sClr + rClr * sindelta) / 2.,
1986 (hNom + sClr - fClr * sindelta) / 2.,
1987 (LNom + fClr + rClr) / 2.,
1999 const double alfWrap(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap)));
2001 const Trap trapWrap((trapClr.
A() + 2 * sWrap + rWrap * singamma) / 2,
2002 (trapClr.
a() + 2 * sWrap - fWrap * singamma) / 2,
2003 (trapClr.
b() + 2 * sWrap - fWrap * sinbeta) / 2,
2004 (trapClr.
H() + 2 * sWrap + rWrap * sindelta) / 2,
2005 (trapClr.
h() + 2 * sWrap - fWrap * sindelta) / 2,
2006 (trapClr.
L() + fWrap + rWrap) / 2.,
2008 aNom - ANom - (cryType > 9 ? 0 : 0.020 * mm),
2013 const DDSolid wrapSolid(
mytrap(wrapDDName.name(), trapWrap));
2018 const double alfWall(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap + 2 * sWall)));
2020 const Trap trapWall((trapWrap.A() + 2 * sWall + rWall * singamma) / 2,
2021 (trapWrap.a() + 2 * sWall - fWall * singamma) / 2,
2022 (trapWrap.b() + 2 * sWall - fWall * sinbeta) / 2,
2023 (trapWrap.H() + 2 * sWall + rWall * sindelta) / 2,
2024 (trapWrap.h() + 2 * sWall - fWall * sindelta) / 2,
2025 (trapWrap.L() + fWall + rWall) / 2.,
2027 aNom - ANom - (cryType < 10 ? 0.150 * mm : 0.100 * mm),
2032 const DDSolid wallSolid(
mytrap(wallDDName.name(), trapWall));
2079 const Vec3 cryToClr(0, 0, (rClr - fClr) / 2);
2104 const Vec3 clrToWrap(0, 0, (rWrap - fWrap) / 2);
2113 const Vec3 wrapToWall1(0, 0, (rWall - fWall) / 2);
2114 const Vec3 wrapToWall(
Vec3((cryType > 9 ? 0 : 0.005 * mm), 0, 0) + wrapToWall1);
2125 const double sidePrime((trapWall.a() - trapCry.
a()) / 2);
2126 const double frontPrime(fWall + fWrap + fClr + LUnd / 2);
2147 for (
unsigned int etaAlv(1); etaAlv <=
nCryPerAlvEta(); ++etaAlv) {
2148 LogDebug(
"EcalGeom") <<
"theta=" <<
theta / deg <<
", sidePrime=" << sidePrime <<
", frontPrime=" << frontPrime
2149 <<
", zeta=" << zeta <<
", delta=" <<
delta <<
", zee=" << zee;
2151 zee += 0.075 * mm + (side *
cos(zeta) + trapWall.h() - sidePrime) /
sin(
theta);
2153 LogDebug(
"EcalGeom") <<
"New zee=" << zee;
2157 const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall);
2159 const Pt3D trap3(trap2 +
Pt3D(0, -trapCry.
h(), 0));
2160 const Pt3D trap1(trap3 +
Pt3D(-trapCry.
a(), 0, 0));
2164 const Pt3D wedge1(wedge3 +
Pt3D(trapCry.
a(), 0, 0));
2166 const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3);
2168 const double xx(0.050 * mm);
2170 const Tf3D tForm(HepGeom::Translate3D(
xx, 0, 0) * tForm1);
2175 DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
2176 myrot(wallLog.
name().
name() +
"_" + std::to_string(etaAlv), tForm.getRotation()));
2182 if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType)
2184 const unsigned int webIndex(cryType / 4);
2229 const std::vector<double>& backPlateParms(backPlateSolid.
parameters());
2247 outtra + backPlateTra,
2282 outtra + backSideTra1,
2283 myrot(
backSideName().
name() +
"Rot8", CLHEP::HepRotationX(180 * deg) * CLHEP::HepRotationZ(90 * deg)));
2289 outtra + backSideTra2,
2307 const double manifCut(2 * mm);
2315 mBManifWaName, backCoolWidth / 2. - manifCut, 0,
mBManifInnDiam() / 2, 0 * deg, 360 * deg));
2331 const double deltaY(-5 * mm);
2337 unsigned int edgeSlotCopy(0);
2338 unsigned int midSlotCopy(0);
2351 const DDTranslation gTra(outtra + backPlateTra + grilleTra);
2354 if (0 == (iGr - 1) % 2) {
2360 cpv.
position(grMidSlotLog[(iGr - 1) / 2],
2366 cpv.
position(grMidSlotLog[(iGr - 1) / 2],
2468 offTra += 2 * backVFELyrTra;
2512 unsigned int iCVFECopy(1);
2513 unsigned int iSep(0);
2514 unsigned int iNSec(0);
2516 for (
unsigned int iMod(0); iMod != 4; ++iMod) {
2519 const double pipeZPos(
vecGrilleZOff()[2 * iMod + 1] - pipeLength / 2 - 1.5 * mm);
2524 for (
unsigned int iMisc(0); iMisc != nMisc; ++iMisc) {
2528 for (
unsigned int iMB(0); iMB !=
vecMBLyrThick().size(); ++iMB) {
2548 const double halfZTank(halfZBCool - 5 * cm);
2558 DDTranslation(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick,
2594 for (
unsigned int j(0);
j != nMisc; ++
j)
2610 bSumTra += 2 * bTra;
2651 -backCoolHeight / 2.0 +
mBCoolTubeOutDiam() / 2., -bHalfWidth + (
j + 1) * bHalfWidth / 5, 0),
2720 dryAirTubeTra1.z());
2733 const unsigned int numSec(static_cast<unsigned int>(
vecBackCoolNSec()[iMod]));
2734 for (
unsigned int jSec(0); jSec != numSec; ++jSec) {
2736 for (
unsigned int iBar(0); iBar !=
nMax; ++iBar) {
2741 if (jSec != numSec - 1)
2763 double patchHeight(0);
2773 const std::vector<double>& patchParms(patchSolid.
parameters());
2818 const std::vector<double>& envParms(envSolid.
parameters());
2823 const std::vector<double>& blkParms(blkSolid.parameters());
2833 const std::vector<double>& cutParms(cutSolid.
parameters());
2845 const std::vector<double>& shim2Parms(shim2Solid.
parameters());
2849 DDTranslation(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0),
2858 const std::vector<double>& shim1Parms(shim1Solid.
parameters());
2863 DDTranslation(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2]),
2900 LogDebug(
"EcalGeom") <<
"******** DDEcalBarrelAlgo test: end it...";
2907 std::make_unique<DDRotationMatrix>(
r.xx(),
r.xy(),
r.xz(),
r.yx(),
r.yy(),
r.yz(),
r.zx(),
r.zy(),
r.zz()));
2914 if (
temp.second.empty()) {
2923 ddname(
s),
t.dz(),
t.theta(),
t.phi(),
t.h1(),
t.bl1(),
t.tl1(),
t.alp1(),
t.h2(),
t.bl2(),
t.tl2(),
t.alp2());
2931 const HepGeom::Point3D<double>&
corner,
2938 const unsigned int copyOne(1);
2942 const double BWebx(bWeb + (BWeb - bWeb) * LWebx / LWeb);
2945 const Trap trapWebClr(BWebx / 2,
2959 const Trap trapWebPl(trapWebClr.
A() / 2,
2964 trapWebClr.
L() / 2.,
2966 trapWebClr.
b() - trapWebClr.
B(),
2970 const DDSolid webPlSolid(
mytrap(webPlDDName.fullname(), trapWebPl));
2990 const Pt3D wedge1(wedge3 +
Pt3D(trapWebClr.
a(), 0, 0));
2992 LogDebug(
"EcalGeom") <<
"trap1=" << vWeb[0] <<
", trap2=" << vWeb[2] <<
", trap3=" << vWeb[3];
2994 LogDebug(
"EcalGeom") <<
"wedge1=" << wedge1 <<
", wedge2=" << wedge2 <<
", wedge3=" << wedge3;
2996 const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3);
3002 DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
3003 myrot(webClrLog.
name().
name() + std::to_string(iWeb), tForm.getRotation()));