File indexing completed on 2025-01-18 09:11:49
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Validation/TrackSummaryPlotTool.hpp"
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Utilities/VectorHelpers.hpp"
0013
0014 #include <TProfile.h>
0015
0016 ActsExamples::TrackSummaryPlotTool::TrackSummaryPlotTool(
0017 const ActsExamples::TrackSummaryPlotTool::Config& cfg,
0018 Acts::Logging::Level lvl)
0019 : m_cfg(cfg),
0020 m_logger(Acts::getDefaultLogger("TrackSummaryPlotTool", lvl)) {}
0021
0022 void ActsExamples::TrackSummaryPlotTool::book(
0023 TrackSummaryPlotTool::TrackSummaryPlotCache& trackSummaryPlotCache) const {
0024 PlotHelpers::Binning bEta = m_cfg.varBinning.at("Eta");
0025 PlotHelpers::Binning bPt = m_cfg.varBinning.at("Pt");
0026 PlotHelpers::Binning bNum = m_cfg.varBinning.at("Num");
0027 ACTS_DEBUG("Initialize the histograms for track info plots");
0028
0029 trackSummaryPlotCache.nStates_vs_eta = PlotHelpers::bookProf(
0030 "nStates_vs_eta", "Number of total states vs. #eta", bEta, bNum);
0031
0032 trackSummaryPlotCache.nMeasurements_vs_eta = PlotHelpers::bookProf(
0033 "nMeasurements_vs_eta", "Number of measurements vs. #eta", bEta, bNum);
0034
0035 trackSummaryPlotCache.nHoles_vs_eta = PlotHelpers::bookProf(
0036 "nHoles_vs_eta", "Number of holes vs. #eta", bEta, bNum);
0037
0038 trackSummaryPlotCache.nOutliers_vs_eta = PlotHelpers::bookProf(
0039 "nOutliers_vs_eta", "Number of outliers vs. #eta", bEta, bNum);
0040
0041 trackSummaryPlotCache.nSharedHits_vs_eta = PlotHelpers::bookProf(
0042 "nSharedHits_vs_eta", "Number of Shared Hits vs. #eta", bEta, bNum);
0043
0044 trackSummaryPlotCache.nStates_vs_pt = PlotHelpers::bookProf(
0045 "nStates_vs_pT", "Number of total states vs. pT", bPt, bNum);
0046
0047 trackSummaryPlotCache.nMeasurements_vs_pt = PlotHelpers::bookProf(
0048 "nMeasurements_vs_pT", "Number of measurements vs. pT", bPt, bNum);
0049
0050 trackSummaryPlotCache.nHoles_vs_pt = PlotHelpers::bookProf(
0051 "nHoles_vs_pT", "Number of holes vs. pT", bPt, bNum);
0052
0053 trackSummaryPlotCache.nOutliers_vs_pt = PlotHelpers::bookProf(
0054 "nOutliers_vs_pT", "Number of outliers vs. pT", bPt, bNum);
0055
0056 trackSummaryPlotCache.nSharedHits_vs_pt = PlotHelpers::bookProf(
0057 "nSharedHits_vs_pT", "Number of Shared Hits vs. pT", bPt, bNum);
0058 }
0059
0060 void ActsExamples::TrackSummaryPlotTool::clear(
0061 TrackSummaryPlotCache& trackSummaryPlotCache) const {
0062 delete trackSummaryPlotCache.nStates_vs_eta;
0063 delete trackSummaryPlotCache.nMeasurements_vs_eta;
0064 delete trackSummaryPlotCache.nOutliers_vs_eta;
0065 delete trackSummaryPlotCache.nHoles_vs_eta;
0066 delete trackSummaryPlotCache.nSharedHits_vs_eta;
0067 delete trackSummaryPlotCache.nStates_vs_pt;
0068 delete trackSummaryPlotCache.nMeasurements_vs_pt;
0069 delete trackSummaryPlotCache.nOutliers_vs_pt;
0070 delete trackSummaryPlotCache.nHoles_vs_pt;
0071 delete trackSummaryPlotCache.nSharedHits_vs_pt;
0072 }
0073
0074 void ActsExamples::TrackSummaryPlotTool::write(
0075 const TrackSummaryPlotTool::TrackSummaryPlotCache& trackSummaryPlotCache)
0076 const {
0077 ACTS_DEBUG("Write the plots to output file.");
0078 trackSummaryPlotCache.nStates_vs_eta->Write();
0079 trackSummaryPlotCache.nMeasurements_vs_eta->Write();
0080 trackSummaryPlotCache.nOutliers_vs_eta->Write();
0081 trackSummaryPlotCache.nHoles_vs_eta->Write();
0082 trackSummaryPlotCache.nSharedHits_vs_eta->Write();
0083 trackSummaryPlotCache.nStates_vs_pt->Write();
0084 trackSummaryPlotCache.nMeasurements_vs_pt->Write();
0085 trackSummaryPlotCache.nOutliers_vs_pt->Write();
0086 trackSummaryPlotCache.nHoles_vs_pt->Write();
0087 trackSummaryPlotCache.nSharedHits_vs_pt->Write();
0088 }
0089
0090 void ActsExamples::TrackSummaryPlotTool::fill(
0091 TrackSummaryPlotTool::TrackSummaryPlotCache& trackSummaryPlotCache,
0092 const Acts::BoundTrackParameters& fittedParameters, std::size_t nStates,
0093 std::size_t nMeasurements, std::size_t nOutliers, std::size_t nHoles,
0094 std::size_t nSharedHits) const {
0095 using Acts::VectorHelpers::eta;
0096 using Acts::VectorHelpers::perp;
0097 const auto momentum = fittedParameters.momentum();
0098 const double fit_eta = eta(momentum);
0099 const double fit_pT = perp(momentum);
0100
0101 PlotHelpers::fillProf(trackSummaryPlotCache.nStates_vs_eta, fit_eta, nStates);
0102 PlotHelpers::fillProf(trackSummaryPlotCache.nMeasurements_vs_eta, fit_eta,
0103 nMeasurements);
0104 PlotHelpers::fillProf(trackSummaryPlotCache.nOutliers_vs_eta, fit_eta,
0105 nOutliers);
0106 PlotHelpers::fillProf(trackSummaryPlotCache.nHoles_vs_eta, fit_eta, nHoles);
0107 PlotHelpers::fillProf(trackSummaryPlotCache.nSharedHits_vs_eta, fit_eta,
0108 nSharedHits);
0109
0110 PlotHelpers::fillProf(trackSummaryPlotCache.nStates_vs_pt, fit_pT, nStates);
0111 PlotHelpers::fillProf(trackSummaryPlotCache.nMeasurements_vs_pt, fit_pT,
0112 nMeasurements);
0113 PlotHelpers::fillProf(trackSummaryPlotCache.nOutliers_vs_pt, fit_pT,
0114 nOutliers);
0115 PlotHelpers::fillProf(trackSummaryPlotCache.nHoles_vs_pt, fit_pT, nHoles);
0116 PlotHelpers::fillProf(trackSummaryPlotCache.nSharedHits_vs_pt, fit_pT,
0117 nSharedHits);
0118 }