|
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "AthLinks/ElementLink.h"
27 m_vtxDecoName(
"TTVA_AMVFVertices"),
28 m_wgtDecoName(
"TTVA_AMVFWeights"),
29 m_trkContKey(
"InDetTrackParticles"),
30 m_vtxContKey(
"PrimaryVertices")
71 return StatusCode::SUCCESS;
79 return StatusCode::SUCCESS;
86 const EventContext& ctx = Gaudi::Hive::currentContext();
92 if(isVtxDeco_available)
return;
95 std::vector<std::pair<const xAOD::Vertex*,float> > vxWithWeight;
101 vxWithWeight.clear();
104 for (
const auto *
const vtx : *vtxCont) {
108 const auto& trkLinks=vtx->trackParticleLinks();
109 const size_t nTrackLinks=trkLinks.size();
110 for (
unsigned i=0;
i<nTrackLinks;++
i) {
111 if (trkLinks[
i].
isValid() && *(trkLinks[
i]) == trk) {
112 vxWithWeight.emplace_back(vtx,vtx->trackWeights()[
i]);
119 std::sort(vxWithWeight.begin(),vxWithWeight.end(),
120 [](std::pair<const xAOD::Vertex*,float>&
a, std::pair<const xAOD::Vertex*,float>&
b){ return a.second > b.second; } );
124 std::vector<ElementLink<xAOD::VertexContainer>> AMVFVertices;
125 std::vector<float> AMVFWeights;
126 AMVFVertices.reserve(vxWithWeight.size());
127 AMVFWeights.reserve(vxWithWeight.size());
129 for (
const auto&
p : vxWithWeight) {
130 AMVFVertices.emplace_back(
p.first,*vtxCont,ctx);
131 AMVFWeights.emplace_back(
p.second);
135 vtxDeco(*trk) = std::move(AMVFVertices);
136 wgtDeco(*trk) = std::move(AMVFWeights);
144 const EventContext& ctx = Gaudi::Hive::currentContext();
156 ATH_MSG_WARNING(
"Unable to retrieve xAOD::VertexContainer, \"" <<
m_vtxContKey.key() <<
"\", returning without applying decorations!");
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
const std::string & key() const
Return the StoreGate ID for the referenced object.
::StatusCode StatusCode
StatusCode definition for legacy code.
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
Handle class for adding a decoration to an object.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
#define ATH_MSG_WARNING(x)
Class describing a TrackParticle.