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

a handle to hold a IMomentumAccessors object More...

#include <MomentumAccessors.h>

Collaboration diagram for columnar::MomentumAccessors< CI, CM >:

Public Member Functions

 MomentumAccessors () noexcept
 
template<typename MyMomentumAccessors , typename... Args>
 MomentumAccessors (std::in_place_type_t< MyMomentumAccessors >, Args &&... args)
 
template<typename MyMomentumAccessors , typename... Args>
void reset (std::in_place_type_t< MyMomentumAccessors >, Args &&... args)
 
double pt (ObjectId< CI, CM > object) const
 the various momentum accessors More...
 
double eta (ObjectId< CI, CM > object) const
 
double phi (ObjectId< CI, CM > object) const
 
double m (ObjectId< CI, CM > object) const
 
double e (ObjectId< CI, CM > object) const
 
double rapidity (ObjectId< CI, CM > object) const
 

Private Attributes

std::shared_ptr< const Detail::IMomentumAccessors< CI, CM > > m_accessors
 the underlying accessors, which default to the xAOD::IParticle accessors in case they are not overridden More...
 

Detailed Description

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
class columnar::MomentumAccessors< CI, CM >

a handle to hold a IMomentumAccessors object

In principle the user could also hold a (smart) pointer to the underlying IMomentumAccessors, but having it in a class like this allows some refactoring in the future. Currently the expectation is that momentum accessors will not be widely used, but if it is I can then refactor this class without affecting the users.

The implementation of this is essentially this is a variation on a type-erased interface. There are a number of variations and optimizations that could be done here. Most notably if one tried hard enough one could probably avoid the ContainerId template parameter for the virtual interface, which would cut down on the code bloat. However that would need some infrastructure support which is not available (as of 24 Jul 25).

I'm not quite clear whether it would be a good idea to hide the underlying momentum accessors

Note that this is also always guaranteed to be valid, defaulting to the IParticle implementation (which is not available in columnar mode).

Definition at line 289 of file MomentumAccessors.h.

Constructor & Destructor Documentation

◆ MomentumAccessors() [1/2]

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
columnar::MomentumAccessors< CI, CM >::MomentumAccessors ( )
inlinenoexcept

Definition at line 293 of file MomentumAccessors.h.

294  {
295  reset (std::in_place_type<Detail::MomentumAccessorsIParticle<CI,CM>>);
296  }

◆ MomentumAccessors() [2/2]

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
template<typename MyMomentumAccessors , typename... Args>
columnar::MomentumAccessors< CI, CM >::MomentumAccessors ( std::in_place_type_t< MyMomentumAccessors< CI, CM > >  ,
Args &&...  args 
)
inline

Definition at line 299 of file MomentumAccessors.h.

300  {
301  reset (std::in_place_type<MyMomentumAccessors>, std::forward<Args> (args)...);
302  }

Member Function Documentation

◆ e()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
double columnar::MomentumAccessors< CI, CM >::e ( ObjectId< CI, CM object) const
inline

Definition at line 319 of file MomentumAccessors.h.

319  {
320  return m_accessors->e (object); }

◆ eta()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
double columnar::MomentumAccessors< CI, CM >::eta ( ObjectId< CI, CM object) const
inline

Definition at line 313 of file MomentumAccessors.h.

313  {
314  return m_accessors->eta (object); }

◆ m()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
double columnar::MomentumAccessors< CI, CM >::m ( ObjectId< CI, CM object) const
inline

Definition at line 317 of file MomentumAccessors.h.

317  {
318  return m_accessors->m (object); }

◆ phi()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
double columnar::MomentumAccessors< CI, CM >::phi ( ObjectId< CI, CM object) const
inline

Definition at line 315 of file MomentumAccessors.h.

315  {
316  return m_accessors->phi (object); }

◆ pt()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
double columnar::MomentumAccessors< CI, CM >::pt ( ObjectId< CI, CM object) const
inline

the various momentum accessors

Definition at line 311 of file MomentumAccessors.h.

311  {
312  return m_accessors->pt (object); }

◆ rapidity()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
double columnar::MomentumAccessors< CI, CM >::rapidity ( ObjectId< CI, CM object) const
inline

Definition at line 321 of file MomentumAccessors.h.

321  {
322  return m_accessors->rapidity (object); }

◆ reset()

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
template<typename MyMomentumAccessors , typename... Args>
void columnar::MomentumAccessors< CI, CM >::reset ( std::in_place_type_t< MyMomentumAccessors< CI, CM > >  ,
Args &&...  args 
)
inline

Definition at line 305 of file MomentumAccessors.h.

306  {
307  m_accessors = std::make_shared<Detail::MomentumAccessorsImp<MyMomentumAccessors>> (std::forward<Args> (args)...);
308  }

Member Data Documentation

◆ m_accessors

template<ContainerIdConcept CI, typename CM = ColumnarModeDefault>
std::shared_ptr<const Detail::IMomentumAccessors<CI,CM> > columnar::MomentumAccessors< CI, CM >::m_accessors
private

the underlying accessors, which default to the xAOD::IParticle accessors in case they are not overridden

Definition at line 328 of file MomentumAccessors.h.


The documentation for this class was generated from the following file:
python.CaloAddPedShiftConfig.args
args
Definition: CaloAddPedShiftConfig.py:47
columnar::MomentumAccessors::m_accessors
std::shared_ptr< const Detail::IMomentumAccessors< CI, CM > > m_accessors
the underlying accessors, which default to the xAOD::IParticle accessors in case they are not overrid...
Definition: MomentumAccessors.h:328
columnar::MomentumAccessors::reset
void reset(std::in_place_type_t< MyMomentumAccessors >, Args &&... args)
Definition: MomentumAccessors.h:305