BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EntranceAngle.h
Go to the documentation of this file.
1#ifndef ENTRANCEANGLE_H
2#define ENTRANCEANGLE_H
3////////////////////////////////
4//
5// BESIII MDC entrance angles are in radians, and degress should inly be used
6// when absolutely necessary. Automatic conversions to and from
7// the radians form are provided, but you have to manually
8// go to and from degrees
9//
10// By convention, angles are represented as [-pi/2, pi/2]
11//
12#include "MdcGeom/Constants.h"
13#include <math.h>
14
15
17{
18public:
19 inline EntranceAngle();
20 inline EntranceAngle(const double);
21 inline ~EntranceAngle();
22
23 inline operator double() const { return _phi;}; // automatic conversion to double
24
25 inline double rad() const;
26 inline double deg() const;
27 // convention : returns value in [-90, 90]
28
29protected:
30 double _phi;
31
32 inline static double normalize(double);
33
34};
35
36//
37// Methods for EntranceAngle
38//
39
40inline double EntranceAngle::normalize(double angle) {
41 while (angle < - Constants::halfPi) {
42 angle += Constants::pi;
43 }
44 while (angle > Constants::halfPi) {
45 angle -= Constants::pi;
46 }
47 return angle;
48}
49
51{ }
52
53inline EntranceAngle::EntranceAngle(const double phi) : _phi(normalize(phi))
54{}
55
57
58inline double EntranceAngle::rad() const
59{ return _phi; }
60
61inline double EntranceAngle::deg() const
62{ return _phi * Constants::radToDegrees; }
63
64#endif
static const double pi
Definition Constants.h:38
static const double halfPi
Definition Constants.h:40
static const double radToDegrees
Definition Constants.h:41
double rad() const
static double normalize(double)
double deg() const