CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Geom::Phi< T1, Range > Class Template Reference

#include <Phi.h>

Public Member Functions

T1 degrees () const
 
bool nearEqual (const Phi< T1, Range > &angle, float tolerance=0.001) const
 
bool nearZero (float tolerance=1.0_deg) const
 
template<typename T2 , typename Range1 >
 operator Phi< T2, Range1 > ()
 Template argument conversion. More...
 
 operator T1 () const
 conversion operator makes transparent use possible. More...
 
Phioperator*= (const T1 &a)
 
Phioperator+= (const T1 &a)
 Standard arithmetics. More...
 
Phioperator+= (const Phi &a)
 
Phioperator-= (const T1 &a)
 
Phioperator-= (const Phi &a)
 
Phioperator/= (const T1 &a)
 
 Phi ()
 Default constructor does not initialise - just as double. More...
 
 Phi (const T1 &val)
 
T1 phi () const
 
T1 value () const
 Explicit access to value in case implicit conversion not OK. More...
 

Private Member Functions

void normalize (T1 &value)
 

Private Attributes

T1 theValue
 

Detailed Description

template<typename T1, typename Range = MinusPiToPi>
class Geom::Phi< T1, Range >

A class for azimuthal angle represantation and algebra. The use of Phi<T> is tranparant due to the implicit conversion to T Constructs like cos(phi) work as with float or double. The difference with respect to built-in types is that Phi is kept in the range (-pi, pi] by default, and this is consistently implemented in aritmetic operations. In other words, Phi implements "modulo(2 pi)" arithmetics. Phi can be instantiated to implement the range 0 to 2pi.

Definition at line 52 of file Phi.h.

Constructor & Destructor Documentation

template<typename T1, typename Range = MinusPiToPi>
Geom::Phi< T1, Range >::Phi ( )
inline

Default constructor does not initialise - just as double.

Definition at line 55 of file Phi.h.

55 {}
template<typename T1, typename Range = MinusPiToPi>
Geom::Phi< T1, Range >::Phi ( const T1 &  val)
inline

Definition at line 63 of file Phi.h.

void normalize(T1 &value)
Definition: Phi.h:122
T1 theValue
Definition: Phi.h:120

Member Function Documentation

template<typename T1, typename Range = MinusPiToPi>
T1 Geom::Phi< T1, Range >::degrees ( ) const
inline
template<typename T1, typename Range = MinusPiToPi>
bool Geom::Phi< T1, Range >::nearEqual ( const Phi< T1, Range > &  angle,
float  tolerance = 0.001 
) const
inline

Definition at line 115 of file Phi.h.

115  {
116  return (std::abs(theValue - angle) - tolerance <= 0.0);
117  }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T1 theValue
Definition: Phi.h:120
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
template<typename T1, typename Range = MinusPiToPi>
bool Geom::Phi< T1, Range >::nearZero ( float  tolerance = 1.0_deg) const
inline

Definition at line 111 of file Phi.h.

111 { return (std::abs(theValue) - tolerance <= 0.0); }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T1 theValue
Definition: Phi.h:120
template<typename T1, typename Range = MinusPiToPi>
void Geom::Phi< T1, Range >::normalize ( T1 &  value)
inlineprivate

Definition at line 122 of file Phi.h.

Referenced by Geom::Phi< float >::operator*=(), Geom::Phi< float >::operator+=(), Geom::Phi< float >::operator-=(), Geom::Phi< float >::operator/=(), and Geom::Phi< float >::Phi().

T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
float normalize(float in)
Definition: MLPFModel.cc:207
template<typename T1, typename Range = MinusPiToPi>
template<typename T2 , typename Range1 >
Geom::Phi< T1, Range >::operator Phi< T2, Range1 > ( )
inline

Template argument conversion.

Definition at line 70 of file Phi.h.

70  {
71  return Phi<T2, Range1>(theValue);
72  }
T1 theValue
Definition: Phi.h:120
template<typename T1, typename Range = MinusPiToPi>
Geom::Phi< T1, Range >::operator T1 ( ) const
inline

conversion operator makes transparent use possible.

Definition at line 66 of file Phi.h.

References Geom::Phi< T1, Range >::theValue.

