4 #include "DD4hep/DetFactoryHelper.h" 13 dd4hep::SensitiveDetector& ) {
41 int nsectors = args.
value<
int>(
"NSector");
42 int nsectortot = args.
value<
int>(
"NSectorTot");
43 int nhalf = args.
value<
int>(
"NHalf");
44 double rin = args.
value<
double>(
"RIn");
45 std::vector<double>
theta = args.
value<std::vector<double> >(
"Theta");
46 std::vector<double> rmax = args.
value<std::vector<double> >(
"RMax");
47 std::vector<double> zoff = args.
value<std::vector<double> >(
"ZOff");
49 double thick = args.
value<
double>(
"Thickness");
50 double width1 = args.
value<
double>(
"Width1");
51 double length1 = args.
value<
double>(
"Length1");
52 double width2 = args.
value<
double>(
"Width2");
53 double length2 = args.
value<
double>(
"Length2");
54 double gap2 = args.
value<
double>(
"Gap2");
57 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: General material " << genMat <<
"\tSectors " << nsectors <<
", " 58 << nsectortot <<
"\tHalves " << nhalf <<
"\tRin " <<
convertCmToMm(rin);
59 for (
unsigned int i = 0;
i < theta.size();
i++)
67 <<
" NameSpace " << idNameSpace <<
" for solids";
70 double alpha = 1._pi / nsectors;
71 double dphi = nsectortot * 2._pi / nsectors;
72 double zstep0 = zoff[1] + rmax[1] *
tan(theta[1]) + (rin - rmax[1]) *
tan(theta[2]);
73 double zstep1 = zstep0 + thick /
cos(theta[2]);
74 double zstep2 = zoff[3];
75 double rstep0 = rin + (zstep2 - zstep1) /
tan(theta[2]);
76 double rstep1 = rin + (zstep1 - zstep0) /
tan(theta[2]);
78 std::vector<double> pgonZ = {zstep0, zstep1, zstep2, zstep2 + thick /
cos(theta[2])};
79 std::vector<double> pgonRmin = {rin, rin, rstep0, rmax[2]};
80 std::vector<double> pgonRmax = {rin, rstep1, rmax[2], rmax[2]};
86 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Polyhedra made of " << genMat <<
" with " 88 <<
convertRadToDeg(-alpha + dphi) <<
" and with " << pgonZ.size() <<
" sections";
89 for (
unsigned int i = 0; i < pgonZ.size(); i++)
95 dd4hep::Rotation3D
rot;
96 parent.placeVolume(genlogic, 1);
98 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << genlogic.name() <<
" number 1 positioned in " 99 << parent.name() <<
" at (0, 0, 0) with no rotation";
103 parent.placeVolume(genlogic, 2, rot);
105 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << genlogic.name() <<
" number 2 positioned in " 106 << parent.name() <<
" at (0, 0, 0) with rotation: " <<
rot;
115 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Polyhedra made of " << genMat
117 <<
" and with " << pgonZ.size() <<
" sections";
118 for (
unsigned int i = 0; i < pgonZ.size(); i++)
123 for (
int ii = 0;
ii < nsectortot; ++
ii) {
127 rotation = dd4hep::RotationZ(phi);
129 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: Creating a new rotation " 134 genlogic.placeVolume(seclogic,
ii + 1, rotation);
136 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << seclogic.name() <<
" number " <<
ii + 1
137 <<
" positioned in " << genlogic.name() <<
" at (0, 0, 0) with rotation: " <<
rotation;
142 double rinl = pgonRmin[0] + thick *
sin(theta[2]);
143 double routl = pgonRmax[2] - thick *
sin(theta[2]);
144 double dx1 = rinl *
tan(alpha);
145 double dx2 = 0.90 * routl *
tan(alpha);
146 double dy = 0.50 * thick;
147 double dz = 0.50 * (routl - rinl);
148 name = idName +
"Trap";
149 solid = dd4hep::Trap(ns.
prepend(name),
dz, 0, 0,
dy, dx1, dx1, 0,
dy, dx2, dx2, 0);
152 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Trap made of " << genMat
158 rot =
cms::makeRotation3D(90._deg, 270._deg, (180._deg - theta[2]), 0, (90._deg - theta[2]), 0);
160 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: Creating a rotation: \t90, 270, " 164 dd4hep::Position
r1(0.5 * (rinl + routl), 0, 0.5 * (pgonZ[1] + pgonZ[2]));
165 seclogic.placeVolume(glog, 1, dd4hep::Transform3D(rot, r1));
167 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << glog.name() <<
" number 1 positioned in " << seclogic.name()
172 name = idName +
"Cable1";
173 double phi = atan((dx2 - dx1) / (2 * dz));
174 double xmid = 0.5 * (dx1 + dx2) - 1.0;
175 solid = dd4hep::Box(ns.
prepend(name), 0.5 * width1, 0.5 * thick, 0.5 * length1);
179 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Box made of " << absMat <<
" of dimension " 184 dd4hep::Rotation3D rot2 =
cms::makeRotation3D((90._deg + phi), 0.0, 90._deg, 90._deg, phi, 0.0);
189 dd4hep::Position
r2((xmid - 0.5 * width1 *
cos(phi)), 0, 0);
190 glog.placeVolume(cablog1, 1, dd4hep::Transform3D(rot2, r2));
192 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog1.name() <<
" number 1 positioned in " << glog.name()
194 <<
", 0, 0) with rotation: " << rot2;
196 dd4hep::Rotation3D rot3 =
cms::makeRotation3D((90._deg - phi), 0, 90._deg, 90._deg, -phi, 0);
201 dd4hep::Position r3(-(xmid - 0.5 * width1 *
cos(phi)), 0, 0);
202 glog.placeVolume(cablog1, 2, dd4hep::Transform3D(rot3, r3));
204 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog1.name() <<
" number 2 positioned in " << glog.name()
206 <<
", 0, 0) with rotation: " << rot3;
209 name = idName +
"Cable2";
210 solid = dd4hep::Box(ns.
prepend(name), 0.5 * width2, 0.5 * thick, 0.5 * length2);
213 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Box made of " << absMat <<
" of dimension " 218 glog.placeVolume(cablog2, 1, dd4hep::Position(0.5 * (width2 + gap2), 0, 0));
220 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog2.name() <<
" number 1 positioned in " << glog.name()
221 <<
" at (" <<
convertCmToMm(0.5 * (width2 + gap2)) <<
", 0, 0) with no rotation";
223 glog.placeVolume(cablog2, 2, dd4hep::Position(-0.5 * (width2 + gap2), 0, 0));
225 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog2.name() <<
" number 2 positioned in " << glog.name()
226 <<
" at " <<
convertCmToMm(-0.5 * (width2 + gap2)) <<
", 0, 0) with no rotation";
228 edm::LogVerbatim(
"HCalGeom") <<
"<<== End of DDHCalTBCableAlgo construction";
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
T value(const std::string &name) const
Geom::Theta< T > theta() const
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
std::string_view name() const
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
dd4hep::Material material(const std::string &name) const
std::string prepend(const std::string &) const
constexpr NumType convertCmToMm(NumType centimeters)
alpha
zGenParticlesMatch = cms.InputTag(""),
#define DECLARE_DDCMS_DETELEMENT(name, func)
std::string parentName() const
Access value of rParent child node.