5 #ifndef XAODCALOEVENT_CALOCLUSTERDETAILS_H
6 #define XAODCALOEVENT_CALOCLUSTERDETAILS_H
9 #include <CaloGeoHelpers/CaloSampling.h>
16 namespace CaloClusterDetails
59 if ((samplingPattern & (0x1U <<
s)) == 0) {
65 return std::popcount(samplingPattern << (32 -
s));
107 [[nodiscard]]
inline float etaBE(
const unsigned sample,
const std::uint32_t samplingPattern,
const std::span<const float> e_sampl,
const std::span<const float> eta_sampl) {
111 const bool haveBarrel=
hasSampling(barrelSample, samplingPattern);
112 const bool haveEndcap=
hasSampling(endcapSample, samplingPattern);
113 if (haveBarrel && haveEndcap) {
115 float eBarrel=
getSamplVar(barrelSample,samplingPattern,e_sampl);
116 float eEndcap=
getSamplVar(endcapSample,samplingPattern,e_sampl);
118 float etaBarrel=
getSamplVar(barrelSample,samplingPattern,eta_sampl);
119 float etaEndcap=
getSamplVar(endcapSample,samplingPattern,eta_sampl);
120 float eSum=eBarrel + eEndcap;
123 if ((eBarrel > 0 && eEndcap > 0) || (eBarrel < 0 && eEndcap < 0))
124 return (eBarrel * etaBarrel + eEndcap * etaEndcap) / eSum;
125 else if (eBarrel > 0)
130 return (0.5 * (etaBarrel + etaEndcap));
133 return getSamplVar(barrelSample,samplingPattern,eta_sampl);
136 return getSamplVar(endcapSample,samplingPattern,eta_sampl);
145 [[nodiscard]]
inline float phiBE(
const unsigned sample,
const std::uint32_t samplingPattern,
const std::span<const float> e_sampl,
const std::span<const float> phi_sampl) {
149 const bool haveBarrel=
hasSampling(barrelSample, samplingPattern);
150 const bool haveEndcap=
hasSampling(endcapSample, samplingPattern);
151 if (haveBarrel && haveEndcap) {
153 float eBarrel=
getSamplVar(barrelSample, samplingPattern, e_sampl);
154 float eEndcap=
getSamplVar(endcapSample, samplingPattern, e_sampl);
155 float eSum=eBarrel+eEndcap;
156 float phiBarrel=
getSamplVar(barrelSample, samplingPattern, phi_sampl);
157 float phiEndcap=
getSamplVar(endcapSample, samplingPattern, phi_sampl);
159 if ((eBarrel > 0 && eEndcap > 0) || (eBarrel < 0 && eEndcap < 0)) {
162 }
else if (eBarrel > 0)
171 return getSamplVar(barrelSample, samplingPattern, phi_sampl);
174 return getSamplVar(endcapSample, samplingPattern, phi_sampl);