ATLAS Offline Software
Coordinate.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 /***************************************************************************
5  Coordinate.cxx - description
6  -------------------
7  begin : 26/02/2002
8  email : e.moyse@qmul.ac.uk
9 ***************************************************************************/
10 
11 #include <cmath>
12 
14 
15 namespace LVL1 {
16 
17  const double Coordinate::m_twoPi = M_PI * 2.0;
18 
19  Coordinate::Coordinate( double phi, double eta )
20  : m_phi( phi ), m_eta( eta ) {
21 
22  checkBounds();
23  }
24 
25  Coordinate::Coordinate()
26  : m_phi( 0.0 ), m_eta( 0.0 ) {
27 
28  }
29 
31  void Coordinate::setCoords( double phi, double eta ) {
32 
33  m_phi = phi; m_eta = eta;
34  checkBounds();
35  return;
36 
37  }
38 
40  double Coordinate::eta() const {
41  return m_eta;
42  }
43 
45  double Coordinate::phi() const {
46  return m_phi;
47  }
48 
53  if ( m_phi < 0 ) m_phi += m_twoPi;
54  if ( m_phi > m_twoPi ) m_phi -= m_twoPi;
55  return;
56  }
57 
58 } // namespace LVL1
59 
61 std::ostream& LVL1::operator<< ( std::ostream& theStream, const Coordinate& theCoord ) {
62  theStream << "(" << theCoord.phi() << ", " << theCoord.eta() << ")";
63  return theStream;
64 }
65 
67 MsgStream& LVL1::operator<< ( MsgStream& theStream, const Coordinate& theCoord ) {
68  theStream << "(" << theCoord.phi() << ", " << theCoord.eta() << ")";
69  return theStream;
70 }
test_pyathena.eta
eta
Definition: test_pyathena.py:10
LVL1::operator<<
std::ostream & operator<<(std::ostream &theStream, const Coordinate &theCoord)
overload << operator so coordinate can be easily displayed...
Definition: Coordinate.cxx:61
LVL1::Coordinate::phi
double phi() const
return phi
Definition: Coordinate.cxx:50
LVL1::Coordinate::m_twoPi
static const double m_twoPi
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:72
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
LVL1::Coordinate
Coordinate class declaration.
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:50
LVL1::Coordinate::checkBounds
void checkBounds()
Ensure coords are sensible this could be done more intelligently, but at least it's readable!
Definition: Coordinate.cxx:57
LVL1::Coordinate::m_eta
double m_eta
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:71
LVL1::Coordinate::Coordinate
Coordinate()
Definition: Coordinate.cxx:30
Coordinate.h
LVL1::Coordinate::m_phi
double m_phi
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:70
LVL1::Coordinate::eta
double eta() const
return eta
Definition: Coordinate.cxx:45
LVL1::Coordinate::setCoords
void setCoords(double phi, double eta)
change coords of an existing Coordinate object
Definition: Coordinate.cxx:36