26 if (!event.
exists(hit_coll_name_, hit_pass_name_)) {
27 ldmx_log(fatal) <<
"Couldn't find input collection " << hit_coll_name_
28 <<
"_" << hit_pass_name_;
31 const auto hcal_rec_hits =
32 event.getCollection<
ldmx::HcalHit>(hit_coll_name_, hit_pass_name_);
34 for (
const auto& h : hcal_rec_hits) e_total += h.
getEnergy();
36 std::vector<ldmx::CaloCluster> pf_clusters;
37 if (!single_cluster_) {
40 min_cluster_hit_mult_);
41 std::vector<const ldmx::CalorimeterHit*> ptrs;
42 for (
const auto& h : hcal_rec_hits) ptrs.push_back(&h);
43 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
46 for (
const auto& hit_ptrs : all_hit_ptrs) {
48 cb.fillClusterInfoFromHits(&cl, hit_ptrs, log_energy_weight_,
50 pf_clusters.push_back(cl);
55 std::vector<const ldmx::CalorimeterHit*> ptrs;
56 ptrs.reserve(hcal_rec_hits.size());
57 for (
const auto& h : hcal_rec_hits) {
61 dummy.fillClusterInfoFromHits(&cl, ptrs, log_energy_weight_,
63 pf_clusters.push_back(cl);
67 std::sort(pf_clusters.begin(), pf_clusters.end(),
69 return a.getEnergy() > b.getEnergy();
71 event.add(cluster_coll_name_, pf_clusters);
72 event.add(
"HcalTotalEnergy" + suffix_, e_total);
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.