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 "
Math/GenVector/VectorUtil.h
"
16
#include "
TMath.h
"
17
18
namespace
ROOT
{
19
20
namespace
Math
{
21
22
23
double
VectorUtil::Phi_0_2pi
(
double
angle
) {
24
// returns phi angle in the interval (0,2*PI]
25
if
(
angle
<= 2. *
TMath::Pi
() &&
angle
> 0)
26
return
angle
;
27
28
if
(
angle
> 0 ) {
29
int
n
=
static_cast<
int
>
(
angle
/ (2. *
TMath::Pi
()));
30
angle
-= 2. *
TMath::Pi
() *
n
;
31
}
else
{
32
int
n
=
static_cast<
int
>
(-(
angle
) / (2. *
TMath::Pi
()));
33
angle
+= 2. *
TMath::Pi
() * (
n
+ 1);
34
}
35
return
angle
;
36
}
37
38
double
VectorUtil::Phi_mpi_pi
(
double
angle
) {
39
// returns phi angle in the interval (-PI,PI]
40
41
if
(
angle
<=
TMath::Pi
() &&
angle
> -
TMath::Pi
())
42
return
angle
;
43
44
if
(
angle
> 0 ) {
45
int
n
=
static_cast<
int
>
((
angle
+
TMath::Pi
()) / (2. *
TMath::Pi
()));
46
angle
-= 2 *
TMath::Pi
() *
n
;
47
}
else
{
48
int
n
=
static_cast<
int
>
(-(
angle
-
TMath::Pi
()) / (2. *
TMath::Pi
()));
49
angle
+= 2 *
TMath::Pi
() *
n
;
50
}
51
return
angle
;
52
}
53
54
55
56
}
//namespace Math
57
}
//namespace ROOT
angle
Option_t Option_t TPoint TPoint angle
Definition
TGWin32VirtualXProxy.cxx:68
TMath.h
VectorUtil.h
ROOT::Math::VectorUtil::Phi_0_2pi
double Phi_0_2pi(double phi)
Return a phi angle in the interval (0,2*PI].
Definition
VectorUtil.cxx:23
ROOT::Math::VectorUtil::Phi_mpi_pi
double Phi_mpi_pi(double phi)
Returns phi angle in the interval (-PI,PI].
Definition
VectorUtil.cxx:38
n
const Int_t n
Definition
legend1.C:16
Math
Namespace for new Math classes and functions.
ROOT
Definition
EExecutionPolicy.hxx:4
TMath::Pi
constexpr Double_t Pi()
Definition
TMath.h:40
math
genvector
src
VectorUtil.cxx
ROOT master - Reference Guide Generated on Thu Sep 18 2025 15:09:16 (GVA Time) using Doxygen 1.10.0