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 EventContext &ctx) 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 20 of file ThinningToolExample.cxx.

20 {
21}

Member Function Documentation

◆ doThinning()

StatusCode DerivationFramework::ThinningToolExample::doThinning ( const EventContext & ctx) const
overridevirtual

Check that the current event passes this filter.

Definition at line 40 of file ThinningToolExample.cxx.

41{
42
43 // Get the track container
44 SG::ThinningHandle<xAOD::TrackParticleContainer> tracks (m_inDetSGKey, ctx);
45 m_ntot += tracks->size();
46 // Loop over tracks, see if they pass, set mask
47 std::vector<bool> mask;
48 for (const xAOD::TrackParticle* track : *tracks) {
49 if ( track->pt() > m_trackPtCut ) {++m_npass; mask.push_back(true);}
50 else { mask.push_back(false); }
51 }
52 tracks.keep (mask);
53
54 return StatusCode::SUCCESS;
55}
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ finalize()

StatusCode DerivationFramework::ThinningToolExample::finalize ( )
overridevirtual

Definition at line 32 of file ThinningToolExample.cxx.

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

◆ initialize()

StatusCode DerivationFramework::ThinningToolExample::initialize ( )
overridevirtual

Definition at line 25 of file ThinningToolExample.cxx.

26{
27 ATH_CHECK( m_inDetSGKey.initialize (m_streamName) );
28 return StatusCode::SUCCESS;
29}
#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: