1 #include "DD4hep/DetFactoryHelper.h"
13 double waferSize = args.
value<
double>(
"WaferSize");
14 double waferT = args.
value<
double>(
"WaferThick");
15 double cellT = args.
value<
double>(
"CellThick");
17 int posSens = args.
value<
int>(
"PosSensitive");
21 std::vector<std::string> truncCN =
22 args.
value<std::vector<std::string> >(
"TruncatedCell");
23 std::vector<std::string> truncSensN =
24 args.
value<std::vector<std::string> >(
"TruncatedSensitive");
25 std::vector<std::string> extenCN = args.
value<std::vector<std::string> >(
"ExtendedCell");
26 std::vector<std::string> extenSensN =
27 args.
value<std::vector<std::string> >(
"ExtendedSensitive");
28 std::vector<std::string> cornrCN = args.
value<std::vector<std::string> >(
"CornerCell");
29 std::vector<std::string> cornrSensN =
30 args.
value<std::vector<std::string> >(
"CornerSensitive");
32 if ((truncCN.size() != truncSensN.size()) || (extenCN.size() != extenSensN.size()) ||
33 (cornrCN.size() != cornrSensN.size())) {
34 edm::LogError(
"HGCalGeom") <<
"The number of cells & sensitive differ:"
35 <<
" Truncated " << truncCN.size() <<
":" << truncSensN.size() <<
" Extended "
36 << extenCN.size() <<
":" << extenSensN.size() <<
" Corners " << cornrCN.size() <<
":"
38 throw cms::Exception(
"DDException") <<
"The number of cells & sensitive "
39 <<
"differ: Truncated " << truncCN.size() <<
":" << truncSensN.size()
40 <<
" Extended " << extenCN.size() <<
":" << extenSensN.size() <<
" Corners "
41 << cornrCN.size() <<
":" << cornrSensN.size();
43 if ((truncCN.size() < 3) || (extenCN.size() < 3) || (cornrCN.size() < 6)) {
44 edm::LogError(
"HGCalGeom") <<
"DDHGCalCell: The number of cells does not"
45 <<
" match with Standard: Truncated " << truncCN.size() <<
" < 3 Extended "
46 << extenCN.size() <<
" < 3"
47 <<
" Corners " << cornrCN.size() <<
" < 6";
48 throw cms::Exception(
"DDException") <<
"Wrong size of truncated|extended"
49 <<
"|corner cells: " << truncCN.size() <<
":" << extenCN.size() <<
":"
55 << nCells <<
" Material " << material <<
"Sensitive Position " << posSens
56 <<
" NameSpace " << ns.
name() <<
" Full Cell: " << fullCN <<
":" << fullSensN;
57 for (
unsigned int k = 0;
k < truncCN.size(); ++
k)
58 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Truncated Cell[" <<
k <<
"] " << truncCN[
k] <<
":" << truncSensN[
k];
59 for (
unsigned int k = 0;
k < extenCN.size(); ++
k)
60 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Extended Cell[" <<
k <<
"] " << extenCN[
k] <<
":" << extenSensN[
k];
61 for (
unsigned int k = 0;
k < cornrCN.size(); ++
k)
62 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Corner Cell[" <<
k <<
"] " << cornrCN[
k] <<
":" << cornrSensN[
k];
65 dd4hep::Material matter = ns.
material(material);
67 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << material <<
" initialized";
71 static const double sqrt3 =
std::sqrt(3.0);
72 static const double waf2cell = 3.0;
73 static const double cornerfac = 2.5;
74 double R = waferSize / (waf2cell *
nCells);
75 double r = 0.5 * R * sqrt3;
77 double dx2 = 0.5 * dx1;
78 double dx3 = cornerfac * dx2;
79 double dx4 = 0.5 * dx2;
81 double dy2 = 0.5 * dy1;
82 double dy3 = 1.5 * dy1;
83 std::vector<double> xx = {
84 dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, dx1, dx4, -dx4, -dx1, -dx3, -dx3, -dx1, -dx4, dx4, dx1, dx3};
85 std::vector<double> yy = {
86 0, dy1, dy1, 0, -dy1, -dy1, dy2, dy1, dy3, dy3, dy1, dy2, -dy2, -dy1, -dy3, -dy3, -dy1, -dy2};
87 double zpos = (posSens == 0) ? -0.5 * (waferT - cellT) : 0.5 * (waferT - cellT);
91 std::vector<double> xw = {xx[0], xx[1], xx[2], xx[3], xx[4], xx[5]};
92 std::vector<double> yw = {yy[0], yy[1], yy[2], yy[3], yy[4], yy[5]};
93 std::vector<double>
zw = {-0.5 * waferT, 0.5 * waferT};
94 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
100 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
104 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
105 for (
unsigned int k = 0;
k < xw.size(); ++
k)
108 std::vector<double> zc = {-0.5 * cellT, 0.5 * cellT};
114 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
118 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
119 for (
unsigned int k = 0; k < xw.size(); ++
k)
123 glog1.placeVolume(glog2, 1, tran);
125 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
129 static constexpr
int ir0[] = {0, 1, 0, 1, 3, 5};
130 static constexpr
int ir1[] = {1, 2, 1, 2, 4, 0};
131 static constexpr
int ir2[] = {2, 3, 3, 3, 5, 1};
132 static constexpr
int ir3[] = {3, 4, 4, 4, 0, 2};
133 static constexpr
int ir4[] = {5, 5, 5, 0, 2, 4};
134 for (
unsigned int i = 0;
i < truncCN.size(); ++
i) {
135 std::vector<double> xw = {xx[ir0[
i]], xx[ir1[
i]], xx[ir2[
i]], xx[ir3[
i]], xx[ir4[
i]]};
136 std::vector<double> yw = {yy[ir0[
i]], yy[ir1[
i]], yy[ir2[
i]], yy[ir3[
i]], yy[ir4[
i]]};
143 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
147 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
148 for (
unsigned int k = 0; k < xw.size(); ++
k)
157 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
161 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
162 for (
unsigned int k = 0; k < xw.size(); ++
k)
165 glog1.placeVolume(glog2, 1, tran);
167 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
172 static constexpr
int ie0[] = {1, 5, 0, 2, 4, 0};
173 static constexpr
int ie1[] = {2, 6, 1, 3, 5, 1};
174 static constexpr
int ie2[] = {3, 9, 10, 4, 0, 2};
175 static constexpr
int ie3[] = {14, 3, 13, 16, 8, 12};
176 static constexpr
int ie4[] = {17, 4, 5, 7, 11, 15};
177 for (
unsigned int i = 0;
i < extenCN.size(); ++
i) {
178 std::vector<double> xw = {xx[ie0[
i]], xx[ie1[
i]], xx[ie2[
i]], xx[ie3[
i]], xx[ie4[
i]]};
179 std::vector<double> yw = {yy[ie0[
i]], yy[ie1[
i]], yy[ie2[
i]], yy[ie3[
i]], yy[ie4[
i]]};
185 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
189 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
190 for (
unsigned int k = 0; k < xw.size(); ++
k)
198 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
202 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
203 for (
unsigned int k = 0; k < xw.size(); ++
k)
206 glog1.placeVolume(glog2, 1, tran);
208 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
213 static constexpr
int ic0[] = {0, 1, 1, 1, 1, 0, 1, 2, 3, 4, 5, 0};
214 static constexpr
int ic1[] = {1, 2, 2, 9, 3, 1, 2, 3, 4, 5, 0, 1};
215 static constexpr
int ic2[] = {10, 3, 3, 3, 4, 3, 12, 5, 16, 0, 8, 2};
216 static constexpr
int ic3[] = {3, 5, 14, 4, 5, 13, 4, 0, 0, 2, 2, 4};
217 static constexpr
int ic4[] = {5, 17, 5, 5, 6, 5, 0, 7, 2, 11, 4, 15};
218 for (
unsigned int i = 0;
i < cornrCN.size(); ++
i) {
219 std::vector<double> xw = {xx[ic0[
i]], xx[ic1[
i]], xx[ic2[
i]], xx[ic3[
i]], xx[ic4[
i]]};
220 std::vector<double> yw = {yy[ic0[
i]], yy[ic1[
i]], yy[ic2[
i]], yy[ic3[
i]], yy[ic4[
i]]};
226 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
230 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
231 for (
unsigned int k = 0; k < xw.size(); ++
k)
239 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
243 <<
cms::convert2mm(zy[1]) <<
":" << scale[1] <<
" and " << xw.size() <<
" edges";
244 for (
unsigned int k = 0; k < xw.size(); ++
k)
247 glog1.placeVolume(glog2, 1, tran);
249 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
T value(const std::string &name) const
Log< level::Error, false > LogError
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
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ nCells
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >