A "std::vector"-like collection of values implementing handy operation to analyse them.
Classes | |
class | ROOT::VecOps::RVec< T > |
A "std::vector"-like collection of values implementing handy operation to analyse them. More... | |
class | ROOT::VecOps::RVecN< T, N > |
Functions | |
template<typename T > | |
auto | ROOT::VecOps::All (const RVec< T > &v) -> decltype(v[0]==false) |
Return true if all of the elements equate to true, return false otherwise. | |
template<typename T > | |
auto | ROOT::VecOps::Any (const RVec< T > &v) -> decltype(v[0]==true) |
Return true if any of the elements equates to true, return false otherwise. | |
template<typename T > | |
std::size_t | ROOT::VecOps::ArgMax (const RVec< T > &v) |
Get the index of the greatest element of an RVec In case of multiple occurrences of the maximum values, the index corresponding to the first occurrence is returned. | |
template<typename T > | |
std::size_t | ROOT::VecOps::ArgMin (const RVec< T > &v) |
Get the index of the smallest element of an RVec In case of multiple occurrences of the minimum values, the index corresponding to the first occurrence is returned. | |
template<typename T > | |
RVec< typename RVec< T >::size_type > | ROOT::VecOps::Argsort (const RVec< T > &v) |
Return an RVec of indices that sort the input RVec. | |
template<typename T , typename Compare > | |
RVec< typename RVec< T >::size_type > | ROOT::VecOps::Argsort (const RVec< T > &v, Compare &&c) |
Return an RVec of indices that sort the input RVec based on a comparison function. | |
template<typename T , unsigned N> | |
size_t | ROOT::VecOps::CapacityInBytes (const RVecN< T, N > &X) |
template<typename T > | |
RVec< RVec< typename RVec< T >::size_type > > | ROOT::VecOps::Combinations (const RVec< T > &v, const typename RVec< T >::size_type n) |
Return the indices that represent all unique combinations of the elements of a given RVec. | |
template<typename T1 , typename T2 > | |
RVec< RVec< typename RVec< T1 >::size_type > > | ROOT::VecOps::Combinations (const RVec< T1 > &v1, const RVec< T2 > &v2) |
Return the indices that represent all combinations of the elements of two RVecs. | |
RVec< RVec< std::size_t > > | ROOT::VecOps::Combinations (const std::size_t size1, const std::size_t size2) |
Return the indices that represent all combinations of the elements of two RVecs. | |
template<typename T0 , typename T1 , typename Common_t = typename std::common_type<T0, T1>::type> | |
RVec< Common_t > | ROOT::VecOps::Concatenate (const RVec< T0 > &v0, const RVec< T1 > &v1) |
Return the concatenation of two RVecs. | |
template<typename T , typename... Args_t> | |
RVec< T > | ROOT::VecOps::Construct (const RVec< Args_t > &... args) |
Build an RVec of objects starting from RVecs of input to their constructors. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::DeltaPhi (const RVec< T > &v1, const RVec< T > &v2, const T c=M_PI) |
Return the angle difference \(\Delta \phi\) in radians of two vectors. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::DeltaPhi (const RVec< T > &v1, T v2, const T c=M_PI) |
Return the angle difference \(\Delta \phi\) in radians of a vector and a scalar. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::DeltaPhi (T v1, const RVec< T > &v2, const T c=M_PI) |
Return the angle difference \(\Delta \phi\) in radians of a scalar and a vector. | |
template<typename T > | |
T | ROOT::VecOps::DeltaPhi (T v1, T v2, const T c=M_PI) |
Return the angle difference \(\Delta \phi\) of two scalars. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::DeltaR (const RVec< T > &eta1, const RVec< T > &eta2, const RVec< T > &phi1, const RVec< T > &phi2, const T c=M_PI) |
Return the distance on the \(\eta\)- \(\phi\) plane ( \(\Delta R\)) from the collections eta1, eta2, phi1 and phi2. | |
template<typename T > | |
T | ROOT::VecOps::DeltaR (T eta1, T eta2, T phi1, T phi2, const T c=M_PI) |
Return the distance on the \(\eta\)- \(\phi\) plane ( \(\Delta R\)) from the scalars eta1, eta2, phi1 and phi2. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::DeltaR2 (const RVec< T > &eta1, const RVec< T > &eta2, const RVec< T > &phi1, const RVec< T > &phi2, const T c=M_PI) |
Return the square of the distance on the \(\eta\)- \(\phi\) plane ( \(\Delta R\)) from the collections eta1, eta2, phi1 and phi2. | |
template<typename T , typename V > | |
auto | ROOT::VecOps::Dot (const RVec< T > &v0, const RVec< V > &v1) -> decltype(v0[0] *v1[0]) |
Inner product. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Drop (const RVec< T > &v, RVec< typename RVec< T >::size_type > idxs) |
Return a copy of the container without the elements at the specified indices. | |
template<typename T , typename F > | |
RVec< T > | ROOT::VecOps::Filter (const RVec< T > &v, F &&f) |
Create a new collection with the elements passing the filter expressed by the predicate. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Intersect (const RVec< T > &v1, const RVec< T > &v2, bool v2_is_sorted=false) |
Return the intersection of elements of two RVecs. | |
template<typename T > | |
T | ROOT::VecOps::InvariantMass (const RVec< T > &pt, const RVec< T > &eta, const RVec< T > &phi, const RVec< T > &mass) |
Return the invariant mass of multiple particles given the collections of the quantities transverse momentum (pt), rapidity (eta), azimuth (phi) and mass. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::InvariantMasses (const RVec< T > &pt1, const RVec< T > &eta1, const RVec< T > &phi1, const RVec< T > &mass1, const RVec< T > &pt2, const RVec< T > &eta2, const RVec< T > &phi2, const RVec< T > &mass2) |
Return the invariant mass of two particles given the collections of the quantities transverse momentum (pt), rapidity (eta), azimuth (phi) and mass. | |
template<typename... Args> | |
auto | ROOT::VecOps::Map (Args &&... args) |
Create new collection applying a callable to the elements of the input collection. | |
template<typename T > | |
T | ROOT::VecOps::Max (const RVec< T > &v) |
Get the greatest element of an RVec. | |
template<typename T > | |
double | ROOT::VecOps::Mean (const RVec< T > &v) |
Get the mean of the elements of an RVec. | |
template<typename T , typename R = T> | |
R | ROOT::VecOps::Mean (const RVec< T > &v, const R zero) |
Get the mean of the elements of an RVec with custom initial value. | |
template<typename T > | |
T | ROOT::VecOps::Min (const RVec< T > &v) |
Get the smallest element of an RVec. | |
template<typename T > | |
RVec< typename RVec< T >::size_type > | ROOT::VecOps::Nonzero (const RVec< T > &v) |
Return the indices of the elements which are not zero. | |
template<class T > | |
std::ostream & | ROOT::VecOps::operator<< (std::ostream &os, const RVec< T > &v) |
Print a RVec at the prompt: | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Reverse (const RVec< T > &v) |
Return copy of reversed vector. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Sort (const RVec< T > &v) |
Return copy of RVec with elements sorted in ascending order. | |
template<typename T , typename Compare > | |
RVec< T > | ROOT::VecOps::Sort (const RVec< T > &v, Compare &&c) |
Return copy of RVec with elements sorted based on a comparison operator. | |
template<typename T > | |
RVec< typename RVec< T >::size_type > | ROOT::VecOps::StableArgsort (const RVec< T > &v) |
Return an RVec of indices that sort the input RVec while keeping the order of equal elements. | |
template<typename T , typename Compare > | |
RVec< typename RVec< T >::size_type > | ROOT::VecOps::StableArgsort (const RVec< T > &v, Compare &&c) |
Return an RVec of indices that sort the input RVec based on a comparison function while keeping the order of equal elements. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::StableSort (const RVec< T > &v) |
Return copy of RVec with elements sorted in ascending order while keeping the order of equal elements. | |
template<typename T , typename Compare > | |
RVec< T > | ROOT::VecOps::StableSort (const RVec< T > &v, Compare &&c) |
Return copy of RVec with elements sorted based on a comparison operator while keeping the order of equal elements. | |
template<typename T > | |
double | ROOT::VecOps::StdDev (const RVec< T > &v) |
Get the standard deviation of the elements of an RVec. | |
template<typename T , typename R = T> | |
R | ROOT::VecOps::Sum (const RVec< T > &v, const R zero=R(0)) |
Sum elements of an RVec. | |
template<typename T > | |
void | ROOT::VecOps::swap (RVec< T > &lhs, RVec< T > &rhs) |
template<typename T > | |
RVec< T > | ROOT::VecOps::Take (const RVec< T > &v, const int n) |
Return first or last n elements of an RVec. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Take (const RVec< T > &v, const RVec< typename RVec< T >::size_type > &i) |
Return elements of a vector at given indices. | |
template<typename T > | |
double | ROOT::VecOps::Var (const RVec< T > &v) |
Get the variance of the elements of an RVec. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Where (const RVec< int > &c, const RVec< T > &v1, const RVec< T > &v2) |
Return the elements of v1 if the condition c is true and v2 if the condition c is false. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Where (const RVec< int > &c, const RVec< T > &v1, typename RVec< T >::value_type v2) |
Return the elements of v1 if the condition c is true and sets the value v2 if the condition c is false. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Where (const RVec< int > &c, T v1, T v2) |
Return a vector with the value v2 if the condition c is false and sets the value v1 if the condition c is true. | |
template<typename T > | |
RVec< T > | ROOT::VecOps::Where (const RVec< int > &c, typename RVec< T >::value_type v1, const RVec< T > &v2) |
Return the elements of v2 if the condition c is false and sets the value v1 if the condition c is true. | |
RVec Unary Arithmetic Operators | |
#define | RVEC_UNARY_OPERATOR(OP) |
RVec Binary Arithmetic Operators | |
#define | ERROR_MESSAGE(OP) "Cannot call operator " #OP " on vectors of different sizes." |
#define | RVEC_BINARY_OPERATOR(OP) |
RVec Assignment Arithmetic Operators | |
#define | RVEC_ASSIGNMENT_OPERATOR(OP) |
RVec Comparison and Logical Operators | |
#define | RVEC_LOGICAL_OPERATOR(OP) |
RVec Standard Mathematical Functions | |
#define | RVEC_UNARY_FUNCTION(NAME, FUNC) |
#define | RVEC_BINARY_FUNCTION(NAME, FUNC) |
#define | RVEC_STD_UNARY_FUNCTION(F) RVEC_UNARY_FUNCTION(F, std::F) |
#define | RVEC_STD_BINARY_FUNCTION(F) RVEC_BINARY_FUNCTION(F, std::F) |
#define ERROR_MESSAGE | ( | OP | ) | "Cannot call operator " #OP " on vectors of different sizes." |
#define RVEC_ASSIGNMENT_OPERATOR | ( | OP | ) |
#define RVEC_BINARY_FUNCTION | ( | NAME, | |
FUNC | |||
) |
#define RVEC_STD_BINARY_FUNCTION | ( | F | ) | RVEC_BINARY_FUNCTION(F, std::F) |
#define RVEC_STD_UNARY_FUNCTION | ( | F | ) | RVEC_UNARY_FUNCTION(F, std::F) |
#define RVEC_UNARY_FUNCTION | ( | NAME, | |
FUNC | |||
) |
#define RVEC_UNARY_OPERATOR | ( | OP | ) |
Return true if all of the elements equate to true, return false otherwise.
Example code, at the ROOT prompt:
Return true if any of the elements equates to true, return false otherwise.
Example code, at the ROOT prompt:
std::size_t ROOT::VecOps::ArgMax | ( | const RVec< T > & | v | ) |
Get the index of the greatest element of an RVec In case of multiple occurrences of the maximum values, the index corresponding to the first occurrence is returned.
Example code, at the ROOT prompt:
std::size_t ROOT::VecOps::ArgMin | ( | const RVec< T > & | v | ) |
Get the index of the smallest element of an RVec In case of multiple occurrences of the minimum values, the index corresponding to the first occurrence is returned.
Example code, at the ROOT prompt:
RVec< typename RVec< T >::size_type > ROOT::VecOps::Argsort | ( | const RVec< T > & | v | ) |
Return an RVec of indices that sort the input RVec.
Example code, at the ROOT prompt:
RVec< typename RVec< T >::size_type > ROOT::VecOps::Argsort | ( | const RVec< T > & | v, |
Compare && | c | ||
) |
Return an RVec of indices that sort the input RVec based on a comparison function.
Example code, at the ROOT prompt:
RVec< RVec< typename RVec< T >::size_type > > ROOT::VecOps::Combinations | ( | const RVec< T > & | v, |
const typename RVec< T >::size_type | n | ||
) |
Return the indices that represent all unique combinations of the elements of a given RVec.
RVec< RVec< typename RVec< T1 >::size_type > > ROOT::VecOps::Combinations | ( | const RVec< T1 > & | v1, |
const RVec< T2 > & | v2 | ||
) |
Return the indices that represent all combinations of the elements of two RVecs.
The type of the return value is an RVec of two RVecs containing indices.
Example code, at the ROOT prompt:
|
inline |
Return the indices that represent all combinations of the elements of two RVecs.
The type of the return value is an RVec of two RVecs containing indices.
Example code, at the ROOT prompt:
RVec< Common_t > ROOT::VecOps::Concatenate | ( | const RVec< T0 > & | v0, |
const RVec< T1 > & | v1 | ||
) |
Return the concatenation of two RVecs.
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::Construct | ( | const RVec< Args_t > &... | args | ) |
Build an RVec of objects starting from RVecs of input to their constructors.
T | Type of the objects contained in the created RVec. |
Args_t | Pack of types templating the input RVecs. |
[in] | args | The RVecs containing the values used to initialise the output objects. |
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::DeltaPhi | ( | const RVec< T > & | v1, |
const RVec< T > & | v2, | ||
const T | c = M_PI |
||
) |
Return the angle difference \(\Delta \phi\) in radians of two vectors.
The function computes the closest angle from v1 to v2 with sign and is therefore in the range \([-\pi, \pi]\). The computation is done per default in radians \(c = \pi\) but can be switched to degrees \(c = 180\).
RVec< T > ROOT::VecOps::DeltaPhi | ( | const RVec< T > & | v1, |
T | v2, | ||
const T | c = M_PI |
||
) |
Return the angle difference \(\Delta \phi\) in radians of a vector and a scalar.
The function computes the closest angle from v1 to v2 with sign and is therefore in the range \([-\pi, \pi]\). The computation is done per default in radians \(c = \pi\) but can be switched to degrees \(c = 180\).
RVec< T > ROOT::VecOps::DeltaPhi | ( | T | v1, |
const RVec< T > & | v2, | ||
const T | c = M_PI |
||
) |
Return the angle difference \(\Delta \phi\) in radians of a scalar and a vector.
The function computes the closest angle from v1 to v2 with sign and is therefore in the range \([-\pi, \pi]\). The computation is done per default in radians \(c = \pi\) but can be switched to degrees \(c = 180\).
T ROOT::VecOps::DeltaPhi | ( | T | v1, |
T | v2, | ||
const T | c = M_PI |
||
) |
Return the angle difference \(\Delta \phi\) of two scalars.
The function computes the closest angle from v1 to v2 with sign and is therefore in the range \([-\pi, \pi]\). The computation is done per default in radians \(c = \pi\) but can be switched to degrees \(c = 180\).
RVec< T > ROOT::VecOps::DeltaR | ( | const RVec< T > & | eta1, |
const RVec< T > & | eta2, | ||
const RVec< T > & | phi1, | ||
const RVec< T > & | phi2, | ||
const T | c = M_PI |
||
) |
Return the distance on the \(\eta\)- \(\phi\) plane ( \(\Delta R\)) from the collections eta1, eta2, phi1 and phi2.
The function computes \(\Delta R = \sqrt{(\eta_1 - \eta_2)^2 + (\phi_1 - \phi_2)^2}\) of the given collections eta1, eta2, phi1 and phi2. The angle \(\phi\) can be set to radian or degrees using the optional argument c, see the documentation of the DeltaPhi helper.
T ROOT::VecOps::DeltaR | ( | T | eta1, |
T | eta2, | ||
T | phi1, | ||
T | phi2, | ||
const T | c = M_PI |
||
) |
Return the distance on the \(\eta\)- \(\phi\) plane ( \(\Delta R\)) from the scalars eta1, eta2, phi1 and phi2.
The function computes \(\Delta R = \sqrt{(\eta_1 - \eta_2)^2 + (\phi_1 - \phi_2)^2}\) of the given scalars eta1, eta2, phi1 and phi2. The angle \(\phi\) can be set to radian or degrees using the optional argument c, see the documentation of the DeltaPhi helper.
RVec< T > ROOT::VecOps::DeltaR2 | ( | const RVec< T > & | eta1, |
const RVec< T > & | eta2, | ||
const RVec< T > & | phi1, | ||
const RVec< T > & | phi2, | ||
const T | c = M_PI |
||
) |
Return the square of the distance on the \(\eta\)- \(\phi\) plane ( \(\Delta R\)) from the collections eta1, eta2, phi1 and phi2.
The function computes \(\Delta R^2 = (\eta_1 - \eta_2)^2 + (\phi_1 - \phi_2)^2\) of the given collections eta1, eta2, phi1 and phi2. The angle \(\phi\) can be set to radian or degrees using the optional argument c, see the documentation of the DeltaPhi helper.
auto ROOT::VecOps::Dot | ( | const RVec< T > & | v0, |
const RVec< V > & | v1 | ||
) | -> decltype(v0[0] * v1[0]) |
Inner product.
Example code, at the ROOT prompt:
Create a new collection with the elements passing the filter expressed by the predicate.
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::Intersect | ( | const RVec< T > & | v1, |
const RVec< T > & | v2, | ||
bool | v2_is_sorted = false |
||
) |
Return the intersection of elements of two RVecs.
Each element of v1 is looked up in v2 and added to the returned vector if found. Following, the order of v1 is preserved. If v2 is already sorted, the optional argument v2_is_sorted can be used to toggle of the internal sorting step, therewith optimising runtime.
Example code, at the ROOT prompt:
T ROOT::VecOps::InvariantMass | ( | const RVec< T > & | pt, |
const RVec< T > & | eta, | ||
const RVec< T > & | phi, | ||
const RVec< T > & | mass | ||
) |
Return the invariant mass of multiple particles given the collections of the quantities transverse momentum (pt), rapidity (eta), azimuth (phi) and mass.
The function computes the invariant mass of multiple particles with the four-vectors (pt, eta, phi, mass).
RVec< T > ROOT::VecOps::InvariantMasses | ( | const RVec< T > & | pt1, |
const RVec< T > & | eta1, | ||
const RVec< T > & | phi1, | ||
const RVec< T > & | mass1, | ||
const RVec< T > & | pt2, | ||
const RVec< T > & | eta2, | ||
const RVec< T > & | phi2, | ||
const RVec< T > & | mass2 | ||
) |
Return the invariant mass of two particles given the collections of the quantities transverse momentum (pt), rapidity (eta), azimuth (phi) and mass.
The function computes the invariant mass of two particles with the four-vectors (pt1, eta2, phi1, mass1) and (pt2, eta2, phi2, mass2).
auto ROOT::VecOps::Map | ( | Args &&... | args | ) |
Create new collection applying a callable to the elements of the input collection.
Example code, at the ROOT prompt:
T ROOT::VecOps::Max | ( | const RVec< T > & | v | ) |
Get the greatest element of an RVec.
Example code, at the ROOT prompt:
Get the mean of the elements of an RVec.
The return type is a double precision floating point number.
Example code, at the ROOT prompt:
Get the mean of the elements of an RVec with custom initial value.
The return type will be deduced from the zero
parameter
Example code, at the ROOT prompt:
T ROOT::VecOps::Min | ( | const RVec< T > & | v | ) |
Get the smallest element of an RVec.
Example code, at the ROOT prompt:
RVec< typename RVec< T >::size_type > ROOT::VecOps::Nonzero | ( | const RVec< T > & | v | ) |
Return the indices of the elements which are not zero.
Example code, at the ROOT prompt:
std::ostream & ROOT::VecOps::operator<< | ( | std::ostream & | os, |
const RVec< T > & | v | ||
) |
Return copy of reversed vector.
Example code, at the ROOT prompt:
Return copy of RVec with elements sorted in ascending order.
This helper is different from Argsort since it does not return an RVec of indices, but an RVec of values.
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::Sort | ( | const RVec< T > & | v, |
Compare && | c | ||
) |
Return copy of RVec with elements sorted based on a comparison operator.
The comparison operator has to fullfill the same requirements of the predicate of by std::sort.
This helper is different from Argsort since it does not return an RVec of indices, but an RVec of values.
Example code, at the ROOT prompt:
RVec< typename RVec< T >::size_type > ROOT::VecOps::StableArgsort | ( | const RVec< T > & | v | ) |
Return an RVec of indices that sort the input RVec while keeping the order of equal elements.
This is the stable variant of Argsort
.
Example code, at the ROOT prompt:
RVec< typename RVec< T >::size_type > ROOT::VecOps::StableArgsort | ( | const RVec< T > & | v, |
Compare && | c | ||
) |
Return an RVec of indices that sort the input RVec based on a comparison function while keeping the order of equal elements.
This is the stable variant of Argsort
.
Example code, at the ROOT prompt:
Return copy of RVec with elements sorted in ascending order while keeping the order of equal elements.
This is the stable variant of Sort
.
This helper is different from StableArgsort since it does not return an RVec of indices, but an RVec of values.
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::StableSort | ( | const RVec< T > & | v, |
Compare && | c | ||
) |
Return copy of RVec with elements sorted based on a comparison operator while keeping the order of equal elements.
The comparison operator has to fullfill the same requirements of the predicate of std::stable_sort.
This helper is different from StableArgsort since it does not return an RVec of indices, but an RVec of values.
This is the stable variant of Sort
.
Example code, at the ROOT prompt:
Get the standard deviation of the elements of an RVec.
The return type is a double precision floating point number. Example code, at the ROOT prompt:
R ROOT::VecOps::Sum | ( | const RVec< T > & | v, |
const R | zero = R(0) |
||
) |
Sum elements of an RVec.
Example code, at the ROOT prompt:
Return first or last n
elements of an RVec.
if n > 0
and last elements if n < 0
.
Example code, at the ROOT prompt:
Get the variance of the elements of an RVec.
The return type is a double precision floating point number. Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::Where | ( | const RVec< int > & | c, |
const RVec< T > & | v1, | ||
const RVec< T > & | v2 | ||
) |
Return the elements of v1 if the condition c is true and v2 if the condition c is false.
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::Where | ( | const RVec< int > & | c, |
const RVec< T > & | v1, | ||
typename RVec< T >::value_type | v2 | ||
) |
Return the elements of v1 if the condition c is true and sets the value v2 if the condition c is false.
Example code, at the ROOT prompt:
Return a vector with the value v2 if the condition c is false and sets the value v1 if the condition c is true.
Example code, at the ROOT prompt:
RVec< T > ROOT::VecOps::Where | ( | const RVec< int > & | c, |
typename RVec< T >::value_type | v1, | ||
const RVec< T > & | v2 | ||
) |
Return the elements of v2 if the condition c is false and sets the value v1 if the condition c is true.
Example code, at the ROOT prompt: