ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
eflowAzimuth Class Reference

eflowAzimuth represents phi and has kinematic functions which correctly deal with phi wraparound etc. More...

#include <eflowUtil.h>

Collaboration diagram for eflowAzimuth:

Public Member Functions

 eflowAzimuth (double phi)
 
 eflowAzimuth (const eflowAzimuth &other)
 
eflowAzimuthoperator= (const eflowAzimuth &other)
 
 ~eflowAzimuth ()
 
double operator() () const
 
double operator= (double phi)
 
eflowAzimuth operator+= (double deltaPhi)
 
eflowAzimuth operator-= (double deltaPhi)
 
double getAbsDifference (const eflowAzimuth &other) const
 
double cycle (const eflowAzimuth &other)
 
double cycle (double phi)
 

Private Member Functions

double adjustRange (double a)
 
void adjustRange ()
 

Private Attributes

double m_value
 

Detailed Description

eflowAzimuth represents phi and has kinematic functions which correctly deal with phi wraparound etc.

Definition at line 21 of file eflowUtil.h.

Constructor & Destructor Documentation

◆ eflowAzimuth() [1/2]

eflowAzimuth::eflowAzimuth ( double  phi)
inline

Definition at line 23 of file eflowUtil.h.

23 : m_value(phi) { if (phi != -999. && !std::isnan(phi)) adjustRange(); }

◆ eflowAzimuth() [2/2]

eflowAzimuth::eflowAzimuth ( const eflowAzimuth other)
inline

Definition at line 24 of file eflowUtil.h.

24 : m_value(other.m_value) { }

◆ ~eflowAzimuth()

eflowAzimuth::~eflowAzimuth ( )
inline

Definition at line 26 of file eflowUtil.h.

26 { }

Member Function Documentation

◆ adjustRange() [1/2]

void eflowAzimuth::adjustRange ( )
inlineprivate

Definition at line 75 of file eflowUtil.h.

75  {
76  if (m_value <= -M_PI) {
77  m_value+=(2*M_PI*std::floor(-(m_value-M_PI)/(2*M_PI)));
78  } else if (m_value > M_PI) {
79  m_value-=(2*M_PI*std::floor((m_value+M_PI)/(2*M_PI)));
80  }
81  }

◆ adjustRange() [2/2]

double eflowAzimuth::adjustRange ( double  a)
inlineprivate

Definition at line 66 of file eflowUtil.h.

66  {
67  if (a <= -M_PI) {
68  return a+(2*M_PI*std::floor(-(a-M_PI)/(2*M_PI)));
69  } else if (a > M_PI) {
70  return a-(2*M_PI*std::floor((a+M_PI)/(2*M_PI)));
71  } else {
72  return a;
73  }
74  }

◆ cycle() [1/2]

double eflowAzimuth::cycle ( const eflowAzimuth other)
inline

Definition at line 51 of file eflowUtil.h.

51 { return cycle(other.m_value); }

◆ cycle() [2/2]

double eflowAzimuth::cycle ( double  phi)
inline

Definition at line 52 of file eflowUtil.h.

52  {
53  double plainDifference = phi-m_value;
54  if (plainDifference > M_PI) {
55  return m_value+2.0*M_PI;
56  } else if (plainDifference < -M_PI) {
57  return m_value-2.0*M_PI;
58  } else {
59  return m_value;
60  }
61  }

◆ getAbsDifference()

double eflowAzimuth::getAbsDifference ( const eflowAzimuth other) const
inline

Definition at line 46 of file eflowUtil.h.

46  {
47  double plainAbsDifference = std::abs(m_value - other.m_value);
48  return plainAbsDifference <= M_PI ? plainAbsDifference : 2*M_PI - plainAbsDifference;
49  }

◆ operator()()

double eflowAzimuth::operator() ( ) const
inline

Definition at line 28 of file eflowUtil.h.

28 { return m_value; }

◆ operator+=()

eflowAzimuth eflowAzimuth::operator+= ( double  deltaPhi)
inline

Definition at line 35 of file eflowUtil.h.

35  {
36  m_value += deltaPhi;
37  adjustRange();
38  return *this;
39  }

◆ operator-=()

eflowAzimuth eflowAzimuth::operator-= ( double  deltaPhi)
inline

Definition at line 40 of file eflowUtil.h.

40  {
41  m_value -= deltaPhi;
42  adjustRange();
43  return *this;
44  }

◆ operator=() [1/2]

eflowAzimuth& eflowAzimuth::operator= ( const eflowAzimuth other)
inline

Definition at line 25 of file eflowUtil.h.

25 { if (this == &other) return *this; else { m_value = other.m_value; return *this; } }

◆ operator=() [2/2]

double eflowAzimuth::operator= ( double  phi)
inline

Definition at line 29 of file eflowUtil.h.

29  {
30  m_value = phi;
31  adjustRange();
32  return m_value;
33  }

Member Data Documentation

◆ m_value

double eflowAzimuth::m_value
private

Definition at line 64 of file eflowUtil.h.


The documentation for this class was generated from the following file:
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eflowAzimuth::m_value
double m_value
Definition: eflowUtil.h:64
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
M_PI
#define M_PI
Definition: ActiveFraction.h:11
eflowAzimuth::cycle
double cycle(const eflowAzimuth &other)
Definition: eflowUtil.h:51
eflowAzimuth::adjustRange
void adjustRange()
Definition: eflowUtil.h:75
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16