RDFAnalysis  0.1.1
Physics analysis with ROOT::RDataFrame
SysVar.h File Reference

Helper functions and classes for adapting function arguments that depend on the systematic being evaluated. More...

#include <string>
#include <type_traits>
#include <RDFAnalysis/IBranchNamer.h>

Go to the source code of this file.

Data Structures

struct  sysvar_traits< T, typename >
 Provide contextual information about a class. More...
 
struct  sysvar_traits< T, std::enable_if_t< std::decay_t< T >::is_rdf_sysvar, void > >
 Provide contextual information about a class. More...
 
class  SysVarBranch
 Class to trigger translation of a single branch name. More...
 
class  SysVarBranchVector
 Class to trigger translation of a vector of branches. More...
 
class  SysVarNewBranch
 Class to trigger translation of a new branch name. More...
 
class  SysVarStringExpression
 Class to trigger translation of a string expression. More...
 

Namespaces

 RDFAnalysis
 

Functions

template<typename T >
std::enable_if_t< sysvar_traits< T >::is_sysvar, typename sysvar_traits< T >::value_type > sysVarTranslate (T &&t, IBranchNamer &namer, const std::string &syst)
 Translate a variable. More...
 
template<typename T >
std::enable_if_t<!sysvar_traits< T >::is_sysvar, T > sysVarTranslate (T &&t, IBranchNamer &, const std::string &)
 Translate a variable. More...
 

Detailed Description

Helper functions and classes for adapting function arguments that depend on the systematic being evaluated.

Actions being applied to the Nodes need to be adapted and called for each relevant systematic. Some of the arguments do not change through this process but many do (for example, branch names and string expressions). We call this process of changing arguments for different systematic calls of the same action a translation.

The Node::Act and Node::ActResult functions determine whether or not to translate an argument by using the sysvar_traits struct which in turn looks for a static constexpr bool member of the correspond argument class type called is_rdf_sysvar. If this is present (and true) the argument will be translated.

For most purposes the SysVarBranch, SysVarBranchVector, SysVarNewBranch and SysVarStringExpression classes provided here will be sufficient (in fact most users will never need to even be aware of the existence of any of this), for some actions it may be necessary to define additional argument classes In order to do this, three things are necessary:

  1. A static constexpr bool member called is_rdf_sysvar which is set to true
  2. A translate(IBranchNamer&, const std::string&) function returning the translated argument
  3. A typedef called value_type which corresponds to the return type of the translate call