9 #include "DD4hep/DetFactoryHelper.h"
21 dd4hep::SensitiveDetector& ) {
26 const auto& materials =
args.value<std::vector<std::string> >(
"MaterialNames");
27 const auto&
names =
args.value<std::vector<std::string> >(
"VolumeNames");
28 const auto& thick =
args.value<std::vector<double> >(
"Thickness");
29 std::vector<int> copyNumber;
30 for (
unsigned int i = 0;
i < materials.size(); ++
i)
31 copyNumber.emplace_back(1);
34 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << materials.size() <<
" types of volumes";
35 for (
unsigned int i = 0;
i <
names.size(); ++
i)
37 <<
" filled with " << materials[
i] <<
" first copy number " << copyNumber[
i];
39 const auto&
layers =
args.value<std::vector<int> >(
"Layers");
40 const auto& layerThick =
args.value<std::vector<double> >(
"LayerThick");
41 const auto& layerType =
args.value<std::vector<int> >(
"LayerType");
42 const auto& layerSense =
args.value<std::vector<int> >(
"LayerSense");
45 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
48 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << layerType.size() <<
" layers";
49 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
50 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType[
i] <<
" sensitive class "
53 const auto& widths =
args.value<std::vector<double> >(
"Widths");
54 const auto& heights =
args.value<std::vector<double> >(
"Heights");
55 const auto& tileN =
args.value<std::vector<int> >(
"TileN");
56 const auto& tileStep =
args.value<std::vector<double> >(
"TileStep");
58 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << widths.size() <<
" sizes for width "
60 for (
unsigned int i = 0;
i < widths.size(); ++
i)
62 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << tileN.size() <<
" tile positioning parameters";
63 for (
unsigned int i = 0;
i < tileN.size(); ++
i)
66 const auto& zMinBlock =
args.value<
double>(
"zMinBlock");
68 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: zStart " << zMinBlock <<
" NameSpace " << ns.
name();
76 for (
unsigned int i = 0;
i <
layers.size();
i++) {
77 double zo = zi + layerThick[
i];
78 int laymax = laymin +
layers[
i];
81 for (
int ly = laymin; ly < laymax; ++ly) {
82 int ii = layerType[ly];
84 zz += (0.5 * thick[
ii]);
85 thickTot += thick[
ii];
89 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo test: Layer " << ly <<
":" <<
ii <<
" Front " << zi
90 <<
" Back " << zo <<
" superlayer thickness " << layerThick[
i];
94 if (layerSense[ly] == 0) {
95 dd4hep::Solid solid = dd4hep::Box(0.5 * widths[0], 0.5 * heights[0], 0.5 * thick[
ii]);
99 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << solid.name() <<
" Box made of " << materials[
ii]
100 <<
" of dimensions " << 0.5 * widths[0] <<
", " << 0.5 * heights[0] <<
", "
104 dd4hep::Solid solid = dd4hep::Box(0.5 * widths[1], 0.5 * heights[1], 0.5 * thick[
ii]);
108 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << solid.name() <<
" Box made of " << materials[
ii]
109 <<
" of dimensions " << 0.5 * widths[1] <<
", " << 0.5 * heights[1] <<
", "
112 int ncol = tileN[0] / 2;
113 int nrow = tileN[1] / 2;
116 edm::LogVerbatim(
"HGCalGeom") << glog.name() <<
" Row " << nrow <<
" Column " << ncol;
118 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
119 int inr = (
nr >= 0) ?
nr : -
nr;
120 double ypos = (
nr >= 0) ? (inr - 0.5) * tileStep[1] : -(inr - 0.5) * tileStep[1];
121 for (
int nc = -ncol; nc <= ncol; ++nc) {
122 int inc = (nc >= 0) ? nc : -nc;
123 double xpos = (nc >= 0) ? (inc - 0.5) * tileStep[0] : -(inc - 0.5) * tileStep[0];
124 if (
nr != 0 && nc != 0) {
133 glog.placeVolume(glog1,
copy, dd4hep::Transform3D(
rotation, tran));
136 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << tile <<
" number " <<
copy <<
" positioned in "
137 << glog.name() <<
" at " << tran <<
" with " <<
rotation;
143 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << kount <<
" tiles for " << glog.name();
147 dd4hep::Rotation3D
rot;
151 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << glog.name() <<
" number " <<
copy <<
" positioned in "
152 <<
module.name() <<
" at " <<
r1 <<
" with " <<
rot;
154 zz += (0.5 * thick[
ii]);
158 if (fabs(thickTot - layerThick[
i]) < 0.00001) {
159 }
else if (thickTot > layerThick[
i]) {
160 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" is smaller than thickness "
161 << thickTot <<
" of all its components **** ERROR ****\n";
162 }
else if (thickTot < layerThick[
i]) {
163 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick[
i] <<
" does not match with "
164 << thickTot <<
" of the components\n";