Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Typedefs | Functions | Variables
xAOD::CaloClusterDetails Namespace Reference

Typedefs

using CaloSample = CaloSampling::CaloSample
 

Functions

bool hasSampling (const CaloSample s, const std::uint32_t samplingPattern)
 Checks if certain smapling contributes to cluster. More...
 
unsigned sampVarIdx (const CaloSample s, const std::uint32_t samplingPattern)
 
float getSamplVar (const CaloSample sampling, const std::uint32_t samplingPattern, const std::span< const float > vec, const float errorvalue=defaultErrorValue)
 
float energyBE (const unsigned sample, const std::uint32_t samplingPattern, const std::span< const float > e_sampl)
 Get the energy in one layer of the EM Calo. More...
 
float etaBE (const unsigned sample, const std::uint32_t samplingPattern, const std::span< const float > e_sampl, const std::span< const float > eta_sampl)
 Get the eta in one layer of the EM Calo. More...
 

Variables

constexpr float defaultErrorValue = -999
 the default error code to return in case of error More...
 

Typedef Documentation

◆ CaloSample

Definition at line 39 of file CaloClusterDetails.h.

Function Documentation

◆ energyBE()

float xAOD::CaloClusterDetails::energyBE ( const unsigned  sample,
const std::uint32_t  samplingPattern,
const std::span< const float e_sampl 
)
inline

Get the energy in one layer of the EM Calo.

Parameters
layerLayer between 0 (Presampler) and 3 (Back)
Returns
energy Works for both, barrel and endcap

Definition at line 86 of file CaloClusterDetails.h.

86  {
87  if (sample>3) return defaultErrorValue;
90  double energy=0;
91  if (hasSampling(barrelSample, samplingPattern)) {
92  energy+=getSamplVar(barrelSample,samplingPattern,e_sampl); //Check for errorcode? Should not happen...
93  }
94  if (hasSampling(endcapSample, samplingPattern)) {
95  energy+=getSamplVar(endcapSample,samplingPattern,e_sampl);
96  }
97  return energy;
98  }

◆ etaBE()

float xAOD::CaloClusterDetails::etaBE ( const unsigned  sample,
const std::uint32_t  samplingPattern,
const std::span< const float e_sampl,
const std::span< const float eta_sampl 
)
inline

Get the eta in one layer of the EM Calo.

Parameters
layerLayer between 0 (Presampler) and 3 (Back)
Returns
energy Works for both, barrel and endcap

Definition at line 106 of file CaloClusterDetails.h.

106  {
107  if (sample>3) {return defaultErrorValue;}
110  const bool haveBarrel=hasSampling(barrelSample, samplingPattern);
111  const bool haveEndcap=hasSampling(endcapSample, samplingPattern);
112  if (haveBarrel && haveEndcap) {
113  //cluster spans barren and endcap
114  float eBarrel=getSamplVar(barrelSample,samplingPattern,e_sampl); //Check for errorcode? Should not happen...
115  float eEndcap=getSamplVar(endcapSample,samplingPattern,e_sampl);
116 
117  float etaBarrel=getSamplVar(barrelSample,samplingPattern,eta_sampl);
118  float etaEndcap=getSamplVar(endcapSample,samplingPattern,eta_sampl);
119  float eSum=eBarrel + eEndcap;
120  if (eSum > 100 /*MeV*/) {
121  //E-weighted average ...
122  if ((eBarrel > 0 && eEndcap > 0) || (eBarrel < 0 && eEndcap < 0))
123  return (eBarrel * etaBarrel + eEndcap * etaEndcap) / eSum;
124  else if (eBarrel > 0)
125  return etaBarrel;
126  else
127  return etaEndcap;
128  }//else eSum==0 case, should never happen
129  return (0.5 * (etaBarrel + etaEndcap));
130  }
131  if (haveBarrel) {
132  return getSamplVar(barrelSample,samplingPattern,eta_sampl);
133  }
134  if (haveEndcap) {
135  return getSamplVar(endcapSample,samplingPattern,eta_sampl);
136  }
137 
138  //Should never reach this point ...
139  return defaultErrorValue;
140  }

◆ getSamplVar()

float xAOD::CaloClusterDetails::getSamplVar ( const CaloSample  sampling,
const std::uint32_t  samplingPattern,
const std::span< const float vec,
const float  errorvalue = defaultErrorValue 
)
inline

Definition at line 71 of file CaloClusterDetails.h.

71  {
72  const unsigned idx=sampVarIdx(sampling, samplingPattern);
73  if (idx<vec.size() ) {
74  return vec[idx];
75  }
76 
77  //std::cout <<Sampling " << sampling << ", Pattern=" << std::hex <<m_samplingPattern << std::dec << ", index=" << idx << " size=" << vec.size() << std::endl;
78  return errorvalue;
79  }

◆ hasSampling()

bool xAOD::CaloClusterDetails::hasSampling ( const CaloSample  s,
const std::uint32_t  samplingPattern 
)
inline

Checks if certain smapling contributes to cluster.

Definition at line 51 of file CaloClusterDetails.h.

51  {
52  return (samplingPattern & (0x1U<<(std::uint32_t)s));
53  }

◆ sampVarIdx()

unsigned xAOD::CaloClusterDetails::sampVarIdx ( const CaloSample  s,
const std::uint32_t  samplingPattern 
)
inline

Definition at line 56 of file CaloClusterDetails.h.

56  {
57  //std::cout << "Pattern=" << std::hex << pattern << std::dec << ", Sampling=" << s << std::endl;
58  if ((samplingPattern & (0x1U << s)) == 0) {
59  return CaloSampling::Unknown;
60  }
61  if (s == 0) {
62  return 0;
63  } // shifting a 32-bit int by 32 bits is undefined behavior!
64  return std::popcount(samplingPattern << (32 - s));
65  // Explanation: Need to get the number of bit (=samples) before the sampling in question
66  // Shift to the left, so bits after the sampling in question fall off the 32bit integer
67  // Then use popcount to count the numbers of 1 in the rest
68  }

Variable Documentation

◆ defaultErrorValue

constexpr float xAOD::CaloClusterDetails::defaultErrorValue = -999
constexpr

the default error code to return in case of error

FIXME: This value is currently taken from the xAOD::CaloCluster class, and should be changed to a more sensible value in the future.

Definition at line 47 of file CaloClusterDetails.h.

xAOD::CaloClusterDetails::hasSampling
bool hasSampling(const CaloSample s, const std::uint32_t samplingPattern)
Checks if certain smapling contributes to cluster.
Definition: CaloClusterDetails.h:51
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
xAOD::CaloClusterDetails::sampVarIdx
unsigned sampVarIdx(const CaloSample s, const std::uint32_t samplingPattern)
Definition: CaloClusterDetails.h:56
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
xAOD::CaloClusterDetails::getSamplVar
float getSamplVar(const CaloSample sampling, const std::uint32_t samplingPattern, const std::span< const float > vec, const float errorvalue=defaultErrorValue)
Definition: CaloClusterDetails.h:71
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CaloSample
CaloCell_ID::CaloSample CaloSample
Definition: CaloCellCollector.cxx:18
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
xAOD::CaloClusterDetails::defaultErrorValue
constexpr float defaultErrorValue
the default error code to return in case of error
Definition: CaloClusterDetails.h:47