Skip to content

Commit b1afdf2

Browse files
committed
add OpenCut() constructor of SimpleCut (always passed)
1 parent 8b9998f commit b1afdf2

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

infra/SimpleCut.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ SimpleCut EqualsCut(const Variable& var, int value, const std::string& title) {
4545
return SimpleCut(var, value, title);
4646
}
4747

48+
SimpleCut OpenCut(const std::string& branchName, const std::string& title) {
49+
return SimpleCut({branchName + ".ones"}, [](const std::vector<double>& par) { return true; });
50+
}
51+
4852
SimpleCut::SimpleCut(const Variable& var, int value, std::string title) : title_(std::move(title)) {
4953
vars_.emplace_back(var);
5054
lambda_ = [value](std::vector<double>& vars) { return vars[0] <= value + SmallNumber && vars[0] >= value - SmallNumber; };

infra/SimpleCut.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ class SimpleCut {
8383
*/
8484
friend SimpleCut EqualsCut(const Variable& var, int value, const std::string& title);
8585

86+
/**
87+
* Constructor for a cut which is always passed
88+
* (needed for keeping generality of the user's code, when a set of cuts
89+
* is iterated and an iteration with no-cut is needed)
90+
* @param branchName name of the branch, which is present in other cuts
91+
*/
92+
friend SimpleCut OpenCut(const std::string& branchName, const std::string& title);
93+
8694
/**
8795
* @brief Evaluates cut
8896
* @tparam T type of data-object associated with TTree
@@ -131,6 +139,7 @@ SimpleCut RangeCut(const std::string& variable_name, double lo, double hi, const
131139
SimpleCut EqualsCut(const std::string& variable_name, int value, const std::string& title = "");
132140
SimpleCut RangeCut(const Variable& var, double lo, double hi, const std::string& title = "");
133141
SimpleCut EqualsCut(const Variable& var, int value, const std::string& title = "");
142+
SimpleCut OpenCut(const std::string& branchName, const std::string& title = "alwaysTrue");
134143

135144
}// namespace AnalysisTree
136145
#endif//ANALYSISTREE_SIMPLECUT_H

0 commit comments

Comments
 (0)