50 ev.getByToken(tracksterToken_, trackstersH_);
51 ev.getByToken(clusterToken_, clusterH_);
55 const std::vector<bool>& rechitMask,
56 const std::vector<bool>& seedable,
58 auto const& hits = *
input;
64 std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
65 for (uint32_t
i = 0;
i < hits.size(); ++
i) {
66 detIdToIndex[hits[
i].detId()] =
i;
69 for (
const auto& tst : tracksters) {
71 if (tst.vertices().empty()) {
76 float probTotal = 0.0f;
78 probTotal += tst.id_probabilities(
cat);
92 double energy = 0.0, highest_energy = 0.0;
93 output.emplace_back();
96 std::vector<std::pair<DetId, float> > hitsAndFractions;
98 std::for_each(
std::begin(tst.vertices()),
std::end(tst.vertices()), [&](
unsigned int lcId) {
99 const auto fraction = 1.f / tst.vertex_multiplicity(iLC++);
100 for (
const auto& cell :
clusters[lcId].hitsAndFractions()) {
101 hitsAndFractions.emplace_back(cell.first, cell.second *
fraction);
105 for (
const auto& hAndF : hitsAndFractions) {
106 auto itr = detIdToIndex.find(hAndF.first);
107 if (itr == detIdToIndex.end()) {
111 assert(ref->detId() == hAndF.first.rawId());
112 const double hit_energy = hAndF.second * ref->energy();
113 energy += hit_energy;
119 if (hit_energy > highest_energy || highest_energy == 0.0) {
120 highest_energy = hit_energy;
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
edm::Handle< reco::CaloClusterCollection > clusterH_
std::vector< int > filter_on_iterations_
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
void setEnergy(double energy)
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
void updateEvent(const edm::Event &) final
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~PFClusterFromHGCalTrackster() override
static std::string const input
void setSeed(const DetId &id)
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
PFClusterFromHGCalTrackster & operator=(const PFClusterFromHGCalTrackster &)=delete
edm::EDGetTokenT< reco::CaloClusterCollection > clusterToken_
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
void setCorrectedEnergy(double cenergy)
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
std::vector< l1t::PFCluster > PFClusterCollection
std::vector< int > filter_on_categories_
T getParameter(std::string const &) const
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
bool filterByTracksterPID_
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
#define DEFINE_EDM_PLUGIN(factory, type, name)
edm::Handle< std::vector< ticl::Trackster > > trackstersH_
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksterToken_
PFClusterFromHGCalTrackster(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
bool filterByTracksterIteration_
void buildClusters(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override