ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClustersInConeTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6// CaloClustersInConeTool
7//
8// (c) ATLAS software
10
14
15namespace xAOD {
16
17 CaloClustersInConeTool::CaloClustersInConeTool (const std::string& type, const std::string& name, const IInterface* parent)
18 : AthAlgTool(type, name, parent)
19 {
20 declareInterface<ICaloClustersInConeTool>(this);
21 }
22
24 = default;
25
27 ATH_CHECK(m_caloClusterLocation.initialize());
28 return StatusCode::SUCCESS;
29 }
30
32 return StatusCode::SUCCESS;
33 }
34
37 {
38 const std::string tableName = name() + "LookUpTable";
39 SG::ReadHandle<LookUpTable> rh (tableName);
40 if (rh.isValid())
41 return &*rh;
42
43
45 if (!caloClusters.isValid()) {
46 ATH_MSG_ERROR("Was not able to access the calo cluster container " << m_caloClusterLocation.key());
47 return nullptr;
48 }
49 auto lut = std::make_unique<LookUpTable>();
50 lut->init(*caloClusters);
51 SG::WriteHandle<LookUpTable> wh (tableName);
52 return wh.put (std::move (lut), true);
53 }
54
55 bool CaloClustersInConeTool::particlesInCone( float eta, float phi, float dr, std::vector< const CaloCluster*>& output ) const {
57 const LookUpTable* lut = getTable();
58
59 return lut->iParticlesInCone( eta, phi, dr, output );
60 }
61
62 bool CaloClustersInConeTool::particlesInCone( float eta, float phi, float dr, std::vector< ElementLink<CaloClusterContainer> >& output ) const {
64 const LookUpTable* lut = getTable();
65
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)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
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?
virtual ~CaloClustersInConeTool(void)
destructor
virtual StatusCode finalize() override
finalize
CaloClustersInConeTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
const LookUpTable * getTable() const
SG::ReadHandleKey< CaloClusterContainer > m_caloClusterLocation
ID track collection name.
virtual bool particlesInCone(float eta, float phi, float dr, std::vector< const CaloCluster * > &output) const override
ICaloClustersInConeTool interface.
IParticlesLookUpTable< CaloCluster > LookUpTable
virtual StatusCode initialize() override
initialize
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.