26 const auto& thick =
args.value<
double>(
"ModuleThickness");
27 const auto& waferSize =
args.value<
double>(
"WaferSize");
30 const auto& waferSepar =
args.value<
double>(
"SensorSeparation");
31 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: Module " << parentName <<
" made of " << material <<
" T " 36 const auto&
tags =
args.value<std::vector<std::string>>(
"Tags");
37 const auto& partialTypes =
args.value<std::vector<int>>(
"PartialTypes");
38 const auto& orientations =
args.value<std::vector<int>>(
"Orientations");
40 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " <<
tags.size() <<
" variations of wafer types";
41 for (
unsigned int k = 0;
k <
tags.size(); ++
k)
43 <<
" Orientation " << orientations[
k];
45 const auto& layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
46 const auto& materials =
args.value<std::vector<std::string>>(
"LayerMaterials");
47 const auto& layerThick =
args.value<std::vector<double>>(
"LayerThickness");
48 const auto& layerType =
args.value<std::vector<int>>(
"LayerTypes");
50 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << layerNames.size() <<
" types of volumes";
51 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
52 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " 56 const auto&
layers =
args.value<std::vector<int>>(
"Layers");
58 std::ostringstream st1;
59 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
60 st1 <<
" [" <<
i <<
"] " <<
layers[
i];
64 const auto& senseT =
args.value<
double>(
"SenseThick");
65 const auto& senseType =
args.value<
int>(
"SenseType");
66 const auto& posSense =
args.value<
int>(
"PosSensitive");
68 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: NameSpace " << ns.name() <<
" Sensitive Layer Name " << senseName
69 <<
" Thickness " << senseT <<
" Type " << senseType <<
" Position " << posSense;
72 static constexpr double tol = 0.00001 * dd4hep::mm;
75 for (
unsigned int k = 0;
k <
tags.size(); ++
k) {
78 std::vector<std::pair<double, double>> wxy =
80 std::vector<double> xM, yM;
81 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
82 xM.emplace_back(wxy[
i].
first);
85 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
86 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
90 ns.addSolidNS(ns.prepend(mother), solid);
92 ns.addVolumeNS(glogM);
94 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of " << material
99 <<
" orientation " << orientations[
k] <<
" and " << xM.size() <<
" edges";
100 for (
unsigned int j = 0;
j < xM.size(); ++
j)
107 std::vector<double> xL, yL;
108 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
109 xL.emplace_back(wxy[
i].
first);
110 yL.emplace_back(wxy[
i].
second);
112 std::vector<dd4hep::Volume> glogs(materials.size());
113 std::vector<int> copyNumber(materials.size(), 1);
114 double zi(-0.5 * thick), thickTot(0.0);
115 for (
unsigned int l = 0;
l <
layers.size();
l++) {
118 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP:Layer " <<
l <<
":" <<
i <<
" T " << layerThick[
i] <<
" Copy " 121 if (copyNumber[
i] == 1) {
122 if (layerType[
i] > 0) {
126 zw[0] = -0.5 * layerThick[
i];
127 zw[1] = 0.5 * layerThick[
i];
131 ns.addSolidNS(ns.prepend(lname), solid);
132 matter = ns.material(materials[
i]);
134 ns.addVolumeNS(glogs[
i]);
136 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of " 141 << partialTypes[
k] <<
" orientation " << orientations[
k] <<
" and " << xM.size()
143 for (
unsigned int j = 0;
j < xL.size(); ++
j)
147 if (layerType[
i] > 0) {
149 zw[0] = -0.5 * senseT;
150 zw[1] = 0.5 * senseT;
152 ns.addSolidNS(ns.prepend(sname), solid);
154 ns.addVolumeNS(glog);
156 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of " 161 << partialTypes[
k] <<
" orientation " << orientations[
k] <<
" and " << xL.size()
163 for (
unsigned int j = 0;
j < xL.size(); ++
j)
168 int copy = 10 + senseType;
169 glogs[
i].placeVolume(glog,
copy, tran);
171 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glog.name() <<
" number " <<
copy <<
" positioned in " 173 <<
") with no rotation";
177 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
179 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glogs[
i].name() <<
" number " << copyNumber[
i]
180 <<
" positioned in " << glogM.name() <<
" at (0,0," 185 thickTot += layerThick[
i];
187 if (
std::abs(thickTot - thick) >= tol) {
188 if (thickTot > thick) {
190 <<
cms::convert2mm(thickTot) <<
": thickness of all its components **** ERROR ****";
193 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
Log< level::Error, false > LogError
static std::vector< std::pair< double, double > > waferXY(const int &part, const int &orient, const int &zside, const double &waferSize, const double &offset, const double &xpos, const double &ypos, const bool &v17)
U second(std::pair< T, U > const &p)
static constexpr long s_executed
Abs< T >::type abs(const T &t)
int32_t waferThick(const int32_t property)
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Log< level::Warning, false > LogWarning