ATLAS Offline Software
InDetPerfPlot_Vertex.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "InDetPerfPlot_Vertex.h"
13 #include "xAODTracking/Vertex.h"
19 
20 
21 using namespace IDPVM;
22 
23 
25  InDetPlotBase(pParent, sDir) {
26  // nop
27 }
28 
29 void
31  book(m_vx_x,"vx_x");
32  book(m_vx_y,"vx_y");
33  book(m_vx_z,"vx_z");
34  book(m_vx_time,"vx_time");
35 
36  book(m_vx_err_x,"vx_err_x");
37  book(m_vx_err_y,"vx_err_y");
38  book(m_vx_err_z,"vx_err_z");
39  book(m_vx_err_time,"vx_err_time");
40 
41  book(m_vx_chi2_over_ndf,"vx_chi2_over_ndf");
42  book(m_vx_type,"vx_type");
43 
44  book(m_vx_nTracks,"vx_nTracks");
45  book(m_vx_track_weights,"vx_track_weights");
46 
47 
48 
49  if (m_iDetailLevel >= 100) {
50  book(m_vx_track_pt,"vx_track_pt");
51  book(m_vx_track_eta,"vx_track_eta");
52  book(m_vx_track_nSiHits,"vx_track_nSiHits");
53  book(m_vx_track_nSiHoles,"vx_track_nSiHoles");
54  book(m_vx_track_d0,"vx_track_d0");
55  book(m_vx_track_err_d0,"vx_track_err_d0");
56  book(m_vx_track_z0,"vx_track_z0");
57  book(m_vx_track_err_z0,"vx_track_err_z0");
58  }
59 }
60 
61 void
63  // fill position plots
67 
68  static const SG::AuxElement::Accessor<uint8_t> accHasValidTime("hasValidTime");
69  static const SG::AuxElement::Accessor<float> accTime("time");
70  if (accHasValidTime.isAvailable(vertex) && accTime.isAvailable(vertex)) {
71  if (vertex.hasValidTime()) {
72  fillHisto(m_vx_time, vertex.time(), weight);
73  }
74  }
75 
76  // fill error plots
77  const AmgSymMatrix(3)& covariance = vertex.covariancePosition();
78  fillHisto(m_vx_err_x, Amg::error(covariance, 0), weight);
79  fillHisto(m_vx_err_y, Amg::error(covariance, 1), weight);
80  fillHisto(m_vx_err_z, Amg::error(covariance, 2), weight);
81 
82  static const SG::AuxElement::Accessor<float> accTimeResolution("timeResolution");
83  if (accHasValidTime.isAvailable(vertex) && accTimeResolution.isAvailable(vertex)) {
84  if (vertex.hasValidTime()) {
85  fillHisto(m_vx_err_time, vertex.timeResolution(), weight);
86  }
87  }
88 
89  // fill vertex quality and type
90  fillHisto(m_vx_type, vertex.vertexType(), weight);
91 
92  float ndf = vertex.numberDoF();
93  if (ndf != 0) {
94  fillHisto(m_vx_chi2_over_ndf, vertex.chiSquared() / ndf, weight);
95  } else {
97  }
98 
99  // fill vertex tracks properties
100  int nTracks = vertex.nTrackParticles();
101  fillHisto(m_vx_nTracks, nTracks, weight);
102  for (const float& trackWeight : vertex.trackWeights()) {
103  fillHisto(m_vx_track_weights, trackWeight, weight);
104  }
105 
106  // fill expert plots: tracks properties at vertex
107  if (m_iDetailLevel >= 100) {
108  // loop over tracks at vertex
109  for (const auto& elTrk : vertex.trackParticleLinks()) {
113  if (!elTrk.isValid()){
116  std::cerr << "Invalid track link on vertex. Vertex track plots will be unreliable. Please check your input format. "<<std::endl;
117  continue;
118  }
119  const xAOD::TrackParticle* trk = *elTrk;
120  fillHisto(m_vx_track_pt, trk->pt() / Gaudi::Units::GeV, weight); // MeV -> GeV
122  const xAOD::ParametersCovMatrix_t covTrk = trk->definingParametersCovMatrix();
123  fillHisto(m_vx_track_d0, trk->d0(), weight);
125  fillHisto(m_vx_track_z0, trk->z0() - vertex.z(), weight);
127  bool successfulRetrieval(false);
128  uint8_t iPixHits, iSctHits, iPixHoles, iSctHoles;
129  successfulRetrieval = trk->summaryValue(iPixHits, xAOD::numberOfPixelHits);
130  successfulRetrieval &= trk->summaryValue(iSctHits, xAOD::numberOfSCTHits);
131  if (successfulRetrieval) {
132  fillHisto(m_vx_track_nSiHits, iPixHits + iSctHits, weight);
133  }
134  successfulRetrieval = trk->summaryValue(iPixHoles, xAOD::numberOfPixelHoles);
135  successfulRetrieval &= trk->summaryValue(iSctHoles, xAOD::numberOfSCTHoles);
136  if (successfulRetrieval) {
137  fillHisto(m_vx_track_nSiHoles, iPixHoles + iSctHoles, weight);
138  }
139  }
140  }
141 }
IDPVM
Class to retrieve associated truth from a track, implementing a cached response.
Definition: InDetPhysValMonitoringTool.h:55
covarianceTool.ndf
ndf
Definition: covarianceTool.py:678
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
xAOD::numberOfPixelHoles
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
Definition: TrackingPrimitives.h:261
PlotBase::m_iDetailLevel
int m_iDetailLevel
Definition: PlotBase.h:101
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
InDetPerfPlot_Vertex::m_vx_track_nSiHoles
TH1 * m_vx_track_nSiHoles
Tracks silicon holes (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:73
InDetPlotBase::book
void book(Htype *&pHisto, const std::string &histoIdentifier, const std::string &nameOverride="", const std::string &folder="default")
Helper method to book histograms using an identifier string.
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
InDetPerfPlot_Vertex::m_vx_track_d0
TH1 * m_vx_track_d0
Tracks d0 (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:75
xAOD::TrackParticle_v1::summaryValue
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
Definition: TrackParticle_v1.cxx:736
EventPrimitivesHelpers.h
InDetPhysValMonitoringUtilities.h
InDetPerfPlot_Vertex::m_vx_track_z0
TH1 * m_vx_track_z0
Tracks z0 (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:79
InDetPerfPlot_Vertex::m_vx_type
TH1 * m_vx_type
type
Definition: InDetPerfPlot_Vertex.h:57
InDetPerfPlot_Vertex::m_vx_y
TH1 * m_vx_y
Position y.
Definition: InDetPerfPlot_Vertex.h:34
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
InDetPerfPlot_Vertex::m_vx_track_err_z0
TH1 * m_vx_track_err_z0
Tracks z0 error (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:81
InDetPerfPlot_Vertex::fill
void fill(const xAOD::Vertex &vertex, float weight)
Definition: InDetPerfPlot_Vertex.cxx:62
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
InDetPerfPlot_Vertex::m_vx_track_pt
TH1 * m_vx_track_pt
Tracks pT (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:67
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
xAOD::TrackParticle_v1::d0
float d0() const
Returns the parameter.
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
InDetPlotBase
Mixin class to give extra capabilities to plots such as ATH_MSG and an easier booking interface,...
Definition: InDetPlotBase.h:33
InDetPerfPlot_Vertex::m_vx_nTracks
TH1 * m_vx_nTracks
Definition: InDetPerfPlot_Vertex.h:63
InDetPerfPlot_Vertex::InDetPerfPlot_Vertex
InDetPerfPlot_Vertex(InDetPlotBase *pParent, const std::string &dirName)
Definition: InDetPerfPlot_Vertex.cxx:24
InDetPerfPlot_Vertex::m_vx_err_time
TH1 * m_vx_err_time
Error time.
Definition: InDetPerfPlot_Vertex.h:49
xAOD::numberOfSCTHoles
@ numberOfSCTHoles
number of SCT holes [unit8_t].
Definition: TrackingPrimitives.h:270
InDetPerfPlot_Vertex::m_vx_track_err_d0
TH1 * m_vx_track_err_d0
Tracks d0 error (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:77
Vertex.h
InDetPerfPlot_Vertex::m_vx_track_nSiHits
TH1 * m_vx_track_nSiHits
Tracks silicon hits (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:71
InDetPerfPlot_Vertex::m_vx_track_weights
TH1 * m_vx_track_weights
Distribution of tracks' weights.
Definition: InDetPerfPlot_Vertex.h:65
EventPrimitives.h
xAOD::TrackParticle_v1::definingParametersCovMatrix
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
Definition: TrackParticle_v1.cxx:246
Amg::error
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 ...
Definition: EventPrimitivesHelpers.h:40
InDetPerfPlot_Vertex::m_vx_time
TH1 * m_vx_time
Time.
Definition: InDetPerfPlot_Vertex.h:38
EventInfo.h
InDetPerfPlot_Vertex::m_vx_err_z
TH1 * m_vx_err_z
Error z.
Definition: InDetPerfPlot_Vertex.h:47
TrackParticle.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
InDetPerfPlot_Vertex::m_vx_chi2_over_ndf
TH1 * m_vx_chi2_over_ndf
Definition: InDetPerfPlot_Vertex.h:55
InDetPerfPlot_Vertex::m_vx_x
TH1 * m_vx_x
Definition: InDetPerfPlot_Vertex.h:32
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
InDetPerfPlot_Vertex::m_vx_err_x
TH1 * m_vx_err_x
Definition: InDetPerfPlot_Vertex.h:43
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
InDetPerfPlot_Vertex.h
InDetPlotBase::fillHisto
static void fillHisto(TProfile *pTprofile, const float bin, const float weight, const float weight2=1.0)
Definition: InDetPlotBase.cxx:82
InDetPerfPlot_Vertex::m_vx_track_eta
TH1 * m_vx_track_eta
Tracks eta (iDetailLevel >= 100)
Definition: InDetPerfPlot_Vertex.h:69
InDetPerfPlot_Vertex::m_vx_err_y
TH1 * m_vx_err_y
Error y.
Definition: InDetPerfPlot_Vertex.h:45
TrackParticleContainer.h
InDetPerfPlot_Vertex::initializePlots
void initializePlots()
Definition: InDetPerfPlot_Vertex.cxx:30
InDetPerfPlot_Vertex::m_vx_z
TH1 * m_vx_z
Position z.
Definition: InDetPerfPlot_Vertex.h:36