ATLAS Offline Software
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 
14 #include <vector>
15 #include <string>
16 
17 // Constructor
19  const std::string& n,
20  const IInterface* p ) :
21  AthAlgTool(t,n,p) {
22  declareInterface<DerivationFramework::ISkimmingTool>(this);
23 
24  }
25 
26 // Destructor
28 // Athena initialize and finalize
30 {
31  ATH_MSG_VERBOSE("initialize() ...");
32  ATH_CHECK(m_muonSGKey.initialize());
33  return StatusCode::SUCCESS;
34 }
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
44 {
45  ++m_ntot;
46  SG::ReadHandle<xAOD::MuonContainer> muons{m_muonSGKey};
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 
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
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::eventPassesFilter
bool eventPassesFilter() const override
Check that the current event passes this filter.
Definition: DRAW_ZMUMU_SkimmingTool.cxx:43
DerivationFramework::DRAW_ZMUMUSkimmingTool::initialize
StatusCode initialize() override
Definition: DRAW_ZMUMU_SkimmingTool.cxx:29
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DRAW_ZMUMUSkimmingTool.h
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::DRAW_ZMUMUSkimmingTool::finalize
StatusCode finalize() override
Definition: DRAW_ZMUMU_SkimmingTool.cxx:35
DerivationFramework::DRAW_ZMUMUSkimmingTool::~DRAW_ZMUMUSkimmingTool
~DRAW_ZMUMUSkimmingTool()
Destructor.