12 : dr2_(0.15 * 0.15), mindr2_(0), rechittools_(nullptr),
debug_(
false), nlayers_(30) {
26 throw cms::Exception(
"HGCalIsoCalculator::produceHGCalIso: rechittools not set");
33 auto makeEtaPhiPair = [
this](
const auto&
hit) {
37 return std::make_pair(eta, phi);
50 throw cms::Exception(
"HGCalIsoCalculator::produceHGCalIso: rechittools not set");
57 const float seedEta = seed->eta();
58 const float seedPhi = seed->phi();
59 const std::vector<std::pair<DetId, float>>& seedHitsAndFractions = seed->hitsAndFractions();
61 auto checkAndFill = [
this, &seedEta, &seedPhi, &seedHitsAndFractions](
const HGCRecHit&
hit,
62 std::pair<float, float> etaphiVal) {
63 float deltar2 =
reco::deltaR2(etaphiVal.first, etaphiVal.second, seedEta, seedPhi);
72 if (std::none_of(seedHitsAndFractions.begin(), seedHitsAndFractions.end(), [&hit](
const auto& seedhit) {
73 return hit.id() == seedhit.first;
76 isoringdeposits_.at(ring) += hit.energy();
83 checkAndFill(hit, *itEtaPhiCache);
87 checkAndFill(hit, *itEtaPhiCache);
91 checkAndFill(hit, *itEtaPhiCache);
98 throw std::logic_error(
"PhotonHGCalIsoCalculator::setNRings: max number of rings reached");
107 if (
i && !(
i % separator) && (
int)counter < (
int)nrings - 1) {
116 throw cms::Exception(
"HGCalIsoCalculator::getIso: ring index out of range");
edm::Handle< HGCRecHitCollection > recHitsEE_
edm::Handle< HGCRecHitCollection > recHitsBH_
void setNRings(const size_t nrings)
void setRecHits(edm::Handle< HGCRecHitCollection > hitsEE, edm::Handle< HGCRecHitCollection > hitsFH, edm::Handle< HGCRecHitCollection > hitsBH)
fill - once per event
std::vector< unsigned int > ringasso_
const hgcal::RecHitTools * rechittools_
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< std::pair< float, float > > hitEtaPhiCache_
void produceHGCalIso(const reco::CaloClusterPtr &seedCluster)
edm::Handle< HGCRecHitCollection > recHitsFH_
std::vector< float > isoringdeposits_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static std::atomic< unsigned int > counter
static int position[264][3]
static std::string const separator(":")
const float getIso(const unsigned int ring) const