7 #include "DD4hep/DetFactoryHelper.h"
26 const auto& thick =
args.value<
double>(
"ModuleThickness");
27 const auto& waferSize =
args.value<
double>(
"WaferSize");
28 const auto& waferSepar =
args.value<
double>(
"SensorSeparation");
30 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: Module " << parentName <<
" made of " << material <<
" T "
34 const auto&
tags =
args.value<std::vector<std::string>>(
"Tags");
35 const auto& partialTypes =
args.value<std::vector<int>>(
"PartialTypes");
36 const auto& orientations =
args.value<std::vector<int>>(
"Orientations");
38 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " <<
tags.size() <<
" variations of wafer types";
39 for (
unsigned int k = 0;
k <
tags.size(); ++
k)
41 <<
" Orientation " << orientations[
k];
43 const auto& layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
44 const auto& materials =
args.value<std::vector<std::string>>(
"LayerMaterials");
45 const auto& layerThick =
args.value<std::vector<double>>(
"LayerThickness");
46 const auto& layerType =
args.value<std::vector<int>>(
"LayerTypes");
48 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << layerNames.size() <<
" types of volumes";
49 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
50 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness "
54 const auto&
layers =
args.value<std::vector<int>>(
"Layers");
56 std::ostringstream st1;
57 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
58 st1 <<
" [" <<
i <<
"] " <<
layers[
i];
62 const auto& senseT =
args.value<
double>(
"SenseThick");
63 const auto& senseType =
args.value<
int>(
"SenseType");
64 const auto& posSense =
args.value<
int>(
"PosSensitive");
66 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: NameSpace " << ns.
name() <<
" Sensitive Layer Name " << senseName
67 <<
" Thickness " << senseT <<
" Type " << senseType <<
" Position " << posSense;
70 static constexpr
double tol = 0.00001 * dd4hep::mm;
71 static const double sqrt3 =
std::sqrt(3.0);
72 double rM = 0.5 * (waferSize + waferSepar);
73 double RM = 2.0 * rM / sqrt3;
74 double r = 0.5 * waferSize;
75 double R = 2.0 *
r / sqrt3;
78 for (
unsigned int k = 0;
k <
tags.size(); ++
k) {
81 std::vector<std::pair<double, double>> wxy =
83 std::vector<double> xM, yM;
84 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
85 xM.emplace_back(wxy[
i].
first);
88 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
89 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
97 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of " << material
102 <<
" orientation " << orientations[
k] <<
" and " << xM.size() <<
" edges";
103 for (
unsigned int j = 0;
j < xM.size(); ++
j)
110 std::vector<double> xL, yL;
111 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
112 xL.emplace_back(wxy[
i].
first);
113 yL.emplace_back(wxy[
i].
second);
115 std::vector<dd4hep::Volume> glogs(materials.size());
116 std::vector<int> copyNumber(materials.size(), 1);
117 double zi(-0.5 * thick), thickTot(0.0);
118 for (
unsigned int l = 0;
l <
layers.size();
l++) {
120 if (copyNumber[
i] == 1) {
121 zw[0] = -0.5 * layerThick[
i];
122 zw[1] = 0.5 * layerThick[
i];
130 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of "
136 for (
unsigned int j = 0;
j < xL.size(); ++
j)
140 if (layerType[
i] > 0) {
142 zw[0] = -0.5 * senseT;
143 zw[1] = 0.5 * senseT;
149 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of "
154 << partialTypes[
k] <<
" orientation " << orientations[
k] <<
" and " << xL.size()
156 for (
unsigned int j = 0;
j < xL.size(); ++
j)
159 double zpos = (posSense == 0) ? -0.5 * (layerThick[
i] - senseT) : 0.5 * (layerThick[
i] - senseT);
161 int copy = 10 + senseType;
162 glogs[
i].placeVolume(glog,
copy, tran);
164 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glog.name() <<
" number " <<
copy <<
" positioned in "
166 <<
") with no rotation";
170 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
172 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << 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) {
181 if (thickTot > thick) {
183 <<
cms::convert2mm(thickTot) <<
": thickness of all its components **** ERROR ****";
186 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";