RDFAnalysis
0.1.1
Physics analysis with ROOT::RDataFrame
|
Base class for the scheduler. More...
#include <SchedulerBase.h>
Data Structures | |
struct | Action |
Helper struct to represent all the information that the scheduler needs to know about an action in order to form the ordering. More... | |
struct | RegionDef |
Helper struct to define a region. More... | |
struct | ScheduleNode |
Helper struct used to build and express the schedule. More... | |
Public Types | |
enum | ActionType { FILTER, VARIABLE, FILL, INVALID } |
Enum to describe the different types of action. More... | |
Public Member Functions | |||
RegionDef & | addRegion (const std::string &name, const std::vector< std::string > &filterList) | ||
Add a region to be scheduled. More... | |||
std::map< std::string, RegionDef > & | regionDefs () | ||
Access the current region definitions. More... | |||
const std::map< std::string, RegionDef > & | regionDefs () const | ||
(const) access the current region definitions More... | |||
void | filterSatisfies (const std::string &filter, const std::vector< std::string > &satisfied) | ||
Tell the scheduler that a filter also satisfies the condition of other filters. More... | |||
ScheduleNode & | getSchedule () | ||
Get the ROOT of the output filter schedule. Will be empty if schedule has not been called. More... | |||
const ScheduleNode & | getSchedule () const | ||
Get the ROOT of the output filter schedule. Will be empty if schedule has not been called. More... | |||
const std::vector< std::string > & | usedVariables () const | ||
Get the variables used by this schedule. Will be empty if schedule has not been called. More... | |||
const std::set< Action > & | getDependencies (const Action &action) const | ||
Get the dependency corresponding to an action.
| |||
float | getCost (const Action &action) const | ||
Get the cost of an action
| |||
bool | isActionSatisfiedBy (const Action &action, const std::set< Action > &candidates, bool considerSelf=true) const | ||
Check whether an action has already been satisfied by one of a list of candidates. More... | |||
bool | isActionSatisfiedBy (const Action &action, const std::set< Action > &candidates, Action &satisfiedBy, bool considerSelf=true) const | ||
Check whether an action has already been satisfied by one of a list of candidates. More... | |||
Static Public Member Functions | |
static std::string | actionTypeToString (ActionType type) |
Convert an ActionType to a string. More... | |
static void | printSchedule (std::ostream &os, const ScheduleNode &root) |
Print a schedule to a graphviz file. More... | |
Protected Member Functions | |
void | addAction (const Action &action, const std::set< Action > &dependencies) |
Add a new action to the record. More... | |
std::map< Action, Action > | buildReplacementMap (const std::set< Action > &filters) const |
Look through a list of filters for any that satisfy each other. More... | |
void | actionDefinesMultipleVariables (const std::string &name, const std::vector< std::string > &defined) |
Tell the scheduler that an action is defining multiple variables. More... | |
ScheduleNode & | schedule (const IBranchNamer &namer) |
Build the schedule. More... | |
ScheduleNode | rawSchedule () const |
Build the 'raw' schedule. More... | |
Base class for the scheduler.
This is the class that does most of the heavy-lifting, being responsible for figuring out the order of the actions used.
enum ActionType |
Enum to describe the different types of action.
Enumerator | |
---|---|
FILTER |
A filter imposes a selection on the events it sees and can also create a branch in the tree structure. |
VARIABLE |
A variable defines a new variable. |
FILL |
A fill is required to return a SysResultPtr to a TObject. |
INVALID |
Not a valid action, used to construct a placeholder action. |
|
protected |
Tell the scheduler that an action is defining multiple variables.
name | The name of the action |
defined | The list of variables. |
|
static |
Convert an ActionType to a string.
Add a new action to the record.
action | The action to add |
dependencies | Its dependencies |
std::runtime_error | If that type/name combination exists |
SchedulerBase::RegionDef & addRegion | ( | const std::string & | name, |
const std::vector< std::string > & | filterList | ||
) |
Add a region to be scheduled.
name | The name of the region to be added |
filterList | The ordered list of filters to be added. |
std::runtime_error | An invalid region name is given. Invalid region names are the empty string '', 'ROOT' or any pre-existing region or filter name. |
|
protected |
Look through a list of filters for any that satisfy each other.
Imagine an action that ends up with the dependencies (writing filters only) {pT > 100, n_B > 1, n_B > 2}. Clearly running both of the n_B selections is wasteful, and if scale factors are applied as part of those selections it might well be actively harmful. Given this set of inputs the return value of this function would be {n_B > 1 : n_B > 2}
void filterSatisfies | ( | const std::string & | filter, |
const std::vector< std::string > & | satisfied | ||
) |
Tell the scheduler that a filter also satisfies the condition of other filters.
filter | The filter |
satisfied | Other filters that this filter satisfies. |
For example, x == 4 clearly satisfies the filter x > 2 so any action that depends on this selection does not need to sequence 'x > 2' if 'x == 4' has already been scheduled.
float getCost | ( | const Action & | action | ) | const |
Get the cost of an action
std::out_of_range | if the action is unknown. |
const std::set< SchedulerBase::Action > & getDependencies | ( | const Action & | action | ) | const |
Get the dependency corresponding to an action.
std::out_of_range | if the action is unknown. |
|
inline |
Get the ROOT of the output filter schedule. Will be empty if schedule has not been called.
|
inline |
Get the ROOT of the output filter schedule. Will be empty if schedule has not been called.
bool isActionSatisfiedBy | ( | const Action & | action, |
const std::set< Action > & | candidates, | ||
bool | considerSelf = true |
||
) | const |
Check whether an action has already been satisfied by one of a list of candidates.
action | The action to check for |
candidates | Candidates that could have satisfied it. |
considerSelf | Whether or not to count action satsified if it occurs in candidates |
bool isActionSatisfiedBy | ( | const Action & | action, |
const std::set< Action > & | candidates, | ||
Action & | satisfiedBy, | ||
bool | considerSelf = true |
||
) | const |
Check whether an action has already been satisfied by one of a list of candidates.
action | The action to check for | |
candidates | Candidates that could have satisfied it. | |
[out] | satisfiedBy | If the action has already been satisfied, fill this reference with the candidate that satisfied it |
considerSelf | Whether or not to count action satsified if it occurs in candidates |
|
static |
Print a schedule to a graphviz file.
os | The output stream |
root | the root node of the schedule |
|
protected |
Build the 'raw' schedule.
The raw schedule is derived only from the requested regions.
|
inline |
Access the current region definitions.
|
inline |
(const) access the current region definitions
|
protected |
Build the schedule.
namer | IBranchNamer that provides the list of predefined variables. |
|
inline |
Get the variables used by this schedule. Will be empty if schedule has not been called.