|
ATLAS Offline Software
|
Go to the documentation of this file.
22 ATH_MSG_INFO(
"Intialized using ITrackVertexAssociationTool");
26 ATH_MSG_INFO(
"Intialized using custom track-vertex association");
27 return StatusCode::SUCCESS;
37 if(!handle_tracks.isValid()){
38 ATH_MSG_ERROR(
"Error retrieving TrackParticleContainer from evtStore: "
40 return StatusCode::FAILURE;
43 const auto *trackContainer = handle_tracks.cptr();
48 bool oneOwningContainer(
true);
49 for(
const auto *
const track : *trackContainer) {
50 if(
track->container() != trackContainer->front()->container()) {
51 oneOwningContainer=
false;
55 if(!oneOwningContainer) {
56 ATH_MSG_ERROR(
"Track view container holds track from multiple owning containers.");
58 return StatusCode::FAILURE;
65 if(!handle_vert.isValid()){
66 ATH_MSG_ERROR(
"Error retrieving VertexContainer from evtStore: "
68 return StatusCode::FAILURE;
71 const auto *vertexContainer = handle_vert.cptr();
80 return StatusCode::FAILURE;
86 if(!handle_tva.record(std::move(tva))){
87 ATH_MSG_ERROR(
"Unable to write new TrackVertexAssociation to evtStore: "
89 return StatusCode::FAILURE;
93 ATH_MSG_DEBUG(
"Wrote new TrackVertexAssociation to evtStore: "
95 return StatusCode::SUCCESS;
101 std::unique_ptr<jet::TrackVertexAssociation>
105 ATH_MSG_DEBUG(
"Building track-vertex association USING InDet tool. trk size="<< trackContainer->
size()
106 <<
" vtx size="<< vertexContainer->
size());
108 auto tva = std::make_unique<jet::TrackVertexAssociation>(trackContainer);
110 std::vector<const xAOD::Vertex*> vecVert;
111 vecVert.assign(vertexContainer->
begin(), vertexContainer->
end());
116 tva->associate(
track,
v );
123 std::unique_ptr<jet::TrackVertexAssociation>
126 ATH_MSG_DEBUG(
"Building track-vertex association trk size="<< trackContainer->
size()
127 <<
" vtx size="<< vertexContainer->
size());
129 auto tva = std::make_unique<jet::TrackVertexAssociation>(trackContainer);
131 for (
size_t iTrack = 0; iTrack < trackContainer->
size(); ++iTrack)
136 const float transverseDistance =
track->d0();
141 const float longitudinalDistance =
track->z0()+
track->vz();
146 size_t matchedIndex = 0;
147 bool foundMatch =
false;
148 for (
size_t iVertex = 0; iVertex < vertexContainer->
size(); ++iVertex)
152 double deltaz = longitudinalDistance -
vertex->z();
165 matchedIndex = iVertex;
171 tva->associate(trackContainer->
at(iTrack),vertexContainer->
at(matchedIndex));
181 std::unique_ptr<jet::TrackVertexAssociation>
184 bool useCustom)
const {
ToolHandle< CP::ITrackVertexAssociationTool > m_tvaTool
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackContainer_key
@ OWN_ELEMENTS
this data object owns its elements
::StatusCode StatusCode
StatusCode definition for legacy code.
std::unique_ptr< jet::TrackVertexAssociation > buildTrackVertexAssociation_withTool(const xAOD::TrackParticleContainer *, const xAOD::VertexContainer *) const
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
std::unique_ptr< jet::TrackVertexAssociation > buildTrackVertexAssociation_custom(const xAOD::TrackParticleContainer *, const xAOD::VertexContainer *) const
Gaudi::Property< float > m_transDistMax
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Class describing a Vertex.
StatusCode execute(const EventContext &ctx) const override
SG::WriteHandleKey< jet::TrackVertexAssociation > m_tva_key
Class describing a TrackParticle.
const T * at(size_type n) const
Access an element, as an rvalue.
StatusCode initialize() override
Athena algorithm's Hooks.
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Property< float > m_maxZ0SinTheta
std::unique_ptr< jet::TrackVertexAssociation > makeTrackVertexAssociation(const xAOD::TrackParticleContainer *, const xAOD::VertexContainer *, bool useCustom) const
Gaudi::Property< float > m_longDistMax
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.