ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSwEta1e_g3 Class Referenceabstract

#include <CaloSwEta1e_g3.h>

Inheritance diagram for CaloSwEta1e_g3:
Collaboration diagram for CaloSwEta1e_g3:

Public Types

typedef ToolWithConstants base_class
 Shorthand for derived classes.
using Context
 Convenient alias for the Context type.
using Constant
 Alias for the Constant type.

Public Member Functions

virtual void makeCorrection (const Context &myctx, xAOD::CaloCluster *cluster) const override
virtual const std::string & toolType () const override
 Return the name of the type of this tool.
virtual StatusCode initialize () override
 Initialize method.
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
virtual void makeCorrection (const Context &myctx, xAOD::CaloCluster *) const =0
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.
Context context (const EventContext &ctx) const
 Create a Context object.
virtual void writeConstants (std::ostream &stream, const std::string &name, const EventContext &ctx) const
 Dump method (for debugging)
virtual StatusCode mergeConstants (CaloRec::ToolConstants &out, const EventContext &ctx) const override
 Merge our constants into out with the proper prefix.
virtual int toolVersion () const
 Return the version number for this tool.

Protected Attributes

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

Private Member Functions

 CaloSwEta1e_g3 ()=delete

Private Attributes

Constant< CxxUtils::Array< 3 > > m_correction { this, "correction", "" }
Constant< float > m_correction_coef { this, "correction_coef", "" }
Constant< int > m_correction_degree { this, "correction_degree", "" }
Constant< int > m_region { this, "region", "" }
SG::ReadCondHandleKey< CaloRec::ToolConstantsm_DBHandle
 Handle to a ToolConstants conditions object.
StringProperty m_prefix
 Prefix for finding our constants within the ToolConstants object.
ToolWithConstantsImpl m_impl
 Internal implementation object.
Constant< int > m_order
 Used to fix the ordering of tools when we're initializing from COOL based on a hierarchical tag.
Constant< bool > m_isdummy
 If true, then this is a dummy tool that should not be executed.

Static Private Attributes

static const float s_middle_layer_granularity = 0.025

Detailed Description

Definition at line 36 of file CaloSwEta1e_g3.h.

Member Typedef Documentation

◆ base_class

typedef ToolWithConstants CaloUtils::ToolWithConstants< BASE >::base_class
inherited

Shorthand for derived classes.

Definition at line 450 of file ToolWithConstants.h.

◆ Constant

using CaloUtils::ToolWithConstants< BASE >::Constant
inherited

Alias for the Constant type.

Definition at line 463 of file ToolWithConstants.h.

◆ Context

using CaloUtils::ToolWithConstants< BASE >::Context
inherited

Convenient alias for the Context type.

Definition at line 458 of file ToolWithConstants.h.

Constructor & Destructor Documentation

◆ CaloSwEta1e_g3()

CaloSwEta1e_g3::CaloSwEta1e_g3 ( )
privatedelete

Member Function Documentation

◆ context()

Context CaloUtils::ToolWithConstants< BASE >::context ( const EventContext & ctx) const
inherited

Create a Context object.

This can then be passed to Constant::operator().

◆ execute() [1/2]

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

Definition at line 53 of file CaloClusterCorrection.cxx.

55{
56 this->makeCorrection (context(ctx), cluster);
57
58#if 0
59 ATH_MSG_DEBUG( " ...... e, et " << cluster->e() << " " << cluster->et() << endmsg);
60 ATH_MSG_DEBUG( " ...... eta, etaBE, etaSmp " << cluster->eta() << " " << cluster->etaBE(2)
61 << " " << cluster->etaSample(CaloSampling::EMB1)
62 << " " << cluster->etaSample(CaloSampling::EMB2)
63 << " " << cluster->etaSample(CaloSampling::EMB3) << endmsg);
64 ATH_MSG_DEBUG( " ...... phi, phiBE, phiSmp " << cluster->phi() << " " << cluster->phiBE(2)
65 << " " << cluster->phiSample(CaloSampling::EMB1)
66 << " " << cluster->phiSample(CaloSampling::EMB2)
67 << " " << cluster->phiSample(CaloSampling::EMB3) << endmsg);
68#endif
69
70 return StatusCode::SUCCESS;
71}
#define endmsg
#define ATH_MSG_DEBUG(x)
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *) const =0
Context context(const EventContext &ctx) const
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.

