 |
ATLAS Offline Software
|
Go to the documentation of this file.
18 const std::string&
name,
19 ISvcLocator* pSvcLocator ) :
28 ATH_CHECK( m_truthParticlesName.initialize(
29 not m_truthParticlesName.key().empty() ) );
31 ATH_CHECK( m_truthClassifier.retrieve() );
35 *
this, m_truthParticlesName,
36 m_prefix.value(), m_decor_truth_names, m_decor_truth );
38 if( m_decor_truth.size() != NDecorations ) {
39 ATH_MSG_ERROR(
"Incorrect booking of truth class decorations" );
40 return StatusCode::FAILURE;
43 return StatusCode::SUCCESS;
55 ATH_MSG_ERROR(
"Failed to retrieve truth particles container" );
56 return StatusCode::FAILURE;
61 ATH_MSG_DEBUG(
"All decorations already exist. Exiting gracefully" );
62 return StatusCode::SUCCESS;
66 std::vector< IDTPM::OptionalDecoration<xAOD::TruthParticleContainer, int> >
69 if( truth_decor.empty() ) {
71 return StatusCode::FAILURE;
76 ATH_CHECK( decorateTruthParticle( *truth, truth_decor ) );
79 return StatusCode::SUCCESS;
89 int>>& truth_decor)
const {
92 auto truthClass = m_truthClassifier->particleTruthClassifier( &truth );
93 int type =
static_cast<int>( truthClass.first );
94 int origin =
static_cast<int>( truthClass.second );
100 return StatusCode::SUCCESS;
void decorateOrRejectQuietly(const T_Cont_Elm &particle, OptionalDecoration< T_Cont, T > &decorator, const T &value)
Safe method to fill the decoration if decor flag is true.
virtual StatusCode initialize() override
std::vector< OptionalDecoration< T_Cont, T > > createDecoratorsIfNeeded(const T_Cont &container, const std::vector< WriteKeyAccessorPair< T_Cont, T > > &keys, const EventContext &ctx, bool verbose=false)
create/book the decorations if they do not exist already
TruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Local includes.
An algorithm that can be simultaneously executed in multiple threads.
Algorithm to decorate truth particles with their origin and type classes from MCTruthClassifier.
StatusCode decorateTruthParticle(const xAOD::TruthParticle &truth, std::vector< IDTPM::OptionalDecoration< xAOD::TruthParticleContainer, int >> &truth_decor) const
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
bool decorationsAllExist(const T_Cont &container, const std::vector< WriteKeyAccessorPair< T_Cont, T > > &keys, bool verbose=false)
Like above - FIXME: maybe not needed.
virtual StatusCode execute(const EventContext &ctx) const override
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void createDecoratorKeysAndAccessor(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< WriteKeyAccessorPair< T_Cont, T > > &decor_out)
create a pair composed of a WriteDecorHandleKey to create a decorator handle and an accessor to check...
std::pair< SG::WriteDecorHandle< ContainerType, VariableType >, bool > OptionalDecoration