Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
DerivationFramework::SkimmingToolExample Class Reference

#include <SkimmingToolExample.h>

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

Public Member Functions

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

Private Attributes

Gaudi::Property< std::string > 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 30 of file SkimmingToolExample.h.

Member Function Documentation

◆ eventPassesFilter()

bool DerivationFramework::SkimmingToolExample::eventPassesFilter ( ) const
overridevirtual

Check that the current event passes this filter.

Definition at line 26 of file SkimmingToolExample.cxx.

27 {
28  ++m_ntot;
29 
30  // Retrieve muon container
31  const xAOD::MuonContainer* muons{nullptr};
32  StatusCode sc = evtStore()->retrieve(muons,m_muonSGKey);
33  if (sc.isFailure()) {
34  ATH_MSG_FATAL("No muon collection with name " << m_muonSGKey << " found in StoreGate!");
35  return false;
36  }
37 
38  // Loop over muons, count up and set decision
39  unsigned int nGoodMu{0};
40  for (const xAOD::Muon* muon : *muons) {
41  if ( muon->muonType() == xAOD::Muon::Combined && muon->pt() > m_muonPtCut ) ++nGoodMu;
42  }
43  bool acceptEvent{false};
44  if (nGoodMu >= m_nMuons) {
45  acceptEvent = true;
46  ++m_npass;
47  }
48  return acceptEvent;
49 
50 }

◆ finalize()

StatusCode DerivationFramework::SkimmingToolExample::finalize ( )
overridevirtual

Athena algtool's Hooks.

Definition at line 18 of file SkimmingToolExample.cxx.

19 {
20  ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
21  return StatusCode::SUCCESS;
22 }

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 49 of file SkimmingToolExample.h.

◆ m_muonSGKey

Gaudi::Property<std::string> DerivationFramework::SkimmingToolExample::m_muonSGKey {this, "MuonContainerKey", "Muons", "Key for muon container"}
private

Definition at line 43 of file SkimmingToolExample.h.

◆ m_nMuons

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

Definition at line 46 of file SkimmingToolExample.h.

◆ m_npass

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

Definition at line 53 of file SkimmingToolExample.h.

◆ m_ntot

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

Definition at line 52 of file SkimmingToolExample.h.


The documentation for this class was generated from the following files:
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::SkimmingToolExample::m_ntot
std::atomic< unsigned int > m_ntot
Definition: SkimmingToolExample.h:52
DerivationFramework::SkimmingToolExample::m_npass
std::atomic< unsigned int > m_npass
Definition: SkimmingToolExample.h:53
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
DerivationFramework::SkimmingToolExample::m_muonSGKey
Gaudi::Property< std::string > m_muonSGKey
Definition: SkimmingToolExample.h:44
DerivationFramework::SkimmingToolExample::m_nMuons
Gaudi::Property< unsigned int > m_nMuons
Definition: SkimmingToolExample.h:47
DerivationFramework::SkimmingToolExample::m_muonPtCut
Gaudi::Property< double > m_muonPtCut
Definition: SkimmingToolExample.h:50