ATLAS Offline Software
VertexSelectionAlg.cxx
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 //
4 
5 // Local include(s):
7 
9 
10 namespace CP {
11 
13 
14  // Greet the user:
15  ATH_MSG_INFO( "Requiring " << m_minVertices << " vertex/vertices from \""
16  << m_vertexKey << "\" with " << m_minTracks
17  << " track(s) each" );
18 
20  ANA_CHECK (m_vertexKey.initialize());
21 
22  // Return gracefully:
23  return StatusCode::SUCCESS;
24  }
25 
28 
29  // Return gracefully:
30  return StatusCode::SUCCESS;
31  }
32 
34 
36 
37  // Retrieve the vertex container:
39 
40  // The number of "good" vertices found:
41  unsigned goodVertices = 0;
42 
43  // Check how many "good" vertices we have in the current event:
44  for( const xAOD::Vertex* vx : *vertices ) {
45  // It has to be either a primary or a pileup vertex:
46  if( ( vx->vertexType() != xAOD::VxType::PriVtx ) &&
47  ( vx->vertexType() != xAOD::VxType::PileUp ) ) {
48  continue;
49  }
50  // With the minimum number of tracks specified:
51  if( vx->nTrackParticles() < m_minTracks ) {
52  continue;
53  }
54  // Apparently this is a "good" vertex:
55  ++goodVertices;
56  }
57 
58  // Decide about the event:
59  filter.setPassed( goodVertices >= m_minVertices );
60 
61  // Return gracefully:
62  return StatusCode::SUCCESS;
63  }
64 
65 } // namespace CP
FilterReporter
a guard class for use with ref FilterReporterParams
Definition: FilterReporter.h:35
CP::VertexSelectionAlg::m_minVertices
Gaudi::Property< unsigned > m_minVertices
Number of vertices required in the event.
Definition: VertexSelectionAlg.h:58
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CP::VertexSelectionAlg::finalize
virtual StatusCode finalize() override
Function finalize the algorithm.
Definition: VertexSelectionAlg.cxx:26
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
covarianceTool.filter
filter
Definition: covarianceTool.py:514
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
VertexSelectionAlg.h
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
CP::VertexSelectionAlg::execute
virtual StatusCode execute() override
Function executing the algorithm.
Definition: VertexSelectionAlg.cxx:33
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
CP::VertexSelectionAlg::m_filterParams
FilterReporterParams m_filterParams
Definition: VertexSelectionAlg.h:62
FilterReporterParams::initialize
StatusCode initialize(bool enabled=true)
do anything we need to do in initialize
Definition: FilterReporterParams.cxx:24
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition: TrackingPrimitives.h:573
CP::VertexSelectionAlg::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition: VertexSelectionAlg.cxx:12
FilterReporter.h
CP::VertexSelectionAlg::m_minTracks
Gaudi::Property< unsigned > m_minTracks
Number of track particles required per vertex.
Definition: VertexSelectionAlg.h:60
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
CP::VertexSelectionAlg::m_vertexKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
Event store key of the vertex container.
Definition: VertexSelectionAlg.h:56
FilterReporterParams::summary
std::string summary()
report the status of filtering
Definition: FilterReporterParams.cxx:60