47{
48 for (xAOD::CaloCluster* clu : *collection) {
49 ATH_CHECK( execute (ctx, clu) );
50 }
51 return StatusCode::SUCCESS;
52}
#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

Initialize method.

Derived classes must call this.

Reimplemented from CaloUtils::ToolWithConstants< CaloClusterProcessor >.

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

Definition at line 47 of file CaloClusterCorrection.cxx.

47 {
48 ATH_CHECK(m_caloMgrKey.initialize());
50 return StatusCode::SUCCESS;
51}
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode initialize() override
Initialize method.

◆ makeCorrection() [1/2]

virtual void CaloClusterCorrection::makeCorrection ( const Context & myctx,
xAOD::CaloCluster *  ) const
pure virtualinherited

◆ makeCorrection() [2/2]

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

Definition at line 43 of file CaloSwEta1e_g3.cxx.

45{
46 // Only for endcap
47 if (!cluster->inEndcap())
48 return;
49
50 const CxxUtils::Array<3> correction = m_correction (myctx);
51 const float correction_coef = m_correction_coef (myctx);
52 const int correction_degree = m_correction_degree (myctx);
53
54 float eta = cluster->etaSample(CaloSampling::EME1);
55 if (eta == -999.) return;
56 float etamax = cluster->etamax(CaloSampling::EME1);
57 float aeta = fabs(eta);
58
59 int corrndx;
60 float ufrac;
61 if (aeta > 2.0)
62 {
64 corrndx = 0;
65 }
66 else if (aeta > 1.8)
67 {
68 ufrac = s_middle_layer_granularity*(1./6);
69 corrndx = 1;
70 }
71 else if (aeta > 1.5)
72 {
74 corrndx = 2;
75 }
76 else
77 {
78 // not in endcap, no correction.
79 return;
80 }
81
82 float u = fmod(eta-etamax, ufrac/2.);
83 u += ufrac/2.;
84 if (eta < 0.) u = ufrac-u;
85 float deta = correction_coef * interpolate (correction[corrndx],
86 u,
87 correction_degree);
88 if (eta < 0)
89 deta = -deta;
90
91 // Make the correction:
92 cluster->setEta( CaloSampling::EME1, eta - deta);
93}
Scalar eta() const
pseudorapidity method
Constant< float > m_correction_coef
static const float s_middle_layer_granularity
Constant< int > m_correction_degree
Constant< CxxUtils::Array< 3 > > m_correction
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 inEndcap() const
Returns true if at least one clustered cell in the endcap.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
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.
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ mergeConstants()

virtual StatusCode CaloUtils::ToolWithConstants< BASE >::mergeConstants ( CaloRec::ToolConstants & out,
const EventContext & ctx ) const
overridevirtualinherited

Merge our constants into out with the proper prefix.

Parameters
[out]outObject to receive our constants.
ctxEvent context.

◆ setenergy()

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

Definition at line 94 of file CaloClusterCorrection.cxx.

95{
96 if (cluster->e() == 0) {
97 if (energy != 0)
98 REPORT_MESSAGE (MSG::WARNING)
99 << "Attempt to rescale zero-energy cluster to energy " << energy
100 << " ignored.";
101 return;
102 }
103
104 float correction = energy/cluster->e();
105 cluster->setE(energy);
106
107 // also correct individual sampling energies:
108
109 for (int iSample=CaloSampling::PreSamplerB;
110 iSample < CaloSampling::Unknown;
111 ++iSample)
112 {
113 CaloSampling::CaloSample sampling=static_cast<CaloSampling::CaloSample>(iSample);
114 if (cluster->hasSampling (sampling)) {
115 double e = cluster->eSample(sampling);
116 cluster->setEnergy(sampling,e*correction) ;
117 }
118 }
119}
#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 74 of file CaloClusterCorrection.cxx.

