1 #include "DD4hep/DetFactoryHelper.h" 13 double waferSize =
args.value<
double>(
"WaferSize");
14 double waferSeparation =
args.value<
double>(
"WaferSeparation");
15 int addWaferSeparation =
args.value<
int>(
"AddWaferSeparation");
16 double waferT =
args.value<
double>(
"WaferThick");
17 double cellT =
args.value<
double>(
"CellThick");
19 int posSens =
args.value<
int>(
"PosSensitive");
23 std::vector<std::string> truncCN =
24 args.value<std::vector<std::string> >(
"TruncatedCell");
25 std::vector<std::string> truncSensN =
26 args.value<std::vector<std::string> >(
"TruncatedSensitive");
27 std::vector<std::string> extenCN =
args.value<std::vector<std::string> >(
"ExtendedCell");
28 std::vector<std::string> extenSensN =
29 args.value<std::vector<std::string> >(
"ExtendedSensitive");
30 std::vector<std::string> cornrCN =
args.value<std::vector<std::string> >(
"CornerCell");
31 std::vector<std::string> cornrSensN =
32 args.value<std::vector<std::string> >(
"CornerSensitive");
34 if ((truncCN.size() != truncSensN.size()) || (extenCN.size() != extenSensN.size()) ||
35 (cornrCN.size() != cornrSensN.size())) {
36 edm::LogError(
"HGCalGeom") <<
"The number of cells & sensitive differ:" 37 <<
" Truncated " << truncCN.size() <<
":" << truncSensN.size() <<
" Extended " 38 << extenCN.size() <<
":" << extenSensN.size() <<
" Corners " << cornrCN.size() <<
":" 40 throw cms::Exception(
"DDException") <<
"The number of cells & sensitive " 41 <<
"differ: Truncated " << truncCN.size() <<
":" << truncSensN.size()
42 <<
" Extended " << extenCN.size() <<
":" << extenSensN.size() <<
" Corners " 43 << cornrCN.size() <<
":" << cornrSensN.size();
45 if ((truncCN.size() < 3) || (extenCN.size() < 3) || (cornrCN.size() < 6)) {
46 edm::LogError(
"HGCalGeom") <<
"DDHGCalCell: The number of cells does not" 47 <<
" match with Standard: Truncated " << truncCN.size() <<
" < 3 Extended " 48 << extenCN.size() <<
" < 3" 49 <<
" Corners " << cornrCN.size() <<
" < 6";
50 throw cms::Exception(
"DDException") <<
"Wrong size of truncated|extended" 51 <<
"|corner cells: " << truncCN.size() <<
":" << extenCN.size() <<
":" 57 <<
nCells <<
" Material " << material <<
"Sensitive Position " << posSens
58 <<
" NameSpace " << ns.
name() <<
" Full Cell: " << fullCN <<
":" << fullSensN
59 <<
" Separation " << waferSeparation <<
":" << addWaferSeparation;
60 for (
unsigned int k = 0;
k < truncCN.size(); ++
k)
61 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Truncated Cell[" <<
k <<
"] " << truncCN[
k] <<
":" << truncSensN[
k];
62 for (
unsigned int k = 0;
k < extenCN.size(); ++
k)
63 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Extended Cell[" <<
k <<
"] " << extenCN[
k] <<
":" << extenSensN[
k];
64 for (
unsigned int k = 0;
k < cornrCN.size(); ++
k)
65 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Corner Cell[" <<
k <<
"] " << cornrCN[
k] <<
":" << cornrSensN[
k];
70 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << material <<
" initialized";
74 static const double sqrt3 =
std::sqrt(3.0);
75 static const double waf2cell = 3.0;
76 static const double cornerfac = 2.5;
78 (addWaferSeparation <= 1) ? waferSize / (waf2cell *
nCells) : (waferSize + waferSeparation) / (waf2cell *
nCells);
79 double r = 0.5 *
R * sqrt3;
81 double dx2 = 0.5 * dx1;
82 double dx3 = cornerfac * dx2;
83 double dx4 = 0.5 * dx2;
84 double dx5 = (addWaferSeparation == 0) ? 0.0 : waferSeparation * 0.5;
85 double dx6 = dx5 * 0.5;
88 double dy2 = 0.5 * dy1;
89 double dy3 = 1.5 * dy1;
90 double dy4 = dx5 * 0.5 * sqrt3;
91 double dy5 = dx5 * 2 / sqrt3;
92 double dy6 = dy5 * 0.5;
93 std::vector<double>
xx = {
94 dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, dx1, dx4, -dx4, -dx1, -dx3, -dx3, -dx1, -dx4, dx4, dx1, dx3};
95 std::vector<double>
yy = {
96 0, dy1, dy1, 0, -dy1, -dy1, dy2, dy1, dy3, dy3, dy1, dy2, -dy2, -dy1, -dy3, -dy3, -dy1, -dy2};
97 std::vector<double> txx = {dx5, dx6, -dx6, -dx5, -dx6, dx6, dx7, 0, -dx7, -dx7, 0, dx7};
98 std::vector<double> tyy = {0, dy4, dy4, 0, -dy4, -dy4, dy6, dy5, dy6, -dy6, -dy5, -dy6};
99 double zpos = (posSens == 0) ? -0.5 * (waferT - cellT) : 0.5 * (waferT - cellT);
103 std::vector<double> xw = {
xx[0],
xx[1],
xx[2],
xx[3],
xx[4],
xx[5]};
104 std::vector<double> yw = {
yy[0],
yy[1],
yy[2],
yy[3],
yy[4],
yy[5]};
105 std::vector<double>
zw = {-0.5 * waferT, 0.5 * waferT};
106 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
112 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
117 for (
unsigned int k = 0;
k < xw.size(); ++
k)
120 std::vector<double> zc = {-0.5 * cellT, 0.5 * cellT};
126 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
131 for (
unsigned int k = 0;
k < xw.size(); ++
k)
135 glog1.placeVolume(glog2, 1, tran);
137 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
141 static constexpr
int ir0[] = {0, 2, 4, 1, 3, 5};
142 static constexpr
int ir1[] = {1, 3, 5, 2, 4, 0};
143 static constexpr
int ir2[] = {2, 4, 0, 3, 5, 1};
144 static constexpr
int ir3[] = {3, 5, 1, 4, 0, 2};
145 static constexpr
int ir4[] = {5, 1, 3, 0, 2, 4};
146 static constexpr
int tr[] = {1, 3, 5, 2, 4, 0};
147 for (
unsigned int i = 0;
i < truncCN.size(); ++
i) {
148 std::vector<double> xw = {
xx[ir0[
i]],
xx[ir1[
i]],
xx[ir2[
i]],
xx[ir3[
i]] + txx[tr[
i]],
xx[ir4[
i]] + txx[tr[
i]]};
149 std::vector<double> yw = {
yy[ir0[
i]],
yy[ir1[
i]],
yy[ir2[
i]],
yy[ir3[
i]] + tyy[tr[
i]],
yy[ir4[
i]] + tyy[tr[
i]]};
156 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
161 for (
unsigned int k = 0;
k < xw.size(); ++
k)
170 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
175 for (
unsigned int k = 0;
k < xw.size(); ++
k)
178 glog1.placeVolume(glog2, 1, tran);
180 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
185 static constexpr
int ie0[] = {1, 3, 5, 0, 2, 4};
186 static constexpr
int ie1[] = {2, 4, 0, 1, 3, 5};
187 static constexpr
int ie2[] = {3, 5, 1, 2, 4, 0};
188 static constexpr
int ie3[] = {14, 6, 10, 12, 16, 8};
189 static constexpr
int ie4[] = {17, 9, 13, 15, 7, 11};
190 static constexpr
int te[] = {2, 4, 0, 1, 3, 5};
191 for (
unsigned int i = 0;
i < extenCN.size(); ++
i) {
192 std::vector<double> xw = {
xx[ie0[
i]],
xx[ie1[
i]],
xx[ie2[
i]],
xx[ie3[
i]] + txx[te[
i]],
xx[ie4[
i]] + txx[te[
i]]};
193 std::vector<double> yw = {
yy[ie0[
i]],
yy[ie1[
i]],
yy[ie2[
i]],
yy[ie3[
i]] + tyy[te[
i]],
yy[ie4[
i]] + tyy[te[
i]]};
199 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
204 for (
unsigned int k = 0;
k < xw.size(); ++
k)
212 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
217 for (
unsigned int k = 0;
k < xw.size(); ++
k)
220 glog1.placeVolume(glog2, 1, tran);
222 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
227 static constexpr
int ic0[] = {0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5};
228 static constexpr
int ic1[] = {1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0};
229 static constexpr
int ic2[] = {10, 3, 14, 5, 6, 1, 2, 12, 4, 16, 0, 8};
230 static constexpr
int ic3[] = {3, 5, 5, 1, 1, 3, 4, 4, 0, 0, 2, 2};
231 static constexpr
int ic4[] = {5, 17, 1, 9, 3, 13, 15, 0, 7, 2, 11, 4};
232 static constexpr
int tc[] = {0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5};
233 for (
unsigned int i = 0;
i < cornrCN.size(); ++
i) {
234 std::vector<double> xw = {
235 xx[ic0[
i]],
xx[ic1[
i]],
xx[ic2[
i]] + txx[tc[
i]],
xx[ic3[
i]] + txx[tc[
i] + 6],
xx[ic4[
i]] + txx[(tc[
i] + 1) % 6]};
236 std::vector<double> yw = {
237 yy[ic0[
i]],
yy[ic1[
i]],
yy[ic2[
i]] + tyy[tc[
i]],
yy[ic3[
i]] + tyy[tc[
i] + 6],
yy[ic4[
i]] + tyy[(tc[
i] + 1) % 6]};
243 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
248 for (
unsigned int k = 0;
k < xw.size(); ++
k)
256 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
261 for (
unsigned int k = 0;
k < xw.size(); ++
k)
264 glog1.placeVolume(glog2, 1, tran);
266 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
Log< level::Error, false > LogError
dd4hep::Material material(const std::string &name) const
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
std::string_view name() const
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ nCells
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
std::string prepend(const std::string &) const