ATLAS Offline Software
Loading...
Searching...
No Matches
DummyVertexSmoother.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*********************************************************************
6 DummyVertexSmoother.cxx - Description in header file
7*********************************************************************/
8
14
15namespace Trk
16{
17
18 DummyVertexSmoother::DummyVertexSmoother(const std::string& t, const std::string& n, const IInterface* p) :
19 AthAlgTool(t,n,p), m_extrapolator(nullptr), m_extrapolatorName("Trk::Extrapolator"), m_extrapolatorInstance("InDetExtrapolator")
20 {
21 declareProperty("ExtrapolatorName", m_extrapolatorName);
22 declareProperty("ExtrapolatorInstance", m_extrapolatorInstance);
23 declareInterface<IVertexSmoother>(this);
24 }
25
27
29 {
30 StatusCode sc = AlgTool::initialize();
32 if (sc.isFailure())
33 {
34 msg(MSG::FATAL)<<"Could not find extrapolator tool." << endmsg;
35 return sc;
36 }
37 msg(MSG::INFO) << "Initialize successful" << endmsg;
38 return StatusCode::SUCCESS;
39 }
40
42 {
43 msg(MSG::INFO) << "Initialize successful" << endmsg;
44 return StatusCode::SUCCESS;
45 }
46
47 // Had to make the vtx non-const because xAOD::Vertex stores
48 // Trk::VxTrackAtVertex and not Trk::VxTrackAtVertex*
50 {
51
52 //vector of associated tracks at vertex:
53 if( vtx.vxTrackAtVertexAvailable() ) //TODO: is this the right thing to check?
54 {
55 std::vector<Trk::VxTrackAtVertex> & tracks = vtx.vxTrackAtVertex();
56
57 if(!tracks.empty())
58 {
59 //iteratively updating private members of VxTrackAtVertex
60 std::vector<Trk::VxTrackAtVertex>::iterator t_it = tracks.begin();
61 std::vector<Trk::VxTrackAtVertex>::iterator te = tracks.end();
62 for( ;t_it != te;++t_it)
63 {
64
65 //TODO: There were previously null pointer checks on both the contents and vector itself
66 // of std::vector<Trk::VxTrackAtVertex*>* in VxCandidate
67 // but now in xAOD::Vertex, there is only a std::vector<Trk::VxTrackAtVertex> so
68 // pointer checks are not possible
69 //
70 // -David S.
71
72 //now the extrapolation will happen anyway, creating the surface
73 PerigeeSurface perigeeSurface(vtx.position());
74 const Trk::TrackParameters * initPar = (*t_it).initialPerigee();
75
76 if(initPar != nullptr)
77 {
78 //Either we should return non-const parameters from the extrapolator
79 //as the owner here has to delete them
80 //Or we need to clone
81 auto extrapolatedPerigee =
82 std::unique_ptr<const Trk::TrackParameters>(m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
83 *initPar,
84 perigeeSurface));
85 if (extrapolatedPerigee != nullptr) {
86 (*t_it).setPerigeeAtVertex(extrapolatedPerigee->clone());
87 } else {
88 msg(MSG::ERROR) << " Extrapolation failed; VxTrackAtertex will not be updated" << endmsg;
89 } // end of successfull extrapolation check
90 } else {
91 msg(MSG::WARNING) << " The VxTrackAtVertex passed has no initial Parameters? This track will not be refitted" << endmsg;
92 }//end of initial parameters protection check
93
94 }//end of loop over all fitted tracks
95 } else {
96 msg(MSG::ERROR) << "xAOD::Vertex with empty vector of tracks is passed to the Vertex Smoother" << endmsg;
97 msg(MSG::ERROR) << "No action taken; Input xAOD::Vertex stays unchanged " << endmsg;
98 }//end of empty vector check
99
100 } else {
101 msg(MSG::ERROR) << "Vertex to be smoothed has no vxTrackAtVertices available!" << endmsg;
102 msg(MSG::ERROR) << "No action taken; Initial xAOD::Vertex returned." << endmsg;
103 }//end of protection check whether vxTrackAtVertices are attached to the object
104 }//end of smooth method
105
106}//end of namespace definitions
#define endmsg
static Double_t sc
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
StatusCode initialize()
Athena default methods.
void smooth(xAOD::Vertex &vtx) const
Actual smooth method.
Trk::IExtrapolator * m_extrapolator
DummyVertexSmoother(const std::string &t, const std::string &n, const IInterface *p)
Constructor and destructor.
Class describing the Line to which the Perigee refers to.
bool vxTrackAtVertexAvailable() const
Check if VxTrackAtVertices are attached to the object.
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
const Amg::Vector3D & position() const
Returns the 3-pos.
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersBase< TrackParametersDim, Charged > TrackParameters
Vertex_v1 Vertex
Define the latest version of the vertex class.