ATLAS Offline Software
CaloSwTransitionRegionsCorr.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 
8 NAME: CaloSwTransitionRegionsCorr.cxx
9 PACKAGE: offline/Calorimeter/CaloClusterCorrection
10 
11 AUTHORS: L. Carminati
12 CREATED: December 4, 2007
13 
14 PURPOSE: Effective corrections for transition regions like eta=0
15  and eta=0.8 . Effective corrections derived by D. Banfi
16  are applied on top of the reconstructed energy
17 
18 ********************************************************************/
19 
20 
22 #include "GaudiKernel/StatusCode.h"
23 #include "GaudiKernel/MsgStream.h"
24 #include <iostream>
25 
26 
49  xAOD::CaloCluster* cluster,
50  const CaloDetDescrElement*/*elt*/,
51  float eta,
52  float adj_eta,
53  float /*phi*/,
54  float /*adj_phi*/,
55  CaloSampling::CaloSample /*samp*/) const
56 {
58  const float etamin_TR00 = m_etamin_TR00 (myctx);
59  const float etamax_TR00 = m_etamax_TR00 (myctx);
60  const float etamin_TR08 = m_etamin_TR08 (myctx);
61  const float etamax_TR08 = m_etamax_TR08 (myctx);
62 
63  // ??? In principle, we should use adj_eta for the interpolation
64  // and range checks. However, the v2 corrections were derived
65  // using regular eta instead.
66 
67  float the_aeta;
68  if (m_use_raw_eta (myctx))
69  the_aeta = std::abs (adj_eta);
70  else
71  the_aeta = std::abs (eta);
72 
73 // -------------------------------------------------------------
74 // Load calibration coefficients
75 // -------------------------------------------------------------
76 
77  CaloRec::Array<1> tr00 = correction[0];
78  CaloRec::Array<1> tr08 = correction[1];
79 
80  static const CaloSampling::CaloSample samps[2][4] = {
89  };
90 
91 
92  ATH_MSG_DEBUG( "the_aeta ::::: " << the_aeta
93  << " cluster->eta() ::::: " << the_aeta << endmsg);
94 
95  double corr = 1 ;
96 
97 // -------------------------------------------------------------
98 // Compute correction for eta = 0
99 // -------------------------------------------------------------
100 
101  if (the_aeta < etamax_TR00 && the_aeta > etamin_TR00 ) {
102  ATH_MSG_DEBUG( " -------------------------- "
103  << "Applying correction for eta = 0 (loose) " << endmsg);
104  ATH_MSG_DEBUG( tr00[0] << " " << tr00[1] << " "
105  << tr00[2] << endmsg);
106 
107  corr = ( tr00[0] - tr00[1] /
108  (exp( tr00[2] - the_aeta ) +
109  exp( tr00[3]*( the_aeta - tr00[4]))+tr00[5]));
110 
111 /*
112  corr = ( tr00[0] - tr00[1] /
113  (exp( -tr00[2] - the_aeta ) +
114  exp( tr00[3]*( the_aeta + tr00[4]))-tr00[5]));
115 */
116  }
117  else if ( the_aeta < etamin_TR00 ) {
118  corr = tr00[6];
119  ATH_MSG_DEBUG( " -------------------------- "
120  << "Applying correction for eta = 0 (tight) " << endmsg);
121  }
122 
123 // -------------------------------------------------------------
124 // Compute correction for eta = 0.8
125 // -------------------------------------------------------------
126 
127  if ( the_aeta < etamax_TR08 && the_aeta > etamin_TR08 ) {
128  ATH_MSG_DEBUG( " -------------------------- "
129  << "Applying correction for eta =0.8 " << endmsg);
130  ATH_MSG_DEBUG( tr08[0] << " " << tr08[1] << " "
131  << tr08[2] << endmsg);
132 
133  corr = (tr08[0] - tr08[1] / (exp( tr08[2] - the_aeta ) +
134  exp( tr08[3] *( the_aeta - tr08[4] )) +
135  tr08[5] ));
136 
137 /*
138  corr = (tr08[0] - tr08[1] / (exp( tr08[2] - the_aeta ) +
139  exp( tr08[3] *( the_aeta - tr08[4] )) -
140  tr08[5] ));
141 */
142  }
143 
144  ATH_MSG_DEBUG( "CaloSwTransitionRegionsCorr::Energy before correction --> "
145  << cluster->e() << " Correction --> " << corr << endmsg);
146 
147  if (corr == 1)
148  return;
149 
150 /*
151  for (int sampling=0; sampling<=3; sampling++){
152  for (int si=0; si<2; ++si) {
153  ATH_MSG_DEBUG( "Before correction " << samps[si][sampling] << " " << cluster->eSample(samps[si][sampling]) << endmsg);
154  }
155  }
156 */
157 
158 // -------------------------------------------------------------
159 // Apply the correction
160 // -------------------------------------------------------------
161 
162  // update sampling energies
163  for (int sampling=1; sampling<=3; sampling++){
164  for (int si=0; si<2; ++si) {
165  if (cluster->hasSampling (samps[si][sampling]))
166  cluster->setEnergy (samps[si][sampling],
167  cluster->eSample(samps[si][sampling]) / corr );
168  }
169  }
170 
171  // update total energy
172 
173  cluster->setE ( cluster->e() / corr );
174 
175  ATH_MSG_DEBUG( "CaloSwTransitionRegionsCorr::Energy after correction --> "
176  << cluster->e() << endmsg);
177 
178 /*
179  for (int sampling=0; sampling<=3; sampling++){
180  for (int si=0; si<2; ++si) {
181  ATH_MSG_DEBUG( "After correction " << samps[si][sampling] << " " << cluster->eSample(samps[si][sampling]) << endmsg);
182  }
183  }
184 */
185 
186 }
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
CaloSwTransitionRegionsCorr::m_etamin_TR00
Constant< float > m_etamin_TR00
Calibration constants: The range over which this correction is defined.
Definition: CaloSwTransitionRegionsCorr.h:62
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloSwTransitionRegionsCorr::m_etamax_TR00
Constant< float > m_etamax_TR00
Definition: CaloSwTransitionRegionsCorr.h:64
CaloSwTransitionRegionsCorr::m_etamin_TR08
Constant< float > m_etamin_TR08
Definition: CaloSwTransitionRegionsCorr.h:66
xAOD::CaloCluster_v1::setEnergy
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.
Definition: CaloCluster_v1.cxx:526
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
xAOD::CaloCluster_v1::setE
void setE(flt_t)
Definition: CaloCluster_v1.cxx:375
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
CaloSwTransitionRegionsCorr.h
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloSwTransitionRegionsCorr::makeTheCorrection
virtual void makeTheCorrection(const Context &myctx, xAOD::CaloCluster *cluster, const CaloDetDescrElement *elt, float eta, float adj_eta, float phi, float adj_phi, CaloSampling::CaloSample samp) const override
Virtual function for the correction-specific code.
Definition: CaloSwTransitionRegionsCorr.cxx:48
CxxUtils::Array< 2 >
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
CaloSwTransitionRegionsCorr::m_use_raw_eta
Constant< bool > m_use_raw_eta
Calibration constant: If true, tabulated values are in terms of raw (local) eta.
Definition: CaloSwTransitionRegionsCorr.h:77
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
xAOD::CaloCluster_v1::eSample
float eSample(const CaloSample sampling) const
Definition: CaloCluster_v1.cxx:521
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
CaloSwTransitionRegionsCorr::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: The tabulated array of correction parameters.
Definition: CaloSwTransitionRegionsCorr.h:72
xAOD::CaloCluster_v1::hasSampling
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
Definition: CaloCluster_v1.h:890
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CaloSwTransitionRegionsCorr::m_etamax_TR08
Constant< float > m_etamax_TR08
Definition: CaloSwTransitionRegionsCorr.h:68