ATLAS Offline Software
Charged.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Charged.h, (c) ATLAS Detector software
8 
9 #ifndef TRKPARAMETERSBASE_CHARGED_H
10 #define TRKPARAMETERSBASE_CHARGED_H 1
11 
12 #include <cmath>
13 
14 namespace Trk
15 {
26  class Charged
27  {
28  public:
30  Charged(const double& charge = 1.):
32  {}
33 
35  Charged(const Charged&) = default;
36 
38  Charged(Charged&&) = default;
39 
41  ~Charged() = default;
42 
44  Charged& operator=(const Charged&) = default;
45 
47  Charged& operator=(Charged&&) = default;
48 
50  double charge() const {return m_charge;}
51 
53  void setCharge(double charge) {m_charge = charge;}
54 
56  bool operator==(const Charged& rOther) const
57  {
58  constexpr double tolerance = 1e-8;
59  return std::abs(charge() - rOther.charge()) < tolerance;
60  }
61 
63  bool operator!=(const Charged& rOther) const
64  {
65  return !(*this == rOther);
66  }
67 
68  private:
69  double m_charge;
70  };
71 } // end of namespace Trk
72 
73 #endif
tolerance
constexpr double tolerance
Definition: runMdtGeoComparison.cxx:105
Trk::Charged::charge
double charge() const
Return the charge.
Definition: Charged.h:50
Trk::Charged
Definition: Charged.h:27
Trk::Charged::operator!=
bool operator!=(const Charged &rOther) const
Inequality operator.
Definition: Charged.h:63
Trk::Charged::~Charged
~Charged()=default
Destructor.
Trk::Charged::m_charge
double m_charge
the charge value
Definition: Charged.h:69
tolerance
Definition: suep_shower.h:17
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::Charged::operator==
bool operator==(const Charged &rOther) const
Equality operator.
Definition: Charged.h:56
Trk::Charged::setCharge
void setCharge(double charge)
Set the charge.
Definition: Charged.h:53
Trk::Charged::Charged
Charged(const double &charge=1.)
Default constructor.
Definition: Charged.h:30
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Trk::Charged::operator=
Charged & operator=(const Charged &)=default
Assignment operator.
Trk::Charged::Charged
Charged(Charged &&)=default
Move constructor.
Trk::Charged::operator=
Charged & operator=(Charged &&)=default
Move assignment operator.
Trk::Charged::Charged
Charged(const Charged &)=default
Copy constructor.