24 if (!event.
exists(hit_coll_name_, hit_pass_name_)) {
25 ldmx_log(fatal) <<
"Couldn't find input collection " << hit_coll_name_
26 <<
" with pass name " << hit_pass_name_;
29 const auto ecal_rec_hits =
30 event.getCollection<
ldmx::EcalHit>(hit_coll_name_, hit_pass_name_);
33 for (
const auto& h : ecal_rec_hits) e_total += h.
getEnergy();
35 std::vector<ldmx::CaloCluster> pf_clusters;
36 if (!single_cluster_) {
38 min_cluster_hit_mult_);
39 std::vector<const ldmx::CalorimeterHit*> ptrs;
40 for (
const auto& h : ecal_rec_hits) ptrs.push_back(&h);
41 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
44 for (
const auto& hit_ptrs : all_hit_ptrs) {
46 cb.fillClusterInfoFromHits(&cl, hit_ptrs, log_energy_weight_);
47 pf_clusters.push_back(cl);
52 std::vector<const ldmx::CalorimeterHit*> ptrs;
53 ptrs.reserve(ecal_rec_hits.size());
54 for (
const auto& h : ecal_rec_hits) {
58 dummy.fillClusterInfoFromHits(&cl, ptrs, log_energy_weight_);
59 pf_clusters.push_back(cl);
62 std::sort(pf_clusters.begin(), pf_clusters.end(),
64 return a.getEnergy() > b.getEnergy();
66 event.add(cluster_coll_name_, pf_clusters);
67 event.add(
"EcalTotalEnergy" + 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.