ATLAS Offline Software
PhysicsAnalysis
D3PDMaker
TruthD3PDMaker
src
TruthParticleFillerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
12
#include "
TruthParticleFillerTool.h
"
13
#include "
AthenaKernel/errorcheck.h
"
14
#include "GaudiKernel/IPartPropSvc.h"
15
#include "HepPDT/ParticleData.hh"
16
#include "HepPDT/ParticleDataTable.hh"
17
#include "
TruthUtils/MagicNumbers.h
"
18
19
namespace
D3PD
{
20
21
28
TruthParticleFillerTool::TruthParticleFillerTool
(
const
std::string&
type
,
29
const
std::string&
name
,
30
const
IInterface*
parent
)
31
:
Base
(
type
,
name
,
parent
),
32
m_ppsvc (
"PartPropSvc"
,
name
)
33
{
34
declareProperty (
"PDGIDVariable"
,
m_PDGIDVariable
=
"pdgId"
);
35
declareProperty (
"PartPropSvc"
,
m_ppsvc
,
36
"Particle property service."
);
37
38
book
().ignore();
// Avoid coverity warnings.
39
}
40
41
45
StatusCode
TruthParticleFillerTool::initialize
()
46
{
47
CHECK
(
m_ppsvc
.retrieve() );
48
return
StatusCode::SUCCESS;
49
}
50
51
55
StatusCode
TruthParticleFillerTool::book
()
56
{
57
CHECK
(
addVariable
(
"status"
,
m_status
) );
58
CHECK
(
addVariable
(
"barcode"
,
m_barcode
) );
59
CHECK
(
addVariable
(
m_PDGIDVariable
,
m_pdgId
) );
60
CHECK
(
addVariable
(
"charge"
,
m_charge
) );
61
return
StatusCode::SUCCESS;
62
}
63
64
73
StatusCode
TruthParticleFillerTool::fill
(
const
xAOD::TruthParticle
&
p
)
74
{
75
*
m_status
=
p
.status();
76
*
m_barcode
=
HepMC::barcode
(
p
);
// FIXME barcode-based
77
*
m_pdgId
=
p
.pdgId();
78
79
const
HepPDT::ParticleDataTable* pdt =
m_ppsvc
->PDT();
80
const
HepPDT::ParticleData*
pd
= pdt->particle (std::abs(
p
.pdgId()));
81
*
m_charge
=
pd
?
pd
->charge() : 0;
82
if
(
p
.pdgId() < 0)
83
*
m_charge
= - *
m_charge
;
84
85
return
StatusCode::SUCCESS;
86
}
87
88
89
}
// namespace D3PD
D3PD::TruthParticleFillerTool::m_status
int * m_status
Variable: Status code for the particle.
Definition:
TruthParticleFillerTool.h:70
D3PD::TruthParticleFillerTool::m_pdgId
int * m_pdgId
Variable: Particle ID code.
Definition:
TruthParticleFillerTool.h:76
makeDTCalibBlob_pickPhase.pd
pd
Definition:
makeDTCalibBlob_pickPhase.py:342
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
Block filler tool for noisy FEB information.
Definition:
CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
D3PD::TruthParticleFillerTool::m_charge
float * m_charge
Variable: Particle charge.
Definition:
TruthParticleFillerTool.h:79
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HepMC::barcode
int barcode(const T *p)
Definition:
Barcode.h:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition:
TruthParticle_v1.h:37
D3PD::TruthParticleFillerTool::fill
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
Definition:
TruthParticleFillerTool.cxx:73
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::TruthParticleFillerTool::m_barcode
int * m_barcode
Variable: Barcode for the particle.
Definition:
TruthParticleFillerTool.h:73
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
MagicNumbers.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::TruthParticleFillerTool::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition:
TruthParticleFillerTool.cxx:45
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
TruthParticleFillerTool.h
Block filler tool for TruthParticle's.
D3PD::TruthParticleFillerTool::m_PDGIDVariable
std::string m_PDGIDVariable
Property: Name for pdgId variable.
Definition:
TruthParticleFillerTool.h:64
D3PD::TruthParticleFillerTool::TruthParticleFillerTool
TruthParticleFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition:
TruthParticleFillerTool.cxx:28
D3PD::TruthParticleFillerTool::book
virtual StatusCode book() final
Book variables for this block.
Definition:
TruthParticleFillerTool.cxx:55
D3PD::TruthParticleFillerTool::m_ppsvc
ServiceHandle< IPartPropSvc > m_ppsvc
Property: Particle property service.
Definition:
TruthParticleFillerTool.h:67
Generated on Wed Jan 8 2025 21:20:56 for ATLAS Offline Software by
1.8.18