89{
90 const EventContext& ctx = Gaudi::Hive::currentContext();
91
93
94
95 unsigned int nTracks = importedTrackParticles->size();
96 if (nTracks==0) return StatusCode::SUCCESS;
97
98
99 std::vector<bool> trackMask(nTracks,false);
101 int nVtxTot =0;
102 int nVtxPass=0;
103
104 std::unordered_map<std::string, SG::ReadDecorHandle<xAOD::VertexContainer, Char_t>> handles;
107 auto it = handles.emplace(std::piecewise_construct, std::forward_as_tuple(
key.key()), std::forward_as_tuple(key, ctx));
108 if(!(*
it.first).second.isPresent())
return StatusCode::FAILURE;
109 }
110
111
113 SG::ThinningHandle<xAOD::VertexContainer> vertexContainer(name, ctx);
114 std::vector<bool> vtxMask(vertexContainer->size(), false);
115
116
118 for(auto vtxItr = vertexContainer->begin(); vtxItr!=vertexContainer->end(); ++vtxItr, ++k) {
120 nVtxTot++;
121
122
124 for(std::vector<std::string>::const_iterator flagItr =
m_passFlags.begin(); flagItr!=
m_passFlags.end(); ++flagItr) {
125 std::string lookupstr =
name.key() +
'.' + (*flagItr);
126 const auto& handle = handles.at(lookupstr);
127 if(handle(*vtx) != 0) {
129 break;
130 }
131 }
132
134
136 nVtxPass++;
137
138
140
141
142 TLorentzVector centreCandidate;
145 }
146
147 for(
uint i=0;
i<nTracks; ++
i) {
148 if(!trackMask[i]) {
151 }
152 }
153 }
154
156
157 for(
uint i=0;
i<nTracks; ++
i) {
158 if(!trackMask[i]) {
160
164 }
165 }
166 }
167 }
168 }
169 }
170 }
171
172
173 vertexContainer.keep(vtxMask);
174 }
175
176
177 m_npass += std::accumulate(trackMask.begin(), trackMask.end(), 0);
181
182 importedTrackParticles.keep(trackMask);
183 }
184
185 return StatusCode::SUCCESS;
186}
SG::ReadDecorHandleKeyArray< xAOD::VertexContainer > m_passArray
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
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.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.