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 
17 class Lepton
18 {
19 public:
20  Lepton(const xAOD::IParticle* ptr, std::size_t tag=0) : m_obj(ptr), m_tag(tag) {}
21  Lepton(const xAOD::Electron* ptr, std::size_t tag=0) : m_obj(ptr), m_tag(tag) {}
22  Lepton(const xAOD::Photon* ptr, std::size_t tag=0) : m_obj(ptr), m_tag(tag) {}
23  Lepton(const Lepton&) = default;
24  Lepton& operator=(const Lepton&) = default;
25  Lepton(Lepton&&) = default;
26  Lepton& operator=(Lepton&&) = default;
27  float pt() const { return m_obj->pt(); }
28  xAOD::Type::ObjectType type() const { return m_obj->type(); }
29  std::size_t tag() const { return m_tag; }
30  const xAOD::Electron* electron() const { return static_cast<const xAOD::Electron*>(m_obj); }
31  const xAOD::Muon* muon() const { return static_cast<const xAOD::Muon*>(m_obj); }
32  const xAOD::Photon* photon() const { return static_cast<const xAOD::Photon*>(m_obj); }
33  const xAOD::IParticle* particle() const { return m_obj; }
34  bool operator<(const Lepton& rhs) const { return m_obj<rhs.m_obj; }
35 protected:
36  const xAOD::IParticle* m_obj = nullptr;
37  std::size_t m_tag = 0; // 0 = no tag
38 };
39 
40 }
41 
42 
43 #endif
TrigGlobEffCorr::Lepton::m_obj
const xAOD::IParticle * m_obj
Definition: Lepton.h:36
TrigGlobEffCorr::Lepton::Lepton
Lepton(const xAOD::Electron *ptr, std::size_t tag=0)
Definition: Lepton.h:21
ObjectType
ObjectType
Definition: BaseObject.h:11
Muon.h
TrigGlobEffCorr::Lepton::photon
const xAOD::Photon * photon() const
Definition: Lepton.h:32
TrigGlobEffCorr
the template specializations below must be enclosed in this namespace
Definition: Calculator.cxx:1240
TrigGlobEffCorr::Lepton::pt
float pt() const
Definition: Lepton.h:27
TrigGlobEffCorr::Lepton::Lepton
Lepton(const xAOD::IParticle *ptr, std::size_t tag=0)
Definition: Lepton.h:20
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:33
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:29
TrigGlobEffCorr::Lepton::muon
const xAOD::Muon * muon() const
Definition: Lepton.h:31
Photon.h
TrigGlobEffCorr::Lepton::operator<
bool operator<(const Lepton &rhs) const
Definition: Lepton.h:34
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:18
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:28
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:37
TrigGlobEffCorr::Lepton::electron
const xAOD::Electron * electron() const
Definition: Lepton.h:30