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;
73 static const double sqrt3 =
std::sqrt(3.0);
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);
93 ns.addSolidNS(ns.prepend(mother), solid);
95 ns.addVolumeNS(glogM);
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++) {
121 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP:Layer " <<
l <<
":" <<
i <<
" T " << layerThick[
i] <<
" Copy " 124 if (copyNumber[
i] == 1) {
125 if (layerType[
i] > 0) {
129 zw[0] = -0.5 * layerThick[
i];
130 zw[1] = 0.5 * layerThick[
i];
134 ns.addSolidNS(ns.prepend(lname), solid);
135 matter = ns.material(materials[
i]);
137 ns.addVolumeNS(glogs[
i]);
139 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of " 144 << partialTypes[
k] <<
" orientation " << orientations[
k] <<
" and " << xM.size()
146 for (
unsigned int j = 0;
j < xL.size(); ++
j)
150 if (layerType[
i] > 0) {
152 zw[0] = -0.5 * senseT;
153 zw[1] = 0.5 * senseT;
155 ns.addSolidNS(ns.prepend(sname), solid);
157 ns.addVolumeNS(glog);
159 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of " 164 << partialTypes[
k] <<
" orientation " << orientations[
k] <<
" and " << xL.size()
166 for (
unsigned int j = 0;
j < xL.size(); ++
j)
171 int copy = 10 + senseType;
172 glogs[
i].placeVolume(glog,
copy, tran);
174 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glog.name() <<
" number " <<
copy <<
" positioned in " 176 <<
") with no rotation";
180 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
182 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glogs[
i].name() <<
" number " << copyNumber[
i]
183 <<
" positioned in " << glogM.name() <<
" at (0,0," 188 thickTot += layerThick[
i];
190 if (
std::abs(thickTot - thick) >= tol) {
191 if (thickTot > thick) {
193 <<
cms::convert2mm(thickTot) <<
": thickness of all its components **** ERROR ****";
196 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
Log< level::Info, true > LogVerbatim
static std::vector< std::pair< double, double > > waferXY(int part, int orient, int zside, double delX, double delY, double xpos, double ypos)
constexpr NumType convert2mm(NumType length)
Log< level::Error, false > LogError
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