ATLAS Offline Software
Loading...
Searching...
No Matches
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
14namespace Trk
15{
25
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
Charged(const Charged &)=default
Copy constructor.
double charge() const
Return the charge.
Definition Charged.h:50
~Charged()=default
Destructor.
bool operator!=(const Charged &rOther) const
Inequality operator.
Definition Charged.h:63
Charged(Charged &&)=default
Move constructor.
bool operator==(const Charged &rOther) const
Equality operator.
Definition Charged.h:56
Charged & operator=(const Charged &)=default
Assignment operator.
Charged(const double &charge=1.)
Default constructor.
Definition Charged.h:30
double m_charge
the charge value
Definition Charged.h:69
Charged & operator=(Charged &&)=default
Move assignment operator.
void setCharge(double charge)
Set the charge.
Definition Charged.h:53
Ensure that the ATLAS eigen extensions are properly loaded.