18 const std::string& name,
19 ISvcLocator* pSvcLocator ) :
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;
79 return StatusCode::SUCCESS;
89 int>>& truth_decor)
const {
93 int type =
static_cast<int>( truthClass.first );
94 int origin =
static_cast<int>( truthClass.second );
100 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
Algorithm to decorate truth particles with their origin and type classes from MCTruthClassifier.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode initialize() override
TruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Local includes.
std::vector< IDTPM::WriteKeyAccessorPair< xAOD::TruthParticleContainer, int > > m_decor_truth
StatusCode decorateTruthParticle(const xAOD::TruthParticle &truth, std::vector< IDTPM::OptionalDecoration< xAOD::TruthParticleContainer, int > > &truth_decor) const
PublicToolHandle< IMCTruthClassifier > m_truthClassifier
virtual StatusCode execute(const EventContext &ctx) const override
const std::vector< std::string > m_decor_truth_names
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticlesName
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::pair< SG::WriteDecorHandle< ContainerType, VariableType >, bool > OptionalDecoration
bool decorationsAllExist(const T_Cont &container, const std::vector< WriteKeyAccessorPair< T_Cont, T > > &keys, bool verbose=false)
Like above - FIXME: maybe not needed.
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::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
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.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.