4#ifndef ROOT_Math_Functions
5#define ROOT_Math_Functions
60template <
class T,
unsigned int D>
class SVector;
86 return (lhs > rhs) ? lhs : rhs;
100 return (lhs < rhs) ? lhs : rhs;
113 return (
x-
static_cast<int>(
x) < 0.5) ?
static_cast<int>(
x) :
static_cast<int>(
x+1);
127inline int Sign(
const T&
x) {
return (
x==0)? 0 : (
x<0)? -1 : 1; }
132template <
unsigned int I>
134 template <
class A,
class B,
class T>
135 static inline T f(
const A& lhs,
const B& rhs,
const T&
x) {
146 template <
class A,
class B,
class T>
147 static inline T f(
const A& lhs,
const B& rhs,
const T& ) {
148 return lhs.apply(0) * rhs.apply(0);
163template <
class T,
unsigned int D>
171template <
class A,
class T,
unsigned int D>
179template <
class A,
class T,
unsigned int D>
188template <
class A,
class B,
class T,
unsigned int D>
197template <
unsigned int I>
199 template <
class A,
class T>
200 static inline T f(
const A& rhs,
const T&
x) {
211 template <
class A,
class T>
212 static inline T f(
const A& rhs,
const T& ) {
213 return Square(rhs.apply(0));
228template <
class T,
unsigned int D>
236template <
class A,
class T,
unsigned int D>
251template <
class T,
unsigned int D>
259template <
class A,
class T,
unsigned int D>
282template <
class A,
class T>
306template <
class A,
class T>
334template <
class A,
class T>
347template <
class T,
class A>
360template <
class A,
class B,
class T>
380template <
class T,
unsigned int D>
388template <
class A,
class T,
unsigned int D>
397template <
class T,
unsigned int D>
398inline VecExpr<BinaryOp<DivOp<T>, SVector<T,D>, Constant<T>,
T>,
T, D>
399 unit(
const SVector<T,D>& lhs) {
400 typedef BinaryOp<DivOp<T>, SVector<T,D>, Constant<T>,
T> DivOpBinOp;
401 return VecExpr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,Constant<T>(mag(lhs))));
407template <
class A,
class T,
unsigned int D>
408inline VecExpr<BinaryOp<DivOp<T>, VecExpr<A,T,D>, Constant<T>,
T>,
T, D>
409 unit(
const VecExpr<A,T,D>& lhs) {
410 typedef BinaryOp<DivOp<T>, VecExpr<A,T,D>, Constant<T>,
T> DivOpBinOp;
411 return VecExpr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,Constant<T>(mag(lhs))));
SVector: a generic fixed size Vector class.
SVector< T, D > & Unit()
transform vector into a vector of length 1
T apply(unsigned int i) const
access the parse tree. Index starts from zero
Expression wrapper class for Vector objects.
T apply(unsigned int i) const
const T Square(const T &x)
square Template function to compute , for any type T returning a type T
const T Minimum(const T &lhs, const T &rhs)
minimum.
int Sign(const T &x)
sign.
int Round(const T &x)
round.
const T Maximum(const T &lhs, const T &rhs)
maximum.
SVector< T, D > Unit(const SVector< T, D > &rhs)
Unit.
SVector< T, 3 > Cross(const SVector< T, 3 > &lhs, const SVector< T, 3 > &rhs)
Vector Cross Product (only for 3-dim vectors) .
T Lmag2(const SVector< T, 4 > &rhs)
Lmag2: Square of Minkowski Lorentz-Vector norm (only for 4D Vectors) Template to compute .
T Mag2(const SVector< T, D > &rhs)
Vector magnitude square Template to compute .
T Dot(const SVector< T, D > &lhs, const SVector< T, D > &rhs)
Vector dot product.
T Mag(const SVector< T, D > &rhs)
Vector magnitude (Euclidian norm) Compute : .
T Lmag(const SVector< T, 4 > &rhs)
Lmag: Minkowski Lorentz-Vector norm (only for 4-dim vectors) Length of a vector Lorentz-Vector: .
Namespace for new Math classes and functions.
Namespace for new ROOT classes and functions.