ATLAS Offline Software
CaloTopoEMGap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 #include "CaloTopoEMGap.h"
14 #include "CLHEP/Units/PhysicalConstants.h"
16 #include "CaloEvent/CaloCell.h"
18 #include "StoreGate/ReadHandle.h"
19 #include <cmath>
20 #include <iostream>
21 
22 
23 using xAOD::CaloCluster;
25 using CLHEP::pi;
26 using CLHEP::twopi;
27 
28 
29 namespace {
30 
31 
32 const double deta = 0.2;
33 const double dphi = twopi / 64. ;
34 
35 
36 } // anonymous namespace
37 
38 
43 {
46  return StatusCode::SUCCESS;
47 }
48 
49 
71  CaloCluster* cluster,
72  const CaloDetDescrElement*/*elt*/,
73  float eta,
74  float adj_eta,
75  float phi,
76  float /*adj_phi*/,
77  CaloSampling::CaloSample /*samp*/) const
78 {
79  // ??? In principle, we should use adj_eta for the interpolation
80  // and range checks. However, the v2 corrections were derived
81  // using regular eta instead.
82  float the_aeta;
83  if (m_use_raw_eta(myctx))
84  the_aeta = std::abs (adj_eta);
85  else
86  the_aeta = std::abs (eta);
87 
88  if (the_aeta < m_etamin_crack(myctx) || the_aeta > m_etamax_crack(myctx))
89  return; // no correction required
90 
92 
93  // Add up the tile scintillator energy in the region around the cluster.
94  double eh_scint = 0;
95  if(cc.isValid())
96  {
98  cc->beginConstCalo(CaloCell_ID::TILE);
100  cc->endConstCalo(CaloCell_ID::TILE);
101 
102  for ( ; f_cell!=l_cell; ++f_cell)
103  {
104  const CaloCell* cell = (*f_cell) ;
105 
106  if (CaloCell_ID::TileGap3 == cell->caloDDE()->getSampling()) {
107  double phic = cell->phi();
108  double etac = cell->eta();
109  if (phic-phi < -pi) phic = phic + twopi;
110  if (phic-phi > pi) phic = phic - twopi;
111  if (etac >= eta-deta && etac <= eta+deta) {
112  if (phic >= phi-dphi && phic <= phi+dphi) {
113  eh_scint += cell->e();
114  }
115  }
116  }
117  }
118  }
119 
121  const int degree = m_degree (myctx);
122 
123  // Find the correction weights.
124  float par0 = interpolate (correction, the_aeta, degree, 1);
125  float par1 = interpolate (correction, the_aeta, degree, 2);
126  float par2 = interpolate (correction, the_aeta, degree, 3);
127  float par3 = interpolate (correction, the_aeta, degree, 4);
128 
129  // The correction is a weighted sum of calorimeter and scintillator energies.
130  float ec = cluster->e();
131 
132  float a = ec/par0;
133  //float b = 0;
134 
135  //if (a > 1.0) b = par0*log(a) + par0;
136 
137  // Sampling energies don't include scintillator contribution.
138  setenergy (cluster, par1*(ec + a + par3));
139  cluster->setE (par1*(ec + a + par2*eh_scint + par3));
140 }
CaloTopoEMGap::m_degree
Constant< int > m_degree
Calibration constant: The interpolation degree.
Definition: CaloTopoEMGap.h:80
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloTopoEMGap.h
CaloTopoEMGap::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: The tabulated array of correction weights, A and alpha.
Definition: CaloTopoEMGap.h:85
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CaloUtils::ToolConstantsContext::ctx
const EventContext & ctx() const
Definition: ToolWithConstants.h:63
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloTopoEMGap::m_cells
SG::ReadHandleKey< CaloCellContainer > m_cells
Definition: CaloTopoEMGap.h:93
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition: CaloClusterCorrection.cxx:94
CaloCell.h
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
pi
#define pi
Definition: TileMuonFitter.cxx:65
CaloClusterCorrection::initialize
virtual StatusCode initialize() override
Initialize method.
Definition: CaloClusterCorrection.cxx:47
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CxxUtils::Array< 2 >
CaloTopoEMGap::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: CaloTopoEMGap.cxx:70
CaloTopoEMGap::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition: CaloTopoEMGap.cxx:42
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
twopi
constexpr double twopi
Definition: VertexPointEstimator.cxx:16
CaloTopoEMGap::m_use_raw_eta
Constant< bool > m_use_raw_eta
Calibration constant: If true, tabulated values are in terms of raw (local) eta.
Definition: CaloTopoEMGap.h:90
CaloCellContainer.h
CaloTopoEMGap::m_etamax_crack
Constant< float > m_etamax_crack
Definition: CaloTopoEMGap.h:76
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
a
TList * a
Definition: liststreamerinfos.cxx:10
CaloTopoEMGap::m_etamin_crack
Constant< float > m_etamin_crack
Calibration constants: The range over which this correction is defined.
Definition: CaloTopoEMGap.h:74
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloClusterCorr::interpolate
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > &regions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.
Definition: interpolate.cxx:75
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
ReadHandle.h
Handle class for reading from StoreGate.
interpolate.h
Polynomial interpolation in a table.
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
python.handimod.cc
int cc
Definition: handimod.py:523