31 const std::vector<bool>&,
32 const std::vector<bool>&,
58 const std::vector<bool>& rechitMask,
59 const std::vector<bool>& seedable,
68 std::unordered_map<uint32_t, size_t> detIdToIndex(
hits.size());
69 for (uint32_t
i = 0;
i <
hits.size(); ++
i) {
70 detIdToIndex[
hits[
i].detId()] =
i;
73 for (
const auto& tst : tracksters) {
75 if (tst.vertices().empty()) {
80 float probTotal = 0.0f;
82 probTotal += tst.id_probabilities(
cat);
96 double energy = 0.0, highest_energy = 0.0;
100 std::vector<std::pair<DetId, float> > hitsAndFractions;
102 std::for_each(std::begin(tst.vertices()), std::end(tst.vertices()), [&](
unsigned int lcId) {
103 const auto fraction = 1.f / tst.vertex_multiplicity(iLC++);
104 for (
const auto& cell :
clusters[lcId].hitsAndFractions()) {
105 hitsAndFractions.emplace_back(cell.first, cell.second *
fraction);
109 for (
const auto& hAndF : hitsAndFractions) {
110 auto itr = detIdToIndex.find(hAndF.first);
111 if (itr == detIdToIndex.end()) {
115 assert(ref->detId() == hAndF.first.rawId());
116 const double hit_energy = hAndF.second * ref->energy();
123 if (hit_energy > highest_energy || highest_energy == 0.0) {
124 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.
void buildClusters(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &, const HcalPFCuts *) override
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_