ATLAS Offline Software
Loading...
Searching...
No Matches
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
12
13StatusCode
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
42 const CaloSampling::CaloSample sam = in_barrel ? CaloSampling::EMB3 : CaloSampling::EME3;
43 const CaloSampling::CaloSample sam2 = in_barrel ? CaloSampling::EMB2 : CaloSampling::EME2;
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
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Definition of CaloDetDescrManager.
Calculate total energy, position, etc. for a given layer of a cluster.
static Double_t sc
Container class for CaloCell.
list_iterator end() const
void select(double eta, double phi, double deta, double dphi)
list_iterator begin() const
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
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:
This class provides the client interface for accessing the detector description information common to...
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
double e3(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 3rd sampling
bool inBarrel(const xAOD::CaloCluster &cluster, int is)
return boolean to know if we are in barrel/end-cap
double e(const xAOD::CaloCluster &cluster)
return the uncorrected sum of energy in all samples
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
static StatusCode execute(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &cmgr, const CaloCellContainer &cell_container, Info &info, bool ExecOtherVariables=true)