ATLAS Offline Software
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 
11 #include "CaloClustersInConeTool.h"
12 #include "StoreGate/ReadHandle.h"
13 #include "StoreGate/WriteHandle.h"
14 
15 namespace xAOD {
16 
17  CaloClustersInConeTool::CaloClustersInConeTool (const std::string& type, const std::string& name, const IInterface* parent)
19  {
20  declareInterface<ICaloClustersInConeTool>(this);
21  }
22 
24  = default;
25 
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
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::CaloClustersInConeTool::CaloClustersInConeTool
CaloClustersInConeTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: CaloClustersInConeTool.cxx:17
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
xAOD::CaloClustersInConeTool::~CaloClustersInConeTool
virtual ~CaloClustersInConeTool(void)
destructor
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
xAOD::CaloClustersInConeTool::m_caloClusterLocation
SG::ReadHandleKey< CaloClusterContainer > m_caloClusterLocation
ID track collection name.
Definition: CaloClustersInConeTool.h:47
xAOD::CaloClustersInConeTool::finalize
virtual StatusCode finalize() override
finalize
Definition: CaloClustersInConeTool.cxx:31
WriteHandle.h
Handle class for recording to StoreGate.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::CaloClustersInConeTool::particlesInCone
virtual bool particlesInCone(float eta, float phi, float dr, std::vector< const CaloCluster * > &output) const override
ICaloClustersInConeTool interface.
Definition: CaloClustersInConeTool.cxx:55
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::CaloClustersInConeTool::initialize
virtual StatusCode initialize() override
initialize
Definition: CaloClustersInConeTool.cxx:26
test_pyathena.parent
parent
Definition: test_pyathena.py:15
parseDir.wh
wh
Definition: parseDir.py:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
merge.output
output
Definition: merge.py:17
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::IParticlesLookUpTable
2D look up table for iParticles
Definition: IParticlesLookUpTable.h:17
ReadHandle.h
Handle class for reading from StoreGate.
AthAlgTool
Definition: AthAlgTool.h:26
CaloClustersInConeTool.h
xAOD::CaloClustersInConeTool::getTable
const LookUpTable * getTable() const
Definition: CaloClustersInConeTool.cxx:36