Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
VertexParametersHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETTRACKPERFMON_VERTEXPARAMETERSHELPER_H
6 #define INDETTRACKPERFMON_VERTEXPARAMETERSHELPER_H
7 
17 #include "xAODTracking/Vertex.h"
19 #include "xAODTruth/TruthVertex.h"
20 
22 #include <cmath>
23 
24 
25 namespace IDTPM {
26 
28  template< class V >
29  inline float posX( const V& v ) { return v.x(); }
30 
32  template< class V >
33  inline float posY( const V& v ) { return v.y(); }
34 
36  template< class V >
37  inline float posZ( const V& v ) { return v.z(); }
38 
40  inline float getChiSquared( const xAOD::Vertex& v ) { return v.chiSquared(); }
41  inline float getChiSquared( const xAOD::TruthVertex& ) { return -9999; }
42  //inline float chiSquared( const V& v ) defined in TrackParametersHelper
43 
45  inline float getNdof( const xAOD::Vertex& v ) { return v.numberDoF(); }
46  inline float getNdof( const xAOD::TruthVertex& ) { return -9999; }
47  //inline float ndof( const V& v ) defined in TrackParametersHelper
48 
51  static thread_local SG::ConstAccessor< uint8_t > accHasValidTime( "hasValidTime" );
52  return accHasValidTime.isAvailable(v) ? accHasValidTime(v) : 0;
53  }
54  inline uint8_t getHasValidTime( const xAOD::TruthVertex& ) { return 1; }
55  //inline uint8_t hasValidTime( const V& v ) defined in TrackParametersHelper
56 
58  inline float getTime( const xAOD::Vertex& v ) {
59  static thread_local SG::ConstAccessor< float > accTime( "time" );
60  return accTime.isAvailable(v) ? accTime(v) : -9999.;
61  }
62  inline float getTime( const xAOD::TruthVertex& v ) { return v.t(); }
63  //inline float time( const V& v ) defined in TrackParametersHelper
64 
66  inline int getVertexType( const xAOD::Vertex& v ) { return int( v.vertexType() ); }
67  inline int getVertexType( const xAOD::TruthVertex& ) { return -1; }
68  template< class V >
69  inline int vertexType( const V& v ) { return getVertexType(v); }
70 
72  enum VposDefs : int { VposX=0, VposY=1, VposZ=2, NVpos=3 };
73 
75  inline float getCov( const xAOD::Vertex& v, VposDefs par1, VposDefs par2 ) {
76  return v.covariancePosition()( par1, par2 );
77  }
78  inline float getCov( const xAOD::TruthVertex&, VposDefs, VposDefs ) { return 0.; }
79  template< class V >
80  inline float cov( const V& v, VposDefs par1, VposDefs par2 ) { return getCov( v, par1, par2 ); }
81 
83  inline float getError( const xAOD::Vertex& v, VposDefs par ) {
84  return ( cov(v, par, par) < 0 ) ? 0. : std::sqrt( cov(v, par, par) ); }
85  inline float getError( const xAOD::TruthVertex&, VposDefs ) { return 0.; }
86  template< class V >
87  inline float error( const V& v, VposDefs par ) { return getError( v, par ); }
88 
90  inline float getTimeErr( const xAOD::Vertex& v ) {
91  static thread_local SG::ConstAccessor< float > accTimeResol( "timeResolution" );
92  return accTimeResol.isAvailable(v) ? accTimeResol(v) : -9999.;
93  }
94  inline float getTimeErr( const xAOD::TruthVertex& ) { return 0.; }
95  template< class V >
96  inline float timeErr( const V& v ) { return getTimeErr(v); }
97 
98 } // namespace IDTPM
99 
100 #endif // > ! INDETTRACKPERFMON_VERTEXPARAMETERSHELPER_H
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
IDTPM::getHasValidTime
uint8_t getHasValidTime(const xAOD::TrackParticle &p)
Accessor utility function for getting the track hasValidTime.
Definition: TrackParametersHelper.h:150
IDTPM::getTime
float getTime(const xAOD::TrackParticle &p)
Accessor utility function for getting the track time.
Definition: TrackParametersHelper.h:156
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
IDTPM::getVertexType
int getVertexType(const xAOD::Vertex &v)
Accessor utility function for getting the vertex type.
Definition: VertexParametersHelper.h:66
IDTPM::getTimeErr
float getTimeErr(const xAOD::Vertex &v)
Accessor utility function for getting the vertex time resolution.
Definition: VertexParametersHelper.h:90
IDTPM::getCov
float getCov(const xAOD::TrackParticle &p, Trk::ParamDefs par1, Trk::ParamDefs par2)
Accessor utility function for getting the track parameters covariance.
Definition: TrackParametersHelper.h:162
IDTPM::getError
float getError(const xAOD::TrackParticle &p, Trk::ParamDefs par)
Accessor utility function for getting the track parameters error.
Definition: TrackParametersHelper.h:170
IDTPM::posY
float posY(const V &v)
Accessor utility function for getting the value of vertex position y.
Definition: VertexParametersHelper.h:33
IDTPM::cov
float cov(const U &p, Trk::ParamDefs par1, Trk::ParamDefs par2)
Definition: TrackParametersHelper.h:166
IDTPM::VposDefs
VposDefs
enum for vertex position
Definition: VertexParametersHelper.h:72
IDTPM::posZ
float posZ(const V &v)
Accessor utility function for getting the value of vertex position z.
Definition: VertexParametersHelper.h:37
Vertex.h
IDTPM::VposX
@ VposX
Definition: VertexParametersHelper.h:72
IDTPM::timeErr
float timeErr(const V &v)
Definition: VertexParametersHelper.h:96
TruthVertex.h
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
IDTPM::posX
float posX(const V &v)
Accessor utility function for getting the value of vertex position x.
Definition: VertexParametersHelper.h:29
IDTPM::getChiSquared
float getChiSquared(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of chi^2.
Definition: TrackParametersHelper.h:125
IDTPM::VposY
@ VposY
Definition: VertexParametersHelper.h:72
python.PyAthena.v
v
Definition: PyAthena.py:154
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
IDTPM::vertexType
int vertexType(const V &v)
Definition: VertexParametersHelper.h:69
IDTPM::error
float error(const U &p, Trk::ParamDefs par)
Definition: TrackParametersHelper.h:174
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
IDTPM::NVpos
@ NVpos
Definition: VertexParametersHelper.h:72
IDTPM::getNdof
float getNdof(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of #dof.
Definition: TrackParametersHelper.h:131
IDTPM::VposZ
@ VposZ
Definition: VertexParametersHelper.h:72