29 declareInterface<DerivationFramework::IThinningTool>(
this);
47 ATH_CHECK(m_vertexContainerNames.initialize(m_streamName));
50 if (m_passFlags.empty()) {
52 return StatusCode::FAILURE;
54 for(
auto itr = m_passFlags.cbegin(); itr!=m_passFlags.cend(); ++itr) {
55 ATH_MSG_INFO(
"Vertices must pass the \"" << itr->key() <<
"\" selection");
59 for(
auto &
key : m_passFlags){
60 key = m_vertexContainerNames.key() +
'.' +
key.key();
63 return StatusCode::SUCCESS;
69 ATH_MSG_INFO(
"Processed "<< m_nVtxTot <<
" vertices, "<< m_nVtxPass<<
" were retained ");
71 return StatusCode::SUCCESS;
78 const EventContext& ctx = Gaudi::Hive::currentContext();
80 std::vector<bool> vtxMask(vertexContainer->size(),
true);
85 std::vector<SG::ReadDecorHandle<xAOD::VertexContainer, Char_t>> handles;
86 handles.reserve(m_passFlags.size());
87 for(
const auto &
key : m_passFlags){
88 handles.emplace_back(
key, ctx);
89 if(!handles.back().isPresent())
return StatusCode::FAILURE;
91 for(
auto vtxItr = vertexContainer->cbegin(); vtxItr!=vertexContainer->cend(); ++vtxItr, ++
k) {
95 if(m_noFlags){
passed =
true; vtxTot++; }
97 for(
auto &flagAcc : handles) {
98 if(flagAcc(*vtx) != 0) {
107 if(vtxMask[
k] ==
false)
continue;
116 std::vector<const xAOD::TrackParticle*> presentVertex, compareVertex;
119 presentVertex.clear();
123 sort( presentVertex.begin(), presentVertex.end() );
127 for(
auto vtxLoopItr = vtxItr+1; vtxLoopItr!=vertexContainer->cend(); vtxLoopItr++, loop_k++){
137 compareVertex.clear();
142 std::sort( compareVertex.begin(), compareVertex.end());
144 vtxMask[loop_k] =
false;
147 ATH_MSG_DEBUG(std::setw(14)<<compareVertex[0]<<std::setw(14) << compareVertex[1]<<std::setw(14)<<compareVertex[2]);
148 ATH_MSG_DEBUG(std::setw(14)<<presentVertex[0]<<std::setw(14) << presentVertex[1]<<std::setw(14)<<presentVertex[2]);
151 if( compareVertex[j] != presentVertex[j] ){vtxMask[loop_k] =
true;
break;}
153 ATH_MSG_DEBUG(
"Verdict:"<<(vtxMask[loop_k]?
"keep":
"erase") );
162 vertexContainer.
keep(vtxMask);
164 m_nVtxTot.fetch_add( vtxTot, std::memory_order_relaxed);
165 m_nVtxPass.fetch_add( nVtxPass, std::memory_order_relaxed);
169 return StatusCode::SUCCESS;