ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPerfPlot_Vertex.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
9
13#include "xAODTracking/Vertex.h"
19
20
21using namespace IDPVM;
22
23
25(InDetPlotBase* pParent, const std::string& sDir,
26 bool isITk, bool doTrackVertexPlots) :
27 InDetPlotBase(pParent, sDir), m_isITk(isITk),
28 m_doTrackVertexPlots(doTrackVertexPlots) {
29 // nop
30}
31
32void
34 book(m_vx_x,"vx_x");
35 book(m_vx_y,"vx_y");
36 book(m_vx_z,"vx_z");
37 if(m_isITk) book(m_vx_time,"vx_time");
38
39 book(m_vx_err_x,"vx_err_x");
40 book(m_vx_err_y,"vx_err_y");
41 book(m_vx_err_z,"vx_err_z");
42 if(m_isITk) book(m_vx_err_time,"vx_err_time");
43
44 book(m_vx_chi2_over_ndf,"vx_chi2_over_ndf");
45 book(m_vx_type,"vx_type");
46
47 book(m_vx_nTracks,"vx_nTracks");
48 book(m_vx_track_weights,"vx_track_weights");
49
51 book(m_vx_track_pt,"vx_track_pt");
52 book(m_vx_track_eta,"vx_track_eta");
53 book(m_vx_track_nSiHits,"vx_track_nSiHits");
54 book(m_vx_track_nSiHoles,"vx_track_nSiHoles");
55 book(m_vx_track_d0,"vx_track_d0");
56 book(m_vx_track_err_d0,"vx_track_err_d0");
57 book(m_vx_track_z0,"vx_track_z0");
58 book(m_vx_track_err_z0,"vx_track_err_z0");
59 }
60}
61
62void
63InDetPerfPlot_Vertex::fill(const xAOD::Vertex& vertex, float weight) {
64 // fill position plots
65 fillHisto(m_vx_x, vertex.x(), weight);
66 fillHisto(m_vx_y, vertex.y(), weight);
67 fillHisto(m_vx_z, vertex.z(), weight);
68
69 // fill error plots
70 const AmgSymMatrix(3)& covariance = vertex.covariancePosition();
71 fillHisto(m_vx_err_x, Amg::error(covariance, 0), weight);
72 fillHisto(m_vx_err_y, Amg::error(covariance, 1), weight);
73 fillHisto(m_vx_err_z, Amg::error(covariance, 2), weight);
74
75 if(m_isITk){
76 static const SG::Accessor<uint8_t> accHasValidTime("hasValidTime");
77 static const SG::Accessor<float> accTime("time");
78 if (accHasValidTime.isAvailable(vertex) && accTime.isAvailable(vertex)) {
79 if (vertex.hasValidTime()) {
80 fillHisto(m_vx_time, vertex.time(), weight);
81 }
82 }
83
84 static const SG::Accessor<float> accTimeResolution("timeResolution");
85 if (accHasValidTime.isAvailable(vertex) && accTimeResolution.isAvailable(vertex)) {
86 if (vertex.hasValidTime()) {
87 fillHisto(m_vx_err_time, vertex.timeResolution(), weight);
88 }
89 }
90 }
91
92 // fill vertex quality and type
93 fillHisto(m_vx_type, vertex.vertexType(), weight);
94
95 float ndf = vertex.numberDoF();
96 if (ndf != 0) {
97 fillHisto(m_vx_chi2_over_ndf, vertex.chiSquared() / ndf, weight);
98 } else {
99 fillHisto(m_vx_chi2_over_ndf, -1, weight);
100 }
101
102 // fill vertex tracks properties
103 int nTracks = vertex.nTrackParticles();
104 fillHisto(m_vx_nTracks, nTracks, weight);
105 for (const float& trackWeight : vertex.trackWeights()) {
106 fillHisto(m_vx_track_weights, trackWeight, weight);
107 }
108
109 // fill expert plots: tracks properties at vertex
111 // loop over tracks at vertex
112 for (const auto& elTrk : vertex.trackParticleLinks()) {
116 if (!elTrk.isValid()){
119 std::cerr << "Invalid track link on vertex. Vertex track plots will be unreliable. Please check your input format. "<<std::endl;
120 continue;
121 }
122 const xAOD::TrackParticle* trk = *elTrk;
123 fillHisto(m_vx_track_pt, trk->pt() / Gaudi::Units::GeV, weight); // MeV -> GeV
124 fillHisto(m_vx_track_eta, trk->eta(), weight);
126 fillHisto(m_vx_track_d0, trk->d0(), weight);
127 fillHisto(m_vx_track_err_d0, Amg::error(covTrk, 0), weight);
128 fillHisto(m_vx_track_z0, trk->z0() - vertex.z(), weight);
129 fillHisto(m_vx_track_err_z0, Amg::error(covTrk, 1), weight);
130 bool successfulRetrieval(false);
131 uint8_t iPixHits, iSctHits, iPixHoles, iSctHoles;
132 successfulRetrieval = trk->summaryValue(iPixHits, xAOD::numberOfPixelHits);
133 successfulRetrieval &= trk->summaryValue(iSctHits, xAOD::numberOfSCTHits);
134 if (successfulRetrieval) {
135 fillHisto(m_vx_track_nSiHits, iPixHits + iSctHits, weight);
136 }
137 successfulRetrieval = trk->summaryValue(iPixHoles, xAOD::numberOfPixelHoles);
138 successfulRetrieval &= trk->summaryValue(iSctHoles, xAOD::numberOfSCTHoles);
139 if (successfulRetrieval) {
140 fillHisto(m_vx_track_nSiHoles, iPixHoles + iSctHoles, weight);
141 }
142 }
143 }
144}
#define AmgSymMatrix(dim)
TH1 * m_vx_track_z0
Tracks z0 (iDetailLevel >= 100).
TH1 * m_vx_track_err_z0
Tracks z0 error (iDetailLevel >= 100).
TH1 * m_vx_track_eta
Tracks eta (iDetailLevel >= 100).
TH1 * m_vx_track_d0
Tracks d0 (iDetailLevel >= 100).
InDetPerfPlot_Vertex(InDetPlotBase *pParent, const std::string &dirName, bool isITk, bool doTrackVertexPlots)
TH1 * m_vx_track_pt
Tracks pT (iDetailLevel >= 100).
TH1 * m_vx_track_nSiHits
Tracks silicon hits (iDetailLevel >= 100).
TH1 * m_vx_track_nSiHoles
Tracks silicon holes (iDetailLevel >= 100).
TH1 * m_vx_track_weights
Distribution of tracks' weights.
TH1 * m_vx_track_err_d0
Tracks d0 error (iDetailLevel >= 100).
void fill(const xAOD::Vertex &vertex, float weight)
TH1 * m_vx_err_time
Error time.
static void fillHisto(TProfile *pTprofile, const float bin, const float weight, const float weight2=1.0)
InDetPlotBase(InDetPlotBase *pParent, const std::string &dirName)
Constructor taking parent node and directory name for plots.
void book(Htype *&pHisto, std::string_view histoIdentifier, std::string_view nameOverride="", std::string_view folder="default")
Helper method to book histograms using an identifier string.
Helper class to provide type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
float z0() const
Returns the parameter.
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float d0() const
Returns the parameter.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Class to retrieve associated truth from a track, implementing a cached response.
AmgSymMatrix(5) ParametersCovMatrix_t
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].