9#include "AthLinks/ElementLink.h"
47 return StatusCode::SUCCESS;
55 return StatusCode::SUCCESS;
66 if(isVtxDeco_available)
return;
69 std::vector<std::pair<const xAOD::Vertex*,float> > vxWithWeight;
78 for (
const auto *
const vtx : *vtxCont) {
82 const auto& trkLinks=vtx->trackParticleLinks();
83 const size_t nTrackLinks=trkLinks.size();
84 for (
unsigned i=0;i<nTrackLinks;++i) {
85 if (trkLinks[i].
isValid() && *(trkLinks[i]) == trk) {
86 vxWithWeight.emplace_back(vtx,vtx->trackWeights()[i]);
93 std::sort(vxWithWeight.begin(),vxWithWeight.end(),
94 [](std::pair<const xAOD::Vertex*,float>&
a, std::pair<const xAOD::Vertex*,float>& b){ return a.second > b.second; } );
98 std::vector<ElementLink<xAOD::VertexContainer>> AMVFVertices;
99 std::vector<float> AMVFWeights;
100 AMVFVertices.reserve(vxWithWeight.size());
101 AMVFWeights.reserve(vxWithWeight.size());
103 for (
const auto& p : vxWithWeight) {
104 AMVFVertices.emplace_back(p.first,*vtxCont,ctx);
105 AMVFWeights.emplace_back(p.second);
109 vtxDeco(*trk) = std::move(AMVFVertices);
110 wgtDeco(*trk) = std::move(AMVFWeights);
#define ATH_CHECK
Evaluate an expression and check for errors.
bool isValid() const
Test to see if the link can be dereferenced.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
Handle class for adding a decoration to an object.
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".