ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM > Class Template Referencefinal

#include <EgammaHelpers.h>

Collaboration diagram for columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >:

Public Member Functions

 IsConvertedPhotonAccessor (ColumnarTool< CM > &columnarTool)
 
std::pair< bool, unsigned > operator() (ObjectId< CI, CM > photon, bool excludeTRT) const
 return whether the photon is converted, and a bitmask of missing links More...
 

Private Attributes

ColumnAccessor< CI, float, CMm_etaAcc
 
ColumnAccessor< CI, std::vector< OptObjectId< ContainerId::vertex, CM > >, CMm_vertexLinksAcc
 
VertexAccessor< std::vector< OptObjectId< ContainerId::track, CM > >, CMm_trackParticleLinksAcc
 
TrackAccessor< std::uint8_t, CMm_numberOfPixelHitsAcc
 
TrackAccessor< std::uint8_t, CMm_numberOfSCTHitsAcc
 
ColumnAccessor< CI, RetypeColumn< xAOD::Type::ObjectType, std::uint16_t >, CMm_objectTypeAcc
 

Detailed Description

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
class columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >

Definition at line 50 of file EgammaHelpers.h.

Constructor & Destructor Documentation

◆ IsConvertedPhotonAccessor()

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::IsConvertedPhotonAccessor ( ColumnarTool< CM > &  columnarTool)
inline

Definition at line 60 of file EgammaHelpers.h.

61  : m_etaAcc (columnarTool, "eta"),
62  m_vertexLinksAcc (columnarTool, "vertexLinks"),
63  m_trackParticleLinksAcc (columnarTool, "trackParticleLinks", {.isOptional = true}),
64  m_numberOfPixelHitsAcc (columnarTool, "numberOfPixelHits"),
65  m_numberOfSCTHitsAcc (columnarTool, "numberOfSCTHits")
66  {
67  if constexpr (!CM::isXAOD)
68  resetAccessor (m_objectTypeAcc, columnarTool, "objectType", {.isOptional = true});
69  }

Member Function Documentation

◆ operator()()

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
std::pair<bool,unsigned> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::operator() ( ObjectId< CI, CM photon,
bool  excludeTRT 
) const
inline

return whether the photon is converted, and a bitmask of missing links

It is up to the called to decide whether they want to do anything for the missing links. The reason to report it out is that the caller will have a message stream, configurable properties, etc. which an accessor helper does not have.

Definition at line 78 of file EgammaHelpers.h.

79  {
80  // While the accessor is generally meant to be used with
81  // photons, sometimes electrons are passed as photons for
82  // performance studies, etc. In xAOD mode we can just check
83  // `IParticle::type()`, while in columnar mode we need the user
84  // to pass that in as an extra column. Having an extra column
85  // for that feels like a bit of an overkill, but it is optional
86  // here, and we can revisit it later if it becomes an issue.
88  if constexpr (CM::isXAOD)
89  {
90  type = photon.getXAODObjectNoexcept().type();
91  } else
92  {
93  if (m_objectTypeAcc.isAvailable(photon))
95  }
96  if (type != xAOD::Type::Photon)
97  return std::make_pair (false, 0x0);
98 
99  const auto vertices = m_vertexLinksAcc(photon);
100  if (vertices.size() == 0) return std::make_pair (false, 0x0);
101  if (!vertices[0].has_value())
102  return std::make_pair (false, 0x1);
103 
104  unsigned missingLinks = 0x0;
105 
106  auto vertex = vertices[0].value();
107  bool hasTrk1 = false;
108  bool hasTrk2 = false;
109  std::uint8_t nSiHits1 = 0;
110  std::uint8_t nSiHits2 = 0;
111  if (m_trackParticleLinksAcc.isAvailable(vertex)) {
112  const auto tracks = m_trackParticleLinksAcc(vertex);
113  if (tracks.size() > 0) {
114  if (tracks[0].has_value()) {
115  hasTrk1 = true;
116  nSiHits1 += m_numberOfPixelHitsAcc(tracks[0].value());
117  nSiHits1 += m_numberOfSCTHitsAcc(tracks[0].value());
118  } else missingLinks |= 0x2;
119  }
120  if (tracks.size() > 1) {
121  if (tracks[1].has_value()) {
122  hasTrk2 = true;
123  nSiHits2 += m_numberOfPixelHitsAcc(tracks[1].value());
124  nSiHits2 += m_numberOfSCTHitsAcc(tracks[1].value());
125  } else missingLinks |= 0x4;
126  }
127  }
128 
129  auto conversionType = xAOD::EgammaDetails::conversionType(hasTrk1, hasTrk2, nSiHits1, nSiHits2);
130  return std::make_pair (xAOD::EgammaDetails::isConvertedPhoton (excludeTRT, photon(m_etaAcc), vertices.size(), conversionType), missingLinks);
131  }

