20 static constexpr double tol2 = 0.00001 * dd4hep::mm;
22 const auto& wafers =
args.value<std::vector<std::string> >(
"WaferName");
23 const auto& covers =
args.value<std::vector<std::string> >(
"CoverName");
25 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << wafers.size() <<
" wafers";
27 for (
auto wafer : wafers) {
31 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << covers.size() <<
" covers";
33 for (
auto cover : covers) {
38 const auto& materials =
args.value<std::vector<std::string> >(
"MaterialNames");
39 const auto&
names =
args.value<std::vector<std::string> >(
"VolumeNames");
40 const auto& thick =
args.value<std::vector<double> >(
"Thickness");
41 std::vector<int> copyNumber;
42 copyNumber.resize(materials.size(), 1);
44 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << materials.size() <<
" types of volumes";
45 for (
unsigned int i = 0;
i <
names.size(); ++
i)
48 <<
" first copy number " << copyNumber[
i];
50 const auto&
layers =
args.value<std::vector<int> >(
"Layers");
51 const auto& layerThick =
args.value<std::vector<double> >(
"LayerThick");
54 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
58 const auto& layerType =
args.value<std::vector<int> >(
"LayerType");
59 const auto& layerSense =
args.value<std::vector<int> >(
"LayerSense");
61 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << layerType.size() <<
" layers";
62 for (
unsigned int i = 0;
i < layerType.size(); ++
i)
63 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType[
i] <<
" sensitive class " 66 const auto& zMinBlock =
args.value<
double>(
"zMinBlock");
67 const auto& rMaxFine =
args.value<
double>(
"rMaxFine");
68 const auto& waferW =
args.value<
double>(
"waferW");
69 const auto& waferGap =
args.value<
double>(
"waferGap");
70 const auto& absorbW =
args.value<
double>(
"absorberW");
71 const auto& absorbH =
args.value<
double>(
"absorberH");
75 <<
" gap among wafers " <<
cms::convert2mm(waferGap) <<
" absorber width " 78 const auto& slopeB =
args.value<std::vector<double> >(
"SlopeBottom");
79 const auto& slopeT =
args.value<std::vector<double> >(
"SlopeTop");
80 const auto& zFront =
args.value<std::vector<double> >(
"ZFront");
81 const auto& rMaxFront =
args.value<std::vector<double> >(
"RMaxFront");
83 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: Bottom slopes " << slopeB[0] <<
":" << slopeB[1] <<
" and " 84 << slopeT.size() <<
" slopes for top";
85 for (
unsigned int i = 0;
i < slopeT.size(); ++
i)
92 std::unordered_set<int> copies;
102 double zi(zMinBlock);
103 double ww = (waferW + waferGap);
104 double dx = 0.5 *
ww;
105 double dy = 3.0 *
dx *
tan(30._deg);
106 double rr = 2.0 *
dx *
tan(30._deg);
108 for (
unsigned int i = 0;
i <
layers.size();
i++) {
109 double zo = zi + layerThick[
i];
111 int laymax = laymin +
layers[
i];
114 for (
int ly = laymin; ly < laymax; ++ly) {
115 int ii = layerType[ly];
116 int copy = copyNumber[
ii];
117 double rinB = (layerSense[ly] == 0) ? (zo * slopeB[0]) : (zo * slopeB[1]);
118 zz += (0.5 * thick[
ii]);
119 thickTot += thick[
ii];
131 if (layerSense[ly] == 0) {
132 dd4hep::Solid solid = dd4hep::Box(absorbW, absorbH, 0.5 * thick[
ii]);
133 ns.addSolidNS(ns.prepend(
name), solid);
136 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule test: " << solid.name() <<
" box of dimension " 141 dd4hep::Solid solid = dd4hep::Tube(rinB, routF, 0.5 * thick[
ii], 0.0, 2._pi);
142 ns.addSolidNS(ns.prepend(
name), solid);
145 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalTBModule: " << solid.name() <<
" Tubs made of " << materials[
ii]
149 int ncol =
static_cast<int>(2.0 * routF /
ww) + 1;
150 int nrow =
static_cast<int>(routF / (
ww *
tan(30._deg))) + 1;
152 int incm(0), inrm(0), kount(0),
ntot(0), nin(0), nfine(0), ncoarse(0);
154 <<
" Column " << ncol;
157 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
158 int inr = (
nr >= 0) ?
nr : -
nr;
159 for (
int nc = -ncol; nc <= ncol; ++nc) {
160 int inc = (nc >= 0) ? nc : -nc;
161 if (inr % 2 == inc % 2) {
162 double xpos = nc *
dx;
163 double ypos =
nr *
dy;
165 yc[0] = ypos - 0.5 *
rr;
167 yc[1] = ypos + 0.5 *
rr;
171 yc[3] = ypos + 0.5 *
rr;
173 yc[4] = ypos - 0.5 *
rr;
176 bool cornerAll(
true);
177 for (
int k = 0;
k < 6; ++
k) {
179 if (rpos < rinB || rpos > routF)
187 if (layerSense[ly] == 1) {
188 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
189 glog1 = (rpos < rMaxFine) ? ns.volume(wafers[0]) : ns.volume(wafers[1]);
198 glog1 = ns.volume(covers[layerSense[ly] - 2]);
210 glog.placeVolume(glog1, copyL, tran);
213 <<
"DDHGCalModule: " << glog1.name() <<
" number " << copyL <<
" positioned in " << glog.name()
221 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalModule: # of columns " << incm <<
" # of rows " << inrm <<
" and " 222 << nin <<
":" << kount <<
":" <<
ntot <<
" wafers (" << nfine <<
":" << ncoarse
234 zz += (0.5 * thick[
ii]);
238 if (fabs(thickTot - layerThick[
i]) > tol2) {
239 if (thickTot > layerThick[
i]) {
242 <<
" of all its components **** ERROR ****\n";
245 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components\n";
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
Log< level::Error, false > LogError
const std::string names[nVars_]
static std::string to_string(const XMLCh *ch)
static constexpr long s_executed
Tan< T >::type tan(const T &t)
static int32_t packTypeUV(int type, int u, int v)
Log< level::Warning, false > LogWarning