ATLAS Offline Software
Loading...
Searching...
No Matches
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
8NAME: CaloSwTransitionRegionsCorr.cxx
9PACKAGE: offline/Calorimeter/CaloClusterCorrection
10
11AUTHORS: L. Carminati
12CREATED: December 4, 2007
13
14PURPOSE: 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
47
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{
57 const CxxUtils::Array<2> correction = m_correction (myctx);
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] = {
81 { CaloSampling::PreSamplerB,
82 CaloSampling::EMB1,
83 CaloSampling::EMB2,
84 CaloSampling::EMB3 },
85 { CaloSampling::PreSamplerE,
86 CaloSampling::EME1,
87 CaloSampling::EME2,
88 CaloSampling::EME3 }
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}
Scalar eta() const
pseudorapidity method
#define endmsg
#define ATH_MSG_DEBUG(x)
This class groups all DetDescr information related to a CaloCell.
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: The tabulated array of correction parameters.
Constant< float > m_etamin_TR00
Calibration constants: The range over which this correction is defined.
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.
Constant< bool > m_use_raw_eta
Calibration constant: If true, tabulated values are in terms of raw (local) eta.
Read-only multidimensional array.
virtual double e() const
The total energy of the particle.
float eSample(const CaloSample sampling) const
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.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.