79{
80 cluster->setEnergy(sampling, em);
81 cluster->setEta(sampling, etam);
82 cluster->setPhi(sampling, phim);
83
84 cluster->setEmax(sampling,emax);
85 cluster->setEtamax(sampling,etamax);
86 cluster->setPhimax(sampling,phimax);
87
88 cluster->setEtasize(sampling, etas);
89 cluster->setPhisize(sampling, phis);
90}
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 & CaloSwEta1e_g3::toolType ( ) const
overridevirtual

Return the name of the type of this tool.

A saved set of constants includes both the C++ class name and a version number. Normally, the class name is taken from the Gaudi type() method, but that may be changed by overriding this method. This can be used, for example, when there are tools with distinct C++ classes but which are yet similar enough to combine together.

Reimplemented from CaloUtils::ToolWithConstants< CaloClusterProcessor >.

Definition at line 96 of file CaloSwEta1e_g3.cxx.

97{
98 static const std::string typeName = "CaloSwEta_g3";
99 return typeName;
100}

◆ toolVersion()

virtual int CaloUtils::ToolWithConstants< BASE >::toolVersion ( ) const
virtualinherited

Return the version number for this tool.

A saved set of constants includes both the C++ class name and a version number. The idea is that the version number can be bumped whenever there's a backwards-incompatible change; this gives some protection against trying to use an old version of a tool with an incompatible newer set of constants.

If you want a tool to have a version number, override this method. Otherwise, it will default to a version number of 0.

◆ writeConstants()

virtual void CaloUtils::ToolWithConstants< BASE >::writeConstants ( std::ostream & stream,
const std::string & name,
const EventContext & ctx ) const
virtualinherited

Dump method (for debugging)

Parameters
streamOstream to which to write.
nameName to go in output
ctxEvent context.

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<3> > CaloSwEta1e_g3::m_correction { this, "correction", "" }
private

Definition at line 55 of file CaloSwEta1e_g3.h.

55{ this, "correction", "" };

◆ m_correction_coef

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

Definition at line 56 of file CaloSwEta1e_g3.h.

56{ this, "correction_coef", "" };

◆ m_correction_degree

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

Definition at line 57 of file CaloSwEta1e_g3.h.

57{ this, "correction_degree", "" };

◆ m_DBHandle

Handle to a ToolConstants conditions object.

Definition at line 534 of file ToolWithConstants.h.

535{ this, "DBHandleKey", "", "" };

◆ m_impl

ToolWithConstantsImpl CaloUtils::ToolWithConstants< BASE >::m_impl
privateinherited

Internal implementation object.

Definition at line 542 of file ToolWithConstants.h.

542{ this->name(), m_prefix, m_DBHandle };
Hold constants for a tool.

◆ m_isdummy

Constant<bool> CaloUtils::ToolWithConstants< BASE >::m_isdummy
privateinherited

If true, then this is a dummy tool that should not be executed.

This is used for the case of reading from COOL using hierarchical tags: we need to have such tags associated with some object in each folder, regardless of whether or not the correction from that folder is actually used. [Every folder that IOVDbSvc knows about at configuration time needs to have a valid object for the configured tag, else IOVDbSvc will raise a fatal error. But we don't know at configuration time which folders we're actually going to need, so we gotta configure all of them.]

Definition at line 560 of file ToolWithConstants.h.

561{this, "isDummy", false };

◆ m_order

Constant<int> CaloUtils::ToolWithConstants< BASE >::m_order
privateinherited

Used to fix the ordering of tools when we're initializing from COOL based on a hierarchical tag.

Tools should be executed in order of increasing m_order.

Definition at line 547 of file ToolWithConstants.h.

548{ this, "order", 0 };

◆ m_prefix

StringProperty CaloUtils::ToolWithConstants< BASE >::m_prefix
privateinherited

Prefix for finding our constants within the ToolConstants object.

Definition at line 538 of file ToolWithConstants.h.

539{ this, "prefix", "", "" };

◆ m_region

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

Definition at line 58 of file CaloSwEta1e_g3.h.

58{ this, "region", "" };

◆ s_middle_layer_granularity

const float CaloSwEta1e_g3::s_middle_layer_granularity = 0.025
staticprivate

Definition at line 60 of file CaloSwEta1e_g3.h.


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