12 #include "DD4hep/DetFactoryHelper.h" 32 double thick =
args.value<
double>(
"Thickness");
33 double zMinBlock =
args.value<
double>(
"zMinBlock");
34 double moduleThick =
args.value<
double>(
"ModuleThick");
35 std::vector<std::string> tagLayer =
36 args.value<std::vector<std::string>>(
"TagLayer");
37 std::vector<std::string> tagSector =
38 args.value<std::vector<std::string>>(
"TagSector");
40 double phi0 =
args.value<
double>(
"PhiStart");
41 double dphi = (2._pi) / tagSector.size();
43 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << tagLayer.size() <<
" Modules with base name " << parentName
44 <<
" made of " << material <<
" T " << thick <<
" Sectors " << tagSector.size()
46 for (
unsigned int i = 0;
i < tagLayer.size(); ++
i)
47 edm::LogVerbatim(
"HGCalGeom") <<
"Layer " <<
i <<
" Tag " << tagLayer[
i] <<
" T " << moduleThick;
48 for (
unsigned int i = 0;
i < tagSector.size(); ++
i)
51 std::vector<std::string> layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
52 std::vector<std::string> materials =
53 args.value<std::vector<std::string>>(
"LayerMaterials");
54 std::vector<double> layerThick =
args.value<std::vector<double>>(
"LayerThickness");
56 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << layerNames.size() <<
" types of volumes";
57 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
58 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " << layerThick[
i]
59 <<
" filled with " << materials[
i];
62 std::vector<int> layerType =
args.value<std::vector<int>>(
"LayerType");
64 std::ostringstream st1;
65 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
66 st1 <<
" [" <<
i <<
"] " << layerType[
i];
67 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType.size() <<
" blocks" << st1.str();
70 double shiftTop =
args.value<
double>(
"ShiftTop");
71 double shiftBot =
args.value<
double>(
"ShiftBottom");
73 edm::LogVerbatim(
"HGCalGeom") <<
"Shifts st the top " << shiftTop <<
" and at the bottom " << shiftBot;
76 std::vector<double> slopeB =
args.value<std::vector<double>>(
"SlopeBottom");
77 std::vector<double> zFrontB =
args.value<std::vector<double>>(
"ZFrontBottom");
78 std::vector<double> rMinFront =
args.value<std::vector<double>>(
"RMinFront");
79 std::vector<double> slopeT =
args.value<std::vector<double>>(
"SlopeTop");
80 std::vector<double> zFrontT =
args.value<std::vector<double>>(
"ZFrontTop");
81 std::vector<double> rMaxFront =
args.value<std::vector<double>>(
"RMaxFront");
83 for (
unsigned int i = 0;
i < slopeB.size(); ++
i)
84 edm::LogVerbatim(
"HGCalGeom") <<
"Bottom Block [" <<
i <<
"] Zmin " << zFrontB[
i] <<
" Rmin " << rMinFront[
i]
85 <<
" Slope " << slopeB[
i];
86 for (
unsigned int i = 0;
i < slopeT.size(); ++
i)
87 edm::LogVerbatim(
"HGCalGeom") <<
"Top Block [" <<
i <<
"] Zmin " << zFrontT[
i] <<
" Rmax " << rMaxFront[
i]
88 <<
" Slope " << slopeT[
i];
96 double zim(zMinBlock);
98 for (
unsigned int j = 0;
j < tagLayer.size(); ++
j) {
100 double zo = zim + moduleThick;
103 for (
unsigned int k = 0;
k < tagSector.size(); ++
k) {
105 double phi1 = phi0 +
k * dphi;
106 double phi2 = phi1 + dphi;
107 double phi0 = phi1 + 0.5 * dphi;
109 std::vector<double> xM, yM;
111 xM = {rinB *
cos(phi1), routF *
cos(phi1), routF *
cos(phi2), rinB *
cos(phi2)};
112 yM = {rinB *
sin(phi1), routF *
sin(phi1), routF *
sin(phi2), rinB *
sin(phi2)};
115 std::vector<double> xTmp = {rinB *
cos(phi1),
121 std::vector<double> yTmp = {rinB *
sin(phi1),
130 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
131 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
137 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << solid.name() <<
" extruded polygon made of " 138 << matter.name() <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0]
139 <<
":" <<
scale[0] <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1]
140 <<
":" <<
scale[1] <<
" and " << xM.size() <<
" edges";
141 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
146 std::vector<dd4hep::Volume> glogs(materials.size());
147 std::vector<int> copyNumber(materials.size(), 1);
148 double zi(-0.5 * thick), thickTot(0.0);
149 for (
unsigned int l = 0;
l < layerType.size();
l++) {
150 unsigned int i = layerType[
l];
151 if (copyNumber[
i] == 1) {
152 zw[0] = -0.5 * layerThick[
i];
153 zw[1] = 0.5 * layerThick[
i];
161 <<
"DDHGCalPassive: Layer " <<
i <<
":" <<
l <<
":" << solid.name() <<
" extruded polygon made of " 162 << matter.name() <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
163 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1] <<
" and " << xM.size()
165 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
170 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
172 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << glogs[
i].name() <<
" number " << copyNumber[
i]
173 <<
" positioned in " << glogM.name() <<
" at (0, 0, " 178 thickTot += layerThick[
i];
180 if ((
std::abs(thickTot - thick) >= tol) && (!layerType.empty())) {
181 if (thickTot > thick) {
182 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
183 <<
": thickness of all its components **** ERROR ****";
185 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " 186 << thickTot <<
" of the components";
Log< level::Info, true > LogVerbatim
HGCalPassive(cms::DDParsingContext &ctxt, xml_h e)
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
Sin< T >::type sin(const T &t)
Log< level::Error, false > LogError
dd4hep::Material material(const std::string &name) const
#define DECLARE_DDCMS_DETELEMENT(name, func)
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
static constexpr long s_executed
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Log< level::Warning, false > LogWarning
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
std::string prepend(const std::string &) const