9 #include "DD4hep/DetFactoryHelper.h"
21 static constexpr
double tol = 0.00001;
24 const auto& materials =
args.value<std::vector<std::string> >(
"MaterialNames");
25 const auto&
names =
args.value<std::vector<std::string> >(
"VolumeNames");
26 const auto& thick =
args.value<std::vector<double> >(
"Thickness");
27 std::vector<int> copyNumber;
28 copyNumber.resize(materials.size(), 1);
31 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << materials.size() <<
" types of volumes";
32 for (
unsigned int i = 0;
i <
names.size(); ++
i)
34 <<
" filled with " << materials[
i] <<
" first copy number " << copyNumber[
i];
36 const auto&
layers =
args.value<std::vector<int> >(
"Layers");
37 const auto& layerThick =
args.value<std::vector<double> >(
"LayerThick");
38 const auto& layerType =
args.value<std::vector<int> >(
"LayerType");
39 const auto& layerSense =
args.value<std::vector<int> >(
"LayerSense");
42 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
45 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << layerType.size() <<
" layers";
46 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
47 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType[
i] <<
" sensitive class "
50 const auto& widths =
args.value<std::vector<double> >(
"Widths");
51 const auto& heights =
args.value<std::vector<double> >(
"Heights");
52 const auto& tileN =
args.value<std::vector<int> >(
"TileN");
53 const auto& tileStep =
args.value<std::vector<double> >(
"TileStep");
55 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << widths.size() <<
" sizes for width "
57 for (
unsigned int i = 0;
i < widths.size(); ++
i)
59 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << tileN.size() <<
" tile positioning parameters";
60 for (
unsigned int i = 0;
i < tileN.size(); ++
i)
63 const auto& zMinBlock =
args.value<
double>(
"zMinBlock");
65 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: zStart " << zMinBlock <<
" NameSpace " << ns.
name();
73 for (
unsigned int i = 0;
i <
layers.size();
i++) {
74 double zo = zi + layerThick[
i];
75 int laymax = laymin +
layers[
i];
78 for (
int ly = laymin; ly < laymax; ++ly) {
79 int ii = layerType[ly];
81 zz += (0.5 * thick[
ii]);
82 thickTot += thick[
ii];
86 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo test: Layer " << ly <<
":" <<
ii <<
" Front " << zi
87 <<
" Back " << zo <<
" superlayer thickness " << layerThick[
i];
91 if (layerSense[ly] == 0) {
92 dd4hep::Solid solid = dd4hep::Box(0.5 * widths[0], 0.5 * heights[0], 0.5 * thick[
ii]);
96 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << solid.name() <<
" Box made of " << materials[
ii]
97 <<
" of dimensions " << 0.5 * widths[0] <<
", " << 0.5 * heights[0] <<
", "
101 dd4hep::Solid solid = dd4hep::Box(0.5 * widths[1], 0.5 * heights[1], 0.5 * thick[
ii]);
105 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << solid.name() <<
" Box made of " << materials[
ii]
106 <<
" of dimensions " << 0.5 * widths[1] <<
", " << 0.5 * heights[1] <<
", "
109 int ncol = tileN[0] / 2;
110 int nrow = tileN[1] / 2;
113 edm::LogVerbatim(
"HGCalGeom") << glog.name() <<
" Row " << nrow <<
" Column " << ncol;
115 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
116 int inr = (
nr >= 0) ?
nr : -
nr;
117 double ypos = (
nr >= 0) ? (inr - 0.5) * tileStep[1] : -(inr - 0.5) * tileStep[1];
118 for (
int nc = -ncol; nc <= ncol; ++nc) {
119 int inc = (nc >= 0) ? nc : -nc;
120 double xpos = (nc >= 0) ? (inc - 0.5) * tileStep[0] : -(inc - 0.5) * tileStep[0];
121 if (
nr != 0 && nc != 0) {
130 glog.placeVolume(glog1,
copy, dd4hep::Transform3D(
rotation, tran));
133 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << tile <<
" number " <<
copy <<
" positioned in "
134 << glog.name() <<
" at " << tran <<
" with " <<
rotation;
140 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << kount <<
" tiles for " << glog.name();
144 module.placeVolume(glog,
copy,
r1);
147 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << glog.name() <<
" number " <<
copy <<
" positioned in "
148 << module.name() <<
" at " <<
r1 <<
" with no rotation";
150 zz += (0.5 * thick[
ii]);
154 if (fabs(thickTot - layerThick[
i]) > tol) {
155 if (thickTot > layerThick[
i]) {
156 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" is smaller than thickness "
157 << thickTot <<
" of all its components **** ERROR ****\n";
159 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" does not match with "
160 << thickTot <<
" of the components\n";