13#include "CaloGeoHelpers/CaloSampling.h"
41 const std::string& name,
42 const ::IInterface* parent)
47 declareInterface<ICaloRingsBuilder>(
this);
50 "Eta Axes can be divide in two.");
52 "Phi Axes can be divide in two.");
69 for (
size_t rsConfIdx = 0; rsConfIdx <
m_nRingSets; ++rsConfIdx) {
71 const auto rsNLayers =
m_nLayers[rsConfIdx];
73 auto end_itr = itr + rsNLayers;
78 const auto& caloSampleItr =
reinterpret_cast<
79 std::vector<CaloSampling::CaloSample>::iterator&
81 const auto& caloSampleEndItr =
reinterpret_cast<
82 std::vector<CaloSampling::CaloSample>::iterator&
85 std::vector<CaloSampling::CaloSample> rsLayers( caloSampleItr ,
108 }
catch (
const std::runtime_error &e) {
109 ATH_MSG_ERROR(
"Could not add collection bounderies due to: " << e.what() );
111 std::ostringstream
str;
114 return StatusCode::FAILURE;
118 if (msgLevel() <= MSG::DEBUG){
119 std::ostringstream
str;
127 return StatusCode::SUCCESS;
133 return StatusCode::SUCCESS;
147 return StatusCode::FAILURE;
156 const auto nRings =
rawConf.nRings;
158 for (
const int layer :
rawConf.layers) {
165 for (
const CaloCell *cell : cells ) {
166 unsigned int ringNumber(0);
169 float deltaEta = (cell->eta() - seed.eta())
171 bool etaPositive = deltaEta > 0;
172 deltaEta = fabs(deltaEta);
183 const float deltaGreater = std::max(deltaEta,
deltaPhi);
186 ringNumber =
static_cast<unsigned int>(std::floor(deltaGreater + .5));
192 ringNumber = (ringNumber * 4) - 3;
195 ringNumber = (ringNumber * 4) - 2;
198 else if (etaPositive){
199 ringNumber = (ringNumber * 4) - 1;
202 ringNumber = (ringNumber * 4);
206 ringNumber = (etaPositive)?(ringNumber * 2):
207 ((ringNumber * 2) - 1);
210 ringNumber = (phiPositive)?(ringNumber * 2):
211 ((ringNumber * 2) - 1);
215 if ( ringNumber < nRings ){
217 rs->at(ringNumber) += cell->energy()/cosh(cell->eta());
219 rs->at(ringNumber) += cell->energy();
225 return StatusCode::SUCCESS;
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_CHECK
Evaluate an expression and check for errors.
Helpers for checking error return status codes and reporting errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Data object for each calorimeter readout cell.
This class provides the client interface for accessing the detector description information common to...
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
CaloAsymRingsBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
~CaloAsymRingsBuilder()
Destructor.
virtual StatusCode initialize() override
Tool main methods:
virtual StatusCode buildRingSet(const xAOD::RingSetConf::RawConf &rawConf, const AtlasGeoPoint &seed, xAOD::RingSet *rs) override
main method where the RingSets are built.
bool m_doPhiAxesDivision
This can be set True to divide in two the phi axes.
bool m_doEtaAxesDivision
This can be set True to divide in two the eta axes.
bool m_doTransverseEnergy
virtual StatusCode finalize() override
finalize method
CaloRingsBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
SG::WriteHandleKey< xAOD::RingSetContainer > m_rsContName
Name of RingSetContainer on Event StoreGate.
const xAOD::RingSetConf::RawConfCollection & rawConf() override
Extra methods:
xAOD::RingSetConf::RawConfCollection m_rsRawConfCol
holds each RingSet configuration (filled at initialize)
SG::WriteHandleKey< xAOD::CaloRingsContainer > m_crContName
Fill RingSet seed for IParticle.
size_t m_nRingSets
hold the number of RingSets we are building for each CaloRings
Gaudi::Property< std::vector< float > > m_etaWidth
Width of the ring in eta.
Gaudi::Property< std::vector< unsigned int > > m_nLayers
Number of calorimeter layers in each ringset.
Gaudi::Property< float > m_cellMaxDEtaDist
Maximum cell distance in eta to seed.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Gaudi::Property< std::vector< float > > m_phiWidth
Width of the ring in phi.
Gaudi::Property< std::vector< int > > m_layers
Calorimeter layers in each ringset.
SG::ReadHandleKey< CaloCellContainer > m_cellsContName
Name of CaloCellContainer.
Gaudi::Property< std::vector< unsigned int > > m_nRings
Number of rings in a ringset.
Gaudi::Property< float > m_cellMaxDPhiDist
Maximum cell distance in phi to seed.
const_pointer_type ptr()
Dereference the pointer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static Ringer::CalJointLayer whichLayer(const std::vector< CaloSampling::CaloSample > &layers)
static void print(const RawConf &raw, std::ostream &stream)
Prints rawConf.
static Ringer::CalJointSection whichSection(const std::vector< CaloSampling::CaloSample > &layers)
static void addRawConfColBounderies(RawConfCollection &clRingsConf)
Add to RawConfCollection its JointLayer/JointSection bounderies.
Namespace dedicated for Ringer utilities.
RingSet_v1 RingSet
Definition of the current "RingSet version".