58 {
59
60
61 SG::ReadHandle<xAOD::TrackParticleContainer> tracks(
m_containerName, ctx );
62 if( ! tracks.isValid() ) {
64 return StatusCode::FAILURE;
65 }
66 SG::ReadHandle<xAOD::VertexContainer> vertices {
m_vertexKey, ctx };
68 {
70 return StatusCode::FAILURE;
71 }
72
73 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer,float> >
75
76 for (const auto *trItr : *tracks) {
77 std::unique_ptr<Trk::ImpactParametersAndSigma> iPandSigma;
78 std::unique_ptr<Trk::ImpactParametersAndSigma> iPandSigmaBiased;
80 for (const auto *const vx : *vertices) {
81 for (const auto& tpLink : vx->trackParticleLinks()) {
82 if (*tpLink == trItr) {
83 foundVertex = vx;
84 break;
85 }
86 }
87 if (foundVertex) break;
88 }
89 if ( foundVertex ) {
90 iPandSigma=
m_tool->estimate(trItr,foundVertex,
true);
91 iPandSigmaBiased =
m_tool->estimate(trItr,foundVertex,
false);
92 if( !iPandSigma )
ATH_MSG_WARNING (
"trackToVertexIPEstimator failed !");
93 if( !iPandSigmaBiased )
ATH_MSG_WARNING (
"trackToVertexIPEstimator biased IP failed !");
94 }
95 else {
96 ATH_MSG_DEBUG(
"No vertex associated to the track. Skipping it.");
97 }
98
99
100 if (iPandSigma) {
101 track_decorators[
kdecnD0Decor]( *trItr ) = iPandSigma->IPd0;
102 track_decorators[
kdecnZ0Decor]( *trItr ) = iPandSigma->IPz0;
110 }
111 else {
121 }
122
123 if (iPandSigmaBiased) {
133 }
134 else {
144 }
145 }
146
147 return StatusCode::SUCCESS;
148 }
#define ATH_MSG_WARNING(x)
ToolHandle< Trk::ITrackToVertexIPEstimator > m_tool
std::vector< SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > > m_trackFloatDecorKeys
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_containerName
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::vector< SG::WriteDecorHandle< T_Cont, T > > createDecorators(const std::vector< SG::WriteDecorHandleKey< T_Cont > > &keys, const EventContext &ctx)
Vertex_v1 Vertex
Define the latest version of the vertex class.