28 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassivePartial: Creating an instance";
32 double thick =
args.value<
double>(
"ModuleThickness");
33 double waferSize =
args.value<
double>(
"WaferSize");
34 double waferSepar =
args.value<
double>(
"SensorSeparation");
36 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassivePartial: Module " << parentName <<
" made of " << material <<
" T " 40 std::vector<std::string>
tags =
args.value<std::vector<std::string>>(
"Tags");
41 std::vector<int> partialTypes =
args.value<std::vector<int>>(
"PartialTypes");
42 std::vector<int> placementIndex =
args.value<std::vector<int>>(
"PlacementIndex");
43 std::vector<std::string> placementIndexTags =
args.value<std::vector<std::string>>(
"PlacementIndexTags");
45 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassivePartial: " <<
tags.size() <<
" variations of wafer types";
46 for (
unsigned int k = 0;
k <
tags.size(); ++
k) {
47 for (
unsigned int m = 0;
m < placementIndex.size(); ++
m) {
49 <<
" Placement Index " << placementIndex[
m] <<
" Tag " << placementIndexTags[
m];
53 std::vector<std::string> layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
54 std::vector<std::string> materials =
args.value<std::vector<std::string>>(
"LayerMaterials");
55 std::vector<double> layerThick =
args.value<std::vector<double>>(
"LayerThickness");
57 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassivePartial: " << layerNames.size() <<
" types of volumes";
58 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
59 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " 62 std::vector<int> layerType =
args.value<std::vector<int>>(
"LayerType");
64 std::ostringstream st1;
65 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
66 st1 <<
" [" <<
i <<
"] " << layerType[
i];
67 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType.size() <<
" blocks" << st1.str();
72 static constexpr
double tol = 0.00001;
75 for (
unsigned int k = 0;
k <
tags.size(); ++
k) {
76 for (
unsigned int m = 0;
m < placementIndex.size(); ++
m) {
79 std::vector<std::pair<double, double>> wxy =
81 std::vector<double> xM, yM;
82 for (
unsigned int i = 0;
i < (wxy.size() - 1); ++
i) {
83 xM.emplace_back(wxy[
i].
first);
86 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
87 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
89 ns.addSolidNS(ns.prepend(mother), solid);
92 ns.addVolumeNS(glogM);
94 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassivePartial: " << solid.name() <<
" extruded polygon made of " 100 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
106 std::vector<dd4hep::Volume> glogs(materials.size());
107 std::vector<int> copyNumber;
108 copyNumber.resize(materials.size(), 1);
109 double zi(-0.5 * thick), thickTot(0.0);
110 for (
unsigned int l = 0;
l < layerType.size();
l++) {
111 unsigned int i = layerType[
l];
112 if (copyNumber[
i] == 1) {
113 zw[0] = -0.5 * layerThick[
i];
114 zw[1] = 0.5 * layerThick[
i];
117 ns.addSolidNS(ns.prepend(layerName), solid);
118 matter = ns.material(materials[
i]);
120 ns.addVolumeNS(glogs[
i]);
123 <<
"DDHGCalPassivePartial: Layer " <<
i <<
":" <<
l <<
":" << solid.name()
124 <<
" extruded polygon made of " << matter.name() <<
" z|x|y|s (0) " <<
cms::convert2mm(
zw[0]) <<
":" 127 <<
scale[1] <<
" and " << xM.size() <<
" edges";
128 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
134 glogM.placeVolume(glogs[
i], copyNumber[
i], tran);
136 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalPassivePartial: " << glogs[
i].name() <<
" number " << copyNumber[
i]
137 <<
" positioned in " << glogM.name() <<
" at (0, 0, " 142 thickTot += layerThick[
i];
144 if ((
std::abs(thickTot - thick) >= tol) && (!layerType.empty())) {
145 if (thickTot > thick) {
146 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
147 <<
": thickness of all its components **** ERROR ****";
149 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " 150 << 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(int part, int orient, int zside, double waferSize, double offset, double xpos, double ypos)
U second(std::pair< T, U > const &p)
Abs< T >::type abs(const T &t)
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Log< level::Warning, false > LogWarning