ATLAS Offline Software
Loading...
Searching...
No Matches
proxim.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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>
13
14
15
16inline double proxim(double b,double a)
17{
18 using std::numbers::pi;
19 const double aplus = a + pi;
20 const double aminus = a - pi;
21 if (b > aplus) [[unlikely]] {
22 do {
23 b -= 2*pi;
24 } while(b > aplus);
25 }
26 else if (b < aminus) [[unlikely]] {
27 do {
28 b += 2*pi;
29 } while(b < aminus);
30 }
31 return b;
32}
33
34
35#endif
static Double_t a
#define pi
double proxim(double b, double a)
Definition proxim.h:16
#define unlikely(x)