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#include "GaudiKernel/ThreadLocalContext.h"
44
46
48 ATH_CHECK(m_caloMgrKey.initialize());
50 return StatusCode::SUCCESS;
51}
52
53StatusCode CaloClusterCorrection::execute (const EventContext& ctx,
54 CaloCluster *cluster) const
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}
72
73// set property of cluster in one sampling
76 float em, float etam, float phim,
77 float emax, float etamax, float phimax,
78 float etas, float phis) const
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}
91
92// set energy, then
93// rescale the energy in each sampling also.
94void CaloClusterCorrection::setenergy(CaloCluster* cluster, float energy ) const
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}
120
#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
Initialize method.
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.
Context context(const EventContext &ctx) const
virtual StatusCode initialize() override
Initialize method.
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.