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 186 of file TruthParentDecoratorAlg.cxx.

186 :
187 m_pids(pids.begin(), pids.end()),
188 m_dec(name),
189 // also hang on to the auxid so we can lock it later
190 m_auxid(SG::AuxTypeRegistry::instance().findAuxID(name))
191{
192}
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 193 of file TruthParentDecoratorAlg.cxx.

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

◆ decorateDefault()

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

Definition at line 203 of file TruthParentDecoratorAlg.cxx.

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

◆ lock()

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

Definition at line 207 of file TruthParentDecoratorAlg.cxx.

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