1 #ifndef RDFAnalysis_SchedulerBase_H 2 #define RDFAnalysis_SchedulerBase_H 42 void addFill(
const std::string& fill) {fills.insert(fill); }
54 const std::string& name,
59 {
return m_regionDefs;}
61 const std::map<std::string, RegionDef>&
regionDefs()
const 62 {
return m_regionDefs;}
75 const std::string& filter,
76 const std::vector<std::string>& satisfied);
89 type(type), name(name), cost(cost) {}
101 return (type == rhs.
type ? name < rhs.
name : type < rhs.
type);
105 return type == rhs.
type && name == rhs.
name;
126 std::map<Action, std::set<Action>,
CostOrdering> expand(
128 const std::set<Action>& preExisting = {})
const;
141 std::map<Action, std::set<Action>,
CostOrdering> expand(
143 const std::set<Action>& preExisting,
144 std::vector<Action>& processing)
const;
177 const Action& next()
const;
185 const std::set<Action>& preExisting = {})
186 { dependencies = action.
expand(scheduler, preExisting); }
205 const std::vector<std::string>&
usedVariables()
const {
return m_usedVars; }
229 const std::set<Action>& candidates,
230 bool considerSelf =
true)
const;
244 const std::set<Action>& candidates,
246 bool considerSelf =
true)
const;
257 const std::set<Action>& dependencies);
270 const std::set<Action>& filters)
const;
278 const std::string& name,
279 const std::vector<std::string>& defined);
300 std::vector<ScheduleNode>&& sources,
302 std::set<Action> preExisting);
304 std::map<std::string, RegionDef> m_regionDefs;
307 std::map<Action, std::set<Action>> m_dependencies;
312 std::map<Action, std::set<Action>> m_satisfiedBy;
318 std::vector<std::string> m_usedVars;
320 void expandSatisfiesRelations(
321 std::map<
Action, std::set<Action>>::iterator itr,
322 std::set<Action>& processed);
326 #endif //> !RDFAnalysis_SchedulerBase_H Helper struct to represent all the information that the scheduler needs to know about an action in or...
Definition: SchedulerBase.h:86
RegionDef & addRegion(const std::string &name, const std::vector< std::string > &filterList)
Add a region to be scheduled.
Definition: SchedulerBase.cxx:76
static void printSchedule(std::ostream &os, const ScheduleNode &root)
Print a schedule to a graphviz file.
Definition: SchedulerBase.cxx:533
bool operator<(const Action &rhs) const
Operator used to construct sets of actions. Order by type first, then name.
Definition: SchedulerBase.h:100
void expand(const SchedulerBase &scheduler, const std::set< Action > &preExisting={})
Expand this node's dependencies.
Definition: SchedulerBase.h:183
Abstract base class that describes how a Node should name its branches internally.
Definition: IBranchNamer.h:33
static std::string actionTypeToString(ActionType type)
Convert an ActionType to a string.
Definition: SchedulerBase.cxx:62
bool operator()(const Action &lhs, const Action &rhs) const
The actual ordering.
Definition: SchedulerBase.h:111
void addAction(const Action &action, const std::set< Action > &dependencies)
Add a new action to the record.
Definition: SchedulerBase.cxx:252
Action action
The action performed by this node.
Definition: SchedulerBase.h:161
const std::vector< std::string > & usedVariables() const
Get the variables used by this schedule. Will be empty if schedule has not been called.
Definition: SchedulerBase.h:205
Helper struct used to build and express the schedule.
Definition: SchedulerBase.h:157
float getCost(const Action &action) const
Get the cost of an action if the action is unknown.
Definition: SchedulerBase.cxx:283
ScheduleNode & schedule(const IBranchNamer &namer)
Build the schedule.
Definition: SchedulerBase.cxx:359
ActionType type
The type of this action.
Definition: SchedulerBase.h:92
float cost
The cost-estimate of this action.
Definition: SchedulerBase.h:96
void addFill(const std::string &fill)
Add a fill to the region.
Definition: SchedulerBase.h:42
const std::set< Action > & getDependencies(const Action &action) const
Get the dependency corresponding to an action. if the action is unknown.
Definition: SchedulerBase.cxx:271
std::string region
The region, if any, that this node defines (i.e. is the final action listed for that region) ...
Definition: SchedulerBase.h:168
std::map< Action, std::set< Action >, Action::CostOrdering > dependencies
The dependencies of that action.
Definition: SchedulerBase.h:163
Action(ActionType type, const std::string &name, float cost=0)
Create the action.
Definition: SchedulerBase.h:88
std::vector< std::string > filterList
Ordered list of filters defining the region.
Definition: SchedulerBase.h:38
ActionType
Enum to describe the different types of action.
Definition: SchedulerBase.h:21
std::set< std::string > fills
Set of fills to be performed on that region.
Definition: SchedulerBase.h:40
Base class for the scheduler.
Definition: SchedulerBase.h:18
A filter imposes a selection on the events it sees and can also create a branch in the tree structure...
Definition: SchedulerBase.h:24
Definition: CutflowDetail.h:11
std::map< Action, Action > buildReplacementMap(const std::set< Action > &filters) const
Look through a list of filters for any that satisfy each other.
Definition: SchedulerBase.cxx:332
ScheduleNode rawSchedule() const
Build the 'raw' schedule.
Definition: SchedulerBase.cxx:383
The branch naming interface.
std::map< std::string, RegionDef > & regionDefs()
Access the current region definitions.
Definition: SchedulerBase.h:58
Helper struct to define a region.
Definition: SchedulerBase.h:36
A fill is required to return a SysResultPtr to a TObject.
Definition: SchedulerBase.h:28
const std::map< std::string, RegionDef > & regionDefs() const
(const) access the current region definitions
Definition: SchedulerBase.h:61
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.
Definition: SchedulerBase.cxx:295
std::string name
The name of this action.
Definition: SchedulerBase.h:94
std::map< Action, std::set< Action >, CostOrdering > expand(const SchedulerBase &scheduler, const std::set< Action > &preExisting={}) const
Expand the dependencies of this action.
Definition: SchedulerBase.cxx:202
const ScheduleNode & getSchedule() const
Get the ROOT of the output filter schedule. Will be empty if schedule has not been called...
Definition: SchedulerBase.h:201
ScheduleNode(const Action &action)
Build the node from the action it performs.
Definition: SchedulerBase.h:159
std::vector< ScheduleNode > children
The children of this node (i.e. the ones that follow it)
Definition: SchedulerBase.h:165
bool operator==(const Action &rhs) const
Equality comparison operator for actions.
Definition: SchedulerBase.h:104
void actionDefinesMultipleVariables(const std::string &name, const std::vector< std::string > &defined)
Tell the scheduler that an action is defining multiple variables.
Definition: SchedulerBase.cxx:350
A variable defines a new variable.
Definition: SchedulerBase.h:26
ScheduleNode & getSchedule()
Get the ROOT of the output filter schedule. Will be empty if schedule has not been called...
Definition: SchedulerBase.h:198
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.
Definition: SchedulerBase.cxx:105
Ordering used in the actual scheduling process. Order by cost first, then type, then name...
Definition: SchedulerBase.h:109
Not a valid action, used to construct a placeholder action.
Definition: SchedulerBase.h:30