Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackSummaryPlotTool.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackSummaryPlotTool.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
13 
14 #include <TProfile.h>
15 
19  : m_cfg(cfg),
20  m_logger(Acts::getDefaultLogger("TrackSummaryPlotTool", lvl)) {}
21 
23  TrackSummaryPlotTool::TrackSummaryPlotCache& trackSummaryPlotCache) const {
24  PlotHelpers::Binning bEta = m_cfg.varBinning.at("Eta");
25  PlotHelpers::Binning bPt = m_cfg.varBinning.at("Pt");
26  PlotHelpers::Binning bNum = m_cfg.varBinning.at("Num");
27  ACTS_DEBUG("Initialize the histograms for track info plots");
28  // number of track states versus eta
29  trackSummaryPlotCache.nStates_vs_eta = PlotHelpers::bookProf(
30  "nStates_vs_eta", "Number of total states vs. #eta", bEta, bNum);
31  // number of measurements versus eta
32  trackSummaryPlotCache.nMeasurements_vs_eta = PlotHelpers::bookProf(
33  "nMeasurements_vs_eta", "Number of measurements vs. #eta", bEta, bNum);
34  // number of holes versus eta
35  trackSummaryPlotCache.nHoles_vs_eta = PlotHelpers::bookProf(
36  "nHoles_vs_eta", "Number of holes vs. #eta", bEta, bNum);
37  // number of outliers versus eta
38  trackSummaryPlotCache.nOutliers_vs_eta = PlotHelpers::bookProf(
39  "nOutliers_vs_eta", "Number of outliers vs. #eta", bEta, bNum);
40  // number of Shared Hits versus eta
41  trackSummaryPlotCache.nSharedHits_vs_eta = PlotHelpers::bookProf(
42  "nSharedHits_vs_eta", "Number of Shared Hits vs. #eta", bEta, bNum);
43  // number of track states versus pt
44  trackSummaryPlotCache.nStates_vs_pt = PlotHelpers::bookProf(
45  "nStates_vs_pT", "Number of total states vs. pT", bPt, bNum);
46  // number of measurements versus pt
47  trackSummaryPlotCache.nMeasurements_vs_pt = PlotHelpers::bookProf(
48  "nMeasurements_vs_pT", "Number of measurements vs. pT", bPt, bNum);
49  // number of holes versus pt
50  trackSummaryPlotCache.nHoles_vs_pt = PlotHelpers::bookProf(
51  "nHoles_vs_pT", "Number of holes vs. pT", bPt, bNum);
52  // number of outliers versus pt
53  trackSummaryPlotCache.nOutliers_vs_pt = PlotHelpers::bookProf(
54  "nOutliers_vs_pT", "Number of outliers vs. pT", bPt, bNum);
55  // number of Shared Hits versus pt
56  trackSummaryPlotCache.nSharedHits_vs_pt = PlotHelpers::bookProf(
57  "nSharedHits_vs_pT", "Number of Shared Hits vs. pT", bPt, bNum);
58 }
59 
61  TrackSummaryPlotCache& trackSummaryPlotCache) const {
62  delete trackSummaryPlotCache.nStates_vs_eta;
63  delete trackSummaryPlotCache.nMeasurements_vs_eta;
64  delete trackSummaryPlotCache.nOutliers_vs_eta;
65  delete trackSummaryPlotCache.nHoles_vs_eta;
66  delete trackSummaryPlotCache.nSharedHits_vs_eta;
67  delete trackSummaryPlotCache.nStates_vs_pt;
68  delete trackSummaryPlotCache.nMeasurements_vs_pt;
69  delete trackSummaryPlotCache.nOutliers_vs_pt;
70  delete trackSummaryPlotCache.nHoles_vs_pt;
71  delete trackSummaryPlotCache.nSharedHits_vs_pt;
72 }
73 
75  const TrackSummaryPlotTool::TrackSummaryPlotCache& trackSummaryPlotCache)
76  const {
77  ACTS_DEBUG("Write the plots to output file.");
78  trackSummaryPlotCache.nStates_vs_eta->Write();
79  trackSummaryPlotCache.nMeasurements_vs_eta->Write();
80  trackSummaryPlotCache.nOutliers_vs_eta->Write();
81  trackSummaryPlotCache.nHoles_vs_eta->Write();
82  trackSummaryPlotCache.nSharedHits_vs_eta->Write();
83  trackSummaryPlotCache.nStates_vs_pt->Write();
84  trackSummaryPlotCache.nMeasurements_vs_pt->Write();
85  trackSummaryPlotCache.nOutliers_vs_pt->Write();
86  trackSummaryPlotCache.nHoles_vs_pt->Write();
87  trackSummaryPlotCache.nSharedHits_vs_pt->Write();
88 }
89 
91  TrackSummaryPlotTool::TrackSummaryPlotCache& trackSummaryPlotCache,
92  const Acts::BoundTrackParameters& fittedParameters, size_t nStates,
93  size_t nMeasurements, size_t nOutliers, size_t nHoles,
94  size_t nSharedHits) const {
97  const auto momentum = fittedParameters.momentum();
98  const double fit_eta = eta(momentum);
99  const double fit_pT = perp(momentum);
100 
101  PlotHelpers::fillProf(trackSummaryPlotCache.nStates_vs_eta, fit_eta, nStates);
102  PlotHelpers::fillProf(trackSummaryPlotCache.nMeasurements_vs_eta, fit_eta,
103  nMeasurements);
104  PlotHelpers::fillProf(trackSummaryPlotCache.nOutliers_vs_eta, fit_eta,
105  nOutliers);
106  PlotHelpers::fillProf(trackSummaryPlotCache.nHoles_vs_eta, fit_eta, nHoles);
107  PlotHelpers::fillProf(trackSummaryPlotCache.nSharedHits_vs_eta, fit_eta,
108  nSharedHits);
109 
110  PlotHelpers::fillProf(trackSummaryPlotCache.nStates_vs_pt, fit_pT, nStates);
111  PlotHelpers::fillProf(trackSummaryPlotCache.nMeasurements_vs_pt, fit_pT,
112  nMeasurements);
113  PlotHelpers::fillProf(trackSummaryPlotCache.nOutliers_vs_pt, fit_pT,
114  nOutliers);
115  PlotHelpers::fillProf(trackSummaryPlotCache.nHoles_vs_pt, fit_pT, nHoles);
116  PlotHelpers::fillProf(trackSummaryPlotCache.nSharedHits_vs_pt, fit_pT,
117  nSharedHits);
118 }