ATLAS Offline Software
egammaMiddleShape.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
8 
10 #include "CaloEvent/CaloCluster.h"
11 #include "CaloUtils/CaloCellList.h"
14 
15 
18  const CaloDetDescrManager& cmgr,
19  const CaloCellContainer& cell_container,
20  Info& info,
21  bool doRetaOnly)
22 {
23  //
24  // Estimate shower shapes from 2nd compartment
25  // based on hottest cell and deta,dphi
26  // with eta = cluster->eta(sam)
27  // phi = cluster->phi(sam)
28  // and search for hottest cell in a 7X7 window
29  // in the second sampling
30  //
31  //
32  StatusCode sc = StatusCode::SUCCESS;
33  // check if cluster is in barrel or in the end-cap
34  if (!cluster.inBarrel() && !cluster.inEndcap()) {
35  return sc;
36  }
37 
38  // check if cluster is in barrel or end-cap
39  const bool in_barrel = egammaEnergyPositionAllSamples::inBarrel(cluster, 2);
40 
41  // define accordingly position of CaloSampling
43 
44  // granularity in (eta,phi) in the pre sampler
45  // CaloCellList needs both enums: subCalo and CaloSample
46  bool barrel = false;
48  int sampling_or_module = 0;
49 
50  float etacell = cluster.etamax(sam);
51  double eta = cluster.etaSample(sam);
52  double phi = cluster.phiSample(sam);
53  if ((eta == 0. && phi == 0.) || std::abs(eta) > 100) {
54  return sc;
55  }
56 
57  CaloDetDescrManager::decode_sample(subcalo, barrel, sampling_or_module, sam);
58 
59  // Get the corresponding grannularities : needs to know where you are
60  // the easiest is to look for the CaloDetDescrElement
61  const CaloDetDescrElement* dde =
62  cmgr.get_element(subcalo, sampling_or_module, barrel, eta, phi);
63  // if object does not exist then return
64  if (!dde) {
65  return sc;
66  }
67  // local granularity
68  double deta = dde->deta();
69  double dphi = dde->dphi();
70 
71  // Find the hottest cell
72  // in a 7x7 (7deta,7*dphi) window
73  // opened in the eta/phi of the
74  // cluster in this sampling
76  sc = calc.fill(cmgr,
77  &cell_container,
78  cluster.etaSample(sam),
79  cluster.phiSample(sam),
80  7. * deta,
81  7. * dphi,
82  sam);
83  double etamax = calc.etarmax();
84  double phimax = calc.phirmax();
85 
86  //select the widest cell list we will use
87  //i.e a 7x7 around the found hottest cell
88  CaloCellList cell_list(&cmgr, &cell_container);
89  cell_list.select(etamax, phimax, 7. * deta, 7. * dphi, sam);
90 
91  // Using that list do the filling
92  // of all the sub windows.
93 
94  // 7x7
95  calc.fill(cell_list.begin(),
96  cell_list.end(),
97  etamax,
98  phimax,
99  7. * deta,
100  7. * dphi,
101  sam);
102  info.e277 = calc.em();
103  // 3X7
104  calc.fill(cell_list.begin(),
105  cell_list.end(),
106  etamax,
107  phimax,
108  3. * deta,
109  7. * dphi,
110  sam);
111  info.e237 = calc.em();
112 
113  if (!doRetaOnly) {
114  // estimate the relevant quantities around the hottest cell
115  // in the following eta X phi windows
116  // 3X3
117  calc.fill(cell_list.begin(),
118  cell_list.end(),
119  etamax,
120  phimax,
121  3. * deta,
122  3. * dphi,
123  sam);
124  info.e233 = calc.em();
125  // 3X5
126  calc.fill(cell_list.begin(),
127  cell_list.end(),
128  etamax,
129  phimax,
130  3. * deta,
131  5. * dphi,
132  sam);
133  info.e235 = calc.em();
134  double etaw = calc.etas();
135  info.phiw = calc.phis();
136  info.etaw = egammaqweta2c::Correct(eta, etacell, etaw);
137  info.width = etaw;
138  info.poscs2 = egammaqweta2c::RelPosition(eta, etacell);
139  // 5X5
140  calc.fill(cell_list.begin(),
141  cell_list.end(),
142  etamax,
143  phimax,
144  5. * deta,
145  5. * dphi,
146  sam);
147  info.e255 = calc.em();
148  }
149  return sc;
150 }
151 
CaloDetDescrElement::deta
float deta() const
cell deta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
grepfile.info
info
Definition: grepfile.py:38
CaloCellList::begin
list_iterator begin() const
Definition: CaloCellList.h:87
CaloCellList
Definition: CaloCellList.h:40
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloCellList::select
void select(double eta, double phi, double deta, double dphi)
Definition: CaloCellList.cxx:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloCellList.h
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
egammaEnergyPositionAllSamples::inBarrel
bool inBarrel(const xAOD::CaloCluster &cluster, int is)
return boolean to know if we are in barrel/end-cap
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
egammaqweta2c.h
xAOD::CaloCluster_v1::etamax
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
Definition: CaloCluster_v1.cxx:576
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
xAOD::CaloCluster_v1::etaSample
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
Definition: CaloCluster_v1.cxx:532
CaloCellList::end
list_iterator end() const
Definition: CaloCellList.h:93
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::CaloCluster_v1::inEndcap
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
Definition: CaloCluster_v1.h:901
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCluster.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
xAOD::CaloCluster_v1::inBarrel
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
Definition: CaloCluster_v1.h:896
xAOD::CaloCluster_v1::phiSample
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
Definition: CaloCluster_v1.cxx:547
egammaEnergyPositionAllSamples.h
egammaMiddleShape.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloDetDescrElement::dphi
float dphi() const
cell dphi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
egammaMiddleShape::Info
Definition: egammaMiddleShape.h:30
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloLayerCalculator
Definition: CaloLayerCalculator.h:82
CaloDetDescrManager_Base::decode_sample
static void decode_sample(CaloCell_ID::SUBCALO &subCalo, bool &barrel, int &sampling_or_module, CaloCell_ID::CaloSample sample)
translate between the 2 ways to label a sub-detector:
Definition: CaloDetDescrManager.cxx:1468
DetectorZone::barrel
@ barrel
egammaqweta2c::RelPosition
double RelPosition(const float eta, const float etacell)
returns method within the cell
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
beamspotnt.calc
calc
Definition: bin/beamspotnt.py:1252
egammaMiddleShape::execute
static StatusCode execute(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &cmgr, const CaloCellContainer &cell_container, Info &info, bool doRetaOnly=false)
Definition: egammaMiddleShape.cxx:17
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
egammaqweta2c::Correct
float Correct(float eta, float etacell, float width)
returns corrected width at eta.
CaloLayerCalculator.h
Calculate total energy, position, etc. for a given layer of a cluster.