CMS 3D CMS Logo

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 OnePiRange &a)
 
OnePiRangeoperator+= (const T &a)
 
OnePiRangeoperator-= (const OnePiRange &a)
 
OnePiRangeoperator-= (const T &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

◆ OnePiRange() [1/2]

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 {}

◆ OnePiRange() [2/2]

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.

27 : theValue(val) { normalize(); }

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

Member Function Documentation

◆ degrees()

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

Definition at line 49 of file OnePiRange.h.

49 { return theValue*180./pi();}

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

◆ eta()

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

Return the pseudorapidity.

Definition at line 53 of file OnePiRange.h.

53 { return -log(tan(theValue/2.)); }

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

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

◆ normalize()

template<class T>
void Geom::OnePiRange< T >::normalize ( )
inlineprivate

◆ operator OnePiRange< T1 >()

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

Template argument conversion.

Definition at line 33 of file OnePiRange.h.

33 { return OnePiRange<T1>(theValue);}

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

◆ operator T()

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

conversion operator makes transparent use possible.

Definition at line 30 of file OnePiRange.h.

30 { return theValue;}

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

◆ operator*=()

template<class T>
OnePiRange& Geom::OnePiRange< T >::operator*= ( const T a)
inline

Definition at line 45 of file OnePiRange.h.

45 {theValue*=a; normalize(); return *this;}

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

◆ operator+=() [1/2]

template<class T>
OnePiRange& Geom::OnePiRange< T >::operator+= ( const OnePiRange< T > &  a)
inline

Definition at line 40 of file OnePiRange.h.

40 {return operator+=(a.value());}

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

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

◆ operator+=() [2/2]

template<class T>
OnePiRange& Geom::OnePiRange< T >::operator+= ( const T a)
inline

Definition at line 39 of file OnePiRange.h.

39 {theValue+=a; normalize(); return *this;}

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

◆ operator-=() [1/2]

template<class T>
OnePiRange& Geom::OnePiRange< T >::operator-= ( const OnePiRange< T > &  a)
inline

Definition at line 43 of file OnePiRange.h.

43 {return operator-=(a.value());}

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

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

◆ operator-=() [2/2]

template<class T>
OnePiRange& Geom::OnePiRange< T >::operator-= ( const T a)
inline

Definition at line 42 of file OnePiRange.h.

42 {theValue-=a; normalize(); return *this;}

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

◆ operator/=()

template<class T>
OnePiRange& Geom::OnePiRange< T >::operator/= ( const T a)
inline

Definition at line 47 of file OnePiRange.h.

47 {theValue/=a; normalize(); return *this;}

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

◆ value()

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

Member Data Documentation

◆ theValue

template<class T>
T Geom::OnePiRange< T >::theValue
private
Geom::OnePiRange::operator+=
OnePiRange & operator+=(const T &a)
Definition: OnePiRange.h:39
Geom::OnePiRange::theValue
T theValue
Definition: OnePiRange.h:58
Geom::pi
constexpr double pi()
Definition: Pi.h:31
Geom::OnePiRange::normalize
void normalize()
Definition: OnePiRange.h:60
Geom::OnePiRange::operator-=
OnePiRange & operator-=(const T &a)
Definition: OnePiRange.h:42
a
double a
Definition: hdecay.h:119
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
heppy_batch.val
val
Definition: heppy_batch.py:351
T
long double T
Definition: Basic3DVectorLD.h:48
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17