16 #include <unordered_map>
83 throw std::invalid_argument(
"Missing particles input collection");
86 throw std::invalid_argument(
"Missing hit-particles map input collection");
89 throw std::invalid_argument(
"Missing proto tracks input collection");
92 throw std::invalid_argument(
"Missing output filename");
99 file = TFile::Open(path.c_str(),
"RECREATE");
101 throw std::invalid_argument(
"Could not open '" + path +
"'");
105 trkTree =
new TTree(
"track_finder_tracks",
"");
114 prtTree =
new TTree(
"track_finder_particles",
"");
136 const HitParticlesMap& hitParticlesMap,
141 std::unordered_map<ActsFatras::Barcode, std::size_t> reconCount;
142 reconCount.reserve(particles.size());
144 std::unordered_map<ActsFatras::Barcode, std::size_t> majorityCount;
145 majorityCount.reserve(particles.size());
147 std::vector<ParticleHitCount> particleHitCounts;
151 std::lock_guard<std::mutex> guardTrk(
trkMutex);
152 for (
size_t itrack = 0; itrack < tracks.size(); ++itrack) {
153 const auto&
track = tracks[itrack];
161 if (not particleHitCounts.empty()) {
162 auto it = majorityCount
163 .try_emplace(particleHitCounts.front().particleId, 0
u)
167 for (
const auto&
hc : particleHitCounts) {
168 auto it = reconCount.try_emplace(
hc.particleId, 0
u).first;
179 for (
const auto& phc : particleHitCounts) {
182 auto trueParticleHits =
183 makeRange(particleHitsMap.equal_range(phc.particleId.value()));
194 std::lock_guard<std::mutex> guardPrt(
trkMutex);
195 for (
const auto&
particle : particles) {
217 auto nt = reconCount.find(
particle.particleId());
219 auto nm = majorityCount.find(
particle.particleId());
239 :
WriterT(cfg.inputProtoTracks,
"TrackFinderPerformanceWriter", lvl),
248 const auto& particles =
250 const auto& hitParticlesMap =
251 ctx.
eventStore.
get<HitParticlesMap>(m_impl->cfg.inputHitParticlesMap);
252 m_impl->write(ctx.
eventNumber, particles, hitParticlesMap, tracks);