ATLAS Offline Software
Event/xAOD/xAODBase/xAODBase/IParticle.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAODBASE_IPARTICLE_H
8 #define XAODBASE_IPARTICLE_H
9 
10 // ROOT include(s):
11 #include <TLorentzVector.h>
12 
13 // EDM include(s):
15 #include "AthContainers/Accessor.h"
16 
17 // Local include(s):
18 #include "ObjectType.h"
19 
20 
22 namespace xAOD {
23 
41  class IParticle : public SG::AuxElement {
42 
43  public:
45  virtual ~IParticle() = default;
46  IParticle() = default;
47  IParticle(const IParticle&) = default;
48  IParticle& operator=(const IParticle&) = default;
49  IParticle(IParticle&&) = delete;
51 
54 
56  virtual double pt() const = 0;
58  virtual double eta() const = 0;
60  virtual double phi() const = 0;
62  virtual double m() const = 0;
64  virtual double e() const = 0;
66  virtual double rapidity() const = 0;
67 
69  typedef TLorentzVector FourMom_t;
70 
72  virtual FourMom_t p4() const = 0;
73 
75 
76 
78  virtual Type::ObjectType type() const = 0;
79 
80 
83 
96  template< class T >
98  T& auxdata( const std::string& name,
99  const std::string& clsname = "" ) {
100 
101  return SG::Accessor< T >(name, clsname)(*this);
102  }
103 
116  template< class T >
118  const T& auxdata( const std::string& name,
119  const std::string& clsname = "" ) const {
120 
121  return SG::ConstAccessor< T >( name, clsname )( *this );
122  }
123 
133  template< class T >
135  bool isAvailable( const std::string& name,
136  const std::string& clsname = "" ) const {
137 
138  return SG::ConstAccessor< T >(name, clsname).isAvailable(*this);
139  }
140 
150  template< class T >
152  bool isAvailableWritable( const std::string& name,
153  const std::string& clsname = "" ) const {
154 
155  return SG::Accessor< T >(name, clsname).isAvailableWritable(*this);
156  }
157 
159 
160 
161  protected:
162  // Hide some functions from the regular xAOD users
165 
166  // Hide the Accessor class from the regular xAOD users
168 
169  }; // class IParticle
170 
171 } // namespace xAOD
172 
173 #ifndef XAOD_STANDALONE
174 #include "AthenaKernel/BaseInfo.h"
176 #endif // not XAOD_STANDALONE
177 
178 #endif // XAODBASE_IPARTICLE_H
xAOD::IParticle::auxdata
XAOD_AUXDATA_DEPRECATED T & auxdata(const std::string &name, const std::string &clsname="")
Fetch an aux data variable, as a non-const reference.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:98
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
SG_BASE
SG_BASE(xAOD::IParticle, SG::AuxElement)
xAOD::IParticle::isAvailable
XAOD_AUXDATA_DEPRECATED bool isAvailable(const std::string &name, const std::string &clsname="") const
Check if a user property is available for reading or not.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:135
xAOD::IParticle::operator=
IParticle & operator=(IParticle &&)=delete
SG::Accessor< T >
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:483
xAOD::IParticle::rapidity
virtual double rapidity() const =0
The true rapidity (y) of the particle.
xAOD::IParticle::auxdata
XAOD_AUXDATA_DEPRECATED const T & auxdata(const std::string &name, const std::string &clsname="") const
Fetch an aux data variable, as a const reference.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:118
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
SG::ConstAccessor< T >
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
SG::AuxElement::getStore
SG::IAuxStore * getStore() const
Return the current store, as a non-const interface.
Definition: AuxElement.cxx:319
SG::AuxElement::Accessor
SG::Accessor< T, ALLOC > Accessor
Definition: AuxElement.h:572
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:69
ObjectType.h
BaseInfo.h
Provide an interface for finding inheritance information at run time.
xAOD::IParticle::IParticle
IParticle(IParticle &&)=delete
XAOD_AUXDATA_DEPRECATED
#define XAOD_AUXDATA_DEPRECATED
Definition: AuxElement.h:45
xAOD::IParticle::pt
virtual double pt() const =0
The transverse momentum ( ) of the particle.
xAOD::IParticle::isAvailableWritable
XAOD_AUXDATA_DEPRECATED bool isAvailableWritable(const std::string &name, const std::string &clsname="") const
Check if a user property is available for writing or not.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:152
xAOD::IParticle::~IParticle
virtual ~IParticle()=default
Virtual destructor, to make vtable happy...
Accessor.h
Helper class to provide type-safe access to aux data.
xAOD::IParticle::p4
virtual FourMom_t p4() const =0
The full 4-momentum of the particle.
xAOD::IParticle::IParticle
IParticle(const IParticle &)=default
SG::AuxElement::getConstStore
const SG::IConstAuxStore * getConstStore() const
Return the current store, as a const interface.
Definition: AuxElement.cxx:304
xAOD::IParticle::IParticle
IParticle()=default
SG::Accessor::isAvailableWritable
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.
xAOD::IParticle::eta
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::IParticle::phi
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition: ObjectType.h:32
xAOD::IParticle::operator=
IParticle & operator=(const IParticle &)=default
xAOD::IParticle::e
virtual double e() const =0
The total energy of the particle.
AuxElement.h
Base class for elements of a container that can have aux data.
xAOD::IParticle::m
virtual double m() const =0
The invariant mass of the particle.