32#include "GaudiKernel/StatusCode.h"
35#include "CLHEP/Units/PhysicalConstants.h"
36#include "GaudiKernel/MsgStream.h"
42using std::numbers::pi;
46inline constexpr double twopi = 2*
pi;
47inline constexpr double deta = 0.2;
48inline constexpr double dphi =
twopi / 64. ;
59 return StatusCode::SUCCESS;
66 float eta = cluster->
eta();
67 float phi = cluster->
phi();
69 float aeta = fabs(
eta);
73 if (aeta < etamin_crack || aeta > etamax_crack)
78 assert (scint_weight.
size() == correction.size());
79 if (correction.size() == 0)
return;
91 for ( ; f_cell!=l_cell; ++f_cell)
95 int inum = cell->caloDDE()->getSampling();
97 if (CaloSampling::TileGap3 == inum ) {
98 double phic = cell->phi();
99 double etac = cell->eta();
102 if (etac >=
eta-deta && etac <=
eta+deta) {
103 if (phic >=
phi-dphi && phic <=
phi+dphi) {
104 eh_scint += cell->e();
112 double granularity = (etamax_crack - etamin_crack)/correction.size();
113 int ind =
static_cast<int> ((aeta - etamin_crack)/granularity);
116 eh_scint = eh_scint * scint_weight[ind];
119 double energy = (cluster->
e())*correction[ind];
123 energy += eh_scint * correction[ind];
124 cluster->
setE(energy);
134 (
const std::string& name)
136 return this->
setProperty (StringProperty (
"cells_name", name));
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
Data object for each calorimeter readout cell.
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
virtual StatusCode initialize() override
Principal data class for CaloCell clusters.
virtual double e() const
Retrieve energy independent of signal state.
virtual double eta() const
Retrieve eta independent of signal state.
virtual double phi() const
Retrieve phi independent of signal state.
virtual void setE(double e)
Set energy.
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
virtual StatusCode setCaloCellContainerName(const std::string &name) override
Change the name of the CaloCellContainer used by this tool.
Constant< float > m_etamax_crack
SG::ReadHandleKey< CaloCellContainer > m_cells_name
Property: The name of the container in which to look to find tile cells.
Constant< float > m_etamin_crack
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Constant< CxxUtils::Array< 1 > > m_scint_weight
Read-only multidimensional array.
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
DataModel_detail::const_iterator< DataVector > const_iterator
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.