29 const std::vector<bool>&,
30 const std::vector<bool>&,
55 const std::vector<bool>& rechitMask,
56 const std::vector<bool>& seedable,
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;
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();
119 if (hit_energy > highest_energy || highest_energy == 0.0) {
120 highest_energy = hit_energy;
T getParameter(std::string const &) const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
uint32_t cc[maxCellsPerHit]
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)
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)
PFClusterFromHGCalTrackster & operator=(const PFClusterFromHGCalTrackster &)=delete
edm::EDGetTokenT< reco::CaloClusterCollection > clusterToken_
void setCorrectedEnergy(double cenergy)
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
std::vector< int > filter_on_categories_
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