4 #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 " <<
convertCmToMm(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++)
91 dd4hep::Rotation3D
rot;
92 parent.placeVolume(genlogic, 1);
94 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << genlogic.name() <<
" number 1 positioned in "
95 <<
parent.name() <<
" at (0, 0, 0) with no rotation";
101 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << genlogic.name() <<
" number 2 positioned in "
102 <<
parent.name() <<
" at (0, 0, 0) with rotation: " <<
rot;
111 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Polyhedra made of " << genMat
113 <<
" and with " << pgonZ.size() <<
" sections";
114 for (
unsigned int i = 0;
i < pgonZ.size();
i++)
119 for (
int ii = 0;
ii < nsectortot; ++
ii) {
125 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: Creating a new rotation "
130 genlogic.placeVolume(seclogic,
ii + 1,
rotation);
132 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << seclogic.name() <<
" number " <<
ii + 1
133 <<
" positioned in " << genlogic.name() <<
" at (0, 0, 0) with rotation: " <<
rotation;
138 double rinl = pgonRmin[0] + thick *
sin(
theta[2]);
139 double routl = pgonRmax[2] - thick *
sin(
theta[2]);
141 double dx2 = 0.90 * routl *
tan(
alpha);
142 double dy = 0.50 * thick;
143 double dz = 0.50 * (routl - rinl);
145 solid = dd4hep::Trap(ns.
prepend(
name),
dz, 0, 0,
dy, dx1, dx1, 0,
dy, dx2, dx2, 0);
148 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Trap made of " << genMat
156 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: Creating a rotation: \t90, 270, "
161 seclogic.placeVolume(glog, 1, dd4hep::Transform3D(
rot,
r1));
163 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << glog.name() <<
" number 1 positioned in " << seclogic.name()
169 double phi = atan((dx2 - dx1) / (2 *
dz));
170 double xmid = 0.5 * (dx1 + dx2) - 1.0;
171 solid = dd4hep::Box(ns.
prepend(
name), 0.5 * width1, 0.5 * thick, 0.5 * length1);
175 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Box made of " << absMat <<
" of dimension "
180 dd4hep::Rotation3D rot2 =
cms::makeRotation3D((90._deg + phi), 0.0, 90._deg, 90._deg, phi, 0.0);
186 glog.placeVolume(cablog1, 1, dd4hep::Transform3D(rot2,
r2));
188 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog1.name() <<
" number 1 positioned in " << glog.name()
190 <<
", 0, 0) with rotation: " << rot2;
192 dd4hep::Rotation3D rot3 =
cms::makeRotation3D((90._deg - phi), 0, 90._deg, 90._deg, -phi, 0);
198 glog.placeVolume(cablog1, 2, dd4hep::Transform3D(rot3, r3));
200 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog1.name() <<
" number 2 positioned in " << glog.name()
202 <<
", 0, 0) with rotation: " << rot3;
206 solid = dd4hep::Box(ns.
prepend(
name), 0.5 * width2, 0.5 * thick, 0.5 * length2);
209 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << solid.name() <<
" Box made of " << absMat <<
" of dimension "
214 glog.placeVolume(cablog2, 1,
dd4hep::Position(0.5 * (width2 + gap2), 0, 0));
216 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog2.name() <<
" number 1 positioned in " << glog.name()
217 <<
" at (" <<
convertCmToMm(0.5 * (width2 + gap2)) <<
", 0, 0) with no rotation";
219 glog.placeVolume(cablog2, 2,
dd4hep::Position(-0.5 * (width2 + gap2), 0, 0));
221 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTBCableAlgo: " << cablog2.name() <<
" number 2 positioned in " << glog.name()
222 <<
" at " <<
convertCmToMm(-0.5 * (width2 + gap2)) <<
", 0, 0) with no rotation";
224 edm::LogVerbatim(
"HCalGeom") <<
"<<== End of DDHCalTBCableAlgo construction";