ATLAS Offline Software
Loading...
Searching...
No Matches
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
7namespace {
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 */
14bool isCrackBarrel(const xAOD::CaloCluster &cluster,
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
38 return (cluster.eSample(CaloSampling::PreSamplerB) + cluster.eSample(CaloSampling::PreSamplerE));
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
53bool 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
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
float eSample(const CaloSample sampling) const
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
CaloSampling::CaloSample CaloSample
double e3(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 3rd sampling
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
double e0(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in pre-sampler
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st 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.