Namespace: Utility
-
namespace utility
Namespace used for common utility functions.
Functions
-
template<typename O, typename I>
inline std::pair<ROOT::RDF::RNode, std::string> Cast(ROOT::RDF::RNode df, const std::string &outputname, const std::string &outputtype, const std::string &column) This function takes a column and casts it from type
Ito another typeO.Note
This functionality is mainly used to mitigate type changes between nanoAOD versions.
- Template Parameters:
O – type of the output column
I – type of the input column
- Parameters:
df – input dataframe
outputname – name of the output column containing the recasted column
outputtype – string with the type of the output column
column – name of the column that should be recasted to another type
- Returns:
a new dataframe with the new column
-
inline bool ApproxEqual(double value1, double value2, double maxDelta = 1e-5)
Function to check if two double values are approximately equal.
- Parameters:
value1 – first double value to compare
value2 – second double value to compare
maxDelta – maximum difference between the two values
- Returns:
true or false
-
template<typename ...Args>
constexpr auto extractLastArgument(const std::tuple<Args...> &args) This function extracts and returns the last element from a tuple containing a variable number of arguments. The function uses
std::getto access the last element of the tuple, allowing you to retrieve the last argument without knowing its type or index beforehand.- Parameters:
args – input tuple containing the arguments
- Returns:
last element of the tuple
-
template<typename ...Args>
constexpr auto popLastArgument(const std::tuple<Args...> &args) This function extracts and returns all elements except the last one from a tuple containing a variable number of arguments. The function uses
std::getto access the elements of the tuple, returning them as a vector of strings.- Parameters:
args – input tuple containing the arguments
- Returns:
vector of strings with all elements except the last one
-
inline void appendParameterPackToVector(std::vector<std::string> &v, const std::string ¶meter)
Function to append a parameter pack to a vector.
- Parameters:
v – the vector to append to
parameter – string to append
-
template<typename ...ParameterPack>
inline void appendParameterPackToVector(std::vector<std::string> &v, const std::string ¶meter, const ParameterPack&... pack) Function to append a parameter pack to a vector.
- Template Parameters:
ParameterPack –
- Parameters:
v – the vector to append to
parameter – the string to append
pack – the parameter pack to append
Function to evaluate a
RooWorkspacefunction and put the output into a new dataframe column.- Parameters:
df – input dataframe
outputname – name of the new column
function – a
RooFunctorpointer, which has to be loaded from a Roo Workspaceinputs – a parameter pack containing all column names needed to be able to evaluate the workspace function
- Returns:
a dataframe with the new column
-
template<typename O, typename I>