1 #include "DD4hep/DetFactoryHelper.h" 11 dd4hep::SensitiveDetector& ) {
15 double waferSize = args.
value<
double>(
"WaferSize");
16 double waferT = args.
value<
double>(
"WaferThick");
17 double cellT = args.
value<
double>(
"CellThick");
18 int nCells = args.
value<
int>(
"NCells");
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() <<
":" 55 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Wafer r " << waferSize <<
" T " << waferT <<
" Cell T " << cellT
56 <<
" Cells/Wafer " << nCells <<
" Material " << material <<
"Sensitive Position " 57 << posSens <<
" Full Cell: " << fullCN <<
":" << fullSensN;
58 for (
int k = 0;
k < 3; ++
k)
59 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Truncated Cell[" <<
k <<
"] " << truncCN[
k] <<
":" << truncSensN[
k];
60 for (
int k = 0;
k < 3; ++
k)
61 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Extended Cell[" <<
k <<
"] " << extenCN[
k] <<
":" << extenSensN[
k];
62 for (
int k = 0;
k < 6; ++
k)
63 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Corner Cell[" <<
k <<
"] " << cornrCN[
k] <<
":" << cornrSensN[
k];
69 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << material <<
" initialized at " << &matter;
73 static const double sqrt3 =
std::sqrt(3.0);
74 static const double waf2cell = 3.0;
75 static const double cornerfac = 2.5;
76 double R = waferSize / (waf2cell * nCells);
77 double r = 0.5 * R * sqrt3;
79 double dx2 = 0.5 * dx1;
80 double dx3 = cornerfac * dx2;
81 double dx4 = 0.5 * dx2;
83 double dy2 = 0.5 * dy1;
84 double dy3 = 1.5 * dy1;
85 std::vector<double>
xx = {dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, -dx4, -dx1, -dx1, -dx4, dx3};
86 std::vector<double>
yy = {0, dy1, dy1, 0, -dy1, -dy1, dy2, dy3, dy1, -dy1, -dy3, -dy2};
87 double zpos = (posSens == 0) ? -0.5 * (waferT - cellT) : 0.5 * (waferT - cellT);
88 dd4hep::Position tran(0, 0, zpos);
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
101 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
102 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
103 <<
" and " << xw.size() <<
" edges";
104 for (
unsigned int k = 0;
k < xw.size(); ++
k)
107 std::vector<double> zc = {-0.5 * cellT, 0.5 * cellT};
113 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
114 <<
" z|x|y|s (0) " << zc[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
115 <<
" z|x|y|s (1) " << zc[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
116 <<
" and " << xw.size() <<
" edges";
117 for (
unsigned int k = 0;
k < xw.size(); ++
k)
122 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
124 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name() <<
" at " 128 static const int ir0[] = {0, 1, 0};
129 static const int ir1[] = {1, 2, 1};
130 static const int ir2[] = {2, 3, 3};
131 static const int ir3[] = {3, 4, 4};
132 static const int ir4[] = {5, 5, 5};
133 for (
int i = 0;
i < 3; ++
i) {
134 std::vector<double> xw = {xx[ir0[
i]], xx[ir1[
i]], xx[ir2[
i]], xx[ir3[
i]], xx[ir4[
i]]};
135 std::vector<double> yw = {yy[ir0[
i]], yy[ir1[
i]], yy[ir2[
i]], yy[ir3[
i]], yy[ir4[
i]]};
142 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
143 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
144 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
145 <<
" and " << xw.size() <<
" edges";
146 for (
unsigned int k = 0;
k < xw.size(); ++
k)
155 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
156 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
157 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
158 <<
" and " << xw.size() <<
" edges";
159 for (
unsigned int k = 0;
k < xw.size(); ++
k)
162 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
164 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
165 <<
" at " << tran <<
" with " <<
rotation;
169 static const int ie0[] = {1, 5, 0};
170 static const int ie1[] = {2, 6, 1};
171 static const int ie2[] = {3, 7, 8};
172 static const int ie3[] = {10, 3, 9};
173 static const int ie4[] = {11, 4, 5};
174 for (
int i = 0;
i < 3; ++
i) {
175 std::vector<double> xw = {xx[ie0[
i]], xx[ie1[
i]], xx[ie2[
i]], xx[ie3[
i]], xx[ie4[
i]]};
176 std::vector<double> yw = {yy[ie0[
i]], yy[ie1[
i]], yy[ie2[
i]], yy[ie3[
i]], yy[ie4[
i]]};
182 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
183 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
184 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
185 <<
" and " << xw.size() <<
" edges";
186 for (
unsigned int k = 0;
k < xw.size(); ++
k)
194 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
195 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
196 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
197 <<
" and " << xw.size() <<
" edges";
198 for (
unsigned int k = 0;
k < xw.size(); ++
k)
201 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
203 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
204 <<
" at " << tran <<
" with " <<
rotation;
208 static const int ic0[] = {0, 1, 1, 1, 1, 0};
209 static const int ic1[] = {1, 2, 2, 7, 3, 1};
210 static const int ic2[] = {8, 3, 3, 3, 4, 3};
211 static const int ic3[] = {3, 5, 10, 4, 5, 9};
212 static const int ic4[] = {5, 11, 5, 5, 6, 5};
213 for (
int i = 0;
i < 6; ++
i) {
214 std::vector<double> xw = {xx[ic0[
i]], xx[ic1[
i]], xx[ic2[
i]], xx[ic3[
i]], xx[ic4[
i]]};
215 std::vector<double> yw = {yy[ic0[
i]], yy[ic1[
i]], yy[ic2[
i]], yy[ic3[
i]], yy[ic4[
i]]};
221 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
222 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
223 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
224 <<
" and " << xw.size() <<
" edges";
225 for (
unsigned int k = 0;
k < xw.size(); ++
k)
233 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
234 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" << scale[0]
235 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" << scale[1]
236 <<
" and " << xw.size() <<
" edges";
237 for (
unsigned int k = 0;
k < xw.size(); ++
k)
240 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
242 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
243 <<
" at " << tran <<
" with " <<
rotation;
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
T value(const std::string &name) const
std::string_view name() const
dd4hep::Material material(const std::string &name) const
std::string prepend(const std::string &) const
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
#define DECLARE_DDCMS_DETELEMENT(name, func)
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)