ATLAS Offline Software
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

 ThinningToolExample (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
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

StringProperty m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
 
SG::ThinningHandleKey< xAOD::TrackParticleContainerm_inDetSGKey { this, "InDetTrackParticlesKey", "InDetTrackParticles", "" }
 
std::atomic< unsigned int > m_ntot
 
std::atomic< unsigned int > m_npass
 
double m_trackPtCut
 

Detailed Description

Author
James Catmore -at- cern.ch

Definition at line 31 of file ThinningToolExample.h.

Constructor & Destructor Documentation

◆ ThinningToolExample()

DerivationFramework::ThinningToolExample::ThinningToolExample ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor with parameters.

Definition at line 20 of file ThinningToolExample.cxx.

22  :
23  base_class(t,n,p),
24  m_ntot(0),
25  m_npass(0),
26  m_trackPtCut(20.0)
27  {
28  declareProperty("TrackPtCut", m_trackPtCut);
29  }

◆ ~ThinningToolExample()

DerivationFramework::ThinningToolExample::~ThinningToolExample ( )
virtual

Destructor.

Definition at line 32 of file ThinningToolExample.cxx.

32  {
33 }

Member Function Documentation

◆ doThinning()

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

Check that the current event passes this filter.

Definition at line 50 of file ThinningToolExample.cxx.

51 {
52  const EventContext& ctx = Gaudi::Hive::currentContext();
53 
54  // Get the track container
56  m_ntot+=tracks->size();
57  // Loop over tracks, see if they pass, set mask
58  std::vector<bool> mask;
59  for (xAOD::TrackParticleContainer::const_iterator trackIt=tracks->begin(); trackIt!=tracks->end(); ++trackIt) {
60  if ( (*trackIt)->pt() > m_trackPtCut ) {++m_npass; mask.push_back(true);}
61  else { mask.push_back(false); }
62  }
63  tracks.keep (mask);
64 
65  return StatusCode::SUCCESS;
66 }

◆ finalize()

StatusCode DerivationFramework::ThinningToolExample::finalize ( )
overridevirtual

Definition at line 42 of file ThinningToolExample.cxx.

43 {
44  ATH_MSG_VERBOSE("finalize() ...");
45  ATH_MSG_INFO("Processed "<< m_ntot <<" tracks, "<< m_npass<< " were retained ");
46  return StatusCode::SUCCESS;
47 }

◆ initialize()

StatusCode DerivationFramework::ThinningToolExample::initialize ( )
overridevirtual

Definition at line 36 of file ThinningToolExample.cxx.

37 {
38  ATH_MSG_VERBOSE("initialize() ...");
39  ATH_CHECK( m_inDetSGKey.initialize (m_streamName) );
40  return StatusCode::SUCCESS;
41 }

Member Data Documentation

◆ m_inDetSGKey

SG::ThinningHandleKey<xAOD::TrackParticleContainer> DerivationFramework::ThinningToolExample::m_inDetSGKey { this, "InDetTrackParticlesKey", "InDetTrackParticles", "" }
private

Definition at line 50 of file ThinningToolExample.h.

◆ m_npass

std::atomic<unsigned int> DerivationFramework::ThinningToolExample::m_npass
mutableprivate

Definition at line 54 of file ThinningToolExample.h.

◆ m_ntot

std::atomic<unsigned int> DerivationFramework::ThinningToolExample::m_ntot
mutableprivate

Definition at line 53 of file ThinningToolExample.h.

◆ m_streamName

StringProperty DerivationFramework::ThinningToolExample::m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
private

Definition at line 48 of file ThinningToolExample.h.

◆ m_trackPtCut

double DerivationFramework::ThinningToolExample::m_trackPtCut
private

Definition at line 55 of file ThinningToolExample.h.


The documentation for this class was generated from the following files:
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
DerivationFramework::ThinningToolExample::m_npass
std::atomic< unsigned int > m_npass
Definition: ThinningToolExample.h:54
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:51
beamspotman.n
n
Definition: beamspotman.py:731
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::ThinningToolExample::m_streamName
StringProperty m_streamName
Definition: ThinningToolExample.h:49
DerivationFramework::ThinningToolExample::m_ntot
std::atomic< unsigned int > m_ntot
Definition: ThinningToolExample.h:53
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
DerivationFramework::ThinningToolExample::m_trackPtCut
double m_trackPtCut
Definition: ThinningToolExample.h:55