5 #include "DD4hep/DetFactoryHelper.h" 37 int nsectors =
args.value<
int>(
"NSector");
38 int nsectortot =
args.value<
int>(
"NSectorTot");
39 int nhalf =
args.value<
int>(
"NHalf");
40 double rin =
args.value<
double>(
"RIn");
41 std::vector<double>
theta =
args.value<std::vector<double> >(
"Theta");
42 std::vector<double> rmax =
args.value<std::vector<double> >(
"RMax");
43 std::vector<double> zoff =
args.value<std::vector<double> >(
"ZOff");
45 double thick =
args.value<
double>(
"Thickness");
46 double width1 =
args.value<
double>(
"Width1");
47 double length1 =
args.value<
double>(
"Length1");
48 double width2 =
args.value<
double>(
"Width2");
49 double length2 =
args.value<
double>(
"Length2");
50 double gap2 =
args.value<
double>(
"Gap2");
53 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: General material " << genMat <<
"\tSectors " << nsectors <<
", " 54 << nsectortot <<
"\tHalves " << nhalf <<
"\tRin " <<
cms::convert2mm(rin);
55 for (
unsigned int i = 0;
i <
theta.size();
i++)
63 <<
" NameSpace " << ns.
name() <<
" for solids";
66 double alpha = 1._pi / nsectors;
67 double dphi = nsectortot * 2._pi / nsectors;
68 double zstep0 = zoff[1] + rmax[1] *
tan(
theta[1]) + (rin - rmax[1]) *
tan(
theta[2]);
69 double zstep1 = zstep0 + thick /
cos(
theta[2]);
70 double zstep2 = zoff[3];
71 double rstep0 = rin + (zstep2 - zstep1) /
tan(
theta[2]);
72 double rstep1 = rin + (zstep1 - zstep0) /
tan(
theta[2]);
74 std::vector<double> pgonZ = {zstep0, zstep1, zstep2, zstep2 + thick /
cos(
theta[2])};
75 std::vector<double> pgonRmin = {rin, rin, rstep0, rmax[2]};
76 std::vector<double> pgonRmax = {rin, rstep1, rmax[2], rmax[2]};
82 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Polyhedra made of " << genMat <<
" with " 85 for (
unsigned int i = 0;
i < pgonZ.size();
i++)
92 dd4hep::Rotation3D
rot;
93 parent.placeVolume(genlogic, 1);
95 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << genlogic.name() <<
" number 1 positioned in " 96 <<
parent.name() <<
" at (0, 0, 0) with no rotation";
102 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << genlogic.name() <<
" number 2 positioned in " 103 <<
parent.name() <<
" at (0, 0, 0) with rotation: " <<
rot;
112 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Polyhedra made of " << genMat
114 <<
" and with " << pgonZ.size() <<
" sections";
115 for (
unsigned int i = 0;
i < pgonZ.size();
i++)
121 for (
int ii = 0;
ii < nsectortot; ++
ii) {
127 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: Creating a new rotation " 132 genlogic.placeVolume(seclogic,
ii + 1,
rotation);
134 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << seclogic.name() <<
" number " <<
ii + 1
135 <<
" positioned in " << genlogic.name() <<
" at (0, 0, 0) with rotation: " <<
rotation;
140 double rinl = pgonRmin[0] + thick *
sin(
theta[2]);
141 double routl = pgonRmax[2] - thick *
sin(
theta[2]);
143 double dx2 = 0.90 * routl *
tan(
alpha);
144 double dy = 0.50 * thick;
145 double dz = 0.50 * (routl - rinl);
147 solid = dd4hep::Trap(ns.
prepend(
name),
dz, 0, 0,
dy, dx1, dx1, 0,
dy, dx2, dx2, 0);
150 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Trap made of " << genMat
158 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: Creating a rotation: \t90, 270, " 163 seclogic.placeVolume(glog, 1, dd4hep::Transform3D(
rot, r1));
165 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << glog.name() <<
" number 1 positioned in " << seclogic.name()
171 double phi = atan((dx2 - dx1) / (2 *
dz));
172 double xmid = 0.5 * (dx1 + dx2) - 1.0;
173 solid = dd4hep::Box(ns.
prepend(
name), 0.5 * width1, 0.5 * thick, 0.5 * length1);
177 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Box made of " << absMat <<
" of dimension " 182 dd4hep::Rotation3D rot2 =
cms::makeRotation3D((90._deg + phi), 0.0, 90._deg, 90._deg, phi, 0.0);
188 glog.placeVolume(cablog1, 1, dd4hep::Transform3D(rot2,
r2));
190 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog1.name() <<
" number 1 positioned in " << glog.name()
192 <<
", 0, 0) with rotation: " << rot2;
194 dd4hep::Rotation3D rot3 =
cms::makeRotation3D((90._deg - phi), 0, 90._deg, 90._deg, -phi, 0);
200 glog.placeVolume(cablog1, 2, dd4hep::Transform3D(rot3, r3));
202 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog1.name() <<
" number 2 positioned in " << glog.name()
204 <<
", 0, 0) with rotation: " << rot3;
208 solid = dd4hep::Box(ns.
prepend(
name), 0.5 * width2, 0.5 * thick, 0.5 * length2);
211 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Box made of " << absMat <<
" of dimension " 216 glog.placeVolume(cablog2, 1,
dd4hep::Position(0.5 * (width2 + gap2), 0, 0));
218 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog2.name() <<
" number 1 positioned in " << glog.name()
219 <<
" at (" <<
cms::convert2mm(0.5 * (width2 + gap2)) <<
", 0, 0) with no rotation";
221 glog.placeVolume(cablog2, 2,
dd4hep::Position(-0.5 * (width2 + gap2), 0, 0));
223 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog2.name() <<
" number 2 positioned in " << glog.name()
224 <<
" at " <<
cms::convert2mm(-0.5 * (width2 + gap2)) <<
", 0, 0) with no rotation";
226 edm::LogVerbatim(
"HCalGeom") <<
"<<== End of DDHCalTBCableAlgo construction";
Log< level::Info, true > LogVerbatim
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
Sin< T >::type sin(const T &t)
dd4hep::Material material(const std::string &name) const
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
std::string_view name() const
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Geom::Theta< T > theta() const
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::string prepend(const std::string &) const