ATLAS Offline Software
Loading...
Searching...
No Matches
RotPhi.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#ifndef DCMATH_ROTPHI_H
6#define DCMATH_ROTPHI_H
7
8#include <cmath>
9
11
12namespace TrkDriftCircleMath {
13
14 class RotPhi {
15 public:
16 RotPhi(double phi) : m_phi{phi}, m_cosphi{std::cos(phi)}, m_sinphi{std::sin(phi)} {}
17
18 RotPhi(const RotPhi&) = default;
19 RotPhi(RotPhi&&) = default;
20
21 RotPhi& operator=(RotPhi&&) = default;
22 RotPhi& operator=(const RotPhi&) = default;
23
24 double phi() const { return m_phi; }
25 double cosphi() const { return m_cosphi; }
26 double sinphi() const { return m_sinphi; }
27
28 double xval(const LocVec2D& lv) const { return cosphi() * lv.x() + sinphi() * lv.y(); }
29 double yval(const LocVec2D& lv) const { return -sinphi() * lv.x() + cosphi() * lv.y(); }
30 LocVec2D operator*(const LocVec2D& lv) const {return LocVec2D{xval(lv), yval(lv)}; }
31
32 RotPhi inverse() const { return RotPhi(-phi()); }
33
34 void set(double phi) {
35 m_phi = phi;
36 m_cosphi = std::cos(phi);
37 m_sinphi = std::sin(phi);
38 }
39
40 private:
41 double m_phi{0};
42 double m_cosphi{0};
43 double m_sinphi{0};
44 };
45
46} // namespace TrkDriftCircleMath
47#endif
Implementation of 2 dimensional vector class.
Definition LocVec2D.h:16
double y() const
Returns the y coordinate of the vector.
Definition LocVec2D.h:29
double x() const
Returns the x coordinate of the vector.
Definition LocVec2D.h:27
LocVec2D operator*(const LocVec2D &lv) const
Definition RotPhi.h:30
RotPhi inverse() const
Definition RotPhi.h:32
RotPhi & operator=(RotPhi &&)=default
double phi() const
Definition RotPhi.h:24
double xval(const LocVec2D &lv) const
Definition RotPhi.h:28
double cosphi() const
Definition RotPhi.h:25
double yval(const LocVec2D &lv) const
Definition RotPhi.h:29
RotPhi & operator=(const RotPhi &)=default
RotPhi(const RotPhi &)=default
void set(double phi)
Definition RotPhi.h:34
double sinphi() const
Definition RotPhi.h:26
RotPhi(RotPhi &&)=default
Function object to check whether two Segments are sub/super sets or different.
STL namespace.