ATLAS Offline Software
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 
9 namespace 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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::SequentialVertexSmoother::smooth
virtual void smooth(xAOD::Vertex &vtx) const override
Smooth method itself: updates the tracks belonging to the VxCandidate with the knowledge of the verte...
Definition: SequentialVertexSmoother.cxx:42
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::SequentialVertexSmoother::initialize
virtual StatusCode initialize() override
default AlgTools methods
Definition: SequentialVertexSmoother.cxx:13
SequentialVertexSmoother.h
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
VxTrackAtVertex.h
Trk::SequentialVertexSmoother::~SequentialVertexSmoother
virtual ~SequentialVertexSmoother()
Trk::SequentialVertexSmoother::m_vertexTrackUpdator
ToolHandle< IVertexTrackUpdator > m_vertexTrackUpdator
Definition: SequentialVertexSmoother.h:67
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::Vertex_v1::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Definition: Vertex_v1.cxx:181
AthAlgTool
Definition: AthAlgTool.h:26
IVertexTrackUpdator.h
xAOD::Vertex_v1::vxTrackAtVertexAvailable
bool vxTrackAtVertexAvailable() const
Check if VxTrackAtVertices are attached to the object.
Definition: Vertex_v1.cxx:209
Trk::SequentialVertexSmoother::SequentialVertexSmoother
SequentialVertexSmoother(const std::string &t, const std::string &n, const IInterface *p)
constructor and destructor
Definition: SequentialVertexSmoother.cxx:28