32 declareProperty(
"IgnoreFlags" ,
m_noFlags);
50 return StatusCode::FAILURE;
53 ATH_MSG_INFO(
"Vertices must pass the \"" << itr->key() <<
"\" selection");
61 return StatusCode::SUCCESS;
69 return StatusCode::SUCCESS;
77 std::vector<bool> vtxMask(vertexContainer->size(),
true);
82 std::vector<SG::ReadDecorHandle<xAOD::VertexContainer, Char_t>> handles;
85 handles.emplace_back(key, ctx);
86 if(!handles.back().isPresent())
return StatusCode::FAILURE;
88 for(
auto vtxItr = vertexContainer->cbegin(); vtxItr!=vertexContainer->cend(); ++vtxItr, ++k) {
94 for(
auto &flagAcc : handles) {
95 if(flagAcc(*vtx) != 0) {
104 if(vtxMask[k] ==
false)
continue;
106 if(!
passed)vtxMask[k]=
false;
113 std::vector<const xAOD::TrackParticle*> presentVertex, compareVertex;
116 presentVertex.clear();
120 sort( presentVertex.begin(), presentVertex.end() );
124 for(
auto vtxLoopItr = vtxItr+1; vtxLoopItr!=vertexContainer->cend(); vtxLoopItr++, loop_k++){
134 compareVertex.clear();
139 std::sort( compareVertex.begin(), compareVertex.end());
141 vtxMask[loop_k] =
false;
144 ATH_MSG_DEBUG(std::setw(14)<<compareVertex[0]<<std::setw(14) << compareVertex[1]<<std::setw(14)<<compareVertex[2]);
145 ATH_MSG_DEBUG(std::setw(14)<<presentVertex[0]<<std::setw(14) << presentVertex[1]<<std::setw(14)<<presentVertex[2]);
148 if( compareVertex[j] != presentVertex[j] ){vtxMask[loop_k] =
true;
break;}
150 ATH_MSG_DEBUG(
"Verdict:"<<(vtxMask[loop_k]?
"keep":
"erase") );
159 vertexContainer.
keep(vtxMask);
161 m_nVtxTot.fetch_add( vtxTot, std::memory_order_relaxed);
162 m_nVtxPass.fetch_add( nVtxPass, std::memory_order_relaxed);
166 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
: B-physics xAOD helpers.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Handle for requesting thinning for a data object.
virtual StatusCode doThinning(const EventContext &ctx) const
std::atomic< unsigned int > m_nVtxPass
SG::ThinningHandleKey< xAOD::VertexContainer > m_vertexContainerNames
SG::ReadDecorHandleKeyArray< xAOD::VertexContainer > m_passFlags
virtual StatusCode initialize()
virtual StatusCode finalize()
Thin_vtxDuplicates(const std::string &t, const std::string &n, const IInterface *p)
std::atomic< unsigned int > m_nVtxTot
StringProperty m_streamName
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Handle for requesting thinning for a data object.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Vertex_v1 Vertex
Define the latest version of the vertex class.