ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::SkimmingToolExample Class Reference

the code used in this implementation is kindly stolen from: atlasoff:: ISF/ISF_Core/ISF_Tools More...

#include <SkimmingToolExample.h>

Inheritance diagram for DerivationFramework::SkimmingToolExample:
Collaboration diagram for DerivationFramework::SkimmingToolExample:

Public Member Functions

virtual StatusCode initialize () override
 Athena algtool's Hooks.
virtual StatusCode finalize () override
virtual bool eventPassesFilter (const EventContext &ctx) const override
 Check that the current event passes this filter.

Private Attributes

SG::ReadHandleKey< xAOD::MuonContainer > m_muonSGKey {this, "MuonContainerKey", "Muons", "Key for muon container"}
Gaudi::Property< unsigned int > m_nMuons {this, "NumberOfMuons", 2, "Minimum number of muons"}
Gaudi::Property< double > m_muonPtCut {this, "MuonPtCut", 10000.0, "p_T cut on muon in MeV"}
std::atomic< unsigned int > m_ntot {0}
std::atomic< unsigned int > m_npass {0}

Detailed Description

the code used in this implementation is kindly stolen from: atlasoff:: ISF/ISF_Core/ISF_Tools

Author
James Catmore -at- cern.ch

Definition at line 31 of file SkimmingToolExample.h.

Member Function Documentation

◆ eventPassesFilter()

bool DerivationFramework::SkimmingToolExample::eventPassesFilter ( const EventContext & ctx) const
overridevirtual

Check that the current event passes this filter.

Definition at line 34 of file SkimmingToolExample.cxx.

35{
36 ++m_ntot;
37
38 // Retrieve muon container
39 SG::ReadHandle<xAOD::MuonContainer> muons(m_muonSGKey, ctx);
40 if (!muons.isValid()) {
41 ATH_MSG_FATAL("No muon collection with name " << m_muonSGKey.key() << " found in StoreGate!");
42 return false;
43 }
44
45 // Loop over muons, count up and set decision
46 unsigned int nGoodMu{0};
47 for (const xAOD::Muon* muon : *muons) {
48 if ( muon->muonType() == xAOD::Muon::MuonType::Combined && muon->pt() > m_muonPtCut ) ++nGoodMu;
49 }
50 bool acceptEvent{false};
51 if (nGoodMu >= m_nMuons) {
52 acceptEvent = true;
53 ++m_npass;
54 }
55 return acceptEvent;
56
57}
#define ATH_MSG_FATAL(x,...)
Gaudi::Property< unsigned int > m_nMuons
SG::ReadHandleKey< xAOD::MuonContainer > m_muonSGKey
Muon_v1 Muon
Reference the current persistent version:
Definition Muon.h:13

◆ finalize()

StatusCode DerivationFramework::SkimmingToolExample::finalize ( )
overridevirtual

Definition at line 26 of file SkimmingToolExample.cxx.

27{
28 ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
29 return StatusCode::SUCCESS;
30}
#define ATH_MSG_INFO(x,...)

◆ initialize()

StatusCode DerivationFramework::SkimmingToolExample::initialize ( )
overridevirtual

Athena algtool's Hooks.

Definition at line 19 of file SkimmingToolExample.cxx.

20{
21 ATH_CHECK(m_muonSGKey.initialize());
22 return StatusCode::SUCCESS;
23}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_muonPtCut

Gaudi::Property<double> DerivationFramework::SkimmingToolExample::m_muonPtCut {this, "MuonPtCut", 10000.0, "p_T cut on muon in MeV"}
private

Definition at line 51 of file SkimmingToolExample.h.

52{this, "MuonPtCut", 10000.0, "p_T cut on muon in MeV"};

◆ m_muonSGKey

SG::ReadHandleKey<xAOD::MuonContainer> DerivationFramework::SkimmingToolExample::m_muonSGKey {this, "MuonContainerKey", "Muons", "Key for muon container"}
private

Definition at line 45 of file SkimmingToolExample.h.

46{this, "MuonContainerKey", "Muons", "Key for muon container"};

◆ m_nMuons

Gaudi::Property<unsigned int> DerivationFramework::SkimmingToolExample::m_nMuons {this, "NumberOfMuons", 2, "Minimum number of muons"}
private

Definition at line 48 of file SkimmingToolExample.h.

49{this, "NumberOfMuons", 2, "Minimum number of muons"};

◆ m_npass

std::atomic<unsigned int> DerivationFramework::SkimmingToolExample::m_npass {0}
mutableprivate

Definition at line 55 of file SkimmingToolExample.h.

55{0};

◆ m_ntot

std::atomic<unsigned int> DerivationFramework::SkimmingToolExample::m_ntot {0}
mutableprivate

Definition at line 54 of file SkimmingToolExample.h.

54{0};

The documentation for this class was generated from the following files: