Skip to content

Commit 519e6df

Browse files
committed
enable PlainTreeFiller::SetFieldsToIgnore() for all default fields
1 parent 33be63b commit 519e6df

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

infra/PlainTreeFiller.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ void PlainTreeFiller::SetFieldsToIgnore(const std::vector<std::string>&& fields_
2525
}
2626

2727
void PlainTreeFiller::Init() {
28+
if (is_ignore_defual_fields_) {
29+
std::vector<std::string> defaultFieldsNames;
30+
auto mapF = config_->GetBranchConfig(branch_name_).GetMap<float>();
31+
auto mapI = config_->GetBranchConfig(branch_name_).GetMap<int>();
32+
auto mapB = config_->GetBranchConfig(branch_name_).GetMap<bool>();
33+
for (auto& m : {mapF, mapI, mapB}) {
34+
for (auto& me : m) {
35+
if (me.second.id_ < 0) defaultFieldsNames.emplace_back(me.first);
36+
}
37+
}
38+
SetFieldsToIgnore(std::move(defaultFieldsNames));
39+
}
2840

2941
if (!branch_name_.empty()) {
3042
const auto& branch_config = config_->GetBranchConfig(branch_name_);

infra/PlainTreeFiller.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class PlainTreeFiller : public AnalysisTask {
2929

3030
void SetFieldsToIgnore(const std::vector<std::string>&& fields_to_ignore);
3131

32+
void SetIsIgnoreDefaultFields(bool is = true) { is_ignore_defual_fields_ = is; }
33+
3234
protected:
3335
TFile* file_{nullptr};
3436
TTree* plain_tree_{nullptr};
@@ -39,6 +41,8 @@ class PlainTreeFiller : public AnalysisTask {
3941

4042
std::vector<float> vars_{};
4143
std::vector<std::string> fields_to_ignore_{};
44+
45+
bool is_ignore_defual_fields_{false};
4246
};
4347

4448
}// namespace AnalysisTree

0 commit comments

Comments
 (0)