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

#include <CaloClusterUpdate.h>

Inheritance diagram for CaloClusterUpdate:
Collaboration diagram for CaloClusterUpdate:

Public Member Functions

virtual void makeCorrection (const Context &myctx, xAOD::CaloCluster *cluster) 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 Attributes

Gaudi::Property< float > m_w1 { this, "layer1_weight", 3, "layer 1 additional weight in eta average" }
Constant< bool > m_update_energy { this, "update_energy", "Should cluster total energy be updated?" }

Detailed Description

Definition at line 46 of file CaloClusterUpdate.h.

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 CaloClusterUpdate::makeCorrection ( const Context & myctx,
xAOD::CaloCluster * cluster ) const
overridevirtual

Implements CaloClusterCorrection.

Definition at line 48 of file CaloClusterUpdate.cxx.

50{
51 float energy=0;
52 float eta=0;
53 float weta=0;
54
55 // set eta to be weighted average of eta1 and eta2
56 ATH_MSG_DEBUG(" inBarrel "<<cluster->inBarrel()
57 << " inEndcap "<<cluster->inEndcap()) ;
58
59 for(int i=0; i<5; i=i+4 )
60 {
61
62 if (i==0 && !cluster->inBarrel()) continue;
63 if (i==4 && !cluster->inEndcap()) continue;
64
65 CaloSampling::CaloSample sam0 = (CaloSampling::CaloSample)(CaloSampling::PreSamplerB+i);
66 CaloSampling::CaloSample sam1 = (CaloSampling::CaloSample)(CaloSampling::PreSamplerB+i+1);
67 CaloSampling::CaloSample sam2 = (CaloSampling::CaloSample)(CaloSampling::PreSamplerB+i+2);
68 CaloSampling::CaloSample sam3 = (CaloSampling::CaloSample)(CaloSampling::PreSamplerB+i+3);
69
70 float e0 = cluster->eSample(sam0);
71 float e1 = cluster->eSample(sam1);
72 float e2 = cluster->eSample(sam2);
73 float e3 = cluster->eSample(sam3);
74
75 // total energy is the sum of each sampling, which had all corrections
76 energy += (e0 + e1 + e2 + e3);
77
78 // do not consider including in the average if both energies are negative
79 if (e1 <= 0 && e2 <= 0) continue;
80
81 // reject weird clusters. Not even sure it can ever happen
82 float eta2 = cluster->etaSample(sam2);
83 if (cluster->hasSampling(sam2) && eta2 == -999.) continue;
84
85 float eta1 = cluster->etaSample(sam1);
86 if (cluster->hasSampling(sam1) && eta1 == -999.) continue;
87
88 // eta1 has better resolution, so weight it differently
89 float w1 = e1*m_w1;
90 float w2 = e2;
91
92 // do not include layer if energy is negative
93 if (e1 <= 0) {
94 w1 = 0;
95 }
96 else if (e2 <= 0) {
97 w2 = 0;
98 }
99
100 eta += (eta1*w1+eta2*w2) ;
101 weta += w1+w2;
102 }
103
104 //
105 // set them in the cluster.
106 //
107 if (eta != -999. && weta != 0)
108 eta = eta/weta;
109 else {
110 ATH_MSG_DEBUG("Weird cluster "
111 " EB1 = " << cluster->eSample(CaloSampling::EMB1)
112 << " etaB1 = " << cluster->etaSample(CaloSampling::EMB1)
113 << " EE1 = " << cluster->eSample(CaloSampling::EME1)
114 << " etaE1 = " << cluster->etaSample(CaloSampling::EME1)
115 << " EB2 = " << cluster->eSample(CaloSampling::EMB2)
116 << " etaB2 = " << cluster->etaSample(CaloSampling::EMB2)
117 << " EE2 = " << cluster->eSample(CaloSampling::EME2)
118 << " etaE2 = " << cluster->etaSample(CaloSampling::EME2));
119 if (cluster->inBarrel() && !cluster->inEndcap())
120 eta = cluster->etaSample(CaloSampling::EMB2);
121 else if (cluster->inEndcap() && !cluster->inBarrel())
122 eta = cluster->etaSample(CaloSampling::EME2);
123 else {
124 if (cluster->eSample(CaloSampling::EMB2) >
125 cluster->eSample(CaloSampling::EME2))
126 eta = cluster->etaSample(CaloSampling::EMB2);
127 else
128 eta = cluster->etaSample(CaloSampling::EME2);
129 }
130 }
131
132 cluster->setEta(eta);
133 cluster->setPhi(cluster->phiBE(2));
134
135 if (m_update_energy (myctx))
136 cluster->setE(energy);
137}
Scalar eta() const
pseudorapidity method
Gaudi::Property< float > m_w1
Constant< bool > m_update_energy
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 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 eSample(const CaloSample sampling) const
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
double e0(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in pre-sampler
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
setEt setPhi setE277 setWeta2 eta1

◆ 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.
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.
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ 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 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.

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_update_energy

Constant<bool> CaloClusterUpdate::m_update_energy { this, "update_energy", "Should cluster total energy be updated?" }
private

Definition at line 64 of file CaloClusterUpdate.h.

65{ this, "update_energy", "Should cluster total energy be updated?" };

◆ m_w1

Gaudi::Property<float> CaloClusterUpdate::m_w1 { this, "layer1_weight", 3, "layer 1 additional weight in eta average" }
private

Definition at line 60 of file CaloClusterUpdate.h.

61{ this, "layer1_weight", 3, "layer 1 additional weight in eta average" };

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