62 const auto& sdst_tracks =
64 const auto& sdst_particles =
65 frame_.get<edm4hep::ReconstructedParticleCollection>(
sdstName(
"MAIN",
"Particles"));
67 podio::UserDataCollection<std::int32_t> prov;
68 prov.resize(sdst_particles.size());
69 for (std::size_t i = 0; i < sdst_particles.size(); ++i) {
72 prov[i] = (sdst_particles[i].getCharge() == 0.f) ? -1 : 0;
77 const auto track_to_particle =
78 buildTrackToParticleMap(sdst_tracks, sdst_particles);
82 std::vector<int> fdst_pa_to_track;
83 std::vector<int> fdst_pa_to_particle;
84 auto extend_maps_to = [&](
int paIdx) {
85 if (paIdx >=
static_cast<int>(fdst_pa_to_track.size())) {
86 fdst_pa_to_track.resize (
static_cast<std::size_t
>(paIdx + 1), -1);
87 fdst_pa_to_particle.resize(
static_cast<std::size_t
>(paIdx + 1), -1);
91 extend_maps_to(paIdx);
94 if (lmain <= 0)
return;
95 const int charge_code =
96 static_cast<int>(std::lround(ph::Q(lmain + 8)));
97 if (charge_code == 0)
return;
100 if (ltrac <= 0)
return;
105 ph::Q(ltrac + 4), ph::Q(ltrac + 5),
107 const double D0_mm = h.params().D0;
108 const double Z0_mm = h.params().Z0;
109 const double omega_pm = h.params().omega;
113 int charge_signed = 0;
114 if (charge_code == 1) charge_signed = +1;
115 else if (charge_code == 2) charge_signed = -1;
116 if (charge_signed == 0)
return;
119 sdst_tracks, D0_mm, Z0_mm, omega_pm, charge_signed);
120 fdst_pa_to_track[paIdx] = matched;
122 if (matched >= 0 && matched <
static_cast<int>(track_to_particle.size())) {
123 const int particle_idx = track_to_particle[matched];
124 if (particle_idx >= 0 && particle_idx <
static_cast<int>(prov.size())) {
125 prov[particle_idx] = +1;
126 fdst_pa_to_particle[paIdx] = particle_idx;
133 ctx_.fdst_pa_to_sdst_track = std::move(fdst_pa_to_track);
134 ctx_.fdst_pa_to_sdst_particle = std::move(fdst_pa_to_particle);
static Helix fromPerigee(float d0, float z0, float theta, float phi, float invR, const std::array< float, 15 > *W=nullptr)
int findMatch(const edm4hep::TrackCollection &sdst_tracks, double fdst_D0_mm, double fdst_Z0_mm, double fdst_omega_per_mm, int fdst_charge_signed, double tolerance_cm2=1.0e-4)