RDFAnalysis  0.1.1
Physics analysis with ROOT::RDataFrame
IBranchNamer Class Referenceabstract

Abstract base class that describes how a Node should name its branches internally. More...

#include <IBranchNamer.h>

Inheritance diagram for IBranchNamer:
DefaultBranchNamer ScheduleNamer

Public Member Functions

virtual ~IBranchNamer ()
 
virtual std::string nameBranch (const std::string &branch, const std::string &systName="") const =0
 Get the full name of a branch. More...
 
virtual std::vector< std::string > nameBranches (const std::vector< std::string > &branches, const std::string &systName="") const
 Get the full names of a list of branches. More...
 
virtual std::string createBranch (const std::string &branch, const std::string &systName="")=0
 Create a new branch. More...
 
virtual bool exists (const std::string &branch, const std::string &systName="") const =0
 Test if a specific variation of a specific branch exists. More...
 
virtual const std::string & nominalName () const =0
 Get the name of the nominal variation. More...
 
virtual std::vector< std::string > systematics () const =0
 Get all systematics. More...
 
virtual std::set< std::string > systematicsAffecting (const std::string &branch) const =0
 Get all systematics affecting a base branch name. More...
 
virtual std::set< std::string > systematicsAffecting (const std::vector< std::string > &branches) const
 Get all the systematics affecting a set of columns. More...
 
virtual std::vector< std::string > branches () const =0
 Get all branch base names. More...
 
virtual void readBranchList (const std::map< std::string, ROOT::RDF::RNode > &rnodes)=0
 Read branch lists from a set of rnodes. More...
 
virtual std::unique_ptr< IBranchNamercopy () const =0
 Make a copy of this class. More...
 
virtual std::pair< std::string, std::vector< std::string > > expandExpression (const std::string &expression) const
 Expand a C++ expression into a pseudo-functional form. More...
 
virtual std::string interpretExpression (const std::string &expression, const std::vector< std::string > &branches, const std::string &systematic)
 Interpret an expression for a given systematic variation. More...
 

Detailed Description

Abstract base class that describes how a Node should name its branches internally.

The Node classes enforce a relationship between ROOT::RNode columns, potentially having multiple variations (corresponding to different systematics) of the same variable. These are stored as different columns in the underlying ROOT:RNodes. Therefore the Node objects need to know how to go from a variable name and a systematic name to the name of the ROOT::RNode column.

That mapping is provided by this class, along with other useful information such as the full list of systematics, the name of the nominal systematic and a list of all defined variables.

Constructor & Destructor Documentation

virtual ~IBranchNamer ( )
inlinevirtual

Member Function Documentation

virtual std::vector<std::string> branches ( ) const
pure virtual

Get all branch base names.

Implemented in DefaultBranchNamer, and ScheduleNamer.

virtual std::unique_ptr<IBranchNamer> copy ( ) const
pure virtual

Make a copy of this class.

Implemented in DefaultBranchNamer, and ScheduleNamer.

virtual std::string createBranch ( const std::string &  branch,
const std::string &  systName = "" 
)
pure virtual

Create a new branch.

Parameters
branchThe base name of the branch
systNameThe name of the variation
Returns
The new branch name

Create a new variation systName of branch branch. If this already exists then a std::runtime_error will be thrown.

Implemented in DefaultBranchNamer, and ScheduleNamer.

virtual bool exists ( const std::string &  branch,
const std::string &  systName = "" 
) const
pure virtual

Test if a specific variation of a specific branch exists.

Parameters
branchThe base name of the branch
systNameThe name of the variation

Implemented in DefaultBranchNamer, and ScheduleNamer.

std::pair< std::string, std::vector< std::string > > expandExpression ( const std::string &  expression) const
virtual

Expand a C++ expression into a pseudo-functional form.

Parameters
expressionThe expression to expand.
Returns
A pair, the first element is the pseudo-functional form, the second the input variables to that function.

This function receives an expression that may contain variable names and then expands it into a form that can be varied for different systematics. For instance a function 'jet_pt * cos(jet_phi)' (where jet_pt and jet_phi are variables) would be expanded to '{0} * cos({1})', {'jet_pt', 'jet_phi'}.

std::string interpretExpression ( const std::string &  expression,
const std::vector< std::string > &  branches,
const std::string &  systematic 
)
virtual

Interpret an expression for a given systematic variation.

Parameters
expressionThe pseudo-functional expression to use
branchesThe input variables to the expression
systematicThe systematic variation to use
Returns
The expression for the given systematic

Reinterpret a pseudo-functional form produced by expandExpression for a specific systematic. For an expression '{0} * cos({1})' with inputs {'jet_pt', 'jet_phi'} and systematic 'KIN_A' only affecting jet_pt (and making hopefully obvious assumptions about the nominal name and the column naming pattern) this function would return 'KIN_A_jet_pt * cos(NOSYS_jet_phi)'

virtual std::string nameBranch ( const std::string &  branch,
const std::string &  systName = "" 
) const
pure virtual

Get the full name of a branch.

Parameters
branchThe base name of the branch
systNameThe name of the variation

Search for a variation systName on a branch branch. If one doesn't exist then it will return the nominal branch. If that doesn't exist it will throw a std::out_of_range exception.

Implemented in DefaultBranchNamer, and ScheduleNamer.

std::vector< std::string > nameBranches ( const std::vector< std::string > &  branches,
const std::string &  systName = "" 
) const
virtual

Get the full names of a list of branches.

Parameters
branchesThe base name of the branches
systNameThe name of the variation

Search for a variation systName on a branch branch. If one doesn't exist then it will return the nominal branch. If that doesn't exist it will throw a std::out_of_range exception.

virtual const std::string& nominalName ( ) const
pure virtual

Get the name of the nominal variation.

Implemented in DefaultBranchNamer, and ScheduleNamer.

virtual void readBranchList ( const std::map< std::string, ROOT::RDF::RNode > &  rnodes)
pure virtual

Read branch lists from a set of rnodes.

Parameters
rnodesThe input rnodes

Implemented in DefaultBranchNamer, and ScheduleNamer.

virtual std::vector<std::string> systematics ( ) const
pure virtual

Get all systematics.

Implemented in DefaultBranchNamer, and ScheduleNamer.

virtual std::set<std::string> systematicsAffecting ( const std::string &  branch) const
pure virtual

Get all systematics affecting a base branch name.

Parameters
branchThe name of the branch to test

Implemented in DefaultBranchNamer, and ScheduleNamer.

std::set< std::string > systematicsAffecting ( const std::vector< std::string > &  branches) const
virtual

Get all the systematics affecting a set of columns.

Parameters
branchesThe names of the branches to test

The documentation for this class was generated from the following files: