23 if (!event.
exists(hitCollName_))
return;
24 const auto ecalRecHits =
event.getCollection<
ldmx::EcalHit>(hitCollName_);
27 for (
const auto& h : ecalRecHits) eTotal += h.
getEnergy();
29 std::vector<ldmx::CaloCluster> pfClusters;
30 if (!singleCluster_) {
33 std::vector<const ldmx::CalorimeterHit*> ptrs;
34 for (
const auto& h : ecalRecHits) ptrs.push_back(&h);
35 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
36 cb.runDBSCAN(ptrs,
false);
38 for (
const auto& hit_ptrs : all_hit_ptrs) {
40 cb.fillClusterInfoFromHits(&cl, hit_ptrs, logEnergyWeight_);
41 pfClusters.push_back(cl);
46 std::vector<const ldmx::CalorimeterHit*> ptrs;
47 ptrs.reserve(ecalRecHits.size());
48 for (
const auto& h : ecalRecHits) {
52 dummy.fillClusterInfoFromHits(&cl, ptrs, logEnergyWeight_);
53 pfClusters.push_back(cl);
56 std::sort(pfClusters.begin(), pfClusters.end(),
58 return a.getEnergy() > b.getEnergy();
60 event.add(clusterCollName_, pfClusters);
61 event.add(
"EcalTotalEnergy" + suffix_, eTotal);
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.