RDFAnalysis  0.1.1
Physics analysis with ROOT::RDataFrame
DefaultBranchNamer Class Reference

Default implementation of the IBranchNamer interface. More...

#include <DefaultBranchNamer.h>

Inheritance diagram for DefaultBranchNamer:
IBranchNamer

Public Member Functions

 DefaultBranchNamer (const std::vector< std::string > &systematics, bool systNameFirst=true, bool inputFromFriends=false, const std::string &nominalName="NOSYS")
 Construct the namer. More...
 
std::string nameBranch (const std::string &branch, const std::string &systName="") const override
 Get the full name of a branch. More...
 
std::string createBranch (const std::string &branch, const std::string &systName="") override
 Get the full name of a branch. More...
 
bool exists (const std::string &branch, const std::string &systName="") const override
 Test if a specific variation of a specific branch exists. More...
 
std::string newBranchName (const std::string &branch, const std::string &systName="") const
 Get the full name of a branch. More...
 
const std::string & nominalName () const override
 Print the name of the nominal variation. More...
 
std::vector< std::string > systematics () const override
 Get all systematics. More...
 
std::set< std::string > systematicsAffecting (const std::string &branch) const override
 Get all systematics affecting a base branch name. More...
 
std::vector< std::string > branches () const override
 Get all branch base names. More...
 
void readBranchList (const std::map< std::string, ROOT::RDF::RNode > &rnodes) override
 Set the node that this namer is looking at. More...
 
std::unique_ptr< IBranchNamercopy () const override
 Make a copy of this class. More...
 
- Public Member Functions inherited from IBranchNamer
virtual ~IBranchNamer ()
 
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::set< std::string > systematicsAffecting (const std::vector< std::string > &branches) const
 Get all the systematics affecting a set of columns. 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

Default implementation of the IBranchNamer interface.

Allows for reading and writing branches of the form SYSNAME_BRANCHNAME or BRANCHNAME_SYSNAME. Can also read in files where the different systematics are saved as friend trees. In this case the input format is SYSNAME.BRANCHNAME.

Constructor & Destructor Documentation

DefaultBranchNamer ( const std::vector< std::string > &  systematics,
bool  systNameFirst = true,
bool  inputFromFriends = false,
const std::string &  nominalName = "NOSYS" 
)
inline

Construct the namer.

Parameters
systematicsThe list of all variations
systNameFirstWhen building column names whether to put the sytematic name first.
inputFromFriendsWhether or not the inputs come from friend trees.
nominalNameThe name of the nominal systematic

Member Function Documentation

std::vector< std::string > branches ( ) const
overridevirtual

Get all branch base names.

Implements IBranchNamer.

std::unique_ptr<IBranchNamer> copy ( ) const
inlineoverridevirtual

Make a copy of this class.

Implements IBranchNamer.

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

Get the full name of a branch.

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

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

Implements IBranchNamer.

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

Test if a specific variation of a specific branch exists.

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

Implements IBranchNamer.

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

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.

Implements IBranchNamer.

std::string newBranchName ( const std::string &  branch,
const std::string &  systName = "" 
) const

Get the full name of a branch.

Parameters
branchThe base name of the branch
systNameThe name of the variation
const std::string& nominalName ( ) const
inlineoverridevirtual

Print the name of the nominal variation.

Implements IBranchNamer.

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

Set the node that this namer is looking at.

Parameters
rnodesThe input rnodes.

Implements IBranchNamer.

std::vector<std::string> systematics ( ) const
inlineoverridevirtual

Get all systematics.

Implements IBranchNamer.

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

Get all systematics affecting a base branch name.

Parameters
branchThe name of the branch to test

Implements IBranchNamer.


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