ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
TruthD3PDMaker
src
TruthParticleFillerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
11
12
#include "
TruthParticleFillerTool.h
"
13
#include "
AthenaKernel/errorcheck.h
"
14
#include "
TruthUtils/MagicNumbers.h
"
15
#include "
TruthUtils/HepMCHelpers.h
"
16
17
namespace
D3PD
{
18
19
26
TruthParticleFillerTool::TruthParticleFillerTool
(
const
std::string&
type
,
27
const
std::string& name,
28
const
IInterface* parent)
29
:
Base
(
type
, name, parent)
30
{
31
declareProperty (
"PDGIDVariable"
,
m_PDGIDVariable
=
"pdgId"
);
32
33
book
().ignore();
// Avoid coverity warnings.
34
}
35
36
40
StatusCode
TruthParticleFillerTool::initialize
()
41
{
42
return
StatusCode::SUCCESS;
43
}
44
45
49
StatusCode
TruthParticleFillerTool::book
()
50
{
51
CHECK
(
addVariable
(
"status"
,
m_status
) );
52
CHECK
(
addVariable
(
"barcode"
,
m_uniqueID
) );
// TODO Rename variable to be consistent?
53
CHECK
(
addVariable
(
m_PDGIDVariable
,
m_pdgId
) );
54
CHECK
(
addVariable
(
"charge"
,
m_charge
) );
55
return
StatusCode::SUCCESS;
56
}
57
58
67
StatusCode
TruthParticleFillerTool::fill
(
const
xAOD::TruthParticle
& p)
68
{
69
*
m_status
= p.status();
70
*
m_uniqueID
=
HepMC::uniqueID
(p);
71
*
m_pdgId
= p.pdgId();
72
*
m_charge
=
static_cast<
int
>
(
MC::charge
(p.pdgId()));
73
return
StatusCode::SUCCESS;
74
}
75
76
77
}
// namespace D3PD
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
HepMCHelpers.h
ATLAS-specific HepMC functions.
MagicNumbers.h
TruthParticleFillerTool.h
Block filler tool for TruthParticle's.
D3PD::BlockFillerTool< xAOD::TruthParticle >::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Definition
AddVariable.cxx:85
D3PD::TruthParticleFillerTool::Base
BlockFillerTool< xAOD::TruthParticle > Base
Definition
TruthParticleFillerTool.h:28
D3PD::TruthParticleFillerTool::m_uniqueID
int * m_uniqueID
Variable: Unique Identifier for the particle.
Definition
TruthParticleFillerTool.h:69
D3PD::TruthParticleFillerTool::m_PDGIDVariable
std::string m_PDGIDVariable
Property: Name for pdgId variable.
Definition
TruthParticleFillerTool.h:63
D3PD::TruthParticleFillerTool::m_charge
float * m_charge
Variable: Particle charge.
Definition
TruthParticleFillerTool.h:75
D3PD::TruthParticleFillerTool::m_status
int * m_status
Variable: Status code for the particle.
Definition
TruthParticleFillerTool.h:66
D3PD::TruthParticleFillerTool::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition
TruthParticleFillerTool.cxx:40
D3PD::TruthParticleFillerTool::TruthParticleFillerTool
TruthParticleFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
TruthParticleFillerTool.cxx:26
D3PD::TruthParticleFillerTool::m_pdgId
int * m_pdgId
Variable: Particle ID code.
Definition
TruthParticleFillerTool.h:72
D3PD::TruthParticleFillerTool::book
virtual StatusCode book() final
Book variables for this block.
Definition
TruthParticleFillerTool.cxx:49
D3PD::TruthParticleFillerTool::fill
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
Definition
TruthParticleFillerTool.cxx:67
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
HepMC::uniqueID
int uniqueID(const T &p)
Definition
MagicNumbers.h:89
MC::charge
double charge(const T &p)
Definition
HepMCHelpers.h:1004
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
type
Generated on
for ATLAS Offline Software by
1.17.0