ATLAS Offline Software
Loading...
Searching...
No Matches
SequentialVertexSmoother.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9namespace Trk
10{
11
12//tool-related methods
14 {
15
16//uploading the corresponding tools
17 if ( m_vertexTrackUpdator.retrieve().isFailure() ) {
18 msg(MSG::FATAL) << "Failed to retrieve tool " << m_vertexTrackUpdator << endmsg;
19 return StatusCode::FAILURE;
20 }
21 msg(MSG::INFO) << "Retrieved tool " << m_vertexTrackUpdator << endmsg;
22
23 return StatusCode::SUCCESS;
24 }//end of initialize method
25
26
27 //class constructor
28 SequentialVertexSmoother::SequentialVertexSmoother(const std::string& t, const std::string& n, const IInterface* p):
29 AthAlgTool(t,n,p),
30 m_vertexTrackUpdator("Trk::KalmanVertexTrackUpdator", this)
31 {
32 declareProperty("VertexTrackUpdator",m_vertexTrackUpdator);
33 declareInterface<IVertexSmoother>(this);
34 }//end of constructor description
35
36 //class destructor empty so far
38
39 //smooth method itself
40 // Had to make the vtx non-const because xAOD::Vertex stores
41 // Trk::VxTrackAtVertex and not Trk::VxTrackAtVertex*
43 {
44
45 //vector of associated tracks at vertex:
46 //protection check whether vxTrackAtVertices are attached to the object
47 if( vtx.vxTrackAtVertexAvailable() ) //TODO: is this the right thing to check?
48 {
49 std::vector<Trk::VxTrackAtVertex> & tracks = vtx.vxTrackAtVertex();
50
51 //updating the tracks one by one
52 if(!tracks.empty())
53 {
54 for(auto & track : tracks)
55 {
56 //TODO: There were previously null pointer checks on both the contents and vector itself
57 // of std::vector<Trk::VxTrackAtVertex*>* in VxCandidate
58 // but now in xAOD::Vertex, there is only a std::vector<Trk::VxTrackAtVertex> so
59 // pointer checks are not possible
60 //
61 // -David S.
62 m_vertexTrackUpdator->update( track, vtx );
63 }//end of loop over all tracks in particular vertex
64 }
65 else{
66
67 //something wrong: notification to user
68 msg(MSG::ERROR) << "Vertex to be smoothed containes no tracks!" << endmsg;
69 msg(MSG::ERROR) << "No action taken; Initial xAOD::Vertex returned." << endmsg;
70 }//end of protection statement
71 }else{
72 msg(MSG::ERROR) << "Vertex to be smoothed has no vxTrackAtVertices available!" << endmsg;
73 msg(MSG::ERROR) << "No action taken; Initial xAOD::Vertex returned." << endmsg;
74 }//end of protection check whether vxTrackAtVertices are attached to the object
75 }//end of smooth method
76
77}//end of the namespace definitions
#define endmsg
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
MsgStream & msg() const
virtual void smooth(xAOD::Vertex &vtx) const override
Smooth method itself: updates the tracks belonging to the VxCandidate with the knowledge of the verte...
SequentialVertexSmoother(const std::string &t, const std::string &n, const IInterface *p)
constructor and destructor
ToolHandle< IVertexTrackUpdator > m_vertexTrackUpdator
virtual StatusCode initialize() override
default AlgTools methods
bool vxTrackAtVertexAvailable() const
Check if VxTrackAtVertices are attached to the object.
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Ensure that the ATLAS eigen extensions are properly loaded.
Vertex_v1 Vertex
Define the latest version of the vertex class.