29 virtual ~Field() =
default;
31 explicit Field(std::string name) : field_(std::move(name)){};
33 Field(std::string branch, std::string field) : branch_(std::move(branch)),
34 field_(std::move(field)){};
36 friend bool operator==(
const Field& that,
const Field& other);
37 friend bool operator>(
const Field& that,
const Field& other);
38 friend bool operator<(
const Field& that,
const Field& other);
47 ANALYSISTREE_ATTR_NODISCARD
const std::string& GetName()
const {
return field_; }
48 ANALYSISTREE_ATTR_NODISCARD
const std::string& GetBranchName()
const {
return branch_; }
50 ANALYSISTREE_ATTR_NODISCARD
size_t GetBranchId()
const {
return branch_id_; }
51 ANALYSISTREE_ATTR_NODISCARD
short GetFieldId()
const {
return field_id_; }
53 ANALYSISTREE_ATTR_NODISCARD DetType GetBranchType()
const {
return branch_type_; }
54 ANALYSISTREE_ATTR_NODISCARD Types GetFieldType()
const {
return field_type_; }
65 throw std::runtime_error(
"Field::Fill - Field " + field_ +
" is not initialized");
67 switch (field_type_) {
68 case Types::kFloat:
return object.template GetField<float>(field_id_);
69 case (Types::kInteger):
return object.template GetField<int>(field_id_);
70 case Types::kBool:
return object.template GetField<bool>(field_id_);
71 default:
throw std::runtime_error(
"Unknown field type");
77 ANALYSISTREE_ATTR_NODISCARD
const Branch* GetParentBranch()
const {
return parent_branch_; }
78 ANALYSISTREE_ATTR_NODISCARD
bool IsInitialized()
const {
return is_init_; }
79 explicit operator bool()
const {
return IsInitialized(); }
84 const Branch* parent_branch_{
nullptr};
90 Types field_type_{Types::kNumberOfTypes};
93 DetType branch_type_{DetType(UndefValueShort)};