ATLAS Offline Software
proxim.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CALOGEOHELPER_PROXIM
6 #define CALOGEOHELPER_PROXIM
7 
8 // inline function for handling two phi angles, to avoid 2PI wrap around.
9 //
10 
11 #include <math.h>
12 #include <numbers>
14 
15 
16 
17 inline double proxim(double b,double a)
18 {
19  using std::numbers::pi;
20  const double aplus = a + pi;
21  const double aminus = a - pi;
22  if (ATH_UNLIKELY(b > aplus)) {
23  do {
24  b -= 2*pi;
25  } while(b > aplus);
26  }
27  else if (ATH_UNLIKELY(b < aminus)) {
28  do {
29  b += 2*pi;
30  } while(b < aminus);
31  }
32  return b;
33 }
34 
35 
36 #endif
proxim
double proxim(double b, double a)
Definition: proxim.h:17
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
pi
#define pi
Definition: TileMuonFitter.cxx:65
AthUnlikelyMacros.h
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10