28 if (!event.
exists(hit_coll_name_, hit_pass_name_)) {
29 ldmx_log(fatal) <<
"Couldn't find input collection " << hit_coll_name_
30 <<
"_" << hit_pass_name_;
33 const auto hcal_rec_hits =
34 event.getCollection<
ldmx::HcalHit>(hit_coll_name_, hit_pass_name_);
36 for (
const auto& h : hcal_rec_hits) e_total += h.
getEnergy();
38 std::vector<ldmx::CaloCluster> pf_clusters;
39 if (!single_cluster_) {
42 min_cluster_hit_mult_);
43 std::vector<const ldmx::CalorimeterHit*> ptrs;
44 for (
const auto& h : hcal_rec_hits) ptrs.push_back(&h);
45 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
48 for (
const auto& hit_ptrs : all_hit_ptrs) {
50 cb.fillClusterInfoFromHits(&cl, hit_ptrs, log_energy_weight_);
51 pf_clusters.push_back(cl);
56 std::vector<const ldmx::CalorimeterHit*> ptrs;
57 ptrs.reserve(hcal_rec_hits.size());
58 for (
const auto& h : hcal_rec_hits) {
62 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.