1 #include "DD4hep/DetFactoryHelper.h"
12 double waferSize =
args.value<
double>(
"WaferSize");
13 double waferT =
args.value<
double>(
"WaferThick");
14 double cellT =
args.value<
double>(
"CellThick");
15 int nCells =
args.value<
int>(
"NCells");
16 int posSens =
args.value<
int>(
"PosSensitive");
20 std::vector<std::string> truncCN =
21 args.value<std::vector<std::string> >(
"TruncatedCell");
22 std::vector<std::string> truncSensN =
23 args.value<std::vector<std::string> >(
"TruncatedSensitive");
24 std::vector<std::string> extenCN =
args.value<std::vector<std::string> >(
"ExtendedCell");
25 std::vector<std::string> extenSensN =
26 args.value<std::vector<std::string> >(
"ExtendedSensitive");
27 std::vector<std::string> cornrCN =
args.value<std::vector<std::string> >(
"CornerCell");
28 std::vector<std::string> cornrSensN =
29 args.value<std::vector<std::string> >(
"CornerSensitive");
31 if ((truncCN.size() != truncSensN.size()) || (extenCN.size() != extenSensN.size()) ||
32 (cornrCN.size() != cornrSensN.size())) {
33 edm::LogError(
"HGCalGeom") <<
"The number of cells & sensitive differ:"
34 <<
" Truncated " << truncCN.size() <<
":" << truncSensN.size() <<
" Extended "
35 << extenCN.size() <<
":" << extenSensN.size() <<
" Corners " << cornrCN.size() <<
":"
37 throw cms::Exception(
"DDException") <<
"The number of cells & sensitive "
38 <<
"differ: Truncated " << truncCN.size() <<
":" << truncSensN.size()
39 <<
" Extended " << extenCN.size() <<
":" << extenSensN.size() <<
" Corners "
40 << cornrCN.size() <<
":" << cornrSensN.size();
42 if ((truncCN.size() != 3) || (extenCN.size() != 3) || (cornrCN.size() != 6)) {
43 edm::LogError(
"HGCalGeom") <<
"DDHGCalCell: The number of cells does not"
44 <<
" match with Standard: Truncated " << truncCN.size() <<
":3 Extended "
45 << extenCN.size() <<
":3"
46 <<
" Corners " << cornrCN.size() <<
":6";
47 throw cms::Exception(
"DDException") <<
"Wrong size of truncated|extended"
48 <<
"|corner cells: " << truncCN.size() <<
":" << extenCN.size() <<
":"
52 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Wafer r " << waferSize <<
" T " << waferT <<
" Cell T " << cellT
53 <<
" Cells/Wafer " << nCells <<
" Material " << material <<
"Sensitive Position "
54 << posSens <<
" Full Cell: " << fullCN <<
":" << fullSensN;
55 for (
int k = 0;
k < 3; ++
k)
56 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Truncated Cell[" <<
k <<
"] " << truncCN[
k] <<
":" << truncSensN[
k];
57 for (
int k = 0;
k < 3; ++
k)
58 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Extended Cell[" <<
k <<
"] " << extenCN[
k] <<
":" << extenSensN[
k];
59 for (
int k = 0;
k < 6; ++
k)
60 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Corner Cell[" <<
k <<
"] " << cornrCN[
k] <<
":" << cornrSensN[
k];
66 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << material <<
" initialized at " << &matter;
70 static const double sqrt3 =
std::sqrt(3.0);
71 static const double waf2cell = 3.0;
72 static const double cornerfac = 2.5;
73 double R = waferSize / (waf2cell * nCells);
74 double r = 0.5 *
R * sqrt3;
76 double dx2 = 0.5 * dx1;
77 double dx3 = cornerfac * dx2;
78 double dx4 = 0.5 * dx2;
80 double dy2 = 0.5 * dy1;
81 double dy3 = 1.5 * dy1;
82 std::vector<double>
xx = {dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, -dx4, -dx1, -dx1, -dx4, dx3};
83 std::vector<double>
yy = {0, dy1, dy1, 0, -dy1, -dy1, dy2, dy3, dy1, -dy1, -dy3, -dy2};
84 double zpos = (posSens == 0) ? -0.5 * (waferT - cellT) : 0.5 * (waferT - cellT);
88 std::vector<double> xw = {
xx[0],
xx[1],
xx[2],
xx[3],
xx[4],
xx[5]};
89 std::vector<double> yw = {
yy[0],
yy[1],
yy[2],
yy[3],
yy[4],
yy[5]};
90 std::vector<double>
zw = {-0.5 * waferT, 0.5 * waferT};
91 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
97 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
98 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
99 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
100 <<
" and " << xw.size() <<
" edges";
101 for (
unsigned int k = 0;
k < xw.size(); ++
k)
104 std::vector<double> zc = {-0.5 * cellT, 0.5 * cellT};
110 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
111 <<
" z|x|y|s (0) " << zc[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
112 <<
" z|x|y|s (1) " << zc[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
113 <<
" and " << xw.size() <<
" edges";
114 for (
unsigned int k = 0;
k < xw.size(); ++
k)
119 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(
rotation, tran));
121 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name() <<
" at "
125 static const int ir0[] = {0, 1, 0};
126 static const int ir1[] = {1, 2, 1};
127 static const int ir2[] = {2, 3, 3};
128 static const int ir3[] = {3, 4, 4};
129 static const int ir4[] = {5, 5, 5};
130 for (
int i = 0;
i < 3; ++
i) {
131 std::vector<double> xw = {
xx[ir0[
i]],
xx[ir1[
i]],
xx[ir2[
i]],
xx[ir3[
i]],
xx[ir4[
i]]};
132 std::vector<double> yw = {
yy[ir0[
i]],
yy[ir1[
i]],
yy[ir2[
i]],
yy[ir3[
i]],
yy[ir4[
i]]};
139 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
140 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
141 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
142 <<
" and " << xw.size() <<
" edges";
143 for (
unsigned int k = 0;
k < xw.size(); ++
k)
152 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
153 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
154 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
155 <<
" and " << xw.size() <<
" edges";
156 for (
unsigned int k = 0;
k < xw.size(); ++
k)
159 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(
rotation, tran));
161 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
162 <<
" at " << tran <<
" with " <<
rotation;
166 static const int ie0[] = {1, 5, 0};
167 static const int ie1[] = {2, 6, 1};
168 static const int ie2[] = {3, 7, 8};
169 static const int ie3[] = {10, 3, 9};
170 static const int ie4[] = {11, 4, 5};
171 for (
int i = 0;
i < 3; ++
i) {
172 std::vector<double> xw = {
xx[ie0[
i]],
xx[ie1[
i]],
xx[ie2[
i]],
xx[ie3[
i]],
xx[ie4[
i]]};
173 std::vector<double> yw = {
yy[ie0[
i]],
yy[ie1[
i]],
yy[ie2[
i]],
yy[ie3[
i]],
yy[ie4[
i]]};
179 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
180 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
181 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
182 <<
" and " << xw.size() <<
" edges";
183 for (
unsigned int k = 0;
k < xw.size(); ++
k)
191 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
192 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
193 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
194 <<
" and " << xw.size() <<
" edges";
195 for (
unsigned int k = 0;
k < xw.size(); ++
k)
198 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(
rotation, tran));
200 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
201 <<
" at " << tran <<
" with " <<
rotation;
205 static const int ic0[] = {0, 1, 1, 1, 1, 0};
206 static const int ic1[] = {1, 2, 2, 7, 3, 1};
207 static const int ic2[] = {8, 3, 3, 3, 4, 3};
208 static const int ic3[] = {3, 5, 10, 4, 5, 9};
209 static const int ic4[] = {5, 11, 5, 5, 6, 5};
210 for (
int i = 0;
i < 6; ++
i) {
211 std::vector<double> xw = {
xx[ic0[
i]],
xx[ic1[
i]],
xx[ic2[
i]],
xx[ic3[
i]],
xx[ic4[
i]]};
212 std::vector<double> yw = {
yy[ic0[
i]],
yy[ic1[
i]],
yy[ic2[
i]],
yy[ic3[
i]],
yy[ic4[
i]]};
218 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
219 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
220 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
221 <<
" and " << xw.size() <<
" edges";
222 for (
unsigned int k = 0;
k < xw.size(); ++
k)
230 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
231 <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" <<
scale[0]
232 <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" <<
scale[1]
233 <<
" and " << xw.size() <<
" edges";
234 for (
unsigned int k = 0;
k < xw.size(); ++
k)
237 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(
rotation, tran));
239 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
240 <<
" at " << tran <<
" with " <<
rotation;