66 { return theValue; }
T1 theValue
Definition: Phi.h:120
template<typename T1, typename Range = MinusPiToPi>
Phi& Geom::Phi< T1, Range >::operator*= ( const T1 &  a)
inline

Definition at line 95 of file Phi.h.

95  {
96  theValue *= a;
98  return *this;
99  }
void normalize(T1 &value)
Definition: Phi.h:122
T1 theValue
Definition: Phi.h:120
double a
Definition: hdecay.h:119
template<typename T1, typename Range = MinusPiToPi>
Phi& Geom::Phi< T1, Range >::operator+= ( const T1 &  a)
inline

Standard arithmetics.

Definition at line 81 of file Phi.h.

81  {
82  theValue += a;
84  return *this;
85  }
void normalize(T1 &value)
Definition: Phi.h:122
T1 theValue
Definition: Phi.h:120
double a
Definition: hdecay.h:119
template<typename T1, typename Range = MinusPiToPi>
Phi& Geom::Phi< T1, Range >::operator+= ( const Phi< T1, Range > &  a)
inline

Definition at line 86 of file Phi.h.

Referenced by Geom::Phi< float >::operator+=().

86 { return operator+=(a.value()); }
Phi & operator+=(const T1 &a)
Standard arithmetics.
Definition: Phi.h:81
double a
Definition: hdecay.h:119
template<typename T1, typename Range = MinusPiToPi>
Phi& Geom::Phi< T1, Range >::operator-= ( const T1 &  a)
inline

Definition at line 88 of file Phi.h.

88  {
89  theValue -= a;
91  return *this;
92  }
void normalize(T1 &value)
Definition: Phi.h:122
T1 theValue
Definition: Phi.h:120
double a
Definition: hdecay.h:119
template<typename T1, typename Range = MinusPiToPi>
Phi& Geom::Phi< T1, Range >::operator-= ( const Phi< T1, Range > &  a)
inline

Definition at line 93 of file Phi.h.

Referenced by Geom::Phi< float >::operator-=().

93 { return operator-=(a.value()); }
Phi & operator-=(const T1 &a)
Definition: Phi.h:88
double a
Definition: hdecay.h:119
template<typename T1, typename Range = MinusPiToPi>
Phi& Geom::Phi< T1, Range >::operator/= ( const T1 &  a)
inline

Definition at line 101 of file Phi.h.

101  {
102  theValue /= a;
104  return *this;
105  }
void normalize(T1 &value)
Definition: Phi.h:122
T1 theValue
Definition: Phi.h:120
double a
Definition: hdecay.h:119
template<typename T1, typename Range = MinusPiToPi>
T1 Geom::Phi< T1, Range >::phi ( ) const
inline
template<typename T1, typename Range = MinusPiToPi>
T1 Geom::Phi< T1, Range >::value ( ) const
inline

Explicit access to value in case implicit conversion not OK.

Definition at line 75 of file Phi.h.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), reco::WMuNuCandidate::acop(), EwkMuDQM::analyze(), HGCalHitValidation::analyze(), average.Average::average(), Basic3DVector< long double >::Basic3DVector(), Basic3DVector< align::Scalar >::Basic3DVector(), Types.string::configValue(), Types.FileInPath::configValue(), PrimitiveConversion::convert_csc(), PrimitiveConversion::convert_dt(), PrimitiveConversion::convert_gem(), PrimitiveConversion::convert_me0(), PrimitiveConversion::convert_rpc(), Mixins.UsingBlock::dumpPython(), L1TMuon::GeometryTranslator::getCSCSpecificPoint(), OmtfAngleConverter::getGlobalEta(), AngleConverter::getGlobalEta(), Mixins.UsingBlock::insertInto(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), Types.vstring::insertInto(), Geom::Phi< float >::operator+=(), Geom::operator-(), Geom::Phi< float >::operator-=(), Geom::operator/(), PhiBorderFinder::PhiBorderFinder(), RecHitProcessor::process(), and RecHitProcessor::processLook().

75 { return theValue; }
T1 theValue
Definition: Phi.h:120

Member Data Documentation

template<typename T1, typename Range = MinusPiToPi>
T1 Geom::Phi< T1, Range >::theValue
private