Member Data Documentation

◆ m_etaAcc

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
ColumnAccessor<CI,float,CM> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::m_etaAcc
private

Definition at line 52 of file EgammaHelpers.h.

◆ m_numberOfPixelHitsAcc

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
TrackAccessor<std::uint8_t,CM> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::m_numberOfPixelHitsAcc
private

Definition at line 55 of file EgammaHelpers.h.

◆ m_numberOfSCTHitsAcc

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
TrackAccessor<std::uint8_t,CM> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::m_numberOfSCTHitsAcc
private

Definition at line 56 of file EgammaHelpers.h.

◆ m_objectTypeAcc

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
ColumnAccessor<CI,RetypeColumn<xAOD::Type::ObjectType,std::uint16_t>,CM> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::m_objectTypeAcc
private

Definition at line 57 of file EgammaHelpers.h.

◆ m_trackParticleLinksAcc

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
VertexAccessor<std::vector<OptObjectId<ContainerId::track,CM> >,CM> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::m_trackParticleLinksAcc
private

Definition at line 54 of file EgammaHelpers.h.

◆ m_vertexLinksAcc

template<ContainerIdConcept CI = ContainerId::egamma, typename CM = ColumnarModeDefault>
ColumnAccessor<CI,std::vector<OptObjectId<ContainerId::vertex,CM> >,CM> columnar::EgammaHelpers::IsConvertedPhotonAccessor< CI, CM >::m_vertexLinksAcc
private

Definition at line 53 of file EgammaHelpers.h.


The documentation for this class was generated from the following file:
columnar::EgammaHelpers::IsConvertedPhotonAccessor::m_trackParticleLinksAcc
VertexAccessor< std::vector< OptObjectId< ContainerId::track, CM > >, CM > m_trackParticleLinksAcc
Definition: EgammaHelpers.h:54
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
ObjectType
ObjectType
Definition: BaseObject.h:11
athena.value
value
Definition: athena.py:124
xAOD::EgammaDetails::isConvertedPhoton
bool isConvertedPhoton(const bool excludeTRT, const float eta, const std::size_t nVertices, const ConversionType conversionType)
is the object a converted photon
Definition: EgammaDetails.h:59
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::EgammaDetails::conversionType
ConversionType conversionType(const bool hasTrk1, const bool hasTrk2, const std::uint8_t nSiHits1, const std::uint8_t nSiHits2)
return the photon conversion type (see EgammaEnums)
Definition: EgammaDetails.h:40
columnar::ColumnarModeXAOD::isXAOD
static constexpr bool isXAOD
Whether this is the xAOD mode.
Definition: ColumnarDef.h:17
columnar::EgammaHelpers::IsConvertedPhotonAccessor::m_etaAcc
ColumnAccessor< CI, float, CM > m_etaAcc
Definition: EgammaHelpers.h:52
columnar::EgammaHelpers::IsConvertedPhotonAccessor::m_numberOfSCTHitsAcc
TrackAccessor< std::uint8_t, CM > m_numberOfSCTHitsAcc
Definition: EgammaHelpers.h:56
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:200
columnar::EgammaHelpers::IsConvertedPhotonAccessor::m_objectTypeAcc
ColumnAccessor< CI, RetypeColumn< xAOD::Type::ObjectType, std::uint16_t >, CM > m_objectTypeAcc
Definition: EgammaHelpers.h:57
columnar::resetAccessor
void resetAccessor(AccessorTemplate< CI, CT, CAM, CM > &accessor, ColumnarTool< CM > &columnBase, const std::string &name, ColumnInfo &&info={})
reset a column accessor to point to a new column
Definition: ColumnAccessor.h:210
columnar::EgammaHelpers::IsConvertedPhotonAccessor::m_vertexLinksAcc
ColumnAccessor< CI, std::vector< OptObjectId< ContainerId::vertex, CM > >, CM > m_vertexLinksAcc
Definition: EgammaHelpers.h:53
columnar::EgammaHelpers::IsConvertedPhotonAccessor::m_numberOfPixelHitsAcc
TrackAccessor< std::uint8_t, CM > m_numberOfPixelHitsAcc
Definition: EgammaHelpers.h:55