/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcGeom/MdcGeom-00-01-17/MdcGeom/EntranceAngle.h

Go to the documentation of this file.
00001 #ifndef ENTRANCEANGLE_H
00002 #define ENTRANCEANGLE_H
00004 //
00005 // BESIII MDC entrance angles are in radians, and degress should inly be used
00006 // when absolutely necessary. Automatic conversions to and from
00007 // the radians form are provided, but you have to manually
00008 // go to and from degrees
00009 //
00010 // By convention, angles are represented as [-pi/2, pi/2]
00011 //
00012 #include "MdcGeom/Constants.h"
00013 #include <math.h>
00014 
00015 
00016 class EntranceAngle
00017 {
00018 public:
00019   inline EntranceAngle();
00020   inline EntranceAngle(const double);
00021   inline ~EntranceAngle();
00022 
00023   inline operator double() const  { return _phi;};   // automatic conversion to double
00024 
00025   inline double rad() const;  
00026   inline double deg() const;  
00027   // convention : returns value in [-90, 90]
00028 
00029 protected:
00030   double _phi;
00031 
00032   inline static double normalize(double);
00033 
00034 };
00035 
00036 //
00037 // Methods for EntranceAngle
00038 //
00039 
00040 inline double EntranceAngle::normalize(double angle) {
00041   while (angle < - Constants::halfPi) {
00042     angle += Constants::pi;
00043   }
00044   while (angle > Constants::halfPi) {
00045     angle -= Constants::pi;
00046   }
00047   return angle;
00048 }
00049 
00050 inline EntranceAngle::EntranceAngle() : _phi(0)
00051 { }
00052 
00053 inline EntranceAngle::EntranceAngle(const double phi) : _phi(normalize(phi))
00054 {}
00055 
00056 inline EntranceAngle::~EntranceAngle() {}
00057 
00058 inline double EntranceAngle::rad() const
00059 { return _phi; }
00060 
00061 inline double EntranceAngle::deg() const
00062 { return _phi *  Constants::radToDegrees; }
00063 
00064 #endif

Generated on Tue Nov 29 23:13:30 2016 for BOSS_7.0.2 by  doxygen 1.4.7