BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcGeom/include/MdcGeom/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
15class EntranceAngle {
16public:
17 inline EntranceAngle();
18 inline EntranceAngle( const double );
20
21 inline operator double() const { return _phi; }; // automatic conversion to double
22
23 inline double rad() const;
24 inline double deg() const;
25 // convention : returns value in [-90, 90]
26
27protected:
28 double _phi;
29
30 inline static double normalize( double );
31};
32
33//
34// Methods for EntranceAngle
35//
36
37inline double EntranceAngle::normalize( double angle ) {
38 while ( angle < -Constants::halfPi ) { angle += Constants::pi; }
39 while ( angle > Constants::halfPi ) { angle -= Constants::pi; }
40 return angle;
41}
42
43inline EntranceAngle::EntranceAngle() : _phi( 0 ) {}
44
45inline EntranceAngle::EntranceAngle( const double phi ) : _phi( normalize( phi ) ) {}
46
48
49inline double EntranceAngle::rad() const { return _phi; }
50
51inline double EntranceAngle::deg() const { return _phi * Constants::radToDegrees; }
52
53#endif
EntranceAngle(const double)
double rad() const
static double normalize(double)
double deg() const