53 const std::size_t n = kTeModules.size();
54 edm4hep::TrackCollection segments;
55 edm4hep::TrackerHitPlaneCollection planes;
56 podio::UserDataCollection<float> segment_length;
57 podio::UserDataCollection<float> plane_length;
63 const double B =
frame_.getParameter<
float>(
64 makeName(
"EVT",
"BField")).value_or(0.f);
71 for (std::size_t m = 0; m < n; ++m) {
73 if (lte <= 0)
continue;
76 for (
const auto& te : mod.elements) {
79 const std::int32_t kind = mod.label * 10 + mod.stage;
81 if (kTeModules[m].plane) {
82 auto hit = planes.create();
84 hit.setQuality(te.descriptor);
85 hit.setPosition({ te.coord[0] * kCm2Mm,
87 te.coord[2] * kCm2Mm });
89 plane_length.push_back(te.length * kCm2Mm);
94 te.coord[0], te.coord[1], te.coord[2], te.theta, te.phi,
95 te.invP, te.invPt, te.is_cylindrical, te.cov, B);
97 auto state = helix.toTrackState(edm4hep::TrackState::AtOther);
103 const bool transverse = te.is_cylindrical
104 ? te.has_meas[kBasisRPhi]
105 : te.has_meas[kBasisX] && te.has_meas[kBasisY];
106 const bool longitudinal = te.is_cylindrical ? te.has_meas[kBasisZ] :
true;
107 state.D0 = transverse ? 0.f : kNotMeasured;
108 state.Z0 = longitudinal ? 0.f : kNotMeasured;
109 if (!te.has_meas[kBasisPhi]) state.phi = kNotMeasured;
110 if (!te.has_meas[kBasisTheta]) state.tanLambda = kNotMeasured;
111 if (!te.has_meas[kBasisInvP]) state.omega = kNotMeasured;
113 auto trk = segments.create();
115 trk.setChi2(te.chi2);
116 trk.setNdf(
static_cast<std::int32_t
>(std::lround(te.ndf)));
117 trk.addToTrackStates(state);
119 segment_length.push_back(te.length * kCm2Mm);
128 put(std::move(planes),
"TEVF",
"TrackElementPlane",
130 put(std::move(plane_length),
"TEVF",
"TrackElementPlane_Length",
133 ctx_.track_elements = std::move(out);
static Helix fromTrackElement(double c1, double c2, double c3, double theta, double phi, double invP, bool invPt, bool cylindrical, const CovMatrix6 &teCov, double B)