delphi-edm4hep
DELPHI SDST/FDST -> EDM4hep converter
Loading...
Searching...
No Matches
TblHybrid.cpp
Go to the documentation of this file.
1// TblHybridWriter — pass-2 implementation.
2
4
5#include <edm4hep/MCParticleCollection.h>
6#include <edm4hep/RecoMCParticleLinkCollection.h>
7#include <edm4hep/ReconstructedParticleCollection.h>
8
9#include <cstddef>
10
12
14{
15 edm4hep::RecoMCParticleLinkCollection out;
16
17 const auto& src =
18 frame_.get<edm4hep::RecoMCParticleLinkCollection>(sdstName("TBL", "RecoToMC"));
19 const auto& fdst_particles =
20 frame_.get<edm4hep::ReconstructedParticleCollection>("fDST_MAIN_Particles");
21 const std::size_t n_fdst = fdst_particles.size();
22
23 for (const auto& sl : src) {
24 auto dl = out.create();
25 dl.setWeight(sl.getWeight());
26 const auto& src_from = sl.getFrom();
27 const auto fidx = src_from.getObjectID().index;
28 if (fidx >= 0 && static_cast<std::size_t>(fidx) < n_fdst) {
29 dl.setFrom(fdst_particles[fidx]);
30 }
31 // `to` (MCParticle) unchanged — sDST_STSH_MCParticles is preserved
32 // as-is in the fDST view (no MC re-emission), so the original
33 // reference is still valid.
34 dl.setTo(sl.getTo());
35 }
36
37 put(std::move(out), "TBL", "RecoToMC", Provenance::Transcribed);
38}
39
40} // namespace delphi_edm4hep::tbl_hybrid
std::string sdstName(std::string_view bank, std::string_view readable) const
const Coll & put(Coll &&coll, std::string_view bank, std::string_view readable, Provenance prov)