ATLAS Offline Software
Loading...
Searching...
No Matches
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
16
18#include "xAODTracking/Vertex.h"
20
22#include <cmath>
23
24
25namespace 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
50 inline uint8_t getHasValidTime( const xAOD::Vertex& v ) {
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
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Athena include(s).
float getTime(const xAOD::TrackParticle &p)
Accessor utility function for getting the track time.
VposDefs
enum for vertex position
uint8_t getHasValidTime(const xAOD::TrackParticle &p)
Accessor utility function for getting the track hasValidTime.
float getTimeErr(const xAOD::Vertex &v)
Accessor utility function for getting the vertex time resolution.
float posX(const V &v)
Accessor utility function for getting the value of vertex position x.
float posZ(const V &v)
Accessor utility function for getting the value of vertex position z.
float getError(const xAOD::TrackParticle &p, Trk::ParamDefs par)
Accessor utility function for getting the track parameters error.
float getNdof(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of dof.
float posY(const V &v)
Accessor utility function for getting the value of vertex position y.
float getChiSquared(const xAOD::TrackParticle &p)
Accessor utility function for getting the value of chi^2.
float timeErr(const V &v)
float getCov(const xAOD::TrackParticle &p, Trk::ParamDefs par1, Trk::ParamDefs par2)
Accessor utility function for getting the track parameters covariance.
int getVertexType(const xAOD::Vertex &v)
Accessor utility function for getting the vertex type.
float cov(const U &p, Trk::ParamDefs par1, Trk::ParamDefs par2)
int vertexType(const V &v)
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
Vertex_v1 Vertex
Define the latest version of the vertex class.