21#include "GaudiKernel/MsgStream.h"
22#include "GaudiKernel/ThreadLocalContext.h"
39bool barrel_p (
int region)
62int sampling (
int region)
198 float deta = elt->
deta();
199 float dphi = elt->
dphi();
203 if (
eta > elt->
eta() + deta/2)
211 if (
phi > elt->
phi() + dphi/2)
218 if (good != 2 && n == 1) {
270 if (elt_b ==
nullptr)
272 else if (elt_e ==
nullptr)
274 else if (cluster->
eSample (CaloSampling::EMB2) >
275 cluster->
eSample (CaloSampling::EME2))
316 if (!descr)
return nullptr;
317 int ieta = descr->eta_channel (
eta);
320 int iphi = descr->phi_channel (
phi);
321 if (iphi < 0)
return nullptr;
322 unsigned int index = iphi;
324 index += descr->n_phi();
344 if (!elt1)
return nullptr;
347 if (!elt2)
return nullptr;
362 int nphi = descr->n_phi();
364 for (
int etasgn = 1; etasgn >= -1; etasgn -= 2) {
365 for (
int iphi = 0; iphi < nphi; iphi++) {
374 if (cellid_mgr->
cell_id (cellIdHash2) != cellId2)
379 auto elt = std::make_unique<DummyDetDescrElement>
380 (descr->subcalo_hash(),
386 elt->set_cylindric_size (elt2->
deta(),
389 elt->set_cylindric (elt2->
eta() - etasgn * elt2->
deta(),
392 elt->set_cylindric_raw (elt2->
eta_raw() - etasgn * elt2->
deta(),
397 if (etasgn < 0)
index += nphi;
409 const std::string& name,
410 const IInterface* parent)
465 if (barrel_p (region)) {
474 samp = CaloSampling::EMB1;
477 samp = CaloSampling::EMB2;
480 samp = CaloSampling::EME1;
483 samp = CaloSampling::EME2;
506 if (std::abs (
phi) > 900 || std::abs (
eta) > 900)
551 corrtab[n_good][0] = energies[i];
553 corrtab[n_good][1] = builder.calculate (i, good);
583 unsigned int n_energies = energies.
size();
584 unsigned int shape[] = {n_energies, 2};
590 unsigned int beg = 0;
591 unsigned int end = n_energies;
592 if (energy <= energies[0])
594 else if (energy >= energies[n_energies-1])
599 for (
unsigned int i=beg; i<end; i++)
600 docalc (i, builder, energies, corrtab, n_good);
604 while (n_good == 0 && beg > 0) {
606 docalc (beg, builder, energies, corrtab, n_good);
608 while (n_good == 0 && end < n_energies) {
609 docalc (end, builder, energies, corrtab, n_good);
620 else if (n_good == 1) {
622 return corrtab[0][1];
624 else if (energy <= corrtab[0][0]) {
626 return corrtab[0][1];
628 else if (energy >= corrtab[n_good-1][0]) {
630 return corrtab[n_good-1][1];
634 return interpolate (corrtab, energy, energy_degree,
644 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.
const EventContext & ctx() const