Skip to content

Commit 35357b0

Browse files
committed
bugfix non-progressing trees in a chain when SetAddress()
1 parent 937b05d commit 35357b0

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

infra/GenericContainerFiller.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ void GenericContainerFiller::Init() {
5656
config_.AddBranchConfig(branchConfig);
5757

5858
for (int iV = 0; iV < branch_values_.size(); iV++) {
59-
TBranch* branch = tree_in_->GetBranch(branch_map_.at(iV).name_.c_str());
60-
SetAddressFICS(branch, branch_map_.at(iV), branch_values_.at(iV));
59+
SetAddressFICS(branch_map_.at(iV).name_, branch_map_.at(iV), branch_values_.at(iV));
6160
}
6261

6362
generic_detector_ = new GenericDetector(branchConfig.GetId());
@@ -114,14 +113,14 @@ int GenericContainerFiller::DetermineFieldIdByName(const std::vector<IndexMap>&
114113
return distance;
115114
}
116115

117-
void GenericContainerFiller::SetAddressFICS(TBranch* branch, const IndexMap& imap, FICS& ficc) {
118-
if (imap.field_type_ == "TLeafF") branch->SetAddress(&ficc.float_);
116+
void GenericContainerFiller::SetAddressFICS(const std::string& branchName, const IndexMap& imap, FICS& ficc) {
117+
if (imap.field_type_ == "TLeafF") tree_in_->SetBranchAddress(branchName.c_str(), &ficc.float_);
119118
else if (imap.field_type_ == "TLeafI")
120-
branch->SetAddress(&ficc.int_);
119+
tree_in_->SetBranchAddress(branchName.c_str(), &ficc.int_);
121120
else if (imap.field_type_ == "TLeafB")
122-
branch->SetAddress(&ficc.char_);
121+
tree_in_->SetBranchAddress(branchName.c_str(), &ficc.char_);
123122
else if (imap.field_type_ == "TLeafS")
124-
branch->SetAddress(&ficc.short_);
123+
tree_in_->SetBranchAddress(branchName.c_str(), &ficc.short_);
125124
else
126125
throw std::runtime_error("GenericContainerFiller::SetAddressFICS(): unsupported filed type " + imap.field_type_);
127126
}

infra/GenericContainerFiller.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class GenericContainerFiller {
6363
void Finish();
6464

6565
static int DetermineFieldIdByName(const std::vector<IndexMap>& iMap, const std::string& name);
66-
static void SetAddressFICS(TBranch* branch, const IndexMap& imap, FICS& ficc);
66+
void SetAddressFICS(const std::string& branchName, const IndexMap& imap, FICS& ficc);
6767
static void SetFieldsFICS(const std::vector<IndexMap>& imap, AnalysisTree::Container& container, const std::vector<FICS>& ficc);
6868

6969
std::string file_in_name_;

0 commit comments

Comments
 (0)