ATLAS Offline Software
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 
7 NAME: CaloClusterCorrection.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: H. Ma, S. Rajagopalan
11 CREATED: Dec 1999
12 
13 PURPOSE: see CaloClusterCorrection.h
14 
15 Updated: May 10, 2000 (SR, HM)
16  Migrated to Athena Framework from PASO
17 
18 Updated: Jan 3, 2001 (HM)
19  QA.
20 Updated: May 2001, (SR) Move to StoreGate
21 
22 Updated: May 5, 2004 (Sven Menke)
23  base class changed from algo to tool
24 
25 Updated: June, 2004 (sss)
26  Call base class's initialize().
27 
28 Updated: January, 2005 (MB)
29  Move to Calorimeter/CaloClusterCorrection.
30 
31 Updated: 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 
45 using xAOD::CaloCluster;
46 
50  return StatusCode::SUCCESS;
51 }
52 
53 StatusCode 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
75  CaloCluster::CaloSample 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.
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 
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CaloClusterCorrection::setsample
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
Definition: CaloClusterCorrection.cxx:74
CaloCluster::eSample
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:975
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
CaloCluster::phiSample
double phiSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1006
CaloCluster::hasSampling
bool hasSampling(const sampling_type &theSampling) const
Checks if certain sampling contributes to cluster.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:954
CaloCluster::phiBE
double phiBE(int sampling) const
EMB/EMEC combined barycenter .
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1209
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition: CaloClusterCorrection.cxx:94
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
CaloClusterCorrection::initialize
virtual StatusCode initialize() override
Initialize method.
Definition: CaloClusterCorrection.cxx:47
CaloUtils::ToolWithConstants::initialize
virtual StatusCode initialize() override
Initialize method.
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCluster::etaSample
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:991
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCluster::setEta
virtual void setEta(double eta)
Set eta.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:769
CaloCluster::etaBE
double etaBE(int sampling) const
EMB/EMEC combined barycenter .
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1199
CaloClusterCorrection.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloUtils::ToolWithConstants< CaloClusterProcessor >::context
Context context(const EventContext &ctx) const
Create a Context object.
CaloClusterCorrection::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: CaloClusterCorrection.h:119
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
CaloClusterCorrection::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *) const =0
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
CaloCluster::eta
virtual double eta() const
Retrieve eta independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:755
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CaloSample
CaloCell_ID::CaloSample CaloSample
Definition: CaloCellCollector.cxx:18
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
P4EEtaPhiMBase::et
virtual double et() const
transverse energy defined to be e*sin(theta)
Definition: P4EEtaPhiMBase.cxx:106
CaloCluster::setPhi
virtual void setPhi(double phi)
Set phi.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:771
CaloClusterCorrection::execute
StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *cluster) const override
Definition: CaloClusterCorrection.cxx:53
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
EgEfficiencyCorr_testFixedInput.etas
list etas
Definition: EgEfficiencyCorr_testFixedInput.py:9
CaloCluster::phi
virtual double phi() const
Retrieve phi independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:759