ATLAS Offline Software
SecVtxValidationPlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "TVector3.h"
9 #include "AthenaKernel/Units.h"
10 
11 using Athena::Units::GeV;
12 
14  const std::string& sDir)
15  : PlotBase(pParent, sDir)
16 {
17  // position
18  m_vertex_x = Book1D("x", "Vertex_x;x [mm];Entries;", 300, -300, 300, false);
19  m_vertex_y = Book1D("y", "Vertex_y;y [mm];Entries;", 300, -300, 300, false);
20  m_vertex_z = Book1D("z", "Vertex_z;z [mm];Entries;", 300, -300, 300, false);
21  m_vertex_r = Book1D("r", "Vertex_r;r [mm];Entries;", 300, 0, 300, false);
22 
23  // four vector
24  m_vertex_pt = Book1D("pt", "Vertex_pt;p_{T} [GeV];Entries;", 100, 0, 100, false);
25  m_vertex_eta = Book1D("eta", "Vertex_eta;#eta;Entries;", 50, -2.5, 2.5, false);
26  m_vertex_phi = Book1D("phi", "Vertex_phi;#phi;Entries;", 64, -3.2, 3.2, false);
27  m_vertex_m = Book1D("m", "Vertex_m;m [GeV];Entries;", 100, 0, 100, false);
28 
29  // misc
30  m_vertex_ntrk = Book1D("ntrk", "Vertex_ntrk;n_{trk};Entries;", 20, 0, 20, false);
31  m_vertex_chi2 = Book1D("chi2", "Vertex_chi2;#chi^{2}/n_{DoF};Entries;", 50, 0, 10, false);
32  m_vertex_charge = Book1D("charge", "Vertex_charge;charge;Entries;", 20, -10, 10, false);
33  m_vertex_mind0 = Book1D("mind0", "Vertex_mind0;d_{0,min} [mm];Entries;", 100, 0, 10, false);
34  m_vertex_maxd0 = Book1D("maxd0", "Vertex_maxd0;d_{0,max} [mm];Entries;", 300, 0, 300, false);
35 }
36 
38 
39  TVector3 vtx_pos(secVtx->x(), secVtx->y(), secVtx->z());
40  float vtx_r = vtx_pos.Perp();
41 
42  xAOD::Vertex::ConstAccessor<float> Chi2("chiSquared");
43  xAOD::Vertex::ConstAccessor<float> nDoF("numberDoF");
45 
46  float minD0 = 1.0 * 1.e4;
47  float maxD0 = 0.0;
48  int charge = 0;
49 
50  const xAOD::Vertex::TrackParticleLinks_t & trkParts = trkAcc( *secVtx );
51 
52  size_t ntrk = trkParts.size();
53  TLorentzVector sumP4(0,0,0,0);
54 
55  for (const auto &trklink : trkParts) {
56  if (!trklink.isValid()) {
57  continue;
58  }
59  const xAOD::TrackParticle & trk = **trklink;
60 
61  double trk_d0 = std::abs(trk.definingParameters()[0]);
62  if(trk_d0 < minD0){ minD0 = trk_d0; }
63  if(trk_d0 > maxD0){ maxD0 = trk_d0; }
64 
66  xAOD::TrackParticle::ConstAccessor< float > etaAcc( "eta_wrtSV" );
67  xAOD::TrackParticle::ConstAccessor< float > phiAcc( "phi_wrtSV" );
68 
69  TLorentzVector trk_P4;
70  trk_P4.SetPtEtaPhiM(ptAcc(trk), etaAcc(trk), phiAcc(trk), trk.p4().M());
71 
72  sumP4 += trk_P4;
73  charge += trk.charge();
74  }
75 
76  m_vertex_x->Fill(secVtx->x());
77  m_vertex_y->Fill(secVtx->y());
78  m_vertex_z->Fill(secVtx->z());
79  m_vertex_r->Fill(vtx_r);
80  m_vertex_pt->Fill(sumP4.Pt() / GeV); // GeV
81  m_vertex_eta->Fill(sumP4.Eta());
82  m_vertex_phi->Fill(sumP4.Phi());
83  m_vertex_m->Fill(sumP4.M() / GeV); // GeV
84  m_vertex_ntrk->Fill(ntrk);
85  m_vertex_chi2->Fill(Chi2(*secVtx)/nDoF(*secVtx));
86  m_vertex_charge->Fill(charge);
87  m_vertex_mind0->Fill(minD0);
88  m_vertex_maxd0->Fill(maxD0);
89 
90 }
SecVtxValidationPlots::m_vertex_z
TH1 * m_vertex_z
Definition: SecVtxValidationPlots.h:29
xAOD::Vertex_v1::x
float x() const
Returns the x position.
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
SecVtxValidationPlots::m_vertex_eta
TH1 * m_vertex_eta
Definition: SecVtxValidationPlots.h:34
PlotBase
Definition: PlotBase.h:34
SecVtxValidationPlots::m_vertex_x
TH1 * m_vertex_x
Definition: SecVtxValidationPlots.h:27
SecVtxValidationPlots::m_vertex_charge
TH1 * m_vertex_charge
Definition: SecVtxValidationPlots.h:41
xAOD::TrackParticle_v1::charge
float charge() const
Returns the charge.
Definition: TrackParticle_v1.cxx:150
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
SecVtxValidationPlots::m_vertex_maxd0
TH1 * m_vertex_maxd0
Definition: SecVtxValidationPlots.h:43
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
PlotBase::Book1D
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition: PlotBase.cxx:94
xAOD::TrackParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TrackParticle_v1.cxx:129
SecVtxValidationPlots::m_vertex_phi
TH1 * m_vertex_phi
Definition: SecVtxValidationPlots.h:35
SecVtxValidationPlots::m_vertex_ntrk
TH1 * m_vertex_ntrk
Definition: SecVtxValidationPlots.h:39
SecVtxValidationPlots::m_vertex_mind0
TH1 * m_vertex_mind0
Definition: SecVtxValidationPlots.h:42
xAOD::Vertex_v1::TrackParticleLinks_t
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
Type for the associated track particles.
Definition: Vertex_v1.h:128
xAOD::Vertex_v1::z
float z() const
Returns the z position.
SecVtxValidationPlots::m_vertex_y
TH1 * m_vertex_y
Definition: SecVtxValidationPlots.h:28
SecVtxValidationPlots::m_vertex_m
TH1 * m_vertex_m
Definition: SecVtxValidationPlots.h:36
charge
double charge(const T &p)
Definition: AtlasPID.h:756
Units.h
Wrapper to avoid constant divisions when using units.
xAOD::TrackParticle_v1::definingParameters
DefiningParameters_t definingParameters() const
Returns a SVector of the Perigee track parameters.
Definition: TrackParticle_v1.cxx:171
TrackParticle.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
SecVtxValidationPlots::m_vertex_r
TH1 * m_vertex_r
Definition: SecVtxValidationPlots.h:30
xAOD::Vertex_v1::y
float y() const
Returns the y position.
SecVtxValidationPlots.h
SecVtxValidationPlots::m_vertex_chi2
TH1 * m_vertex_chi2
Definition: SecVtxValidationPlots.h:40
SecVtxValidationPlots::SecVtxValidationPlots
SecVtxValidationPlots(PlotBase *pParent, const std::string &sDir)
Standard Constructor.
Definition: SecVtxValidationPlots.cxx:13
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
SecVtxValidationPlots::m_vertex_pt
TH1 * m_vertex_pt
Definition: SecVtxValidationPlots.h:33
TrackParticleContainer.h
SecVtxValidationPlots::fill
void fill(const xAOD::Vertex *secVtx)
fill the histograms
Definition: SecVtxValidationPlots.cxx:37