BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
BesAngle Class Reference

#include <BesAngle.h>

Public Member Functions

 BesAngle ()
 
 BesAngle (const double)
 
 ~BesAngle ()
 
 operator double () const
 
double rad () const
 
double deg () const
 
double posRad () const
 
double posDeg () const
 
void setRad (const double)
 
void setDeg (const double)
 
double arc (double radius) const
 
void setSector (int n, int max)
 
void setSector (int n, int max, BesAngle phi_0)
 
BesAngle operator+ (const BesAngle &) const
 
BesAngle operator+ (const double) const
 
BesAngle operator- (const BesAngle &) const
 
BesAngle operator- (const double) const
 
BesAngle operator* (const double) const
 
BesAngle operator/ (const double) const
 
void operator= (const BesAngle)
 
void operator+= (BesAngle)
 
void operator-= (BesAngle)
 
void operator+= (double)
 
void operator-= (double)
 
void operator*= (double)
 
void operator/= (double)
 
int sector (int max)
 
int sector (int max, BesAngle phi_0)
 
double Rad () const
 
double Deg () const
 
int Sector (int max)
 
int Sector (int max, BesAngle phi_0)
 

Static Public Attributes

static const double pi = Constants::pi
 used instead.
 
static const double twoPi = Constants::twoPi
 

Static Protected Member Functions

static double normalize (double)
 

Protected Attributes

double _phi
 

Static Protected Attributes

static const double toDegrees = Constants::radToDegrees
 

Friends

BesAngle operator* (const double, const BesAngle &)
 
double sin (const BesAngle)
 
double cos (const BesAngle)
 
double tan (const BesAngle)
 

Detailed Description

Definition at line 17 of file BesAngle.h.

Constructor & Destructor Documentation

◆ BesAngle() [1/2]

BesAngle::BesAngle ( )
inline

Definition at line 110 of file BesAngle.h.

110 : _phi(0)
111{ }
double _phi
Definition: BesAngle.h:85

Referenced by operator*(), operator+(), operator-(), and operator/().

◆ BesAngle() [2/2]

BesAngle::BesAngle ( const double  phi)
inline

Definition at line 113 of file BesAngle.h.

113 : _phi(normalize(phi))
114{}
static double normalize(double)
Definition: BesAngle.h:98

◆ ~BesAngle()

BesAngle::~BesAngle ( )
inline

Definition at line 116 of file BesAngle.h.

116{}

Member Function Documentation

◆ arc()

double BesAngle::arc ( double  radius) const
inline

Definition at line 139 of file BesAngle.h.

140{ return radius * rad(); }
double rad() const
Definition: BesAngle.h:118

◆ deg()

double BesAngle::deg ( ) const
inline

Definition at line 121 of file BesAngle.h.

122{ return _phi * Constants::radToDegrees; }
static const double radToDegrees
Definition: Constants.h:41

Referenced by Deg(), and MdcTrackList::pickHits().

◆ Deg()

double BesAngle::Deg ( ) const
inline

Definition at line 79 of file BesAngle.h.

79{ return deg(); }
double deg() const
Definition: BesAngle.h:121

◆ normalize()

double BesAngle::normalize ( double  angle)
inlinestaticprotected

Definition at line 98 of file BesAngle.h.

98 {
99 if (angle < - Constants::pi) {
100 angle += Constants::twoPi;
101 if (angle < - Constants::pi) angle = fmod(angle+ Constants::pi, Constants::twoPi) + Constants::pi;
102 }
103 else if (angle > Constants::pi) {
104 angle -= Constants::twoPi;
105 if (angle > Constants::pi) angle = fmod(angle+Constants::pi, Constants::twoPi) - Constants::pi;
106 }
107 return angle;
108}
static const double pi
Definition: Constants.h:38
static const double twoPi
Definition: Constants.h:39

Referenced by operator*=(), operator+=(), operator-=(), operator/=(), operator=(), and setRad().

◆ operator double()

BesAngle::operator double ( ) const
inline

Definition at line 24 of file BesAngle.h.

24{ return _phi;}; // automatic conversion to double

◆ operator*()

BesAngle BesAngle::operator* ( const double  x) const
inline

Definition at line 160 of file BesAngle.h.

161{ return BesAngle(_phi * x); }
BesAngle()
Definition: BesAngle.h:110

◆ operator*=()

void BesAngle::operator*= ( double  x)
inline

Definition at line 189 of file BesAngle.h.

190{ _phi = normalize(_phi*x);
191}

◆ operator+() [1/2]

BesAngle BesAngle::operator+ ( const BesAngle a) const
inline

Definition at line 148 of file BesAngle.h.

149{ return BesAngle(_phi + a._phi); }

◆ operator+() [2/2]

BesAngle BesAngle::operator+ ( const double  a) const
inline

Definition at line 151 of file BesAngle.h.

152{ return BesAngle(_phi + a); }

◆ operator+=() [1/2]

void BesAngle::operator+= ( BesAngle  a)
inline

Definition at line 173 of file BesAngle.h.

174{ _phi = normalize(_phi + a._phi );
175}

◆ operator+=() [2/2]

void BesAngle::operator+= ( double  a)
inline

Definition at line 177 of file BesAngle.h.

178{ _phi = normalize(_phi + a);
179}

◆ operator-() [1/2]

BesAngle BesAngle::operator- ( const BesAngle a) const
inline

