Skip to content

Commit f2271e6

Browse files
lubynetsOleksii Lubynets
andauthored
fix logical error of previous commit (#117)
Co-authored-by: Oleksii Lubynets <lubynets@lxbuild07.gsi.de>
1 parent c55528e commit f2271e6

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

infra/AnalysisEntry.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,24 @@ bool AnalysisEntry::ApplyCutOnBranches(std::vector<const Branch*>& br, std::vect
2727
if(br.size() != cuts.size() || cuts.size() != ch.size()) {
2828
throw std::runtime_error("AnalysisTree::AnalysisEntry::ApplyCutOnBranches() - Branch, Cuts and Ch vectors must have the same size");
2929
}
30+
bool ok{true};
3031
std::vector<const BranchChannel*> bch_vec;
3132
std::vector<size_t> id_vec;
3233
bch_vec.reserve(br.size());
3334
id_vec.reserve(br.size());
3435
for(int i=0; i<br.size(); i++) {
3536
BranchChannel* bchptr = new BranchChannel(br.at(i), ch.at(i));
37+
if(cuts.at(i) != nullptr) {
38+
if(!cuts.at(i)->Apply(*bchptr)) {
39+
ok = false;
40+
delete bchptr;
41+
break;
42+
}
43+
}
3644
bch_vec.emplace_back(bchptr);
3745
id_vec.emplace_back(br.at(i)->GetId());
3846
}
39-
bool result = !cuts_ || cuts_->Apply(bch_vec, id_vec);
47+
bool result = ok && (!cuts_ || cuts_->Apply(bch_vec, id_vec));
4048
for(auto& bv : bch_vec) {
4149
delete bv;
4250
}

0 commit comments

Comments
 (0)