23 ecal::EcalTriggerGeometry::CONDITIONS_OBJECT_NAME);
25 if (!event.
exists(hit_coll_name_, hit_coll_name_events_passname_))
return;
26 auto ecal_trig_digis{
event.getObject<ldmx::HgcrocTrigDigiCollection>(
27 hit_coll_name_, hit_coll_passname_)};
29 std::vector<Hit> hits{};
31 for (
const auto& trig_digi : ecal_trig_digis) {
33 float e = cvt.calc(trig_digi.linearPrimitive(), tid.
layer());
54 hit.layer_ = tid.
layer();
56 hit.module_id_ = tid.
module();
57 hit.idx_ = hits.size();
63 if (!my_geo.is_initialized_) {
64 for (
int imod = 0; imod < 7; imod++) {
65 for (
int icell = 0; icell < 48; icell++) {
68 my_geo.addTp(
id.raw(), icell, imod, xx, yy);
74 builder.setClusterGeo(&my_geo);
75 for (
const auto& h : hits) builder.addHit(h);
77 builder.buildClusters();
78 auto clusters = builder.getClusters();
80 TrigCaloClusterCollection trig_clusters;
81 for (
const auto& c : clusters) {
83 t.setXYZerr(c.xx_, c.yy_, c.zz_);
90 t.setFirstLayer(c.first_layer_);
91 t.setLastLayer(c.last_layer_);
95 n_tp = c.hits_.size();
97 for (
const auto& c2d : c.clusters2d_) n_tp += c2d.hits_.size();
100 trig_clusters.push_back(t);
103 event.add(cluster_coll_name_, trig_clusters);
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.