ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterHelpers.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8#ifndef COLUMNAR_CLUSTER_CLUSTER_HELPERS_H
9#define COLUMNAR_CLUSTER_CLUSTER_HELPERS_H
10
13
15
17
18namespace columnar
19{
21 {
29
30
31 template<ContainerIdConcept CI = ContainerId::cluster,typename CM=ColumnarModeDefault>
32 class EnergyBEAccessor final
33 {
36
37 public:
38
40
42 : m_eAcc (columnarTool, "e_sampl"), m_samplingPatternAcc (columnarTool, "samplingPattern") {}
43
44 float operator () (ObjectId<CI,CM> object, const unsigned sample) const
45 {
46 // Newer xAODs have the sampling pattern as an auxiliary
47 // variable which is what we are using by default. For older
48 // xAODs we fall back to the xAOD-only implementation, and hope
49 // that we are not in columnar mode.
50 const auto samplingPattern = m_samplingPatternAcc.isAvailable(object) ? m_samplingPatternAcc(object) : object.getXAODObject().samplingPattern();
51
52 return xAOD::CaloClusterDetails::energyBE(sample, samplingPattern, m_eAcc(object));
53 }
54 };
55
56
57
58 template<ContainerIdConcept CI = ContainerId::cluster,typename CM=ColumnarModeDefault>
59 class EtaBEAccessor final
60 {
64
65 public:
66
68
70 : m_eAcc (columnarTool, "e_sampl"), m_etaAcc (columnarTool, "eta_sampl"), m_samplingPatternAcc (columnarTool, "samplingPattern") {}
71
72 float operator () (ObjectId<CI,CM> object, const unsigned sample) const
73 {
74 // Newer xAODs have the sampling pattern as an auxiliary
75 // variable which is what we are using by default. For older
76 // xAODs we fall back to the xAOD-only implementation, and hope
77 // that we are not in columnar mode.
78 const auto samplingPattern = m_samplingPatternAcc.isAvailable(object) ? m_samplingPatternAcc(object) : object.getXAODObject().samplingPattern();
79
80 return xAOD::CaloClusterDetails::etaBE(sample, samplingPattern, m_eAcc(object), m_etaAcc(object));
81 }
82 };
83
84
85
86 template<ContainerIdConcept CI = ContainerId::cluster,typename CM=ColumnarModeDefault>
87 class PhiBEAccessor final
88 {
92
93 public:
94
96
98 : m_eAcc (columnarTool, "e_sampl"), m_phiAcc (columnarTool, "phi_sampl"), m_samplingPatternAcc (columnarTool, "samplingPattern") {}
99
100 float operator () (ObjectId<CI,CM> object, const unsigned sample) const
101 {
102 // Newer xAODs have the sampling pattern as an auxiliary
103 // variable which is what we are using by default. For older
104 // xAODs we fall back to the xAOD-only implementation, and hope
105 // that we are not in columnar mode.
106 const auto samplingPattern = m_samplingPatternAcc.isAvailable(object) ? m_samplingPatternAcc(object) : object.getXAODObject().samplingPattern();
107
108 return xAOD::CaloClusterDetails::phiBE(sample, samplingPattern, m_eAcc(object), m_phiAcc(object));
109 }
110 };
111 }
112}
113
114#endif
Helper functions for CaloCluster accessors.
EnergyBEAccessor(ColumnarTool< CM > &columnarTool)
float operator()(ObjectId< CI, CM > object, const unsigned sample) const
ColumnAccessor< CI, std::vector< float >, CM > m_eAcc
ColumnAccessor< CI, uint32_t, CM > m_samplingPatternAcc
EtaBEAccessor(ColumnarTool< CM > &columnarTool)
ColumnAccessor< CI, std::vector< float >, CM > m_eAcc
float operator()(ObjectId< CI, CM > object, const unsigned sample) const
ColumnAccessor< CI, std::vector< float >, CM > m_etaAcc
ColumnAccessor< CI, uint32_t, CM > m_samplingPatternAcc
ColumnAccessor< CI, uint32_t, CM > m_samplingPatternAcc
ColumnAccessor< CI, std::vector< float >, CM > m_phiAcc
PhiBEAccessor(ColumnarTool< CM > &columnarTool)
ColumnAccessor< CI, std::vector< float >, CM > m_eAcc
float operator()(ObjectId< CI, CM > object, const unsigned sample) const
the base class for all columnar components
a class representing a single object (electron, muons, etc.)
AccessorTemplate< CI, CT, ColumnAccessMode::input, CM > ColumnAccessor
float phiBE(const unsigned sample, const std::uint32_t samplingPattern, const std::span< const float > e_sampl, const std::span< const float > phi_sampl)
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.
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.