37 m_resPlotTool(
m_cfg.resPlotToolConfig, level),
38 m_effPlotTool(
m_cfg.effPlotToolConfig, level),
39 m_trackSummaryPlotTool(
m_cfg.trackSummaryPlotToolConfig, level)
44 throw std::invalid_argument(
"Missing particles input collection");
47 throw std::invalid_argument(
"Missing hit-particles map input collection");
50 throw std::invalid_argument(
"Missing output filename");
62 throw std::invalid_argument(
"Could not open '" +
path +
"'");
72 m_resPlotTool.clear(m_resPlotCache);
73 m_effPlotTool.clear(m_effPlotCache);
74 m_trackSummaryPlotTool.clear(m_trackSummaryPlotCache);
76 if (m_outputFile !=
nullptr) {
77 m_outputFile->Close();
84 m_resPlotTool.refinement(m_resPlotCache);
86 if (m_outputFile !=
nullptr) {
88 m_resPlotTool.write(m_resPlotCache);
89 m_effPlotTool.write(m_effPlotCache);
90 m_trackSummaryPlotTool.write(m_trackSummaryPlotCache);
92 ACTS_INFO(
"Wrote performance plots to '" << m_outputFile->GetPath() <<
"'");
100 const auto&
particles = m_inputParticles(ctx);
101 const auto& hitParticlesMap = m_inputMeasurementParticlesMap(ctx);
104 std::vector<ActsFatras::Barcode> reconParticleIds;
105 reconParticleIds.reserve(
particles.size());
107 std::vector<ParticleHitCount> particleHitCounts;
110 std::lock_guard<std::mutex> lock(m_writeMutex);
113 for (
size_t itraj = 0; itraj < trajectories.size(); ++itraj) {
114 const auto& traj = trajectories[itraj];
117 const auto& trackTips = traj.tips();
118 const auto& mj = traj.multiTrajectory();
120 if (trackTips.empty()) {
121 ACTS_WARNING(
"No trajectory found for entry " << itraj);
127 if (trackTips.size() > 1) {
128 ACTS_ERROR(
"Track fitting should not result in multiple trajectories.");
129 return ProcessCode::ABORT;
132 auto trackTip = trackTips.front();
135 if (not traj.hasTrackParameters(trackTip)) {
139 const auto& fittedParameters = traj.trackParameters(trackTip);
144 if (particleHitCounts.empty()) {
145 ACTS_WARNING(
"No truth particle associated with this trajectory.");
149 const auto ip =
particles.find(particleHitCounts.front().particleId);
151 ACTS_WARNING(
"Majority particle not found in the particles collection.");
156 reconParticleIds.push_back(ip->particleId());
158 m_resPlotTool.fill(m_resPlotCache, ctx.
geoContext, *ip,
159 traj.trackParameters(trackTip));
164 m_trackSummaryPlotTool.fill(m_trackSummaryPlotCache, fittedParameters,
165 trajState.nStates, trajState.nMeasurements,
166 trajState.nOutliers, trajState.nHoles,
167 trajState.nSharedHits);
174 bool isReconstructed =
false;
176 auto it = std::find(reconParticleIds.begin(), reconParticleIds.end(),
178 if (
it != reconParticleIds.end()) {
179 isReconstructed =
true;
181 m_effPlotTool.fill(m_effPlotCache,
particle, isReconstructed);