33 : name_(field.GetBranchName() +
"." + field.GetName()),
43 Variable(std::string name, std::vector<Field> fields, std::function<
double(std::vector<double>&)> lambda);
60 ANALYSISTREE_ATTR_NODISCARD
const std::string& GetName()
const {
return name_; }
61 ANALYSISTREE_ATTR_NODISCARD
const std::vector<Field>& GetFields()
const {
return fields_; }
62 ANALYSISTREE_ATTR_NODISCARD
short GetNumberOfBranches()
const {
return n_branches_; }
63 ANALYSISTREE_ATTR_NODISCARD std::set<std::string> GetBranches()
const;
64 ANALYSISTREE_ATTR_NODISCARD std::string GetBranchName()
const;
66 double GetValue(std::vector<const BranchChannel*>& bch, std::vector<size_t>&
id)
const;
70 double GetValue(
const T&
object)
const {
71 assert(is_init_ && n_branches_ == 1);
73 for (
const auto& field : fields_) {
74 vars_.emplace_back(field.template GetValue(
object));
76 return lambda_(vars_);
81 void SetName(std::string name) { name_ = std::move(name); }
85 void IfEmptyVariableConvertToOnes(
const Variable& var);
89 std::vector<Field> fields_{};
90 mutable std::vector<double> vars_{};
91 std::function<double(std::vector<double>&)> lambda_{[](std::vector<double>& var) {
return var.at(0); }};