ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSwEta2b_g3 Class Reference

#include <CaloSwEta2b_g3.h>

Inheritance diagram for CaloSwEta2b_g3:
Collaboration diagram for CaloSwEta2b_g3:

Public Member Functions

virtual void makeCorrection (const Context &myctx, xAOD::CaloCluster *cluster) const override
virtual const std::string & toolType () const override
virtual StatusCode initialize () override
virtual void setsample (xAOD::CaloCluster *cluster, CaloSampling::CaloSample sampling, float em, float etam, float phim, float emax, float etamax, float phimax, float etas, float phis) const
virtual void setenergy (xAOD::CaloCluster *cluster, float energy) const
StatusCode execute (const EventContext &ctx, xAOD::CaloCluster *cluster) const override
virtual StatusCode execute (const EventContext &ctx, xAOD::CaloClusterContainer *collection) const
 Execute on an entire collection of clusters.

Protected Attributes

SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}

Private Member Functions

 CaloSwEta2b_g3 ()=delete

Private Attributes

Constant< CxxUtils::Array< 2 > > m_correction { this, "correction", "" }
Constant< CxxUtils::Array< 2 > > m_residuals { this, "residuals", "" }
Constant< CxxUtils::Array< 1 > > m_residual_bins { this, "residual_bins", "" }
Constant< int > m_correction_degree { this, "correction_degree", "" }
Constant< int > m_residual_eval_degree { this, "residual_eval_degree", ""}
Constant< int > m_residual_degree { this, "residual_degree", "" }
Constant< float > m_correction_coef { this, "correction_coef", "" }
Constant< float > m_residual_coef { this, "residual_coef", "" }
Constant< int > m_region { this, "region", "" }

Static Private Attributes

static const float s_middle_layer_granularity = 0.025

Detailed Description

Definition at line 40 of file CaloSwEta2b_g3.h.

Constructor & Destructor Documentation

◆ CaloSwEta2b_g3()

CaloSwEta2b_g3::CaloSwEta2b_g3 ( )
privatedelete

Member Function Documentation

◆ execute() [1/2]

StatusCode CaloClusterCorrection::execute ( const EventContext & ctx,
xAOD::CaloCluster * cluster ) const
overrideinherited

Definition at line 52 of file CaloClusterCorrection.cxx.

54{
55 this->makeCorrection (context(ctx), cluster);
56
57#if 0
58 ATH_MSG_DEBUG( " ...... e, et " << cluster->e() << " " << cluster->et() << endmsg);
59 ATH_MSG_DEBUG( " ...... eta, etaBE, etaSmp " << cluster->eta() << " " << cluster->etaBE(2)
60 << " " << cluster->etaSample(CaloSampling::EMB1)
61 << " " << cluster->etaSample(CaloSampling::EMB2)
62 << " " << cluster->etaSample(CaloSampling::EMB3) << endmsg);
63 ATH_MSG_DEBUG( " ...... phi, phiBE, phiSmp " << cluster->phi() << " " << cluster->phiBE(2)
64 << " " << cluster->phiSample(CaloSampling::EMB1)
65 << " " << cluster->phiSample(CaloSampling::EMB2)
66 << " " << cluster->phiSample(CaloSampling::EMB3) << endmsg);
67#endif
68
69 return StatusCode::SUCCESS;
70}
#define endmsg
#define ATH_MSG_DEBUG(x)
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *) const =0
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.

◆ execute() [2/2]

StatusCode CaloClusterProcessor::execute ( const EventContext & ctx,
xAOD::CaloClusterContainer * collection ) const
inherited

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters.

This will iterate over all the clusters in collection and call execute on each one individually.

Parameters
collectionThe container of clusters.
ctxThe event context.

This will iterate over all the clusters in collection and call execute on each one individually.

Definition at line 65 of file CaloClusterProcessor.cxx.

46{
47 for (xAOD::CaloCluster* clu : *collection) {
48 ATH_CHECK( execute (ctx, clu) );
49 }
50 return StatusCode::SUCCESS;
51}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *cluster) const override
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ initialize()

StatusCode CaloClusterCorrection::initialize ( )
overridevirtualinherited

Reimplemented in CaloClusterBadChannelList, CaloDummyCorrection, CaloFillRectangularCluster, CaloSwDeadOTX_back, CaloSwDeadOTX_ps, CaloSwGap_g3, CaloSwGap_v2, CaloSwGap_v3, CaloTopoEMGap, and CaloTopoEMlayers.

