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 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
189 m_auxid(SG::AuxTypeRegistry::instance().findAuxID(name))
190{
191}
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 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}
#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 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: