Skip to content

Commit 3dee913

Browse files
committed
add title_ to BranchConfig for detailed description if needed
1 parent e52e4cb commit 3dee913

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

core/BranchConfig.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void BranchConfig::GenerateId() {
1414
id_ = id_hasher(name_);
1515
}
1616

17-
BranchConfig::BranchConfig(std::string name, DetType type) : name_(std::move(name)), type_(type) {
17+
BranchConfig::BranchConfig(std::string name, DetType type, std::string title) : name_(std::move(name)), type_(type), title_(std::move(title)) {
1818
GenerateId();
1919

2020
if (type_ == DetType::kTrack) {
@@ -184,13 +184,18 @@ void BranchConfig::GuaranteeFieldNameVacancy(const std::string& name) const {
184184
}
185185

186186
void BranchConfig::Print() const {
187-
std::cout << "Branch " << name_ << " (id=" << id_ << ") consists of:" << std::endl;
188-
std::cout << "Floating fields:" << std::endl;
187+
std::cout << "Branch " << name_ << " (" << title_ << ") consists of:" << std::endl;
188+
std::cout << "\nFloating fields:" << std::endl;
189189
VectorConfig<float>::Print();
190-
std::cout << "Integer fields:" << std::endl;
190+
std::cout << "\nInteger fields:" << std::endl;
191191
VectorConfig<int>::Print();
192-
std::cout << "Boolean fields:" << std::endl;
192+
std::cout << "\nBoolean fields:" << std::endl;
193193
VectorConfig<bool>::Print();
194194
// std::cout << std::endl;
195195
}
196+
197+
void BranchConfig::PrintBranchId() const {
198+
std::cout << "Branch " << name_ << " (id=" << id_ << ")" << std::endl;
199+
}
200+
196201
}// namespace AnalysisTree

core/BranchConfig.hpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,12 @@ class BranchConfig : public VectorConfig<int>, public VectorConfig<float>, publi
125125
BranchConfig& operator=(const BranchConfig&) = default;
126126
~BranchConfig() override = default;
127127

128-
BranchConfig(std::string name, DetType type);
128+
BranchConfig(std::string name, DetType type, std::string title="");
129129

130130
void Print() const override;
131131

132+
void PrintBranchId() const;
133+
132134
ANALYSISTREE_ATTR_NODISCARD Types GetFieldType(const std::string& sField) const;
133135
ANALYSISTREE_ATTR_NODISCARD ShortInt_t GetFieldId(const std::string& sField) const;
134136

@@ -159,13 +161,17 @@ class BranchConfig : public VectorConfig<int>, public VectorConfig<float>, publi
159161
}
160162
}
161163

164+
void SetTitle(std::string title) { title_ = std::move(title); }
165+
162166
// Getters
163167
template<typename T>
164168
ANALYSISTREE_ATTR_NODISCARD const MapType& GetMap() const { return VectorConfig<T>::GetMap(); }
165169
template<typename T>
166170
ANALYSISTREE_ATTR_NODISCARD ShortInt_t GetSize() const { return VectorConfig<T>::GetSize(); }
167171

168172
ANALYSISTREE_ATTR_NODISCARD std::string GetName() const { return name_; }
173+
ANALYSISTREE_ATTR_NODISCARD std::string GetTitle() const { return title_; }
174+
169175
template<typename T>
170176
ANALYSISTREE_ATTR_NODISCARD std::vector<std::string> GetFieldsNamesT() const {
171177
std::vector<std::string> result;
@@ -193,10 +199,11 @@ class BranchConfig : public VectorConfig<int>, public VectorConfig<float>, publi
193199
void GuaranteeFieldNameVacancy(const std::string& name) const;
194200

195201
std::string name_;
202+
std::string title_;
196203
size_t id_{0};
197204
DetType type_{DetType(UndefValueShort)};
198205

199-
ClassDefOverride(BranchConfig, 3);
206+
ClassDefOverride(BranchConfig, 4);
200207
};
201208

202209
// BranchConfig Merge(const BranchConfig& primary, const BranchConfig& secondary);

core/Configuration.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ void Configuration::Print(Option_t*) const {
8787
}
8888
}
8989

90+
void Configuration::PrintBranchIds() const {
91+
for (const auto& branch : branches_) {
92+
std::cout << std::endl;
93+
branch.second.PrintBranchId();
94+
}
95+
}
96+
9097
const std::string& Configuration::GetMatchName(const std::string& br1, const std::string& br2) const {
9198
auto search = matches_index_.find({br1, br2});
9299
if (search != matches_index_.end()) {

core/Configuration.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ class Configuration : public TObject {
9898

9999
void Print(Option_t* = "") const;
100100

101+
void PrintBranchIds() const;
102+
101103
static MatchingIndex MakeMatchingIndex(const std::vector<MatchingConfig>& matches) {
102104
MatchingIndex result;
103105
for (auto& match : matches) {

0 commit comments

Comments
 (0)