Definition at line 46 of file CaloClusterCorrection.cxx.

46 {
47 ATH_CHECK(m_caloMgrKey.initialize());
48 ATH_CHECK(base_class::initialize());
49 return StatusCode::SUCCESS;
50}
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey

◆ makeCorrection()

void CaloSwEta2b_g3::makeCorrection ( const Context & myctx,
xAOD::CaloCluster * cluster ) const
overridevirtual

Implements CaloClusterCorrection.

Definition at line 49 of file CaloSwEta2b_g3.cxx.

51{
52 // Only for barrel
53 if (!cluster->inBarrel())
54 return;
55
56 const CxxUtils::Array<2> correction = m_correction (myctx);
57 const CxxUtils::Array<2> residuals = m_residuals (myctx);
58 const CxxUtils::Array<1> residual_bins = m_residual_bins (myctx);
59 const int correction_degree = m_correction_degree(myctx);
60 const int residual_eval_degree = m_residual_eval_degree(myctx);
61 const int residual_degree = m_residual_degree(myctx);
62 const float correction_coef = m_correction_coef(myctx);
63 const float residual_coef = m_residual_coef(myctx);
64
65 assert (residuals.size(1)-1 == residual_bins.size());
66
67 // eta of second sampling
68 float eta = cluster->etaSample(CaloSampling::EMB2);
69 if (eta == -999.) return;
70 float aeta = fabs(eta);
71
72 // u2 is the distance to the inner edge of the cell (granularity 0.025)
73 float u2 = fmod(aeta,s_middle_layer_granularity) ;
74
75 // First order (average) S-shape correction
76 float deta = correction_coef * interpolate (correction,
77 u2,
78 correction_degree);
79
80 // Residual S-shape correction: six ranges in eta from 0 to 1.2
81 // Evaluated by 2nd order interpolation between 10 tabulated values
82
83 // first we evaluate our residual in each eta range, given u2
84
85 unsigned int shape[] = {residual_bins.size(), 2};
86 CaloRec::WritableArrayData<2> w (shape);
87
88 for (unsigned int i=0; i < residual_bins.size(); i++) {
89 w[i][0] = residual_bins[i];
90 w[i][1] = interpolate (residuals,
91 u2,
92 residual_eval_degree,
93 i+1);
94 }
95
96 // finally we interpolate (2nd order) for the actual eta
97
98 deta += residual_coef * interpolate (w,
99 aeta,
100 residual_degree);
101 if (eta < 0)
102 deta = -deta;
103
104 // make correction to second sampling
105 cluster->setEta(CaloSampling::EMB2, eta - deta);
106}
Scalar eta() const
pseudorapidity method
Constant< float > m_residual_coef
Constant< int > m_residual_eval_degree
Constant< CxxUtils::Array< 2 > > m_correction
Constant< int > m_residual_degree
Constant< CxxUtils::Array< 1 > > m_residual_bins
static const float s_middle_layer_granularity
Constant< int > m_correction_degree
Constant< float > m_correction_coef
Constant< CxxUtils::Array< 2 > > m_residuals
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > &regions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ setenergy()

void CaloClusterCorrection::setenergy ( xAOD::CaloCluster * cluster,
float energy ) const
virtualinherited

Definition at line 93 of file CaloClusterCorrection.cxx.

94{
95 if (cluster->e() == 0) {
96 if (energy != 0)
97 REPORT_MESSAGE (MSG::WARNING)
98 << "Attempt to rescale zero-energy cluster to energy " << energy
99 << " ignored.";
100 return;
101 }
102
103 float correction = energy/cluster->e();
104 cluster->setE(energy);
105
106 // also correct individual sampling energies:
107
108 for (int iSample=CaloSampling::PreSamplerB;
109 iSample < CaloSampling::Unknown;
110 ++iSample)
111 {
112 CaloSampling::CaloSample sampling=static_cast<CaloSampling::CaloSample>(iSample);
113 if (cluster->hasSampling (sampling)) {
114 double e = cluster->eSample(sampling);
115 cluster->setEnergy(sampling,e*correction) ;
116 }
117 }
118}
#define REPORT_MESSAGE(LVL)
Report a message.
float eSample(const CaloSample sampling) const
bool setEnergy(const CaloSample sampling, const float e)
Set energy for a given sampling. Returns false if the sample isn't part of the cluster.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.

