ATLAS Offline Software
egammaBackShape.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 
11 #include "CaloUtils/CaloCellList.h"
12 
15  const CaloDetDescrManager& cmgr,
16  const CaloCellContainer& cell_container,
17  Info& info,
18  bool ExecOtherVariables)
19 {
20  //
21  // Estimate shower shapes from third compartment
22  // based on hottest cell and deta,dphi
23  // with eta = cluster->eta(sam)
24  // phi = cluster->phi(sam)
25  //
26 
27  // check if cluster is in barrel or in the end-cap
28  if (!cluster.inBarrel() && !cluster.inEndcap()) {
29  return StatusCode::SUCCESS;
30  }
31 
32  double eallsamples = egammaEnergyPositionAllSamples::e(cluster);
33  double e3 = egammaEnergyPositionAllSamples::e3(cluster);
34 
35  // fraction of energy deposited in third sampling
36  info.f3 = std::abs(eallsamples) > 0. ? e3 / eallsamples : 0.;
37 
38  // check if cluster is in barrel or end-cap
39  const bool in_barrel = egammaEnergyPositionAllSamples::inBarrel(cluster, 3);
40 
41  // define accordingly position of CaloSampling
44 
46  bool barrel = false;
47  int sampling_or_module = 0;
48 
49  // From the original (eta,phi) position, find the location
50  // (sampling, barrel/end-cap, granularity)
51  // For this we use the tool egammaEnergyAllSamples
52  // which uses the CaloCluster method inBarrel() and inEndcap()
53  // but also, in case close to the crack region where both
54  // boolean can be true, the energy reconstructed in the sampling
55  //
56 
57  // Fetch eta and phi of the sampling
58  // Note that we use m_sam2 in the 2nd sampling, not in presampler
59  double eta = cluster.etamax(sam2);
60  double phi = cluster.phimax(sam2);
61 
62  if ((eta == 0. && phi == 0.) || std::abs(eta) > 100) {
63  return StatusCode::SUCCESS;
64  }
65 
66  // granularity in (eta,phi) in the pre sampler
67  // CaloCellList needs both enums: subCalo and CaloSample
68  CaloDetDescrManager::decode_sample(subcalo, barrel, sampling_or_module, sam);
69 
70  // Get the corresponding grannularities : needs to know where you are
71  // the easiest is to look for the CaloDetDescrElement
72  const CaloDetDescrElement* dde =
73  cmgr.get_element(subcalo, sampling_or_module, barrel, eta, phi);
74  // if object does not exist then return
75  if (!dde) {
76  return StatusCode::SUCCESS;
77  }
78 
79  // local granularity
80  double deta = dde->deta();
81  double dphi = dde->dphi();
82  // change values of eta,phi
83  eta = dde->eta_raw();
84  phi = dde->phi_raw();
85 
86  // estimate the relevant quantities around the hottest cell
87  // in the following eta X phi windows
89 
90  // 3X3
91  StatusCode sc =
92  calc.fill(cmgr, &cell_container, eta, phi, 3. * deta, 3. * dphi, sam);
93  if (sc.isFailure()) {
94  return sc;
95  }
96  info.e333 = calc.em();
97 
98  if (ExecOtherVariables) {
99 
100  CaloCellList cell_list(&cmgr, &cell_container);
101  // 7x7
102  cell_list.select(eta, phi, 7.0 * deta, 7.0 * dphi, sam);
103 
104  calc.fill(
105  cell_list.begin(), cell_list.end(), eta, phi, 7. * deta, 7. * dphi, sam);
106  info.e377 = calc.em();
107 
108  // 5X5
109  calc.fill(
110  cell_list.begin(), cell_list.end(), eta, phi, 5. * deta, 5. * dphi, sam);
111  info.e355 = calc.em();
112 
113  // 3X7
114  calc.fill(
115  cell_list.begin(), cell_list.end(), eta, phi, 3. * deta, 7. * dphi, sam);
116  info.e337 = calc.em();
117 
118  // 3X5
119  calc.fill(
120  cell_list.begin(), cell_list.end(), eta, phi, 3. * deta, 5. * dphi, sam);
121  info.e335 = calc.em();
122  }
123 
124  // f3core
125  if (eallsamples > 0. && info.e333 > -999.) {
126  info.f3core = info.e333 / eallsamples;
127  }
128 
129  return StatusCode::SUCCESS;
130 }
131 
CaloDetDescrElement::deta
float deta() const
cell deta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
grepfile.info
info
Definition: grepfile.py:38
xAOD::CaloCluster_v1::phimax
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
Definition: CaloCluster_v1.cxx:589
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
egammaBackShape::execute
static StatusCode execute(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &cmgr, const CaloCellContainer &cell_container, Info &info, bool ExecOtherVariables=true)
Definition: egammaBackShape.cxx:14
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
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloCellList::end
list_iterator end() const
Definition: CaloCellList.h:93
egammaBackShape::Info
Definition: egammaBackShape.h:30
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
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
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
egammaEnergyPositionAllSamples.h
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
egammaBackShape.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloDetDescrElement::dphi
float dphi() const
cell dphi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
egammaEnergyPositionAllSamples::e
double e(const xAOD::CaloCluster &cluster)
return the uncorrected sum of energy in all samples
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
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
egammaEnergyPositionAllSamples::e3
double e3(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 3rd sampling
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
beamspotnt.calc
calc
Definition: bin/beamspotnt.py:1252
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloLayerCalculator.h
Calculate total energy, position, etc. for a given layer of a cluster.