Definition at line 154 of file BesAngle.h.

155{ return BesAngle(_phi - a._phi); }

◆ operator-() [2/2]

BesAngle BesAngle::operator- ( const double  a) const
inline

Definition at line 157 of file BesAngle.h.

158{ return BesAngle(_phi - a); }

◆ operator-=() [1/2]

void BesAngle::operator-= ( BesAngle  a)
inline

Definition at line 181 of file BesAngle.h.

182{ _phi = normalize(_phi - a._phi );
183}

◆ operator-=() [2/2]

void BesAngle::operator-= ( double  a)
inline

Definition at line 185 of file BesAngle.h.

186{ _phi = normalize(_phi - a);
187}

◆ operator/()

BesAngle BesAngle::operator/ ( const double  x) const
inline

Definition at line 163 of file BesAngle.h.

164{ return BesAngle(_phi / x); }

◆ operator/=()

void BesAngle::operator/= ( double  x)
inline

Definition at line 193 of file BesAngle.h.

194{ _phi = normalize(_phi/x);
195}

◆ operator=()

void BesAngle::operator= ( const BesAngle  a)
inline

Definition at line 169 of file BesAngle.h.

170{ _phi = normalize(a._phi);
171}

◆ posDeg()

double BesAngle::posDeg ( ) const
inline

Definition at line 130 of file BesAngle.h.

131{ return posRad() * Constants::radToDegrees; }
double posRad() const
Definition: BesAngle.h:124

◆ posRad()

double BesAngle::posRad ( ) const
inline

Definition at line 124 of file BesAngle.h.

125{
126 if (_phi >= 0.0) return _phi;
127 else return _phi + Constants::twoPi;
128}

Referenced by MdcTrackList::pickHits(), and posDeg().

◆ rad()

◆ Rad()

double BesAngle::Rad ( ) const
inline

Definition at line 78 of file BesAngle.h.

78{ return rad(); }

Referenced by MdcSegGrouperCsmc::storePar().

◆ sector() [1/2]

int BesAngle::sector ( int  max)
inline

Definition at line 197 of file BesAngle.h.

198{
199 double phi = _phi;
200 if (phi < 0) phi += Constants::twoPi;
201 return ( int (phi / (Constants::twoPi / max) ) + 1 );
202}

Referenced by Sector().

◆ Sector() [1/2]

int BesAngle::Sector ( int  max)
inline

Definition at line 81 of file BesAngle.h.

81{ return sector(max); }
int sector(int max)
Definition: BesAngle.h:197

◆ sector() [2/2]

int BesAngle::sector ( int  max,
BesAngle  phi_0 
)
inline

Definition at line 204 of file BesAngle.h.

205{
206 BesAngle t( _phi - phi_0._phi);
207 return t.sector(max);
208}
TTree * t
Definition: binning.cxx:23

◆ Sector() [2/2]

int BesAngle::Sector ( int  max,
BesAngle  phi_0 
)
inline

Definition at line 82 of file BesAngle.h.

82{ return sector(max, phi_0); }

◆ setDeg()

void BesAngle::setDeg ( const double  phi)
inline

Definition at line 136 of file BesAngle.h.

void setRad(const double)
Definition: BesAngle.h:133

◆ setRad()

void BesAngle::setRad ( const double  phi)
inline

Definition at line 133 of file BesAngle.h.

134{ _phi = normalize(phi); }

Referenced by MdcSegGrouperSt::fillWithSegs(), MdcTrack::projectToR(), setDeg(), and setSector().

◆ setSector() [1/2]

void BesAngle::setSector ( int  n,
int  max 
)
inline

Definition at line 142 of file BesAngle.h.

143{ setRad((n + 0.5) * Constants::twoPi / max); }

◆ setSector() [2/2]

void BesAngle::setSector ( int  n,
int  max,
BesAngle  phi_0 
)
inline

Definition at line 145 of file BesAngle.h.

146{ setRad((n + 0.5) * Constants::twoPi / max + phi_0._phi); }

Friends And Related Function Documentation

◆ cos

double cos ( const BesAngle  a)
friend

Definition at line 213 of file BesAngle.h.

214{ return cos(a._phi); }
friend double cos(const BesAngle)
Definition: BesAngle.h:213

◆ operator*

BesAngle operator* ( const double  x,
const BesAngle a 
)
friend

Definition at line 166 of file BesAngle.h.

167{ return BesAngle(a * x); }

◆ sin

double sin ( const BesAngle  a)
friend

Definition at line 210 of file BesAngle.h.

211{ return sin(a._phi); }
friend double sin(const BesAngle)
Definition: BesAngle.h:210

◆ tan

double tan ( const BesAngle  a)
friend

Definition at line 216 of file BesAngle.h.

217{ return tan(a._phi); }
friend double tan(const BesAngle)
Definition: BesAngle.h:216

Member Data Documentation

◆ _phi

◆ pi

const double BesAngle::pi = Constants::pi
static

used instead.

Definition at line 74 of file BesAngle.h.

◆ toDegrees

const double BesAngle::toDegrees = Constants::radToDegrees
staticprotected

Definition at line 89 of file BesAngle.h.

◆ twoPi

const double BesAngle::twoPi = Constants::twoPi
static

Definition at line 75 of file BesAngle.h.


The documentation for this class was generated from the following files: