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 for (
unsigned int k = 0;
k < truncCN.size(); ++
k)
60 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Truncated Cell[" <<
k <<
"] " << truncCN[
k] <<
":" << truncSensN[
k];
61 for (
unsigned int k = 0;
k < extenCN.size(); ++
k)
62 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Extended Cell[" <<
k <<
"] " << extenCN[
k] <<
":" << extenSensN[
k];
63 for (
unsigned int k = 0;
k < cornrCN.size(); ++
k)
64 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: Corner Cell[" <<
k <<
"] " << cornrCN[
k] <<
":" << cornrSensN[
k];
69 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << material <<
" initialized";
73 static const double sqrt3 =
std::sqrt(3.0);
74 static const double waf2cell = 3.0;
75 static const double cornerfac = 2.5;
77 (addWaferSeparation == 0) ? waferSize / (waf2cell *
nCells) : (waferSize + waferSeparation) / (waf2cell *
nCells);
78 double r = 0.5 *
R * sqrt3;
80 double dx2 = 0.5 * dx1;
81 double dx3 = cornerfac * dx2;
82 double dx4 = 0.5 * dx2;
83 double dx5 = (addWaferSeparation == 0) ? 0.0 : waferSeparation * 0.5;
84 double dx6 = dx5 * 0.5;
87 double dy2 = 0.5 * dy1;
88 double dy3 = 1.5 * dy1;
89 double dy4 = dx5 * 0.5 * sqrt3;
90 double dy5 = dx5 * 2 / sqrt3;
91 double dy6 = dy5 * 0.5;
92 std::vector<double>
xx = {
93 dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, dx1, dx4, -dx4, -dx1, -dx3, -dx3, -dx1, -dx4, dx4, dx1, dx3};
94 std::vector<double>
yy = {
95 0, dy1, dy1, 0, -dy1, -dy1, dy2, dy1, dy3, dy3, dy1, dy2, -dy2, -dy1, -dy3, -dy3, -dy1, -dy2};
96 std::vector<double> txx = {dx5, dx6, -dx6, -dx5, -dx6, dx6, dx7, 0, -dx7, -dx7, 0, dx7};
97 std::vector<double> tyy = {0, dy4, dy4, 0, -dy4, -dy4, dy6, dy5, dy6, -dy6, -dy5, -dy6};
98 double zpos = (posSens == 0) ? -0.5 * (waferT - cellT) : 0.5 * (waferT - cellT);
102 std::vector<double> xw = {
xx[0],
xx[1],
xx[2],
xx[3],
xx[4],
xx[5]};
103 std::vector<double> yw = {
yy[0],
yy[1],
yy[2],
yy[3],
yy[4],
yy[5]};
104 std::vector<double>
zw = {-0.5 * waferT, 0.5 * waferT};
105 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
111 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
116 for (
unsigned int k = 0;
k < xw.size(); ++
k)
119 std::vector<double> zc = {-0.5 * cellT, 0.5 * cellT};
125 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
130 for (
unsigned int k = 0;
k < xw.size(); ++
k)
134 glog1.placeVolume(glog2, 1, tran);
136 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
140 static constexpr
int ir0[] = {0, 2, 4, 1, 3, 5};
141 static constexpr
int ir1[] = {1, 3, 5, 2, 4, 0};
142 static constexpr
int ir2[] = {2, 4, 0, 3, 5, 1};
143 static constexpr
int ir3[] = {3, 5, 1, 4, 0, 2};
144 static constexpr
int ir4[] = {5, 1, 3, 0, 2, 4};
145 static constexpr
int tr[] = {1, 3, 5, 2, 4, 0};
146 for (
unsigned int i = 0;
i < truncCN.size(); ++
i) {
147 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]]};
148 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]]};
155 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
160 for (
unsigned int k = 0;
k < xw.size(); ++
k)
169 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
174 for (
unsigned int k = 0;
k < xw.size(); ++
k)
177 glog1.placeVolume(glog2, 1, tran);
179 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
184 static constexpr
int ie0[] = {1, 3, 5, 0, 2, 4};
185 static constexpr
int ie1[] = {2, 4, 0, 1, 3, 5};
186 static constexpr
int ie2[] = {3, 5, 1, 2, 4, 0};
187 static constexpr
int ie3[] = {14, 6, 10, 12, 16, 8};
188 static constexpr
int ie4[] = {17, 9, 13, 15, 7, 11};
189 static constexpr
int te[] = {2, 4, 0, 1, 3, 5};
190 for (
unsigned int i = 0;
i < extenCN.size(); ++
i) {
191 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]]};
192 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]]};
198 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
203 for (
unsigned int k = 0;
k < xw.size(); ++
k)
211 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
216 for (
unsigned int k = 0;
k < xw.size(); ++
k)
219 glog1.placeVolume(glog2, 1, tran);
221 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
226 static constexpr
int ic0[] = {0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5};
227 static constexpr
int ic1[] = {1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0};
228 static constexpr
int ic2[] = {10, 3, 14, 5, 6, 1, 2, 12, 4, 16, 0, 8};
229 static constexpr
int ic3[] = {3, 5, 5, 1, 1, 3, 4, 4, 0, 0, 2, 2};
230 static constexpr
int ic4[] = {5, 17, 1, 9, 3, 13, 15, 0, 7, 2, 11, 4};
231 static constexpr
int tc[] = {0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5};
232 for (
unsigned int i = 0;
i < cornrCN.size(); ++
i) {
233 std::vector<double> xw = {
234 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]};
235 std::vector<double> yw = {
236 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]};
242 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
247 for (
unsigned int k = 0;
k < xw.size(); ++
k)
255 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << solid.name() <<
" extruded polygon made of " << material
260 for (
unsigned int k = 0;
k < xw.size(); ++
k)
263 glog1.placeVolume(glog2, 1, tran);
265 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalCell: " << glog2.name() <<
" number 1 position in " << glog1.name()
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ nCells
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
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