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);
91 dd4hep::Material matter = ns.material(material);
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++) {
120 if (copyNumber[i] == 1) {
121 if (layerType[i] > 0) {
125 zw[0] = -0.5 * layerThick[
i];
126 zw[1] = 0.5 * layerThick[
i];
130 ns.addSolidNS(ns.prepend(lname), solid);
131 matter = ns.material(materials[i]);
133 ns.addVolumeNS(glogs[i]);
135 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of "
138 <<
" z|x|y|s (1) " <<
cms::convert2mm(zw[1]) <<
": partial " << partialTypes[
k]
141 for (
unsigned int j = 0;
j < xL.size(); ++
j)
145 if (layerType[i] > 0) {
147 zw[0] = -0.5 * senseT;
148 zw[1] = 0.5 * senseT;
150 ns.addSolidNS(ns.prepend(sname), solid);
152 ns.addVolumeNS(glog);
154 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << solid.name() <<
" extruded polygon made of "
159 << partialTypes[
k] <<
" orientation " << orientations[
k] <<
" and " << xL.size()
161 for (
unsigned int j = 0;
j < xL.size(); ++
j)
164 double zpos = (posSense == 0) ? -0.5 * (waferThick - senseT) : 0.5 * (waferThick - senseT);
166 int copy = 10 + senseType;
167 glogs[
i].placeVolume(glog, copy, tran);
169 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glog.name() <<
" number " << copy <<
" positioned in "
171 <<
") with no rotation";
175 glogM.placeVolume(glogs[i], copyNumber[i], tran0);
177 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferP: " << glogs[
i].name() <<
" number " << copyNumber[
i]
178 <<
" positioned in " << glogM.name() <<
" at (0,0,"
183 thickTot += layerThick[
i];
185 if (
std::abs(thickTot - thick) >= tol) {
186 if (thickTot > thick) {
188 <<
cms::convert2mm(thickTot) <<
": thickness of all its components **** ERROR ****";
191 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
Log< level::Info, true > LogVerbatim
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
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