27 const auto& thick =
args.value<
double>(
"ModuleThickness");
28 const auto& waferSize =
args.value<
double>(
"WaferSize");
32 const auto& waferSepar =
args.value<
double>(
"SensorSeparation");
33 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: Module " << parentName <<
" made of " << material
38 const auto&
tags =
args.value<std::vector<std::string>>(
"Tags");
39 const auto& partialTypes =
args.value<std::vector<int>>(
"PartialTypes");
40 const auto& placementIndex =
args.value<std::vector<int>>(
"PlacementIndex");
41 const auto& placementIndexTags =
args.value<std::vector<std::string>>(
"PlacementIndexTags");
43 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " <<
tags.size() <<
" variations of wafer types";
44 for (
unsigned int k = 0;
k <
tags.size(); ++
k) {
45 for (
unsigned int m = 0;
m < placementIndex.size(); ++
m) {
47 <<
" Placement Index " << placementIndex[
m] <<
" Tag " << placementIndexTags[
m];
51 const auto& layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
52 const auto& materials =
args.value<std::vector<std::string>>(
"LayerMaterials");
53 const auto& layerThick =
args.value<std::vector<double>>(
"LayerThickness");
54 const auto& layerType =
args.value<std::vector<int>>(
"LayerTypes");
56 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " << layerNames.size() <<
" types of volumes";
57 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
58 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " 62 const auto&
layers =
args.value<std::vector<int>>(
"Layers");
64 std::ostringstream st1;
65 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
66 st1 <<
" [" <<
i <<
"] " <<
layers[
i];
70 const auto& senseT =
args.value<
double>(
"SenseThick");
71 const auto& senseType =
args.value<
int>(
"SenseType");
73 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: NameSpace " << ns.name() <<
" Sensitive Layer Name " 74 << senseName <<
" Thickness " << senseT <<
" Type " << senseType;
77 static constexpr
double tol = 0.00001 * dd4hep::mm;
78 static const double sqrt3 =
std::sqrt(3.0);
79 double r = 0.5 * waferSize;
80 double R = 2.0 *
r / sqrt3;
83 for (
unsigned int k = 0;
k <
tags.size(); ++
k) {
84 for (
unsigned int m = 0;
m < placementIndex.size(); ++
m) {
87 std::vector<std::pair<double, double>> wxy =
89 std::vector<double> xM, yM;
90 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
91 xM.emplace_back(wxy[
i].
first);
94 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
95 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
99 ns.addSolidNS(ns.prepend(mother), solid);
101 ns.addVolumeNS(glogM);
103 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " << solid.name() <<
" extruded polygon made of " 108 <<
" placement index " << placementIndex[
m] <<
" and " << xM.size() <<
" edges";
109 for (
unsigned int j = 0;
j < xM.size(); ++
j)
116 std::vector<double> xL, yL;
117 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
118 xL.emplace_back(wxy[
i].
first);
119 yL.emplace_back(wxy[
i].
second);
121 std::vector<dd4hep::Volume> glogs(materials.size());
122 std::vector<int> copyNumber(materials.size(), 1);
123 double zi(-0.5 * thick), thickTot(0.0);
124 for (
unsigned int l = 0;
l <
layers.size();
l++) {
126 if (copyNumber[
i] == 1) {
127 if (layerType[
i] > 0) {
131 zw[0] = -0.5 * layerThick[
i];
132 zw[1] = 0.5 * layerThick[
i];
136 ns.addSolidNS(ns.prepend(lname), solid);
137 matter = ns.material(materials[
i]);
139 ns.addVolumeNS(glogs[
i]);
141 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " << solid.name()
142 <<
" extruded polygon made of " << materials[
i] <<
" z|x|y|s (0) " 146 <<
" placement index " << placementIndex[
m] <<
cms::convert2mm(zx[1]) <<
":" 149 for (
unsigned int j = 0;
j < xL.size(); ++
j)
154 if (layerType[
i] > 0) {
156 zw[0] = -0.5 * senseT;
157 zw[1] = 0.5 * senseT;
159 ns.addSolidNS(ns.prepend(sname), solid);
161 ns.addVolumeNS(glog);
163 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " << solid.name()
164 <<
" extruded polygon made of " << materials[
i] <<
" z|x|y|s (0) " 169 <<
" placement index " << placementIndex[
m] <<
" and " << xL.size() <<
" edges";
170 for (
unsigned int j = 0;
j < xL.size(); ++
j)
175 double zpos = (posSense.second > 0) ? -0.5 * (
waferThick - senseT) : 0.5 * (
waferThick - senseT);
177 int copy = 10 + senseType;
178 glogs[
i].placeVolume(glog,
copy, tran);
180 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " << glog.name() <<
" number " <<
copy 181 <<
" positioned in " << glogs[
i].name() <<
" at (0, 0," <<
cms::convert2mm(zpos)
182 <<
") with no rotation";
186 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
188 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferPartialRotated: " << glogs[
i].name() <<
" number " 189 << copyNumber[
i] <<
" positioned in " << glogM.name() <<
" at (0,0," 194 thickTot += layerThick[
i];
196 if (
std::abs(thickTot - thick) >= tol) {
197 if (thickTot > thick) {
200 <<
": thickness of all its components **** ERROR ****";
203 <<
" 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 std::pair< int32_t, int32_t > cellOrient(int32_t placementIndex)
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