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::ThinningToolExample Class Reference

#include <ThinningToolExample.h>

Inheritance diagram for DerivationFramework::ThinningToolExample:
Collaboration diagram for DerivationFramework::ThinningToolExample:

Public Member Functions

virtual ~ThinningToolExample ()
 Destructor. More...
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual StatusCode doThinning () const override
 Check that the current event passes this filter. More...
 

Private Attributes

Gaudi::Property< std::string > m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
 
Gaudi::Property< double > m_trackPtCut { this, "TrackPtCut", 20.0, "Track p_T cut in GeV" }
 
SG::ThinningHandleKey< xAOD::TrackParticleContainerm_inDetSGKey { this, "InDetTrackParticlesKey", "InDetTrackParticles", "Key for track particle container" }
 
std::atomic< unsigned int > m_ntot {0}
 
std::atomic< unsigned int > m_npass {0}
 

Detailed Description

Author
James Catmore -at- cern.ch

Definition at line 26 of file ThinningToolExample.h.

Constructor & Destructor Documentation

◆ ~ThinningToolExample()

DerivationFramework::ThinningToolExample::~ThinningToolExample ( )
virtual

Destructor.

Definition at line 21 of file ThinningToolExample.cxx.

21  {
22 }

Member Function Documentation

◆ doThinning()

StatusCode DerivationFramework::ThinningToolExample::doThinning ( ) const
overridevirtual

Check that the current event passes this filter.

Definition at line 41 of file ThinningToolExample.cxx.

42 {
43  const EventContext& ctx = Gaudi::Hive::currentContext();
44 
45  // Get the track container
47  m_ntot += tracks->size();
48  // Loop over tracks, see if they pass, set mask
49  std::vector<bool> mask;
50  for (const xAOD::TrackParticle* track : *tracks) {
51  if ( track->pt() > m_trackPtCut ) {++m_npass; mask.push_back(true);}
52  else { mask.push_back(false); }
53  }
54  tracks.keep (mask);
55 
56  return StatusCode::SUCCESS;
57 }

◆ finalize()

StatusCode DerivationFramework::ThinningToolExample::finalize ( )
overridevirtual

Definition at line 33 of file ThinningToolExample.cxx.

34 {
35  ATH_MSG_INFO("Processed "<< m_ntot <<" tracks, "<< m_npass<< " were retained ");
36  return StatusCode::SUCCESS;
37 }

◆ initialize()

StatusCode DerivationFramework::ThinningToolExample::initialize ( )
overridevirtual

Definition at line 26 of file ThinningToolExample.cxx.

27 {
28  ATH_CHECK( m_inDetSGKey.initialize (m_streamName) );
29  return StatusCode::SUCCESS;
30 }

Member Data Documentation

◆ m_inDetSGKey

SG::ThinningHandleKey<xAOD::TrackParticleContainer> DerivationFramework::ThinningToolExample::m_inDetSGKey { this, "InDetTrackParticlesKey", "InDetTrackParticles", "Key for track particle container" }
private

Definition at line 49 of file ThinningToolExample.h.

◆ m_npass

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

Definition at line 53 of file ThinningToolExample.h.

◆ m_ntot

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

Definition at line 52 of file ThinningToolExample.h.

◆ m_streamName

Gaudi::Property<std::string> DerivationFramework::ThinningToolExample::m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
private

Definition at line 43 of file ThinningToolExample.h.

◆ m_trackPtCut

Gaudi::Property<double> DerivationFramework::ThinningToolExample::m_trackPtCut { this, "TrackPtCut", 20.0, "Track p_T cut in GeV" }
private

Definition at line 46 of file ThinningToolExample.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::ThinningToolExample::m_streamName
Gaudi::Property< std::string > m_streamName
Definition: ThinningToolExample.h:44
DerivationFramework::ThinningToolExample::m_npass
std::atomic< unsigned int > m_npass
Definition: ThinningToolExample.h:53
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition: ThinningHandle.h:84
DerivationFramework::ThinningToolExample::m_inDetSGKey
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
Definition: ThinningToolExample.h:50
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::ThinningToolExample::m_trackPtCut
Gaudi::Property< double > m_trackPtCut
Definition: ThinningToolExample.h:47
DerivationFramework::ThinningToolExample::m_ntot
std::atomic< unsigned int > m_ntot
Definition: ThinningToolExample.h:52
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43