ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticleClassificationFillerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12
15
16
17namespace D3PD {
18
19
27 (const std::string& type,
28 const std::string& name,
29 const IInterface* parent)
30 : Base(type, name, parent),
31 m_classifier ("MCTruthClassifier")
32{
33 declareProperty ("Classifier", m_classifier, "Classifier tool instance.");
34
35 book().ignore(); // Avoid coverity warnings.
36}
37
38
43{
44 CHECK( m_classifier.retrieve() );
45 return Base::initialize();
46}
47
48
53{
54 CHECK( addVariable ("type", m_type, "MC particle type, from classifier tool" ) );
55 CHECK( addVariable ("origin", m_origin, "MC particle origin, from classifier tool" ) );
56
57 return StatusCode::SUCCESS;
58}
59
60
69StatusCode
71{
72 auto res = m_classifier->particleTruthClassifier(&p);
73 *m_type = res.first;
74 *m_origin = res.second;
75
76 return StatusCode::SUCCESS;
77}
78
79
80} // namespace D3PD
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
std::pair< std::vector< unsigned int >, bool > res
Block filler for truth classification.
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
ToolHandle< IMCTruthClassifier > m_classifier
Property: The classifier tool.
StatusCode initialize() override
Standard Gaudi initialize method.
TruthParticleClassificationFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
virtual StatusCode book() final
Book variables for this block.
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
Block filler tool for noisy FEB information.
TruthParticle_v1 TruthParticle
Typedef to implementation.