38 ATH_MSG_INFO(
"Intialized using ITrackVertexAssociationTool");
42 ATH_MSG_INFO(
"Intialized using custom track-vertex association");
43 return StatusCode::SUCCESS;
51 if(!handle_tracks.isValid()){
52 ATH_MSG_ERROR(
"Error retrieving TrackParticleContainer from evtStore: "
57 const auto *trackContainer = handle_tracks.cptr();
62 bool oneOwningContainer(
true);
64 if(track->container() != trackContainer->front()->container()) {
65 oneOwningContainer=
false;
69 if(!oneOwningContainer) {
70 ATH_MSG_ERROR(
"Track view container holds track from multiple owning containers.");
79 if(!handle_vert.isValid()){
80 ATH_MSG_ERROR(
"Error retrieving VertexContainer from evtStore: "
85 const auto *vertexContainer = handle_vert.cptr();
101 if(!handle_tva.record(std::move(tva))){
102 ATH_MSG_ERROR(
"Unable to write new TrackVertexAssociation to evtStore: "
108 ATH_MSG_DEBUG(
"Wrote new TrackVertexAssociation to evtStore: "
118std::unique_ptr<jet::TrackVertexAssociation>
122 ATH_MSG_DEBUG(
"Building track-vertex association USING InDet tool. trk size="<< trackContainer->
size()
123 <<
" vtx size="<< vertexContainer->
size());
125 auto tva = std::make_unique<jet::TrackVertexAssociation>(trackContainer);
127 std::vector<const xAOD::Vertex*> vecVert;
128 vecVert.assign(vertexContainer->
begin(), vertexContainer->
end());
133 tva->associate( track, v );
140std::unique_ptr<jet::TrackVertexAssociation>
143 ATH_MSG_DEBUG(
"Building track-vertex association trk size="<< trackContainer->
size()
144 <<
" vtx size="<< vertexContainer->
size());
146 auto tva = std::make_unique<jet::TrackVertexAssociation>(trackContainer);
148 for (
size_t iTrack = 0; iTrack < trackContainer->
size(); ++iTrack)
153 const float transverseDistance = track->d0();
158 const float longitudinalDistance = track->z0()+track->vz();
160 double sinTheta = std::sin(track->theta());
163 size_t matchedIndex = 0;
164 bool foundMatch =
false;
165 for (
size_t iVertex = 0; iVertex < vertexContainer->
size(); ++iVertex)
169 double deltaz = longitudinalDistance - vertex->z();
182 matchedIndex = iVertex;
188 tva->associate(trackContainer->
at(iTrack),vertexContainer->
at(matchedIndex));
198std::unique_ptr<jet::TrackVertexAssociation>
201 bool useCustom)
const {
#define ATH_CHECK
Evaluate an expression and check for errors.
const xAOD::TrackParticleContainer * PTPC
const xAOD::VertexContainer * PVC
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const T * at(size_type n) const
Access an element, as an rvalue.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
@ OWN_ELEMENTS
this data object owns its elements
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".