File indexing completed on 2026-05-07 08:04:09
0001
0002
0003
0004 #include <edm4eic/Cluster.h>
0005 #include <edm4eic/Track.h>
0006 #include <map>
0007 #include <tuple>
0008 #include <utility>
0009 #include <vector>
0010
0011 #include "ChargedCandidateMaker.h"
0012 #include "algorithms/interfaces/CompareObjectID.h"
0013
0014 namespace eicrecon {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 void ChargedCandidateMaker::process(const ChargedCandidateMaker::Input& input,
0025 const ChargedCandidateMaker::Output& output) const {
0026
0027
0028 const auto [in_matches] = input;
0029 auto [out_particles] = output;
0030
0031
0032 if (in_matches->empty()) {
0033 debug("No track-cluster matches in collection");
0034 return;
0035 }
0036
0037 std::map<edm4eic::Track, std::vector<edm4eic::Cluster>, CompareObjectID<edm4eic::Track>>
0038 mapTrackToClusters;
0039 for (const auto& match : *in_matches) {
0040 mapTrackToClusters[match.getTrack()].push_back(match.getCluster());
0041 }
0042
0043 for (const auto& [track, clusters] : mapTrackToClusters) {
0044 edm4eic::MutableReconstructedParticle particle = out_particles->create();
0045 particle.addToTracks(track);
0046 for (const edm4eic::Cluster& cluster : clusters) {
0047 particle.addToClusters(cluster);
0048 }
0049 }
0050 }
0051 }