ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticlesInConeTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4
6// TruthParticlesInConeTool
7//
8// (c) ATLAS software
10
12
13namespace xAOD {
14
16 const std::string& name,
17 const IInterface* parent)
18 : AthAlgTool(type, name, parent)
19{
20 declareInterface<ITruthParticlesInConeTool>(this);
21}
22
23
24StatusCode
26{
28 const std::string tableName = name() + "LookUpTable";
29 m_LookUpTableCacheRead = tableName;
30 m_LookUpTableCacheWrite = tableName;
33 return StatusCode::SUCCESS;
34}
35
37TruthParticlesInConeTool::getTable(const EventContext& ctx) const
38{
40 if (rh.isValid()) {
41 return &*rh;
42 }
44 ctx);
45 if (!truthParticles.isValid()) {
46 ATH_MSG_ERROR("Could not open a TruthParticle container with key "
48 return nullptr;
49 }
50 auto lut = std::make_unique<LookUpTable>();
51 lut->init(*truthParticles);
53 return wh.put(std::move(lut), true);
54}
55
56bool
58 const EventContext& ctx,
59 float eta,
60 float phi,
61 float dr,
62 std::vector<const TruthParticle*>& output) const
63{
65 const LookUpTable* lut = getTable(ctx);
66 return lut->iParticlesInCone(eta, phi, dr, output);
67}
68} // end of namespace
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandleKey< LookUpTable > m_LookUpTableCacheWrite
TruthParticlesInConeTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
const LookUpTable * getTable(const EventContext &ctx) const
SG::ReadHandleKey< TruthParticleContainer > m_truthParticleLocation
Truth Particle collection name.
virtual bool particlesInCone(const EventContext &ctx, float eta, float phi, float dr, std::vector< const TruthParticle * > &output) const override final
ITruthParticlesInConeTool interface.
SG::ReadHandleKey< LookUpTable > m_LookUpTableCacheRead
IParticlesLookUpTable< TruthParticle > LookUpTable
virtual StatusCode initialize() override final
initialize
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.