14 #include "DD4hep/DetFactoryHelper.h" 57 double yh1, bl1, tl1, yh2, bl2, tl2, alp,
theta, phi, xpos, ypos,
zpos;
97 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: General material " << genMaterial <<
"\tAbsorber " 98 << absorberMat <<
"\tPlastic " << plasticMat <<
"\tScintillator " << scintMat
99 <<
"\tRotation " << rotstr <<
"\tSectors " <<
sectors;
101 zMinBlock =
args.value<
double>(
"ZMinBlock");
102 zMaxBlock =
args.value<
double>(
"ZMaxBlock");
103 z1Beam =
args.value<
double>(
"Z1Beam");
104 ziDip =
args.value<
double>(
"ZiDip");
105 dzStep =
args.value<
double>(
"DzStep");
106 moduleThick =
args.value<
double>(
"ModuleThick");
107 layerThick =
args.value<
double>(
"LayerThick");
108 scintThick =
args.value<
double>(
"ScintThick");
116 rMaxFront =
args.value<
double>(
"RMaxFront");
117 rMaxBack =
args.value<
double>(
"RMaxBack");
118 trimLeft =
args.value<
double>(
"TrimLeft");
119 trimRight =
args.value<
double>(
"TrimRight");
120 tolAbs =
args.value<
double>(
"TolAbs");
126 slopeBot =
args.value<
double>(
"SlopeBottom");
127 slopeTop =
args.value<
double>(
"SlopeTop");
128 slopeTopF =
args.value<
double>(
"SlopeTopFront");
129 modType =
args.value<
int>(
"ModType");
130 modNumber =
args.value<
int>(
"ModNumber");
131 layerType =
args.value<
int>(
"LayerType");
133 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: slopeBot " << slopeBot <<
"\tslopeTop " << slopeTop
134 <<
"\tslopeTopF " << slopeTopF <<
"\tmodType " << modType <<
"\tmodNumber " 135 << modNumber <<
"\tlayerType " << layerType;
137 layerNumber =
args.value<std::vector<int> >(
"LayerNumber");
139 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << layerNumber.size() <<
" layer Numbers";
140 for (
unsigned int i = 0;
i < layerNumber.size(); ++
i)
143 phiName =
args.value<std::vector<std::string> >(
"PhiName");
145 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << phiName.size() <<
" phi sectors";
146 for (
unsigned int i = 0;
i < phiName.size(); ++
i)
149 layerName =
args.value<std::vector<std::string> >(
"LayerName");
151 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << layerName.size() <<
" layers";
152 for (
unsigned int i = 0;
i < layerName.size(); ++
i)
156 idOffset =
args.value<
int>(
"IdOffset");
159 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Parent " <<
args.parentName() <<
" " << modName
160 <<
" idName " <<
idName <<
" NameSpace " << ns.
name() <<
" Offset " << idOffset;
164 edm::LogVerbatim(
"HCalGeom") <<
"==>> Constructing DDHCalEndcapModuleAlgo...";
169 constructInsideModule0(ctxt,
e, mother);
171 constructInsideModule(ctxt,
e, mother);
173 edm::LogVerbatim(
"HCalGeom") <<
"<<== End of DDHCalEndcapModuleAlgo construction ...";
181 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: \t\tInside module0";
187 dd4hep::Rotation3D
rot = getRotation(rotstr, ns);
189 int layer = layerNumber[0];
190 int layer0 = layerNumber[1];
194 for (
unsigned int iphi = 0;
iphi < phiName.size();
iphi++) {
210 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.name() <<
" Trap made of " << plasticMat
211 <<
" of dimensions " <<
cms::convert2mm(0.5 * layerThick) <<
", 0, 0, " 220 module.placeVolume(glog, idOffset + layer + 1, dd4hep::Transform3D(
rot, r1));
222 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.name() <<
" number " << (idOffset + layer + 1)
225 <<
") with rotation: " <<
rot;
228 int copyNo = layer0 * 10 + layerType;
229 name = modName + layerName[0] + phiName[
iphi];
230 constructScintLayer(glog, scintThick, parm,
name, copyNo, ns);
234 double zi = zMinBlock + layerThick;
235 double zo = zi + 0.5 * dzStep;
236 double rinF, routF, rinB, routB;
237 if (modNumber == 0) {
238 rinF = zi * slopeTopF;
239 routF = (zi - z1Beam) * slopeTop;
240 rinB = zo * slopeTopF;
241 routB = (zo - z1Beam) * slopeTop;
242 }
else if (modNumber > 0) {
243 rinF = zi * slopeBot;
244 routF = zi * slopeTopF;
245 rinB = zo * slopeBot;
246 routB = zo * slopeTopF;
248 rinF = zi * slopeBot;
249 routF = (zi - z1Beam) * slopeTop;
250 rinB = zo * slopeBot;
251 routB = (zo - z1Beam) * slopeTop;
271 name =
idName + modName + layerName[0] +
"Absorber";
285 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.name() <<
" Trap made of " << matabsorbr.name()
296 module.placeVolume(glog, idOffset + layer + 1, dd4hep::Transform3D(
rot,
r2));
298 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.name() <<
" number 1 positioned in " 301 <<
") with rotation: " <<
rot;
308 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: \t\tInside module";
314 dd4hep::Rotation3D
rot = getRotation(rotstr, ns);
317 double zi = zMinBlock;
319 for (
unsigned int i = 0;
i < layerName.size();
i++) {
323 int layer = layerNumber[
i];
324 double zo = zi + 0.5 * dzStep;
326 for (
unsigned int iphi = 0;
iphi < phiName.size();
iphi++) {
327 double ziAir = zo - moduleThick;
329 if (modNumber == 0) {
330 rinF = ziAir * slopeTopF;
331 rinB = zo * slopeTopF;
333 rinF = ziAir * slopeBot;
334 rinB = zo * slopeBot;
336 double routF = getRout(ziAir);
337 double routB = getRout(zo);
339 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Layer " <<
i <<
" Phi " <<
iphi <<
" Front " 360 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.name() <<
" Trap made of " << matter.name()
371 module.placeVolume(glog, layer + 1, dd4hep::Transform3D(
rot, r1));
373 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.name() <<
" number " << (layer + 1)
376 <<
") with rotation: " <<
rot;
379 parm.
yh1 = 0.5 * (routF - rinB) - getTrim(
iphi);
396 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.name() <<
" Trap made of " 397 << matplastic.name() <<
" of dimensions " <<
cms::convert2mm(0.5 * layerThick)
405 double ypos = 0.5 * (routF + rinB) - parm.
xpos;
407 glog.placeVolume(plog, idOffset + layer + 1,
r2);
409 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << plog.name() <<
" number " 410 << (idOffset + layer + 1) <<
" positioned in " << glog.name() <<
" at (0, " 414 int copyNo = layer * 10 + layerType;
415 name = modName + layerName[
i] + phiName[
iphi];
416 constructScintLayer(plog, scintThick, parm,
name, copyNo, ns);
419 zi = zo - 0.5 * dzStep;
434 zo = zi + layerThick;
437 zi = zo - layerThick;
440 if (modNumber == 0) {
441 rin = zo * slopeTopF;
442 rout = (zi - z1Beam) * slopeTop;
443 }
else if (modNumber > 0) {
445 rout = zi * slopeTopF;
448 rout = (zi - z1Beam) * slopeTop;
452 <<
cms::convert2mm(zo) <<
" " << slopeTopF <<
" " << slopeTop <<
" " << slopeBot <<
" " 456 double yh = 0.5 * (rout - rin);
458 double tl = 0.5 * rout *
tan(
alpha);
459 parm.
xpos = 0.5 * (rin + rout);
460 parm.
ypos = 0.5 * (bl + tl);
461 parm.
zpos = 0.5 * (zi + zo);
481 unsigned int iphi,
double rinF,
double routF,
double rinB,
double routB,
double zi,
double zo) {
492 parm.
yh1 = 0.5 * (routF - rinB);
495 parm.
yh2 = 0.5 * (routF - rinB);
499 double dy = 0.5 * (rinB + routF - rinB - routF);
500 parm.
xpos = 0.25 * (rinB + routF + rinB + routF);
502 parm.
zpos = 0.5 * (zi + zo);
516 parm.
theta = atan(r / (zo - zi));
542 dd4hep::Solid solid = dd4hep::Trap(
543 ns.
prepend(
name), 0.5 *
dz, 0, 0, parm.
yh1, parm.
bl1, parm.
tl1, parm.
alp, parm.
yh1, parm.
bl1, parm.
tl1, parm.
alp);
545 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.name() <<
" Trap made of " << scintMat
556 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.name() <<
" number " <<
id <<
" positioned in " 557 <<
detector.name() <<
" at (0,0,0) with no rotation";
569 double r = (modNumber >= 0) ? ((z - z1Beam) * slopeTop) : z * slopeTopF;
Log< level::Info, true > LogVerbatim
const dd4hep::Rotation3D & rotation(const std::string &name) const
void constructInsideModule0(cms::DDParsingContext &ctxt, xml_h e, dd4hep::Volume &module)
HCalEndcapModuleAlgo(cms::DDParsingContext &ctxt, xml_h e)
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
void constructScintLayer(dd4hep::Volume &detector, double dz, HCalEndcapModuleAlgo::HcalEndcapPar parm, const std::string &nm, int id, cms::DDNamespace &ns)
dd4hep::Material material(const std::string &name) const
double getRout(double z) const
HcalEndcapPar(double yh1v=0, double bl1v=0, double tl1v=0, double yh2v=0, double bl2v=0, double tl2v=0, double alpv=0, double thv=0, double fiv=0, double x=0, double y=0, double z=0)
#define DECLARE_DDCMS_DETELEMENT(name, func)
HcalEndcapPar parameterLayer0(unsigned int iphi)
static constexpr long s_executed
double getTrim(unsigned int j) const
std::string_view name() const
Tan< T >::type tan(const T &t)
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
std::vector< std::string > layerName
std::vector< int > layerNumber
dd4hep::Rotation3D getRotation(const std::string &rotstr, cms::DDNamespace &ns)
std::vector< std::string > phiName
Geom::Theta< T > theta() const
HcalEndcapPar parameterLayer(unsigned int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo)
void constructInsideModule(cms::DDParsingContext &ctxt, xml_h e, dd4hep::Volume &module)
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::string prepend(const std::string &) const