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");
42 double phi0 =
args.value<
double>(
"PhiStart");
43 double dphi = (2._pi) / tagSector.size();
45 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << tagLayer.size() <<
" Modules with base name " << parentName
46 <<
" made of " << material <<
" T " << thick <<
" Sectors " << tagSector.size()
48 for (
unsigned int i = 0;
i < tagLayer.size(); ++
i)
49 edm::LogVerbatim(
"HGCalGeom") <<
"Layer " <<
i <<
" Tag " << tagLayer[
i] <<
" T " << moduleThick;
50 for (
unsigned int i = 0;
i < tagSector.size(); ++
i)
53 std::vector<std::string> layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
54 std::vector<std::string> materials =
55 args.value<std::vector<std::string>>(
"LayerMaterials");
56 std::vector<double> layerThick =
args.value<std::vector<double>>(
"LayerThickness");
58 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << layerNames.size() <<
" types of volumes";
59 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
60 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " << layerThick[
i]
61 <<
" filled with " << materials[
i];
64 std::vector<int> layerType =
args.value<std::vector<int>>(
"LayerType");
66 std::ostringstream st1;
67 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
68 st1 <<
" [" <<
i <<
"] " << layerType[
i];
69 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType.size() <<
" blocks" << st1.str();
72 double shiftTop =
args.value<
double>(
"ShiftTop");
73 double shiftBot =
args.value<
double>(
"ShiftBottom");
75 edm::LogVerbatim(
"HGCalGeom") <<
"Shifts st the top " << shiftTop <<
" and at the bottom " << shiftBot;
78 std::vector<double> slopeB =
args.value<std::vector<double>>(
"SlopeBottom");
79 std::vector<double> zFrontB =
args.value<std::vector<double>>(
"ZFrontBottom");
80 std::vector<double> rMinFront =
args.value<std::vector<double>>(
"RMinFront");
81 std::vector<double> slopeT =
args.value<std::vector<double>>(
"SlopeTop");
82 std::vector<double> zFrontT =
args.value<std::vector<double>>(
"ZFrontTop");
83 std::vector<double> rMaxFront =
args.value<std::vector<double>>(
"RMaxFront");
85 for (
unsigned int i = 0;
i < slopeB.size(); ++
i)
86 edm::LogVerbatim(
"HGCalGeom") <<
"Bottom Block [" <<
i <<
"] Zmin " << zFrontB[
i] <<
" Rmin " << rMinFront[
i]
87 <<
" Slope " << slopeB[
i];
88 for (
unsigned int i = 0;
i < slopeT.size(); ++
i)
89 edm::LogVerbatim(
"HGCalGeom") <<
"Top Block [" <<
i <<
"] Zmin " << zFrontT[
i] <<
" Rmax " << rMaxFront[
i]
90 <<
" Slope " << slopeT[
i];
98 double zim(zMinBlock);
100 for (
unsigned int j = 0;
j < tagLayer.size(); ++
j) {
102 double zo = zim + moduleThick;
105 for (
unsigned int k = 0;
k < tagSector.size(); ++
k) {
107 double phi1 = phi0 +
k * dphi;
108 double dphi0 = dphi /
parts;
110 int nsec = 2 *
parts + 2;
111 std::vector<double> xM(nsec, 0), yM(nsec, 0);
113 double phi0 = phi1 +
n * dphi0;
115 xM[0] = rinB *
cos(phi0);
116 yM[0] = rinB *
sin(phi0);
118 xM[nsec -
n] = rinB *
cos(phi0);
119 yM[nsec -
n] = rinB *
sin(phi0);
121 xM[
n + 1] = routF *
cos(phi0);
122 yM[
n + 1] = routF *
sin(phi0);
124 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
125 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
131 double phi2 = phi1 + dphi;
132 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << solid.name() <<
" extruded polygon made of " 133 << matter.name() <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0]
134 <<
":" <<
scale[0] <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1]
135 <<
":" <<
scale[1] <<
" and " << xM.size() <<
" edges with " <<
parts 137 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
142 std::vector<dd4hep::Volume> glogs(materials.size());
143 std::vector<int> copyNumber(materials.size(), 1);
144 double zi(-0.5 * thick), thickTot(0.0);
145 for (
unsigned int l = 0;
l < layerType.size();
l++) {
146 unsigned int i = layerType[
l];
147 if (copyNumber[
i] == 1) {
148 zw[0] = -0.5 * layerThick[
i];
149 zw[1] = 0.5 * layerThick[
i];
157 <<
"DDHGCalPassive: Layer " <<
i <<
":" <<
l <<
":" << solid.name() <<
" extruded polygon made of " 158 << matter.name() <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
159 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1] <<
" and " << xM.size()
161 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
166 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
168 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassive: " << glogs[
i].name() <<
" number " << copyNumber[
i]
169 <<
" positioned in " << glogM.name() <<
" at (0, 0, " 174 thickTot += layerThick[
i];
176 if ((
std::abs(thickTot - thick) >= tol) && (!layerType.empty())) {
177 if (thickTot > thick) {
178 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
179 <<
": thickness of all its components **** ERROR ****";
181 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " 182 << 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