31 double thick =
args.value<
double>(
"ModuleThickness");
32 double waferSize =
args.value<
double>(
"WaferSize");
33 double waferSepar =
args.value<
double>(
"SensorSeparation");
35 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassiveFull: Module " << parentName <<
" made of " << material <<
" T " 36 << thick <<
" Wafer 2r " << waferSize <<
" Half Separation " << waferSepar;
38 std::vector<std::string> layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
39 std::vector<std::string> materials =
args.value<std::vector<std::string>>(
"LayerMaterials");
40 std::vector<double> layerThick =
args.value<std::vector<double>>(
"LayerThickness");
41 std::vector<int> copyNumber;
42 copyNumber.resize(materials.size(), 1);
44 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassiveFull: " << layerNames.size() <<
" types of volumes";
45 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
46 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " << layerThick[
i]
47 <<
" filled with " << materials[
i];
49 std::vector<int> layerType =
args.value<std::vector<int>>(
"LayerType");
51 std::ostringstream st1;
52 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
53 st1 <<
" [" <<
i <<
"] " << layerType[
i];
54 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType.size() <<
" blocks" << st1.str();
59 static constexpr
double tol = 0.00001;
60 static const double sqrt3 =
std::sqrt(3.0);
61 double rM = 0.5 * (waferSize + waferSepar);
62 double RM2 = rM / sqrt3;
65 std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
66 std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
67 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
68 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
70 ns.addSolidNS(ns.prepend(parentName), solid);
73 ns.addVolumeNS(glogM);
75 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassiveFull: " << solid.name() <<
" extruded polygon made of " 76 << matter.name() <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" 77 <<
scale[0] <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" 78 <<
scale[1] <<
" and " << xM.size() <<
" edges";
79 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
84 std::vector<dd4hep::Volume> glogs(materials.size());
85 double zi(-0.5 * thick), thickTot(0.0);
86 for (
unsigned int l = 0;
l < layerType.size();
l++) {
87 unsigned int i = layerType[
l];
88 if (copyNumber[
i] == 1) {
89 zw[0] = -0.5 * layerThick[
i];
90 zw[1] = 0.5 * layerThick[
i];
93 ns.addSolidNS(ns.prepend(layerName), solid);
94 matter = ns.material(materials[
i]);
96 ns.addVolumeNS(glogs[
i]);
98 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassiveFull: Layer " <<
i <<
":" <<
l <<
":" << solid.name()
99 <<
" extruded polygon made of " << matter.name() <<
" z|x|y|s (0) " <<
zw[0]
100 <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0] <<
" z|x|y|s (1) " <<
zw[1]
101 <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1] <<
" and " << xM.size()
103 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
108 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
110 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassiveFull: " << glogs[
i].name() <<
" number " << copyNumber[
i]
111 <<
" positioned in " << glogM.name() <<
" at " << tran0 <<
" with no rotation";
115 thickTot += layerThick[
i];
117 if ((
std::abs(thickTot - thick) >= tol) && (!layerType.empty())) {
118 if (thickTot > thick) {
119 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
120 <<
": thickness of all its components **** ERROR ****";
122 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " << thickTot
123 <<
" of the components";
Log< level::Info, true > LogVerbatim
Log< level::Error, false > LogError
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