ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DerivationFramework::TrackMeasurementThinning Class Reference

#include <TrackMeasurementThinning.h>

Inheritance diagram for DerivationFramework::TrackMeasurementThinning:
Collaboration diagram for DerivationFramework::TrackMeasurementThinning:

Public Member Functions

 TrackMeasurementThinning (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
virtual ~TrackMeasurementThinning ()
 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_selectionString { this, "SelectionString", "", ""}
 
std::atomic< unsigned int > m_ntot {}
 
std::atomic< unsigned int > m_npass {}
 
StringProperty m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
 
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainerm_SGKey { this, "TrackMeasurementValidationKey", "PixelClusters", "" }
 

Detailed Description

Author
David Salek -at- cern.ch

Definition at line 32 of file TrackMeasurementThinning.h.

Constructor & Destructor Documentation

◆ TrackMeasurementThinning()

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

Constructor with parameters.

Definition at line 19 of file TrackMeasurementThinning.cxx.

21  :
22  base_class(t,n,p)
23  {
24  }

◆ ~TrackMeasurementThinning()

DerivationFramework::TrackMeasurementThinning::~TrackMeasurementThinning ( )
virtualdefault

Destructor.

Member Function Documentation

◆ doThinning()

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

Check that the current event passes this filter.

Definition at line 57 of file TrackMeasurementThinning.cxx.

58 {
59  const EventContext& ctx = Gaudi::Hive::currentContext();
60 
61  // Get the cluster container
63  (m_SGKey, ctx);
64 
65  // Check the event contains clusters
66  unsigned int nClusters = clusters->size();
67  if (nClusters==0) return StatusCode::SUCCESS;
68 
69  // Set up a mask with the same entries as the full collection
70  std::vector<bool> mask;
71  mask.assign(nClusters,false); // default: don't keep anything
72  m_ntot += nClusters;
73 
74  // Execute the text parser and update the mask
75  if (m_parser) {
76  std::vector<int> entries = m_parser->evaluateAsVector();
77  unsigned int nEntries = entries.size();
78  // check the sizes are compatible
79  if (nClusters != nEntries ) {
80  ATH_MSG_ERROR("Sizes incompatible! Are you sure your selection string used the same collection as the input collection??");
81  return StatusCode::FAILURE;
82  } else {
83  // set mask
84  for (unsigned int i=0; i<nClusters; ++i) if (entries[i]==1) mask[i]=true;
85  }
86  }
87  // Count the mask
88  unsigned int n_pass=0;
89  for (unsigned int i=0; i<nClusters; ++i) {
90  if (mask[i]) ++n_pass;
91  }
92  m_npass += n_pass;
93 
94  // Execute the thinning service based on the mask. Finish.
95  clusters.keep (mask);
96 
97  return StatusCode::SUCCESS;
98 }

◆ finalize()

StatusCode DerivationFramework::TrackMeasurementThinning::finalize ( )
overridevirtual

Definition at line 48 of file TrackMeasurementThinning.cxx.

49 {
50  ATH_MSG_VERBOSE("finalize() ...");
51  ATH_MSG_INFO("Processed "<< m_ntot <<" measurements, "<< m_npass<< " were retained ");
52  ATH_CHECK( finalizeParser());
53  return StatusCode::SUCCESS;
54 }

◆ initialize()

StatusCode DerivationFramework::TrackMeasurementThinning::initialize ( )
overridevirtual

Definition at line 30 of file TrackMeasurementThinning.cxx.

31 {
32  ATH_MSG_VERBOSE("initialize() ...");
33  if (m_selectionString.empty()) {
34  ATH_MSG_FATAL("No inner detector track selection string provided!");
35  return StatusCode::FAILURE;
36  } else {ATH_MSG_INFO("Track thinning selection string: " << m_selectionString);}
37 
38  //check xAOD::InDetTrackParticle collection
39  ATH_CHECK( m_SGKey.initialize (m_streamName) );
40  ATH_MSG_INFO("Using " << m_SGKey << "as the source collection for thinning.");
41 
42  // Set up the text-parsing machinery for thinning the tracks directly according to user cuts
43  if (!m_selectionString.empty()) {
44  ATH_CHECK( initializeParser(m_selectionString) );
45  }
46  return StatusCode::SUCCESS;
47 }

Member Data Documentation

◆ m_npass

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

Definition at line 53 of file TrackMeasurementThinning.h.

◆ m_ntot

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

Definition at line 52 of file TrackMeasurementThinning.h.

◆ m_selectionString

Gaudi::Property<std::string> DerivationFramework::TrackMeasurementThinning::m_selectionString { this, "SelectionString", "", ""}
private

Definition at line 49 of file TrackMeasurementThinning.h.

◆ m_SGKey

SG::ThinningHandleKey<xAOD::TrackMeasurementValidationContainer> DerivationFramework::TrackMeasurementThinning::m_SGKey { this, "TrackMeasurementValidationKey", "PixelClusters", "" }
private

Definition at line 57 of file TrackMeasurementThinning.h.

◆ m_streamName

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

Definition at line 54 of file TrackMeasurementThinning.h.


The documentation for this class was generated from the following files:
DerivationFramework::TrackMeasurementThinning::m_npass
std::atomic< unsigned int > m_npass
Definition: TrackMeasurementThinning.h:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
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
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::TrackMeasurementThinning::m_ntot
std::atomic< unsigned int > m_ntot
Definition: TrackMeasurementThinning.h:52
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::TrackMeasurementThinning::m_SGKey
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > m_SGKey
Definition: TrackMeasurementThinning.h:58
lumiFormat.i
int i
Definition: lumiFormat.py:85
DerivationFramework::TrackMeasurementThinning::m_streamName
StringProperty m_streamName
Definition: TrackMeasurementThinning.h:55
beamspotman.n
n
Definition: beamspotman.py:731
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
DerivationFramework::TrackMeasurementThinning::m_selectionString
Gaudi::Property< std::string > m_selectionString
Definition: TrackMeasurementThinning.h:50
entries
double entries
Definition: listroot.cxx:49
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73