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

#include <ThinningToolExample.h>

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

Public Member Functions

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

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
46 SG::ThinningHandle<xAOD::TrackParticleContainer> tracks (m_inDetSGKey, ctx);
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}
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ 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}
#define ATH_MSG_INFO(x)

◆ 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Property< std::string > m_streamName

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.

50{ this, "InDetTrackParticlesKey", "InDetTrackParticles", "Key for track particle container" };

◆ m_npass

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

Definition at line 53 of file ThinningToolExample.h.

53{0};

◆ m_ntot

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

Definition at line 52 of file ThinningToolExample.h.

52{0};

◆ 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.

44{ this, "StreamName", "", "Name of the stream being thinned" };

◆ 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.

47{ this, "TrackPtCut", 20.0, "Track p_T cut in GeV" };

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