◆ setsample()

void CaloClusterCorrection::setsample ( xAOD::CaloCluster * cluster,
CaloSampling::CaloSample sampling,
float em,
float etam,
float phim,
float emax,
float etamax,
float phimax,
float etas,
float phis ) const
virtualinherited

Definition at line 73 of file CaloClusterCorrection.cxx.

78{
79 cluster->setEnergy(sampling, em);
80 cluster->setEta(sampling, etam);
81 cluster->setPhi(sampling, phim);
82
83 cluster->setEmax(sampling,emax);
84 cluster->setEtamax(sampling,etamax);
85 cluster->setPhimax(sampling,phimax);
86
87 cluster->setEtasize(sampling, etas);
88 cluster->setPhisize(sampling, phis);
89}
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
bool setEtasize(const CaloSample sampling, const float etaSize)
Set the cluster size in for a given sampling.
bool setPhisize(const CaloSample sampling, const float phiSize)
Set the cluster size in for a given sampling.
bool setPhimax(const CaloSample sampling, const float phiMax)
Set the phi of the cell with the highest energy in a particular sampling.
bool setEmax(const CaloSample sampling, const float eMax)
Set the Energy of the cell with the highest energy in a particular sampling.
bool setEtamax(const CaloSample sampling, const float etaMax)
Set the eta of the cell with the highest energy in a particular sampling.

◆ toolType()

const std::string & CaloSwEta2b_g3::toolType ( ) const
overridevirtual

Definition at line 109 of file CaloSwEta2b_g3.cxx.

110{
111 static const std::string typeName = "CaloSwEta_g3";
112 return typeName;
113}

Member Data Documentation

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> CaloClusterCorrection::m_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
protectedinherited

Definition at line 83 of file CaloClusterCorrection.h.

83{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_correction

Constant<CxxUtils::Array<2> > CaloSwEta2b_g3::m_correction { this, "correction", "" }
private

Definition at line 59 of file CaloSwEta2b_g3.h.

59{ this, "correction", "" };

◆ m_correction_coef

Constant<float> CaloSwEta2b_g3::m_correction_coef { this, "correction_coef", "" }
private

Definition at line 65 of file CaloSwEta2b_g3.h.

65{ this, "correction_coef", "" };

◆ m_correction_degree

Constant<int> CaloSwEta2b_g3::m_correction_degree { this, "correction_degree", "" }
private

Definition at line 62 of file CaloSwEta2b_g3.h.

62{ this, "correction_degree", "" };

◆ m_region

Constant<int> CaloSwEta2b_g3::m_region { this, "region", "" }
private

Definition at line 67 of file CaloSwEta2b_g3.h.

67{ this, "region", "" };

◆ m_residual_bins

Constant<CxxUtils::Array<1> > CaloSwEta2b_g3::m_residual_bins { this, "residual_bins", "" }
private

Definition at line 61 of file CaloSwEta2b_g3.h.

61{ this, "residual_bins", "" };

◆ m_residual_coef

Constant<float> CaloSwEta2b_g3::m_residual_coef { this, "residual_coef", "" }
private

Definition at line 66 of file CaloSwEta2b_g3.h.

66{ this, "residual_coef", "" };

◆ m_residual_degree

Constant<int> CaloSwEta2b_g3::m_residual_degree { this, "residual_degree", "" }
private

Definition at line 64 of file CaloSwEta2b_g3.h.

64{ this, "residual_degree", "" };

◆ m_residual_eval_degree

Constant<int> CaloSwEta2b_g3::m_residual_eval_degree { this, "residual_eval_degree", ""}
private

Definition at line 63 of file CaloSwEta2b_g3.h.

63{ this, "residual_eval_degree", ""};

◆ m_residuals

Constant<CxxUtils::Array<2> > CaloSwEta2b_g3::m_residuals { this, "residuals", "" }
private

Definition at line 60 of file CaloSwEta2b_g3.h.

60{ this, "residuals", "" };

◆ s_middle_layer_granularity

const float CaloSwEta2b_g3::s_middle_layer_granularity = 0.025
staticprivate

Definition at line 69 of file CaloSwEta2b_g3.h.


The documentation for this class was generated from the following files: