BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
mdcWrapAng.h
Go to the documentation of this file.
1// mdcWrapAng.h
2/* Handle wrap-around problems in phi: phi1 is the reference angle, and phi2
3 is adjusted, if necessary, so that it is close to phi1. The assumption is
4 that phi1 and phi2 are in fact supposed to be close to one another. */
5
6#ifndef MDCWRAPANG_H
7#define MDCWRAPANG_H
8
9#include "MdcGeom/Constants.h"
10static const double &twpi = Constants::twoPi;
11
12inline double mdcWrapAng( double phi1, double phi2) {
13
14 double diff;
15
16 diff = phi2 - phi1;
17 if (diff > 0.5*twpi) phi2 -= twpi;
18 else if (diff < -0.5*twpi) phi2 += twpi;
19
20 return phi2;
21}
22#endif
static const double twoPi
Definition: Constants.h:39
double mdcWrapAng(double phi1, double phi2)
Definition: mdcWrapAng.h:12