Process the event and put new data products into it.
19 {
22 ecal::EcalTriggerGeometry::CONDITIONS_OBJECT_NAME);
23
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_)};
27
28 std::vector<Hit> hits{};
29 EcalTpToE cvt;
30 for (const auto& trig_digi : ecal_trig_digis) {
32 float e = cvt.calc(trig_digi.linearPrimitive(), tid.layer());
33
34
35
36
37
38
39 double x, y, z;
40
41
42
43
44
46
47
49 hit.e_ = e;
50 hit.x_ = x;
51 hit.y_ = y;
52 hit.z_ = z;
53 hit.layer_ = tid.layer();
54 hit.cell_id_ = tid.getTriggerCellID();
55 hit.module_id_ = tid.module();
56 hit.idx_ = hits.size();
57 hits.push_back(hit);
58 }
59
60
61 ClusterGeometry my_geo;
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);
68 }
69 }
70 my_geo.initialize();
71 }
72 IdealClusterBuilder builder;
73 builder.setClusterGeo(&my_geo);
74 for (const auto& h : hits) builder.addHit(h);
75
76 builder.buildClusters();
77 auto clusters = builder.getClusters();
78
79 TrigCaloClusterCollection trig_clusters;
80 for (const auto& c : clusters) {
81 TrigCaloCluster t(c.x_, c.y_, c.z_, c.e_);
82 t.setXYZerr(c.xx_, c.yy_, c.zz_);
83 t.setdxdz(c.dxdz_);
84 t.setdydz(c.dydz_);
85 t.setdxdze(c.dxdze_);
86 t.setdydze(c.dydze_);
87 t.set3D(!c.is_2d_);
88 t.setLayer(c.layer_);
89 t.setFirstLayer(c.first_layer_);
90 t.setLastLayer(c.last_layer_);
91 t.setDepth(c.depth_);
92 int n_tp = 0;
93 if (c.is_2d_) {
94 n_tp = c.hits_.size();
95 } else {
96 for (const auto& c2d : c.clusters2d_) n_tp += c2d.hits_.size();
97 }
98 t.setNTP(n_tp);
99 trig_clusters.push_back(t);
100 }
101
102 event.add(cluster_coll_name_, trig_clusters);
103}
defines the relationship between precision cells and trigger cells and provides geometry information ...
std::tuple< double, double, double > globalPosition(ldmx::EcalTriggerID triggerCell) const
Returns the center of the given trigger cell in world coordinates.
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
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.
Extension of DetectorID providing access to ECal trigger cell information.