ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterCorrection.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloClusterCorrection.cxx
8PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10AUTHORS: H. Ma, S. Rajagopalan
11CREATED: Dec 1999
12
13PURPOSE: see CaloClusterCorrection.h
14
15Updated: May 10, 2000 (SR, HM)
16 Migrated to Athena Framework from PASO
17
18Updated: Jan 3, 2001 (HM)
19 QA.
20Updated: May 2001, (SR) Move to StoreGate
21
22Updated: May 5, 2004 (Sven Menke)
23 base class changed from algo to tool
24
25Updated: June, 2004 (sss)
26 Call base class's initialize().
27
28Updated: January, 2005 (MB)
29 Move to Calorimeter/CaloClusterCorrection.
30
31Updated: February, 2006 (DLelas)
32 New method added:
33 "makeCorrectionOnClusCollection(CaloClusterContainer *clusColl)"
34 Which enables corrections to be applied to a whole
35 CaloCluster collection. It is needed by sliding window cell weights
36 calculation.
37
38********************************************************************/
39// INCLUDE HEADER FILES:
42#include "GaudiKernel/MsgStream.h"
43
45
47 ATH_CHECK(m_caloMgrKey.initialize());
48 ATH_CHECK(base_class::initialize());
49 return StatusCode::SUCCESS;
50}
51
52StatusCode CaloClusterCorrection::execute (const EventContext& ctx,
53 CaloCluster *cluster) const
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}
71
72// set property of cluster in one sampling
75 float em, float etam, float phim,
76 float emax, float etamax, float phimax,
77 float etas, float phis) const
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}
90
91// set energy, then
92// rescale the energy in each sampling also.
93void CaloClusterCorrection::setenergy(CaloCluster* cluster, float energy ) const
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}
119
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *cluster) const override
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
virtual StatusCode initialize() override
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *) const =0
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
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Principal data class for CaloCell clusters.
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
double phiSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
virtual double e() const
Retrieve energy independent of signal state.
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.
virtual void setEta(double eta)
Set eta.
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
bool hasSampling(const sampling_type &theSampling) const
Checks if certain sampling contributes to cluster.
virtual double phi() const
Retrieve phi independent of signal state.
virtual void setPhi(double phi)
Set phi.
virtual void setE(double e)
Set energy.
virtual double et() const
transverse energy defined to be e*sin(theta)
CaloSampling::CaloSample CaloSample
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.