24 const IInterface* p ) :
31 declareProperty(
"PrimaryVertexKey",
m_vertex_key=
"PrimaryVertices");
33 declareProperty(
"TrackSelectionTool",
m_trkSelTool,
"Track selection tool" );
44 ATH_MSG_ERROR(
"InDetTrackSelectionTool not set. Cannot initialize.");
45 return StatusCode::FAILURE;
51 return StatusCode::FAILURE;
55 return StatusCode::SUCCESS;
62 return StatusCode::SUCCESS;
78 if (evtStore()->retrieve(vtxC,
m_vertex_key).isFailure()) {
80 return StatusCode::FAILURE;
84 unsigned int nTracks = tracks->size();
85 if (nTracks==0)
return StatusCode::SUCCESS;
92 for (
auto vertex : *vtxC) {
103 float sumPT = sumPt2Acc(*vertex);
106 primary_vertex = vertex;
110 size_t ntp = vertex->nTrackParticles();
113 primary_vertex = vertex;
119 if (!primary_vertex) {
124 std::vector<bool> mask(nTracks,
false);
127 for (
auto tp : *tracks) {
132 int index = tp->index();
133 mask[
index] =
static_cast<bool>(acceptData);
138 unsigned int n_pass=0;
139 for (
unsigned int i=0; i<nTracks; ++i) {
140 if (mask[i]) ++n_pass;
146 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle for requesting thinning for a data object.
virtual StatusCode doThinning(const EventContext &ctx) const override
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
std::string m_vertex_scheme
std::atomic< unsigned int > m_npass
StatusCode finalize() override
StringProperty m_streamName
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkSelTool
track selection tool which can be optionally used for N_trk and sum pt cuts
std::atomic< unsigned int > m_ntot
StatusCode initialize() override
~HITrackParticleThinningTool()
HITrackParticleThinningTool(const std::string &t, const std::string &n, const IInterface *p)
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
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.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.