69 const auto& sdst_particles =
70 frame_.get<edm4hep::ReconstructedParticleCollection>(
sdstName(
"MAIN",
"Particles"));
71 const auto& fdst_tracks =
72 frame_.get<edm4hep::TrackCollection>(
"fDST_TRAC_Tracks");
73 const std::size_t n_fdst_tracks = fdst_tracks.size();
82 const auto& fdst_emnc =
frame_.get<edm4hep::ClusterCollection>(
"fDST_EMNC_Showers");
83 const auto& fdst_hcnc =
frame_.get<edm4hep::ClusterCollection>(
"fDST_HCNC_Showers");
84 const auto emnc_id =
frame_.get<edm4hep::ClusterCollection>(
sdstName(
"EMNC",
"Showers")).getID();
85 const auto hcnc_id =
frame_.get<edm4hep::ClusterCollection>(
sdstName(
"HCNC",
"Showers")).getID();
86 const std::size_t n_emnc = fdst_emnc.size();
87 const std::size_t n_hcnc = fdst_hcnc.size();
91 edm4hep::ReconstructedParticleCollection main_out;
92 for (
const auto& sp : sdst_particles) {
93 auto dp = main_out.create();
104 for (std::size_t i = 0; i < sdst_particles.size(); ++i) {
105 auto dp = main_out[i];
106 const auto& sp = sdst_particles[i];
107 for (
const auto& st : sp.getTracks()) {
108 const auto idx = st.getObjectID().index;
109 if (idx >= 0 &&
static_cast<std::size_t
>(idx) < n_fdst_tracks) {
110 dp.addToTracks(fdst_tracks[idx]);
113 for (
const auto& sc : sp.getClusters()) {
114 const auto oid = sc.getObjectID();
115 if (oid.collectionID == emnc_id &&
116 oid.index >= 0 &&
static_cast<std::size_t
>(oid.index) < n_emnc) {
117 dp.addToClusters(fdst_emnc[oid.index]);
118 }
else if (oid.collectionID == hcnc_id &&
119 oid.index >= 0 &&
static_cast<std::size_t
>(oid.index) < n_hcnc) {
120 dp.addToClusters(fdst_hcnc[oid.index]);
123 for (
const auto& sub : sp.getParticles()) {
124 const auto idx = sub.getObjectID().index;
125 if (idx >= 0 &&
static_cast<std::size_t
>(idx) < main_out.size()) {
126 dp.addToParticles(main_out[idx]);
133 edm4hep::VertexCollection pv_out;
134 edm4hep::VertexCollection vtx_out;
135 edm4hep::VertexCollection v0_out;
136 edm4hep::VertexCollection phc_out;
138 const auto& sdst_pv =
frame_.get<edm4hep::VertexCollection>(
sdstName(
"PV",
"PrimaryVertex"));
139 const auto& sdst_vtx =
frame_.get<edm4hep::VertexCollection>(
sdstName(
"PV",
"Vertices"));
140 const auto& sdst_v0 =
frame_.get<edm4hep::VertexCollection>(
sdstName(
"V0",
"V0Candidates"));
141 const auto& sdst_phc =
frame_.get<edm4hep::VertexCollection>(
sdstName(
"PHC",
"PhotonConversions"));
143 cloneVerticesWithRepointedParticles(sdst_pv, pv_out, main_out);
144 cloneVerticesWithRepointedParticles(sdst_vtx, vtx_out, main_out);
145 cloneVerticesWithRepointedParticles(sdst_v0, v0_out, main_out);
146 cloneVerticesWithRepointedParticles(sdst_phc, phc_out, main_out);