ROOT
master
Reference Guide
Loading...
Searching...
No Matches
VectorUtil.cxx
Go to the documentation of this file.
1
// @(#)root/mathcore:$Id$
2
// Authors: W. Brown, M. Fischler, L. Moneta 2006
3
4
/**********************************************************************
5
* *
6
* Copyright (c) 2006 , LCG ROOT MathLib Team *
7
* *
8
* *
9
**********************************************************************/
10
11
// Implementation of VectorUtil functions
12
//
13
// Created by: Lorenzo Moneta 22 Aug 2006
14
//
15
#include "
MathX/GenVectorX/VectorUtil.h
"
16
17
#include "
MathX/GenVectorX/AccHeaders.h
"
18
19
#include "
MathX/GenVectorX/MathHeaders.h
"
20
21
namespace
ROOT
{
22
23
namespace
ROOT_MATH_ARCH
{
24
25
double
VectorUtil::Phi_0_2pi
(
double
angle
)
26
{
27
// returns phi angle in the interval (0,2*PI]
28
if
(
angle <= 2. * M_PI && angle >
0)
29
return
angle
;
30
31
if
(
angle
> 0) {
32
int
n
=
static_cast<
int
>
(
angle
/ (2. *
M_PI
));
33
angle
-= 2. *
M_PI
*
n
;
34
}
else
{
35
int
n
=
static_cast<
int
>
(-(
angle
) / (2. *
M_PI
));
36
angle
+= 2. *
M_PI
* (
n
+ 1);
37
}
38
return
angle
;
39
}
40
41
double
VectorUtil::Phi_mpi_pi
(
double
angle
)
42
{
43
// returns phi angle in the interval (-PI,PI]
44
45
if
(
angle <= M_PI && angle >
-
M_PI
)
46
return
angle
;
47
48
if
(
angle
> 0) {
49
int
n
=
static_cast<
int
>
((
angle
+
M_PI
) / (2. *
M_PI
));
50
angle
-= 2 *
M_PI
*
n
;
51
}
else
{
52
int
n
=
static_cast<
int
>
(-(
angle
-
M_PI
) / (2. *
M_PI
));
53
angle
+= 2 *
M_PI
*
n
;
54
}
55
return
angle
;
56
}
57
58
}
// namespace ROOT_MATH_ARCH
59
}
// namespace ROOT
AccHeaders.h
MathHeaders.h
M_PI
#define M_PI
Definition
Rotated.cxx:105
angle
Option_t Option_t TPoint TPoint angle
Definition
TGWin32VirtualXProxy.cxx:68
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
VectorUtil.h
ROOT::ROOT_MATH_ARCH::VectorUtil::Phi_mpi_pi
double Phi_mpi_pi(double phi)
Returns phi angle in the interval (-PI,PI].
Definition
VectorUtil.cxx:41
ROOT::ROOT_MATH_ARCH::VectorUtil::Phi_0_2pi
double Phi_0_2pi(double phi)
Return a phi angle in the interval (0,2*PI].
Definition
VectorUtil.cxx:25
n
const Int_t n
Definition
legend1.C:16
ROOT_MATH_ARCH
Definition
Cartesian3Dfwd.h:9
ROOT
Definition
EExecutionPolicy.hxx:4
math
experimental
genvectorx
src
VectorUtil.cxx
ROOT master - Reference Guide Generated on Thu Sep 18 2025 04:29:16 (GVA Time) using Doxygen 1.10.0