1 #ifndef RDFAnalysis_Node_H 2 #define RDFAnalysis_Node_H 31 template <
typename Detail>
51 const std::string&
name,
69 const std::string& name,
70 const std::string& expression)
89 const std::string& name,
90 const std::string& expression,
117 typename Ret_t =
typename ROOT::TTraits::CallableTraits<F>::ret_type>
118 std::enable_if_t<N==std::tuple_size<Ret_t>::value,
Node>*
Define(
119 const std::array<std::string, N>& names,
139 template <
typename F>
140 std::enable_if_t<std::is_convertible<typename ROOT::TTraits::CallableTraits<F>::ret_type, std::tuple<bool, float>>::value,
Node*>
Filter(
143 const std::string& name =
"",
161 template <
typename F>
162 std::enable_if_t<std::is_convertible<typename ROOT::TTraits::CallableTraits<F>::ret_type,
bool>::value,
Node*>
Filter(
165 const std::string& name =
"",
166 const std::string& cutflowName =
"",
167 const std::string& weight =
"",
179 const std::string& expression,
180 const std::string& name =
"",
181 const std::string& cutflowName =
"",
182 const std::string& weight =
"",
197 template <
typename F,
typename W>
198 std::enable_if_t<!std::is_convertible<F, std::string>::value && !std::is_convertible<W, std::string>::value,
Node*>
Filter(
201 const std::string& name,
202 const std::string& cutflowName,
217 template <
typename W>
219 const std::string& expression,
220 const std::string& name,
221 const std::string& cutflowName,
234 const Detail&
detail()
const {
return m_detail; }
242 bool isRoot()
const {
return m_parent ==
nullptr; }
256 std::unique_ptr<IBranchNamer>&&
namer,
258 const std::string& name =
"ROOT",
259 const std::string& cutflowName =
"Number of events",
260 const std::string& weight =
"",
263 return std::unique_ptr<Node>(
265 name, cutflowName, weight, strategy) );
272 void run(ULong64_t printEvery);
282 void run(ULong64_t printEvery, ULong64_t total);
294 template <
typename Monitor>
295 void run(Monitor monitor);
309 std::unique_ptr<IBranchNamer>&&
namer,
311 const std::string& name =
"ROOT",
312 const std::string& cutflowName =
"Number of events",
313 const std::string& weight =
"",
327 template <
typename W>
330 std::unique_ptr<IBranchNamer>&&
namer,
332 const std::string& name,
333 const std::string& cutflowName,
349 std::map<std::string, RNode>&&
rnodes,
350 const std::string& name,
351 const std::string& cutflowName,
352 const std::string& weight,
367 template <
typename W>
370 std::map<std::string, RNode>&&
rnodes,
371 const std::string& name,
372 const std::string& cutflowName,
378 Node* m_parent =
nullptr;
381 std::vector<std::unique_ptr<Node>> m_children;
388 #include "RDFAnalysis/Node.icc" 389 #endif //> !RDFAnalysis_Node_H The base class for the Node classes.
Node * parent()
Get the parent of this node.
Definition: Node.h:237
const std::string & cutflowName() const
Get the name in a cutflow.
Definition: NodeBase.h:395
Base class for the Node classes.
Definition: NodeBase.h:41
Node * Define(const std::string &name, const std::string &expression, const ColumnNames_t &columns)
Define a new variable on this node.
Definition: Node.h:88
const std::map< std::string, RNode > & rnodes() const
Get the RNode objects.
Definition: NodeBase.h:404
bool isMC() const
Was 'MC' mode activated?
Definition: NodeBase.h:401
ROOT::RDataFrame::ColumnNames_t ColumnNames_t
Helper typedef.
Definition: NodeBase.h:30
Detail detail_t
The type of the Detail on this node.
Definition: Node.h:37
std::enable_if_t< std::is_convertible< typename ROOT::TTraits::CallableTraits< F >::ret_type, std::tuple< bool, float > >::value, Node * > Filter(F f, const ColumnNames_t &columns={}, const std::string &name="", const std::string &cutflowName="", WeightStrategy strategy=WeightStrategy::Default)
Create a filter on this node.
const std::string & name() const
Get the name.
Definition: NodeBase.h:392
std::enable_if_t<!std::is_convertible< F, std::string >{}, T > enable_ifn_string_t
Reduce size of enable_if statements.
Definition: Helpers.h:114
bool isRoot() const
Is the node the root?
Definition: Node.h:242
Node * Define(const std::string &name, const std::string &expression)
Define a new variable on this node.
Definition: Node.h:68
const Detail & detail() const
(Const) get the node details
Definition: Node.h:234
Definition: CutflowDetail.h:11
Class to represent a single step in the analysis process.
Definition: Node.h:32
auto as_range(Container &container)
Make a range_t from a container.
Definition: Helpers.h:44
WeightStrategy
enum class to describe how weights are applied.
Definition: WeightStrategy.h:33
const IBranchNamer & namer() const
The namer.
Definition: NodeBase.h:409
Forward declaration for the node class.
auto children()
Allow access to iterate over the child nodes.
Definition: Node.h:227
std::enable_if_t< N==std::tuple_size< Ret_t >::value, Node > * Define(const std::array< std::string, N > &names, F f, const ColumnNames_t &columns)
Define several new variables on this node in a single statement.
Definition: Node.h:118
static std::unique_ptr< Node > createROOT(const RNode &rnode, std::unique_ptr< IBranchNamer > &&namer, bool isMC, const std::string &name="ROOT", const std::string &cutflowName="Number of events", const std::string &weight="", WeightStrategy strategy=WeightStrategy::Default)
Create the root node of the tree.
Definition: Node.h:254
enable_ifn_string_t< F, NodeBase * > Define(const std::string &name, F f, const ColumnNames_t &columns={})
Define a new variable on this node.
Detail & detail()
Get the node details.
Definition: Node.h:232
ROOT::RDF::RNode RNode
Helper typedef.
Definition: NodeBase.h:28
auto children() const
Allow (const) access to iterate over the child nodes.
Definition: Node.h:229
enable_ifn_string_t< F, Node * > Define(const std::string &name, F f, const ColumnNames_t &columns={})
Define a new variable on this node.
Definition: Node.h:50
void run(ULong64_t printEvery)
Trigger the run.
const Node * parent() const
(const) get the parent of this node
Definition: Node.h:239