25 if (!event.
exists(hit_coll_name_, hit_pass_name_)) {
26 ldmx_log(fatal) <<
"Couldn't find input collection " << hit_coll_name_
27 <<
" with pass name " << hit_pass_name_;
30 const auto ecal_rec_hits =
31 event.getCollection<
ldmx::EcalHit>(hit_coll_name_, hit_pass_name_);
34 for (
const auto& h : ecal_rec_hits) e_total += h.
getEnergy();
36 std::vector<ldmx::CaloCluster> pf_clusters;
37 if (!single_cluster_) {
39 min_cluster_hit_mult_);
40 std::vector<const ldmx::CalorimeterHit*> ptrs;
41 for (
const auto& h : ecal_rec_hits) ptrs.push_back(&h);
42 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
45 for (
const auto& hit_ptrs : all_hit_ptrs) {
47 cb.fillClusterInfoFromHits(&cl, hit_ptrs, log_energy_weight_,
49 pf_clusters.push_back(cl);
54 std::vector<const ldmx::CalorimeterHit*> ptrs;
55 ptrs.reserve(ecal_rec_hits.size());
56 for (
const auto& h : ecal_rec_hits) {
60 dummy.fillClusterInfoFromHits(&cl, ptrs, log_energy_weight_,
62 pf_clusters.push_back(cl);
65 std::sort(pf_clusters.begin(), pf_clusters.end(),
67 return a.getEnergy() > b.getEnergy();
69 event.add(cluster_coll_name_, pf_clusters);
70 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.