18 using namespace hgcal;
21 template <
typename DDD>
22 inline void check_ddd(
const DDD* ddd) {
24 throw cms::Exception(
"hgcal::RecHitTools") <<
"DDDConstants not accessibl to hgcal::RecHitTools!";
28 template <
typename GEOM>
29 inline void check_geom(
const GEOM*
geom) {
30 if (
nullptr ==
geom) {
31 throw cms::Exception(
"hgcal::RecHitTools") <<
"Geometry not provided yet to hgcal::RecHitTools!";
60 const HGCalGeometry* hg = static_cast<const HGCalGeometry*>(
geom->getSubdetectorGeometry(det, subdet));
70 unsigned int wmaxEE(0), wmaxFH(0);
71 auto geomEE = static_cast<const HGCalGeometry*>(
77 wmaxEE = (geomEE->topology().dddConstants()).waferCount(0);
78 auto geomFH = static_cast<const HGCalGeometry*>(
80 wmaxFH = (geomFH->topology().dddConstants()).waferCount(0);
82 auto geomBH = static_cast<const HGCalGeometry*>(
85 fhOffset_ + (geomBH->topology().dddConstants()).firstLayer() - (geomEE->topology().dddConstants()).firstLayer();
87 bhMaxIphi_ = geomBH->topology().dddConstants().maxCells(
true);
93 wmaxEE = 1 + (geomEE->topology().dddConstants()).waferMax();
97 wmaxFH = 1 + (geomFH->topology().dddConstants()).waferMax();
132 auto hg = static_cast<const HGCalGeometry*>(
geom);
178 std::float_t thick(0.37);
181 auto ddd = get_ddd(
geom, hid);
185 auto ddd = get_ddd(
geom, hid);
189 auto ddd = get_ddd(
geom, hid);
190 thick = ddd->cellThickness(hid.
layer(), hid.
wafer(), 0);
192 LogDebug(
"getSiThickness::InvalidSiliconDetid")
193 <<
"det id: " << std::hex <<
id.rawId() <<
std::dec <<
":" <<
id.det() <<
" is not HGCal silicon!";
217 assert(thickIndex > 0 &&
"ERROR - silicon thickness has a nonsensical value");
224 LogDebug(
"getScintDEtaDPhi::InvalidScintDetid")
225 <<
"det id: " << std::hex <<
id.rawId() <<
std::dec <<
":" <<
id.det() <<
" is not HGCal scintillator!";
229 return {cellGeom->etaSpan(), cellGeom->phiSpan()};
237 auto ddd = get_ddd(
geom, hid);
238 size = ddd->cellSizeHex(hid.
type());
241 auto ddd = get_ddd(
geom, hid);
242 size = ddd->cellSizeHex(hid.
type());
245 auto ddd = get_ddd(
geom, hid);
249 <<
"det id: " << std::hex <<
id.rawId() <<
std::dec <<
":" <<
id.det() <<
" is not HGCal silicon!";
260 layer = (geomEE->topology().dddConstants()).
layers(
true);
266 layer = (geomFH->topology().dddConstants()).
layers(
true);
272 layer = (geomBH->topology().dddConstants())->getMaxDepth(1);
278 layer = (geomEE->topology().dddConstants()).
layers(
true);
281 layer += (geomFH->topology().dddConstants()).
layers(
true);
285 layer += (geomBH->topology().dddConstants())->getMaxDepth(1);
289 layer += (geomBH2->topology().dddConstants()).
layers(
true);
295 layer = (geomHFN->topology().dddConstants()).
layers(
true);
301 return (
unsigned int)(
layer);
310 layer = (geomEE->topology().dddConstants()).
layers(
true);
316 layer = (geomFH->topology().dddConstants()).
layers(
true);
322 layer = (geomBH->topology().dddConstants()).
layers(
true);
327 auto geomHFN = static_cast<const HGCalGeometry*>(
329 layer = (geomHFN->topology().dddConstants()).
layers(
true);
331 auto geomEE = static_cast<const HGCalGeometry*>(
333 layer = (geomEE->topology().dddConstants()).
layers(
true);
334 auto geomFH = static_cast<const HGCalGeometry*>(
336 layer += (geomFH->topology().dddConstants()).
layers(
true);
343 return (
unsigned int)(
layer);
389 <<
"det id: " << std::hex <<
id.rawId() <<
std::dec <<
":" <<
id.det() <<
" is not HGCal silicon!";
407 <<
"det id: " << std::hex <<
id.rawId() <<
std::dec <<
":" <<
id.det() <<
" is not HGCal silicon!";
409 return std::pair<int, int>(cellU, cellV);
417 auto ddd = get_ddd(
geom, hid);
418 const int waferType = ddd->waferTypeT(hid.
waferType());
419 return ddd->isHalfCell(waferType, hid.
cell());
435 return isonlysilicon;
440 return corrected_position.
eta();
462 float pt = hitEnergy / cosh(
eta);
469 float pt = hitEnergy / cosh(
eta);