ATLAS Offline Software
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 
15 
16 
17 namespace 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 
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
D3PD::TruthParticleClassificationFillerTool::m_type
int * m_type
Variable: type from classifier tool.
Definition: TruthParticleClassificationFillerTool.h:69
initialize
void initialize()
Definition: run_EoverP.cxx:894
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition: AddVariable.cxx:85
D3PD::TruthParticleClassificationFillerTool::initialize
StatusCode initialize() override
Standard Gaudi initialize method.
Definition: TruthParticleClassificationFillerTool.cxx:42
D3PD::TruthParticleClassificationFillerTool::TruthParticleClassificationFillerTool
TruthParticleClassificationFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: TruthParticleClassificationFillerTool.cxx:27
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::BlockFillerTool< xAOD::TruthParticle >
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::TruthParticleClassificationFillerTool::m_origin
int * m_origin
Variable: origin from classifier tool.
Definition: TruthParticleClassificationFillerTool.h:72
D3PD::TruthParticleClassificationFillerTool::book
virtual StatusCode book() final
Book variables for this block.
Definition: TruthParticleClassificationFillerTool.cxx:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::TruthParticleClassificationFillerTool::fill
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
Definition: TruthParticleClassificationFillerTool.cxx:70
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TruthParticleClassificationFillerTool.h
Block filler for truth classification.
D3PD::TruthParticleClassificationFillerTool::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Property: The classifier tool.
Definition: TruthParticleClassificationFillerTool.h:66