ATLAS Offline Software
egammaEnergyPositionAllSamples.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
7 namespace {
8 /*if both in barrel and end-cap then have to
9  * rely on energy deposition
10  * be careful to test 0 precisely
11  * As eSample returns energy 0 in case of failure (eg. sampling not set)
12  * while the other sample can have cells but energy <0 due to noise
13  */
14 bool isCrackBarrel(const xAOD::CaloCluster &cluster,
15  const xAOD::CaloCluster::CaloSample barrel,
16  const xAOD::CaloCluster::CaloSample endCap) {
17 
18  const auto barrelSamE = cluster.eSample(barrel);
19  const auto endCapSamE= cluster.eSample(endCap);
20  if (barrelSamE == 0. && endCapSamE!= 0.) {
21  return false; // endcap
22  }
23  if (barrelSamE != 0. && endCapSamE == 0.) {
24  return true; // barrel
25  }
26  if (barrelSamE >= endCapSamE) {
27  return true; // barrel
28  }
29  return false; // endcap;
30 }
31 } // namespace
32 
34  return (e0(cluster) + e1(cluster) + e2(cluster) + e3(cluster));
35 }
36 
39 }
40 
42  return (cluster.eSample(CaloSampling::EMB1) + cluster.eSample(CaloSampling::EME1));
43 }
44 
46  return (cluster.eSample(CaloSampling::EMB2) + cluster.eSample(CaloSampling::EME2));
47 }
48 
50  return (cluster.eSample(CaloSampling::EMB3) + cluster.eSample(CaloSampling::EME3));
51 }
52 
53 bool egammaEnergyPositionAllSamples::inBarrel(const xAOD::CaloCluster &cluster, const int sampling) {
54 
55  // from cluster position and energy define
56  // if we are in barrel or end-cap
57  // In particular it uses energy deposit in 2nd sampling
58  // to check close to the crack region
59  // sampling (0=presampler,1=strips,2=middle,3=back)
60  //
61  if (cluster.inBarrel() && !cluster.inEndcap()) {
62  return true; // barrel
63  } if (!cluster.inBarrel() && cluster.inEndcap()) {
64  return false; // endcap
65  } if (cluster.inBarrel() && cluster.inEndcap()) {
66  switch (sampling) {
67  case 0: {
68  return isCrackBarrel(cluster, CaloSampling::PreSamplerB, CaloSampling::PreSamplerE);
69  }
70  case 1: {
71  return isCrackBarrel(cluster, CaloSampling::EMB1, CaloSampling::EME1);
72  }
73  case 2: {
74  return isCrackBarrel(cluster, CaloSampling::EMB2, CaloSampling::EME2);
75  }
76  case 3: {
77  return isCrackBarrel(cluster, CaloSampling::EMB3, CaloSampling::EME3);
78  }
79  default: {
80  return true; // barrel default
81  }
82  }
83  }
84 
85  return true; // barrel defautl
86 }
87 
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
egammaEnergyPositionAllSamples::e1
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
egammaEnergyPositionAllSamples::inBarrel
bool inBarrel(const xAOD::CaloCluster &cluster, int is)
return boolean to know if we are in barrel/end-cap
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
xAOD::CaloCluster_v1::inBarrel
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
Definition: CaloCluster_v1.h:896
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
egammaEnergyPositionAllSamples.h
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
xAOD::CaloCluster_v1::eSample
float eSample(const CaloSample sampling) const
Definition: CaloCluster_v1.cxx:521
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
egammaEnergyPositionAllSamples::e
double e(const xAOD::CaloCluster &cluster)
return the uncorrected sum of energy in all samples
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
egammaEnergyPositionAllSamples::e0
double e0(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in pre-sampler
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
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56