14 hitCollName_ = ps.getParameter<std::string>(
"hitCollName");
15 hitPassName_ = ps.getParameter<std::string>(
"hitPassName");
16 clusterCollName_ = ps.getParameter<std::string>(
"clusterCollName");
17 suffix_ = ps.getParameter<std::string>(
"suffix",
"");
18 singleCluster_ = ps.getParameter<
bool>(
"doSingleCluster");
19 logEnergyWeight_ = ps.getParameter<
bool>(
"logEnergyWeight");
21 minClusterHitMult_ = ps.getParameter<
int>(
"minClusterHitMult");
22 clusterHitDist_ = ps.getParameter<
double>(
"clusterHitDist");
23 clusterZBias_ = ps.getParameter<
double>(
"clusterZBias", 1);
24 minHitEnergy_ = ps.getParameter<
double>(
"minHitEnergy");
28 if (!event.
exists(hitCollName_))
return;
29 const auto hcalRecHits =
30 event.getCollection<
ldmx::HcalHit>(hitCollName_, hitPassName_);
32 for (
const auto& h : hcalRecHits) eTotal += h.
getEnergy();
34 std::vector<ldmx::CaloCluster> pfClusters;
35 if (!singleCluster_) {
39 std::vector<const ldmx::CalorimeterHit*> ptrs;
40 for (
const auto& h : hcalRecHits) ptrs.push_back(&h);
41 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
42 cb.runDBSCAN(ptrs,
false);
44 for (
const auto& hit_ptrs : all_hit_ptrs) {
46 cb.fillClusterInfoFromHits(&cl, hit_ptrs, logEnergyWeight_);
47 pfClusters.push_back(cl);
52 std::vector<const ldmx::CalorimeterHit*> ptrs;
53 ptrs.reserve(hcalRecHits.size());
54 for (
const auto& h : hcalRecHits) {
58 dummy.fillClusterInfoFromHits(&cl, ptrs, logEnergyWeight_);
59 pfClusters.push_back(cl);
63 std::sort(pfClusters.begin(), pfClusters.end(),
65 return a.getEnergy() > b.getEnergy();
67 event.add(clusterCollName_, pfClusters);
68 event.add(
"HcalTotalEnergy" + 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.