21#include "GaudiKernel/MsgStream.h"
38bool barrel_p (
int region)
61int sampling (
int region)
197 float deta = elt->
deta();
198 float dphi = elt->
dphi();
202 if (
eta > elt->
eta() + deta/2)
210 if (
phi > elt->
phi() + dphi/2)
217 if (good != 2 && n == 1) {
269 if (elt_b ==
nullptr)
271 else if (elt_e ==
nullptr)
273 else if (cluster->
eSample (CaloSampling::EMB2) >
274 cluster->
eSample (CaloSampling::EME2))
315 if (!descr)
return nullptr;
316 int ieta = descr->eta_channel (
eta);
319 int iphi = descr->phi_channel (
phi);
320 if (iphi < 0)
return nullptr;
321 unsigned int index = iphi;
323 index += descr->n_phi();
343 if (!elt1)
return nullptr;
346 if (!elt2)
return nullptr;
361 int nphi = descr->n_phi();
363 for (
int etasgn = 1; etasgn >= -1; etasgn -= 2) {
364 for (
int iphi = 0; iphi < nphi; iphi++) {
373 if (cellid_mgr->
cell_id (cellIdHash2) != cellId2)
378 auto elt = std::make_unique<DummyDetDescrElement>
379 (descr->subcalo_hash(),
385 elt->set_cylindric_size (elt2->
deta(),
388 elt->set_cylindric (elt2->
eta() - etasgn * elt2->
deta(),
391 elt->set_cylindric_raw (elt2->
eta_raw() - etasgn * elt2->
deta(),
396 if (etasgn < 0)
index += nphi;
408 const std::string& name,
409 const IInterface* parent)
464 if (barrel_p (region)) {
473 samp = CaloSampling::EMB1;
476 samp = CaloSampling::EMB2;
479 samp = CaloSampling::EME1;
482 samp = CaloSampling::EME2;
505 if (std::abs (
phi) > 900 || std::abs (
eta) > 900)
550 corrtab[n_good][0] = energies[i];
552 corrtab[n_good][1] = builder.calculate (i, good);
582 unsigned int n_energies = energies.
size();
583 unsigned int shape[] = {n_energies, 2};
589 unsigned int beg = 0;
590 unsigned int end = n_energies;
591 if (energy <= energies[0])
593 else if (energy >= energies[n_energies-1])
598 for (
unsigned int i=beg; i<end; i++)
599 docalc (i, builder, energies, corrtab, n_good);
603 while (n_good == 0 && beg > 0) {
605 docalc (beg, builder, energies, corrtab, n_good);
607 while (n_good == 0 && end < n_energies) {
608 docalc (end, builder, energies, corrtab, n_good);
619 else if (n_good == 1) {
621 return corrtab[0][1];
623 else if (energy <= corrtab[0][0]) {
625 return corrtab[0][1];
627 else if (energy >= corrtab[n_good-1][0]) {
629 return corrtab[n_good-1][1];
633 return interpolate (corrtab, energy, energy_degree,
643 auto newhelper = std::make_unique<const CaloClusterCorr::DDHelper> (dd_man);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Definition of CaloDetDescrManager.
Definition of CaloDetDescriptor.
Calo Subsystem specific Detector Elements + Dummy element for testing.
CaloPhiRange class declaration.
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
Helper class for offline cell identifiers.
const CaloDetDescrElement * dd_inner_strip_fixup(const CaloDetDescrManager *dd_man, int region, float eta, float phi) const
Work around innermost strip problem.
const CaloDetDescrElement * find_dd_elt(const CaloDetDescrManager *dd_mgr, int region, const xAOD::CaloCluster *cluster, float eta, float phi) const
Find the detector descriptor element for a given position, correcting for DD edge bugs.
static const CaloDetDescrElement * find_dd_elt1(const CaloDetDescrManager *dd_mgr, int region, const CaloCluster *cluster, float eta, float phi)
Find the detector descriptor element for a given position.
void make_dummy_elts(const CaloDetDescrManager *dd_man)
Construct dummy DDEs used to work around innermost strip problem.
static const CaloDetDescrElement * dd_try_gap(const CaloDetDescrManager *dd_man, int region, const CaloCluster *cluster, float eta, float phi)
std::vector< std::unique_ptr< const CaloDetDescrElement > > m_dummy_elts
Collection of dummy elements.
DDHelper()=delete
delte default Constructor
Helper, used to calculate the values of the energy interpolation table.
static float energy_interpolation(float energy, const TableBuilder &builder, const CaloRec::Array< 1 > &energies, int energy_degree)
Many of the corrections use the same method for doing the final interpolation in energy.
virtual ~CaloClusterCorrectionCommon()
Destructor.
CaloClusterCorrectionCommon(const std::string &type, const std::string &name, const IInterface *parent)
Inherit constructor.
CxxUtils::CachedUniquePtr< const CaloClusterCorr::DDHelper > m_ddhelper
Helper for detector description lookup.
const CaloClusterCorr::DDHelper & ddhelper(const CaloDetDescrManager *dd_man) const
Retrieve the detector description helper, creating it if needed.
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Perform the correction.
virtual void makeTheCorrection(const Context &myctx, xAOD::CaloCluster *cluster, const CaloDetDescrElement *elt, float eta, float adj_eta, float phi, float adj_phi, CaloSampling::CaloSample samp) const =0
Virtual function for the correction-specific code.
Constant< int > m_region
Calibration constant: The calorimeter region for which this correction is intended.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Principal data class for CaloCell clusters.
double phiSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
double etaBE(int sampling) const
EMB/EMEC combined barycenter .
double phiBE(int sampling) const
EMB/EMEC combined barycenter .
virtual double eta() const
Retrieve eta independent of signal state.
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
bool inEndcap() const
Returns true if at least one clustered cell in EMEC.
virtual double phi() const
Retrieve phi independent of signal state.
bool inBarrel() const
Returns true if at least one clustered cell in EMB.
This class groups all DetDescr information related to a CaloCell.
float r_raw() const
cell r_raw
float eta_raw() const
cell eta_raw
float dphi() const
cell dphi
float eta() const
cell eta
float phi() const
cell phi
float phi_raw() const
cell phi_raw
float deta() const
cell deta
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
const CaloDetDescriptor * get_descriptor(const Identifier ®ionId) const
get descriptor by region identifier
This class provides the client interface for accessing the detector description information common to...
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
static double fix(double phi)
Read-only multidimensional array.
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
Read-write multidimensional array.
This is a "hash" representation of an Identifier.
float eSample(const CaloSample sampling) const
Polynomial interpolation in a table.
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > ®ions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.