1 #include "DD4hep/DetFactoryHelper.h" 12 dd4hep::SensitiveDetector& ) {
17 double waferSize = args.
value<
double>(
"WaferSize");
18 double waferT = args.
value<
double>(
"WaferThick");
19 double cellT = args.
value<
double>(
"CellThick");
20 int nCells = args.
value<
int>(
"NCells");
21 int posSens = args.
value<
int>(
"PosSensitive");
25 std::vector<std::string> truncCN = args.
value<std::vector<std::string> >(
"TruncatedCell");
26 std::vector<std::string> truncSensN = 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 = args.
value<std::vector<std::string> >(
"ExtendedSensitive");
29 std::vector<std::string> cornrCN = args.
value<std::vector<std::string> >(
"CornerCell");
30 std::vector<std::string> cornrSensN = args.
value<std::vector<std::string> >(
"CornerSensitive");
32 if ((truncCN.size() != truncSensN.size()) ||
33 (extenCN.size() != extenSensN.size()) ||
34 (cornrCN.size() != cornrSensN.size())) {
35 edm::LogError(
"HGCalGeom") <<
"The number of cells & sensitive differ:" 36 <<
" Truncated " << truncCN.size() <<
":" 37 << truncSensN.size() <<
" Extended " 38 << extenCN.size() <<
":" << extenSensN.size()
39 <<
" Corners " << cornrCN.size() <<
":" 41 throw cms::Exception(
"DDException") <<
"The number of cells & sensitive " 42 <<
"differ: Truncated " 43 << truncCN.size() <<
":" 44 << truncSensN.size() <<
" Extended " 45 << extenCN.size() <<
":" 46 << extenSensN.size() <<
" Corners " 47 << cornrCN.size() <<
":" 50 if ((truncCN.size() != 3) || (extenCN.size() != 3) ||
51 (cornrCN.size() != 6)) {
52 edm::LogError(
"HGCalGeom") <<
"DDHGCalCell: The number of cells does not" 53 <<
" match with Standard: Truncated " 54 << truncCN.size() <<
":3 Extended " 55 << extenCN.size() <<
":3" <<
" Corners " 56 << cornrCN.size() <<
":6";
57 throw cms::Exception(
"DDException") <<
"Wrong size of truncated|extended" 58 <<
"|corner cells: " << truncCN.size()
59 <<
":" << extenCN.size() <<
":" 64 <<
" T " << waferT <<
" Cell T " << cellT
65 <<
" Cells/Wafer " << nCells <<
" Material " 66 << material <<
"Sensitive Position " 67 << posSens <<
" Full Cell: " << fullCN <<
":" 69 for (
int k=0;
k<3; ++
k)
71 <<
"] " << truncCN[
k] <<
":" 73 for (
int k=0;
k<3; ++
k)
75 <<
"] " << extenCN[
k] <<
":" 77 for (
int k=0;
k<6; ++
k)
79 <<
"] " << cornrCN[
k] <<
":" 87 <<
" initialized at " << &matter;
91 static const double sqrt3 =
std::sqrt(3.0);
92 static const double waf2cell = 3.0;
93 static const double cornerfac= 2.5;
94 double R = waferSize/(waf2cell*nCells);
95 double r = 0.5*R*sqrt3;
98 double dx3 = cornerfac*dx2;
101 double dy2 = 0.5*dy1;
102 double dy3 = 1.5*dy1;
103 std::vector<double>
xx = {dx1, dx2,-dx2,-dx1,-dx2,dx2,
104 dx3,-dx4,-dx1,-dx1,-dx4,dx3};
105 std::vector<double>
yy = {0, dy1,dy1, 0,-dy1,-dy1,
106 dy2,dy3,dy1,-dy1,-dy3,-dy2};
107 double zpos = (posSens == 0) ? -0.5*(waferT-cellT) : 0.5*(waferT-cellT);
108 dd4hep::Position tran(0,0,zpos);
111 std::vector<double> xw = {xx[0],xx[1],xx[2],xx[3],xx[4],xx[5]};
112 std::vector<double> yw = {yy[0],yy[1],yy[2],yy[3],yy[4],yy[5]};
113 std::vector<double>
zw = {-0.5*waferT,0.5*waferT};
114 std::vector<double> zx(2,0), zy(2,0),
scale(2,1.0);
121 <<
" extruded polygon made of " << material
122 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
123 <<
":" << zy[0] <<
":" << scale[0]
124 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
125 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 126 << xw.size() <<
" edges";
127 for (
unsigned int k=0;
k<xw.size(); ++
k)
130 std::vector<double> zc = {-0.5*cellT,0.5*cellT};
137 <<
" extruded polygon made of " << material
138 <<
" z|x|y|s (0) " << zc[0] <<
":" << zx[0]
139 <<
":" << zy[0] <<
":" << scale[0]
140 <<
" z|x|y|s (1) " << zc[1] <<
":" << zx[1]
141 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 142 << xw.size() <<
" edges";
143 for (
unsigned int k=0;
k<xw.size(); ++
k)
148 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation,tran));
151 <<
" number 1 position in " << glog1.name()
152 <<
" at " << tran <<
" with " <<
rotation;
155 static const int ir0[] = {0,1,0};
156 static const int ir1[] = {1,2,1};
157 static const int ir2[] = {2,3,3};
158 static const int ir3[] = {3,4,4};
159 static const int ir4[] = {5,5,5};
160 for (
int i=0;
i<3; ++
i) {
161 std::vector<double> xw = {xx[ir0[
i]],xx[ir1[
i]],xx[ir2[
i]],xx[ir3[
i]],xx[ir4[
i]]};
162 std::vector<double> yw = {yy[ir0[
i]],yy[ir1[
i]],yy[ir2[
i]],yy[ir3[
i]],yy[ir4[
i]]};
170 <<
" extruded polygon made of " << material
171 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
172 <<
":" << zy[0] <<
":" << scale[0]
173 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
174 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 175 << xw.size() <<
" edges";
176 for (
unsigned int k=0;
k<xw.size(); ++
k)
187 <<
" extruded polygon made of " << material
188 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
189 <<
":" << zy[0] <<
":" << scale[0]
190 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
191 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 192 << xw.size() <<
" edges";
193 for (
unsigned int k=0;
k<xw.size(); ++
k)
197 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation,tran));
200 <<
" number 1 position in " << glog1.name()
201 <<
" at " << tran <<
" with " <<
rotation;
205 static const int ie0[] = {1,5,0};
206 static const int ie1[] = {2,6,1};
207 static const int ie2[] = {3,7,8};
208 static const int ie3[] = {10,3,9};
209 static const int ie4[] = {11,4,5};
210 for (
int i=0;
i<3; ++
i) {
211 std::vector<double> xw = {xx[ie0[
i]],xx[ie1[
i]],xx[ie2[
i]],xx[ie3[
i]],xx[ie4[
i]]};
212 std::vector<double> yw = {yy[ie0[
i]],yy[ie1[
i]],yy[ie2[
i]],yy[ie3[
i]],yy[ie4[
i]]};
219 <<
" extruded polygon made of " << material
220 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
221 <<
":" << zy[0] <<
":" << scale[0]
222 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
223 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 224 << xw.size() <<
" edges";
225 for (
unsigned int k=0;
k<xw.size(); ++
k)
235 <<
" extruded polygon made of " << material
236 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
237 <<
":" << zy[0] <<
":" << scale[0]
238 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
239 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 240 << xw.size() <<
" edges";
241 for (
unsigned int k=0;
k<xw.size(); ++
k)
245 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation,tran));
248 <<
" number 1 position in " << glog1.name()
249 <<
" at " << tran <<
" with " <<
rotation;
253 static const int ic0[] = {0,1,1,1,1,0};
254 static const int ic1[] = {1,2,2,7,3,1};
255 static const int ic2[] = {8,3,3,3,4,3};
256 static const int ic3[] = {3,5,10,4,5,9};
257 static const int ic4[] = {5,11,5,5,6,5};
258 for (
int i=0;
i<6; ++
i) {
259 std::vector<double> xw = {xx[ic0[
i]],xx[ic1[
i]],xx[ic2[
i]],xx[ic3[
i]],xx[ic4[
i]]};
260 std::vector<double> yw = {yy[ic0[
i]],yy[ic1[
i]],yy[ic2[
i]],yy[ic3[
i]],yy[ic4[
i]]};
267 <<
" extruded polygon made of " << material
268 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
269 <<
":" << zy[0] <<
":" << scale[0]
270 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
271 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 272 << xw.size() <<
" edges";
273 for (
unsigned int k=0;
k<xw.size(); ++
k)
283 <<
" extruded polygon made of " << material
284 <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0]
285 <<
":" << zy[0] <<
":" << scale[0]
286 <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1]
287 <<
":" << zy[1] <<
":" << scale[1] <<
" and " 288 << xw.size() <<
" edges";
289 for (
unsigned int k=0;
k<xw.size(); ++
k)
293 glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation,tran));
296 <<
" number 1 position in " << glog1.name()
297 <<
" 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
#define DECLARE_DDCMS_DETELEMENT(name, func)
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)