10 hitCollName_ = ps.getParameter<std::string>(
"hitCollName");
11 hitPassName_ = ps.getParameter<std::string>(
"hitPassName");
12 clusterCollName_ = ps.getParameter<std::string>(
"clusterCollName");
13 suffix_ = ps.getParameter<std::string>(
"suffix",
"");
14 singleCluster_ = ps.getParameter<
bool>(
"doSingleCluster");
15 logEnergyWeight_ = ps.getParameter<
bool>(
"logEnergyWeight");
17 minClusterHitMult_ = ps.getParameter<
int>(
"minClusterHitMult");
18 clusterHitDist_ = ps.getParameter<
double>(
"clusterHitDist");
19 clusterZBias_ = ps.getParameter<
double>(
"clusterZBias", 1);
20 minHitEnergy_ = ps.getParameter<
double>(
"minHitEnergy");
24 if (!event.
exists(hitCollName_))
return;
25 const auto ecalRecHits =
26 event.getCollection<
ldmx::EcalHit>(hitCollName_, hitPassName_);
29 for (
const auto& h : ecalRecHits) eTotal += h.
getEnergy();
31 std::vector<ldmx::CaloCluster> pfClusters;
32 if (!singleCluster_) {
35 std::vector<const ldmx::CalorimeterHit*> ptrs;
36 for (
const auto& h : ecalRecHits) ptrs.push_back(&h);
37 std::vector<std::vector<const ldmx::CalorimeterHit*> > all_hit_ptrs =
38 cb.runDBSCAN(ptrs,
false);
40 for (
const auto& hit_ptrs : all_hit_ptrs) {
42 cb.fillClusterInfoFromHits(&cl, hit_ptrs, logEnergyWeight_);
43 pfClusters.push_back(cl);
48 std::vector<const ldmx::CalorimeterHit*> ptrs;
49 ptrs.reserve(ecalRecHits.size());
50 for (
const auto& h : ecalRecHits) {
54 dummy.fillClusterInfoFromHits(&cl, ptrs, logEnergyWeight_);
55 pfClusters.push_back(cl);
58 std::sort(pfClusters.begin(), pfClusters.end(),
60 return a.getEnergy() > b.getEnergy();
62 event.add(clusterCollName_, pfClusters);
63 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.