ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CascadeCountDecorator Class Reference

#include <TruthParentDecoratorAlg.h>

Collaboration diagram for CascadeCountDecorator:

Public Member Functions

 CascadeCountDecorator (const std::string &name, const std::vector< int > &pids)
 
void decorate (const SG::AuxElement &target, const std::vector< MatchedParent > &parents) const
 
void decorateDefault (const SG::AuxElement &target) const
 
void lock (const xAOD::IParticleContainer *target) const
 

Private Attributes

std::vector< int > m_pids
 
SG::AuxElement::Decorator< unsigned char > m_dec
 
SG::auxid_t m_auxid
 

Detailed Description

Definition at line 16 of file TruthParentDecoratorAlg.h.

Constructor & Destructor Documentation

◆ CascadeCountDecorator()

CascadeCountDecorator::CascadeCountDecorator ( const std::string &  name,
const std::vector< int > &  pids 
)

Definition at line 185 of file TruthParentDecoratorAlg.cxx.

185  :
186  m_pids(pids.begin(), pids.end()),
187  m_dec(name),
188  // also hang on to the auxid so we can lock it later
190 {
191 }

Member Function Documentation

◆ decorate()

void CascadeCountDecorator::decorate ( const SG::AuxElement target,
const std::vector< MatchedParent > &  parents 
) const

Definition at line 192 of file TruthParentDecoratorAlg.cxx.

193 {
194  unsigned char n_match = 0;
195  for (const auto& parent: parents) {
196  for (const auto& pid: m_pids) {
197  if (parent.cascade_pids.contains(pid)) n_match++;
198  }
199  }
200  m_dec(target) = n_match;
201 }

◆ decorateDefault()

void CascadeCountDecorator::decorateDefault ( const SG::AuxElement target) const

Definition at line 202 of file TruthParentDecoratorAlg.cxx.

203 {
204  m_dec(target) = 0;
205 }

◆ lock()

void CascadeCountDecorator::lock ( const xAOD::IParticleContainer target) const

Definition at line 206 of file TruthParentDecoratorAlg.cxx.

207 {
208  // We're locking a decoration on a const container, which would be a
209  // problem if they were made by anyone else since someone else might
210  // be messing with them. But here it shouldn't be a problem since we
211  // made them.
212  auto* cont ATLAS_THREAD_SAFE = const_cast<xAOD::IParticleContainer*>(target);
213  cont->lockDecoration(m_auxid);
214 }

Member Data Documentation

◆ m_auxid

SG::auxid_t CascadeCountDecorator::m_auxid
private

Definition at line 28 of file TruthParentDecoratorAlg.h.

◆ m_dec

SG::AuxElement::Decorator<unsigned char> CascadeCountDecorator::m_dec
private

Definition at line 27 of file TruthParentDecoratorAlg.h.

◆ m_pids

std::vector<int> CascadeCountDecorator::m_pids
private

Definition at line 26 of file TruthParentDecoratorAlg.h.


The documentation for this class was generated from the following files:
CascadeCountDecorator::m_auxid
SG::auxid_t m_auxid
Definition: TruthParentDecoratorAlg.h:28
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
python.DecayParser.parents
parents
print ("==> buf:",buf)
Definition: DecayParser.py:30
CascadeCountDecorator::m_pids
std::vector< int > m_pids
Definition: TruthParentDecoratorAlg.h:26
CascadeCountDecorator::m_dec
SG::AuxElement::Decorator< unsigned char > m_dec
Definition: TruthParentDecoratorAlg.h:27
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
copySelective.target
string target
Definition: copySelective.py:36
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211