22 ecal::EcalTriggerGeometry::CONDITIONS_OBJECT_NAME);
24 if (!event.
exists(hit_coll_name_, hit_coll_name_events_passname_))
return;
25 auto ecal_trig_digis{
event.getObject<ldmx::HgcrocTrigDigiCollection>(
26 hit_coll_name_, hit_coll_passname_)};
28 std::vector<Hit> hits{};
30 for (
const auto& trig_digi : ecal_trig_digis) {
32 float e = cvt.calc(trig_digi.linearPrimitive(), tid.
layer());
53 hit.layer_ = tid.
layer();
55 hit.module_id_ = tid.
module();
56 hit.idx_ = hits.size();
62 if (!my_geo.is_initialized_) {
63 for (
int imod = 0; imod < 7; imod++) {
64 for (
int icell = 0; icell < 48; icell++) {
67 my_geo.addTp(
id.raw(), icell, imod, xx, yy);
73 builder.setClusterGeo(&my_geo);
74 for (
const auto& h : hits) builder.addHit(h);
76 builder.buildClusters();
77 auto clusters = builder.getClusters();
79 TrigCaloClusterCollection trig_clusters;
80 for (
const auto& c : clusters) {
82 t.setXYZerr(c.xx_, c.yy_, c.zz_);
89 t.setFirstLayer(c.first_layer_);
90 t.setLastLayer(c.last_layer_);
94 n_tp = c.hits_.size();
96 for (
const auto& c2d : c.clusters2d_) n_tp += c2d.hits_.size();
99 trig_clusters.push_back(t);
102 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.