ATLAS Offline Software
Loading...
Searching...
No Matches
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
14#include "GaudiKernel/IPartPropSvc.h"
17
18namespace D3PD {
19
20
28 const std::string& name,
29 const IInterface* parent)
30 : Base (type, name, parent),
31 m_ppsvc ("PartPropSvc", name)
32{
33 declareProperty ("PDGIDVariable", m_PDGIDVariable = "pdgId");
34 declareProperty ("PartPropSvc", m_ppsvc,
35 "Particle property service.");
36
37 book().ignore(); // Avoid coverity warnings.
38}
39
40
45{
46 CHECK( m_ppsvc.retrieve() );
47 return StatusCode::SUCCESS;
48}
49
50
55{
56 CHECK( addVariable("status", m_status) );
57 CHECK( addVariable("barcode", m_uniqueID) ); // TODO Rename variable to be consistent?
59 CHECK( addVariable("charge", m_charge) );
60 return StatusCode::SUCCESS;
61}
62
63
73{
74 *m_status = p.status();
76 *m_pdgId = p.pdgId();
77 *m_charge = static_cast<int>(MC::charge(p.pdgId()));
78 return StatusCode::SUCCESS;
79}
80
81
82} // namespace D3PD
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
ATLAS-specific HepMC functions.
Block filler tool for TruthParticle's.
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
ServiceHandle< IPartPropSvc > m_ppsvc
Property: Particle property service.
BlockFillerTool< xAOD::TruthParticle > Base
int * m_uniqueID
Variable: Unique Identifier for the particle.
std::string m_PDGIDVariable
Property: Name for pdgId variable.
float * m_charge
Variable: Particle charge.
int * m_status
Variable: Status code for the particle.
virtual StatusCode initialize() override
Standard Gaudi initialize method.
TruthParticleFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
int * m_pdgId
Variable: Particle ID code.
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.
int uniqueID(const T &p)
double charge(const T &p)
TruthParticle_v1 TruthParticle
Typedef to implementation.