ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TrackingAnalysisAlgorithms
Root
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):
6
#include "
TrackingAnalysisAlgorithms/VertexSelectionAlg.h
"
7
8
#include <
EventBookkeeperTools/FilterReporter.h
>
9
10
namespace
CP
{
11
12
StatusCode
VertexSelectionAlg::initialize
() {
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
19
ANA_CHECK
(
m_filterParams
.initialize());
20
ANA_CHECK
(
m_vertexKey
.initialize());
21
22
// Return gracefully:
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
VertexSelectionAlg::finalize
() {
27
ANA_MSG_INFO
(
m_filterParams
.summary());
28
29
// Return gracefully:
30
return
StatusCode::SUCCESS;
31
}
32
33
StatusCode
VertexSelectionAlg::execute
(
const
EventContext &ctx)
const
{
34
35
FilterReporter
filter (
m_filterParams
,
false
, ctx);
36
37
// Retrieve the vertex container:
38
SG::ReadHandle<xAOD::VertexContainer>
vertices(
m_vertexKey
, ctx);
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
FilterReporter.h
VertexSelectionAlg.h
CP::VertexSelectionAlg::m_filterParams
FilterReporterParams m_filterParams
Definition
VertexSelectionAlg.h:62
CP::VertexSelectionAlg::m_minTracks
Gaudi::Property< unsigned > m_minTracks
Number of track particles required per vertex.
Definition
VertexSelectionAlg.h:60
CP::VertexSelectionAlg::finalize
virtual StatusCode finalize() override
Function finalize the algorithm.
Definition
VertexSelectionAlg.cxx:26
CP::VertexSelectionAlg::m_vertexKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
Event store key of the vertex container.
Definition
VertexSelectionAlg.h:56
CP::VertexSelectionAlg::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition
VertexSelectionAlg.cxx:12
CP::VertexSelectionAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Definition
VertexSelectionAlg.cxx:33
CP::VertexSelectionAlg::m_minVertices
Gaudi::Property< unsigned > m_minVertices
Number of vertices required in the event.
Definition
VertexSelectionAlg.h:58
FilterReporter
a guard class for use with ref FilterReporterParams
Definition
FilterReporter.h:35
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition
TrackingPrimitives.h:592
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0