CMS 3D CMS Logo

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

#include <OnePiRange.h>

Public Member Functions

T degrees () const
 
T eta () const
 Return the pseudorapidity. More...
 
 OnePiRange ()
 Default constructor does not initialise - just as double. More...
 
 OnePiRange (const T &val)
 Constructor from T, does not provide automatic conversion. More...
 
template<class T1 >
 operator OnePiRange< T1 > ()
 Template argument conversion. More...
 
 operator T () const
 conversion operator makes transparent use possible. More...
 
OnePiRangeoperator*= (const T &a)
 
OnePiRangeoperator+= (const T &a)
 
OnePiRangeoperator+= (const OnePiRange &a)
 
OnePiRangeoperator-= (const T &a)
 
OnePiRangeoperator-= (const OnePiRange &a)
 
OnePiRangeoperator/= (const T &a)
 
T value () const
 Explicit access to value in case implicit conversion not OK. More...
 

Private Member Functions

void normalize ()
 

Private Attributes

T theValue
 

Detailed Description

template<class T>
class Geom::OnePiRange< T >

A class for polar angle represantation. The use of OnePiRange<T> is tranparant due to the implicit conversion to T Constructs like cos(theta) work as with float or double. The difference with respect to built-in types is that OnePiRange is kept in the range [0, pi], and this is consistently implemented in aritmetic operations. In other words, OnePiRange implements "modulo(pi)" arithmetics.

Definition at line 20 of file OnePiRange.h.

Constructor & Destructor Documentation

template<class T>
Geom::OnePiRange< T >::OnePiRange ( )
inline

Default constructor does not initialise - just as double.

Definition at line 24 of file OnePiRange.h.

24 {}
template<class T>
Geom::OnePiRange< T >::OnePiRange ( const T val)
inlineexplicit

Constructor from T, does not provide automatic conversion.

Definition at line 27 of file OnePiRange.h.

References Geom::OnePiRange< T >::normalize().

27 : theValue(val) { normalize(); }
void normalize()
Definition: OnePiRange.h:60

Member Function Documentation

template<class T>
T Geom::OnePiRange< T >::degrees ( ) const
inline

Definition at line 49 of file OnePiRange.h.

References Geom::pi(), and Geom::OnePiRange< T >::theValue.

49 { return theValue*180./pi();}
double pi()
Definition: Pi.h:31
template<class T>
T Geom::OnePiRange< T >::eta ( ) const
inline

Return the pseudorapidity.

Definition at line 53 of file OnePiRange.h.

References create_public_lumi_plots::log, funct::tan(), and Geom::OnePiRange< T >::theValue.

Referenced by Particle.Particle::__str__(), Muon.Muon::absEffAreaIso(), Jet.Jet::jetID(), and Jet.Jet::puJetId().

53 { return -log(tan(theValue/2.)); }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
template<class T>
void Geom::OnePiRange< T >::normalize ( )
inlineprivate

Definition at line 60 of file OnePiRange.h.

References Geom::pi(), and Geom::OnePiRange< T >::theValue.

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

60  {
61  if( theValue > (T) pi() || theValue < 0) {
62  theValue = fmod( theValue, (T) pi());
63  }
64  if (theValue < 0.) theValue += pi();
65  }
double pi()
Definition: Pi.h:31
long double T
template<class T>
template<class T1 >
Geom::OnePiRange< T >::operator OnePiRange< T1 > ( )
inline

Template argument conversion.

Definition at line 33 of file OnePiRange.h.

References Geom::OnePiRange< T >::theValue.

33 { return OnePiRange<T1>(theValue);}
template<class T>
Geom::OnePiRange< T >::operator T ( ) const
inline

conversion operator makes transparent use possible.

Definition at line 30 of file OnePiRange.h.

References Geom::OnePiRange< T >::theValue.

30 { return theValue;}
template<class T>
OnePiRange& Geom::OnePiRange< T >::operator*= ( const T a)
inline

Definition at line 45 of file OnePiRange.h.

References a, Geom::OnePiRange< T >::normalize(), and Geom::OnePiRange< T >::theValue.

45 {theValue*=a; normalize(); return *this;}
double a
Definition: hdecay.h:121
void normalize()
Definition: OnePiRange.h:60
template<class T>
OnePiRange& Geom::OnePiRange< T >::operator+= ( const T a)
inline

Definition at line 39 of file OnePiRange.h.

References a, Geom::OnePiRange< T >::normalize(), and Geom::OnePiRange< T >::theValue.

39 {theValue+=a; normalize(); return *this;}
double a
Definition: hdecay.h:121
void normalize()
Definition: OnePiRange.h:60
template<class T>
OnePiRange& Geom::OnePiRange< T >::operator+= ( const OnePiRange< T > &  a)
inline

Definition at line 40 of file OnePiRange.h.

References Geom::OnePiRange< T >::operator+=(), and Geom::OnePiRange< T >::value().

Referenced by Geom::OnePiRange< T >::operator+=().

40 {return operator+=(a.value());}
OnePiRange & operator+=(const T &a)
Definition: OnePiRange.h:39
double a
Definition: hdecay.h:121
template<class T>
OnePiRange& Geom::OnePiRange< T >::operator-= ( const T a)
inline

Definition at line 42 of file OnePiRange.h.

References a, Geom::OnePiRange< T >::normalize(), and Geom::OnePiRange< T >::theValue.

42 {theValue-=a; normalize(); return *this;}
double a
Definition: hdecay.h:121
void normalize()
Definition: OnePiRange.h:60
template<class T>
OnePiRange& Geom::OnePiRange< T >::operator-= ( const OnePiRange< T > &  a)
inline

Definition at line 43 of file OnePiRange.h.

References Geom::OnePiRange< T >::operator-=(), and Geom::OnePiRange< T >::value().

Referenced by Geom::OnePiRange< T >::operator-=().

43 {return operator-=(a.value());}
double a
Definition: hdecay.h:121
OnePiRange & operator-=(const T &a)
Definition: OnePiRange.h:42
template<class T>
OnePiRange& Geom::OnePiRange< T >::operator/= ( const T a)
inline

Definition at line 47 of file OnePiRange.h.

References a, Geom::OnePiRange< T >::normalize(), and Geom::OnePiRange< T >::theValue.

47 {theValue/=a; normalize(); return *this;}
double a
Definition: hdecay.h:121
void normalize()
Definition: OnePiRange.h:60
template<class T>
T Geom::OnePiRange< T >::value ( ) const
inline

Member Data Documentation

template<class T>
T Geom::OnePiRange< T >::theValue
private