ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
PrimaryDPDMaker
src
DRAW_ZMUMU_SkimmingTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// DRAW_ZMUMUSkimmingTool.cxx
8
// Author: James Catmore (James.Catmore@cern.ch)
9
// This tool implements the "good muon" event selection required
10
// by the DRAW_ZMUMU format, avoiding the use of decorators on the
11
// muons. Inherits from derivation framework components.
12
13
#include "
PrimaryDPDMaker/DRAW_ZMUMUSkimmingTool.h
"
14
#include <vector>
15
#include <string>
16
17
// Constructor
18
DerivationFramework::DRAW_ZMUMUSkimmingTool::DRAW_ZMUMUSkimmingTool
(
const
std::string& t,
19
const
std::string& n,
20
const
IInterface* p ) :
21
AthAlgTool
(t,n,p) {
22
declareInterface<DerivationFramework::ISkimmingTool>(
this
);
23
24
}
25
26
// Destructor
27
DerivationFramework::DRAW_ZMUMUSkimmingTool::~DRAW_ZMUMUSkimmingTool
() =
default
;
28
// Athena initialize and finalize
29
StatusCode
DerivationFramework::DRAW_ZMUMUSkimmingTool::initialize
()
30
{
31
ATH_MSG_VERBOSE
(
"initialize() ..."
);
32
ATH_CHECK
(
m_muonSGKey
.initialize());
33
return
StatusCode::SUCCESS;
34
}
35
StatusCode
DerivationFramework::DRAW_ZMUMUSkimmingTool::finalize
()
36
{
37
ATH_MSG_VERBOSE
(
"finalize() ..."
);
38
ATH_MSG_INFO
(
"Processed "
<<
m_ntot
<<
" events, "
<<
m_npass
<<
" events passed filter "
);
39
return
StatusCode::SUCCESS;
40
}
41
42
// The filter itself
43
bool
DerivationFramework::DRAW_ZMUMUSkimmingTool::eventPassesFilter
(
const
EventContext& ctx)
const
44
{
45
++
m_ntot
;
46
SG::ReadHandle<xAOD::MuonContainer>
muons{
m_muonSGKey
, ctx};
47
// Loop over muons, count up and set decision
48
unsigned
int
nGoodMu(0);
49
for
(
const
xAOD::Muon
* muItr : *muons) {
50
nGoodMu += muItr->pt() >
m_muonPtCut
&&
m_muonSelectionTool
->accept(*muItr);
51
}
52
bool
acceptEvent{
false
};
53
if
(nGoodMu >=
m_nMuons
) {
54
acceptEvent =
true
;
55
++
m_npass
;
56
}
57
return
acceptEvent;
58
}
59
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
DRAW_ZMUMUSkimmingTool.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
DerivationFramework::DRAW_ZMUMUSkimmingTool::m_muonSGKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonSGKey
Definition
DRAW_ZMUMUSkimmingTool.h:51
DerivationFramework::DRAW_ZMUMUSkimmingTool::~DRAW_ZMUMUSkimmingTool
~DRAW_ZMUMUSkimmingTool()
Destructor.
DerivationFramework::DRAW_ZMUMUSkimmingTool::m_muonSelectionTool
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
Definition
DRAW_ZMUMUSkimmingTool.h:53
DerivationFramework::DRAW_ZMUMUSkimmingTool::m_ntot
std::atomic< unsigned int > m_ntot
Definition
DRAW_ZMUMUSkimmingTool.h:48
DerivationFramework::DRAW_ZMUMUSkimmingTool::eventPassesFilter
bool eventPassesFilter(const EventContext &ctx) const override
Check that the current event passes this filter.
Definition
DRAW_ZMUMU_SkimmingTool.cxx:43
DerivationFramework::DRAW_ZMUMUSkimmingTool::m_nMuons
Gaudi::Property< unsigned int > m_nMuons
Definition
DRAW_ZMUMUSkimmingTool.h:54
DerivationFramework::DRAW_ZMUMUSkimmingTool::finalize
StatusCode finalize() override
Definition
DRAW_ZMUMU_SkimmingTool.cxx:35
DerivationFramework::DRAW_ZMUMUSkimmingTool::m_npass
std::atomic< unsigned int > m_npass
Definition
DRAW_ZMUMUSkimmingTool.h:49
DerivationFramework::DRAW_ZMUMUSkimmingTool::m_muonPtCut
Gaudi::Property< float > m_muonPtCut
Definition
DRAW_ZMUMUSkimmingTool.h:55
DerivationFramework::DRAW_ZMUMUSkimmingTool::DRAW_ZMUMUSkimmingTool
DRAW_ZMUMUSkimmingTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition
DRAW_ZMUMU_SkimmingTool.cxx:18
DerivationFramework::DRAW_ZMUMUSkimmingTool::initialize
StatusCode initialize() override
Definition
DRAW_ZMUMU_SkimmingTool.cxx:29
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
Generated on
for ATLAS Offline Software by
1.17.0