8 #include "DD4hep/DetFactoryHelper.h"
16 using namespace angle_units::operators;
21 static constexpr
double tol = 0.00001 * dd4hep::mm;
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)
33 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names[
i] <<
" of thickness "
35 <<
" first copy number " << copyNumber[
i];
37 const auto&
layers = args.
value<std::vector<int> >(
"Layers");
38 const auto& layerThick = args.
value<std::vector<double> >(
"LayerThick");
39 const auto& layerType = args.
value<std::vector<int> >(
"LayerType");
40 const auto& layerSense = args.
value<std::vector<int> >(
"LayerSense");
43 for (
unsigned int i = 0; i <
layers.size(); ++
i)
46 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << layerType.size() <<
" layers";
47 for (
unsigned int i = 0; i < layerType.size(); ++
i)
48 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" << i <<
"] with material type " << layerType[
i] <<
" sensitive class "
51 const auto& widths = args.
value<std::vector<double> >(
"Widths");
52 const auto& heights = args.
value<std::vector<double> >(
"Heights");
53 const auto& tileN = args.
value<std::vector<int> >(
"TileN");
54 const auto& tileStep = args.
value<std::vector<double> >(
"TileStep");
56 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << widths.size() <<
" sizes for width "
58 for (
unsigned int i = 0; i < widths.size(); ++
i)
61 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << tileN.size() <<
" tile positioning parameters";
62 for (
unsigned int i = 0; i < tileN.size(); ++
i)
65 const auto& zMinBlock = args.
value<
double>(
"zMinBlock");
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 "
93 dd4hep::Material matter = ns.
material(materials[ii]);
95 if (layerSense[ly] == 0) {
96 dd4hep::Solid solid = dd4hep::Box(0.5 * widths[0], 0.5 * heights[0], 0.5 * thick[ii]);
100 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << solid.name() <<
" Box made of " << materials[
ii]
105 dd4hep::Solid solid = dd4hep::Box(0.5 * widths[1], 0.5 * heights[1], 0.5 * thick[ii]);
109 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << solid.name() <<
" Box made of " << materials[
ii]
113 int ncol = tileN[0] / 2;
114 int nrow = tileN[1] / 2;
117 edm::LogVerbatim(
"HGCalGeom") << glog.name() <<
" Row " << nrow <<
" Column " << ncol;
119 for (
int nr = -nrow; nr <= nrow; ++nr) {
120 int inr = (nr >= 0) ? nr : -nr;
121 double ypos = (nr >= 0) ? (inr - 0.5) * tileStep[1] : -(inr - 0.5) * tileStep[1];
122 for (
int nc = -ncol; nc <= ncol; ++nc) {
123 int inc = (nc >= 0) ? nc : -nc;
124 double xpos = (nc >= 0) ? (inc - 0.5) * tileStep[0] : -(inc - 0.5) * tileStep[0];
125 if (nr != 0 && nc != 0) {
134 glog.placeVolume(glog1, copy, dd4hep::Transform3D(rotation, tran));
138 <<
"DDAHcalModuleAlgo: " << tile <<
" number " << copy <<
" positioned in " << glog.name() <<
" at ("
145 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << kount <<
" tiles for " << glog.name();
149 module.placeVolume(glog, copy, r1);
152 edm::LogVerbatim(
"HGCalGeom") <<
"DDAHcalModuleAlgo: " << glog.name() <<
" number " << copy <<
" positioned in "
153 << module.name() <<
" at (0,0," <<
cms::convert2mm(zz) <<
") with no rotation";
155 zz += (0.5 * thick[
ii]);
159 if (fabs(thickTot - layerThick[i]) > tol) {
160 if (thickTot > layerThick[i]) {
163 <<
" of all its components **** ERROR ****\n";
166 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components\n";
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
Log< level::Info, true > LogVerbatim
static constexpr int kSignRowColumn_
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
constexpr NumType convert2mm(NumType length)
T value(const std::string &name) const
std::string to_string(const V &value)
Log< level::Error, false > LogError
const std::string names[nVars_]
std::string_view name() const
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
dd4hep::Material material(const std::string &name) const
std::string prepend(const std::string &) const
static constexpr int kRowColumn_
Log< level::Warning, false > LogWarning
static constexpr int kColumn_
Constants used.
std::string parentName() const
Access value of rParent child node.