23 :
WriterT(cfg.inputTrajectories,
"TrackFitterPerformanceWriter", lvl),
24 m_cfg(std::move(cfg)),
25 m_resPlotTool(m_cfg.resPlotToolConfig, lvl),
26 m_effPlotTool(m_cfg.effPlotToolConfig, lvl),
27 m_trackSummaryPlotTool(m_cfg.trackSummaryPlotToolConfig, lvl)
32 throw std::invalid_argument(
"Missing input trajectories collection");
35 throw std::invalid_argument(
"Missing input particles collection");
38 throw std::invalid_argument(
"Missing output filename");
47 throw std::invalid_argument(
"Could not open '" + path +
"'");
57 m_resPlotTool.clear(m_resPlotCache);
58 m_effPlotTool.clear(m_effPlotCache);
59 m_trackSummaryPlotTool.clear(m_trackSummaryPlotCache);
62 m_outputFile->Close();
68 m_resPlotTool.refinement(m_resPlotCache);
72 m_resPlotTool.write(m_resPlotCache);
73 m_effPlotTool.write(m_effPlotCache);
74 m_trackSummaryPlotTool.write(m_trackSummaryPlotCache);
76 ACTS_INFO(
"Wrote performance plots to '" << m_outputFile->GetPath() <<
"'");
84 const auto& particles =
88 std::lock_guard<std::mutex> lock(m_writeMutex);
91 std::map<ActsFatras::Barcode, TruthFitTrack> reconTrajectories;
94 for (
const auto& traj : trajectories) {
95 if (not traj.hasTrajectory()) {
98 const auto& [trackTip,
track] = traj.trajectory();
101 const auto particleHitCount = traj.identifyMajorityParticle();
102 if (particleHitCount.empty()) {
107 const auto ip = particles.find(particleHitCount.front().particleId);
108 if (ip == particles.end()) {
113 reconTrajectories.emplace(ip->particleId(), traj);
117 size_t nTotalStates = 0, nHits = 0, nOutliers = 0, nHoles = 0;
118 track.visitBackwards(trackTip, [&](
const auto& state) {
120 auto typeFlags = state.typeFlags();
131 m_trackSummaryPlotTool.fill(m_trackSummaryPlotCache, *ip, nTotalStates,
132 nHits, nOutliers, nHoles);
135 if (traj.hasTrackParameters()) {
136 m_resPlotTool.fill(m_resPlotCache, ctx.
geoContext, *ip,
137 traj.trackParameters());
145 for (
const auto&
particle : particles) {
146 const auto it = reconTrajectories.find(
particle.particleId());
147 if (
it != reconTrajectories.end()) {
149 m_effPlotTool.fill(m_effPlotCache,
particle,
150 it->second.hasTrackParameters());
153 m_effPlotTool.fill(m_effPlotCache,
particle,
false);