ATLAS Offline Software
Loading...
Searching...
No Matches
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 20 of file TruthParentDecoratorAlg.h.

Constructor & Destructor Documentation

◆ CascadeCountDecorator()

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

Definition at line 195 of file TruthParentDecoratorAlg.cxx.

195 :
196 m_pids(pids.begin(), pids.end()),
197 m_dec(name),
198 // also hang on to the auxid so we can lock it later
199 m_auxid(SG::AuxTypeRegistry::instance().findAuxID(name))
200{
201}
SG::AuxElement::Decorator< unsigned char > m_dec
static AuxTypeRegistry & instance()
Return the singleton registry instance.

Member Function Documentation

◆ decorate()

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

Definition at line 202 of file TruthParentDecoratorAlg.cxx.

203{
204 unsigned char n_match = 0;
205 for (const auto& parent: parents) {
206 for (const auto& pid: m_pids) {
207 if (parent.cascade_pids.contains(pid)) n_match++;
208 }
209 }
210 m_dec(target) = n_match;
211}

◆ decorateDefault()

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

Definition at line 212 of file TruthParentDecoratorAlg.cxx.

213{
214 m_dec(target) = 0;
215}

◆ lock()

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

Definition at line 216 of file TruthParentDecoratorAlg.cxx.

217{
218 // We're locking a decoration on a const container, which would be a
219 // problem if they were made by anyone else since someone else might
220 // be messing with them. But here it shouldn't be a problem since we
221 // made them.
222 auto* cont ATLAS_THREAD_SAFE = const_cast<xAOD::IParticleContainer*>(target);
223 cont->lockDecoration(m_auxid);
224}
#define ATLAS_THREAD_SAFE
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.

Member Data Documentation

◆ m_auxid

SG::auxid_t CascadeCountDecorator::m_auxid
private

Definition at line 32 of file TruthParentDecoratorAlg.h.

◆ m_dec

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

Definition at line 31 of file TruthParentDecoratorAlg.h.

◆ m_pids

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

Definition at line 30 of file TruthParentDecoratorAlg.h.


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