ATLAS Offline Software
Lepton.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // contact: jmaurer@cern.ch
6 
7 #ifndef TRIGGLOBALEFFICIENCYCORRECTION_LEPTON_H
8 #define TRIGGLOBALEFFICIENCYCORRECTION_LEPTON_H 1
9 
10 #include "xAODEgamma/Electron.h"
11 #include "xAODEgamma/Photon.h"
12 #include "xAODMuon/Muon.h"
13 
14 namespace TrigGlobEffCorr {
15 
16 class Lepton {
17  public:
18  Lepton(const xAOD::IParticle* ptr, std::size_t tag = 0)
19  : m_obj(ptr), m_tag(tag) {}
20  Lepton(const xAOD::Electron* ptr, std::size_t tag = 0)
21  : m_obj(ptr), m_tag(tag) {}
22  Lepton(const xAOD::Photon* ptr, std::size_t tag = 0)
23  : m_obj(ptr), m_tag(tag) {}
24  Lepton(const Lepton&) = default;
25  Lepton& operator=(const Lepton&) = default;
26  Lepton(Lepton&&) = default;
27  Lepton& operator=(Lepton&&) = default;
28  float pt() const { return m_obj->pt(); }
29  xAOD::Type::ObjectType type() const { return m_obj->type(); }
30  std::size_t tag() const { return m_tag; }
31  const xAOD::Electron* electron() const {
32  return static_cast<const xAOD::Electron*>(m_obj);
33  }
34  const xAOD::Muon* muon() const {
35  return static_cast<const xAOD::Muon*>(m_obj);
36  }
37  const xAOD::Photon* photon() const {
38  return static_cast<const xAOD::Photon*>(m_obj);
39  }
40  const xAOD::IParticle* particle() const { return m_obj; }
41  bool operator<(const Lepton& rhs) const { return m_obj < rhs.m_obj; }
42 
43  protected:
44  const xAOD::IParticle* m_obj = nullptr;
45  std::size_t m_tag = 0; // 0 = no tag
46 };
47 
48 } // namespace TrigGlobEffCorr
49 
50 #endif
TrigGlobEffCorr::Lepton::m_obj
const xAOD::IParticle * m_obj
Definition: Lepton.h:44
TrigGlobEffCorr::Lepton::Lepton
Lepton(const xAOD::Electron *ptr, std::size_t tag=0)
Definition: Lepton.h:20
ObjectType
ObjectType
Definition: BaseObject.h:11
Muon.h
TrigGlobEffCorr::Lepton::photon
const xAOD::Photon * photon() const
Definition: Lepton.h:37
TrigGlobEffCorr
the template specializations below must be enclosed in this namespace
Definition: Calculator.cxx:1596
TrigGlobEffCorr::Lepton::pt
float pt() const
Definition: Lepton.h:28
TrigGlobEffCorr::Lepton::Lepton
Lepton(const xAOD::IParticle *ptr, std::size_t tag=0)
Definition: Lepton.h:18
TrigGlobEffCorr::Lepton::operator=
Lepton & operator=(Lepton &&)=default
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
TrigGlobEffCorr::Lepton::particle
const xAOD::IParticle * particle() const
Definition: Lepton.h:40
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
TrigGlobEffCorr::Lepton::Lepton
Lepton(const Lepton &)=default
TrigGlobEffCorr::Lepton::tag
std::size_t tag() const
Definition: Lepton.h:30
TrigGlobEffCorr::Lepton::muon
const xAOD::Muon * muon() const
Definition: Lepton.h:34
Photon.h
TrigGlobEffCorr::Lepton::operator<
bool operator<(const Lepton &rhs) const
Definition: Lepton.h:41
TrigGlobEffCorr::Lepton::Lepton
Lepton(const xAOD::Photon *ptr, std::size_t tag=0)
Definition: Lepton.h:22
xAOD::IParticle::pt
virtual double pt() const =0
The transverse momentum ( ) of the particle.
TrigGlobEffCorr::Lepton
Definition: Lepton.h:16
TrigGlobEffCorr::Lepton::operator=
Lepton & operator=(const Lepton &)=default
xAOD::Electron_v1
Definition: Electron_v1.h:34
TrigGlobEffCorr::Lepton::type
xAOD::Type::ObjectType type() const
Definition: Lepton.h:29
TrigGlobEffCorr::Lepton::Lepton
Lepton(Lepton &&)=default
xAOD::Photon_v1
Definition: Photon_v1.h:37
Electron.h
TrigGlobEffCorr::Lepton::m_tag
std::size_t m_tag
Definition: Lepton.h:45
TrigGlobEffCorr::Lepton::electron
const xAOD::Electron * electron() const
Definition: Lepton.h:31