Skip to content

Commit d867e73

Browse files
authored
Merge pull request #40343 from kdlong/from-CMSSW_13_0_0_pre2
Fix -1 precision in SimpleFlatTableProducer
2 parents ba0cbbe + 19b2cd6 commit d867e73

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ class FuncVariable : public Variable<ObjType> {
5353
void fill(std::vector<const ObjType *> &selobjs, nanoaod::FlatTable &out) const override {
5454
std::vector<ValType> vals(selobjs.size());
5555
for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
56+
ValType val = func_(*selobjs[i]);
5657
if constexpr (std::is_same<ValType, float>()) {
5758
if (this->precision_ == -2) {
58-
vals[i] = MiniFloatConverter::reduceMantissaToNbitsRounding(func_(*selobjs[i]), precisionFunc_(*selobjs[i]));
59-
} else {
60-
vals[i] = func_(*selobjs[i]);
61-
}
59+
auto prec = precisionFunc_(*selobjs[i]);
60+
vals[i] = prec > 0 ? MiniFloatConverter::reduceMantissaToNbitsRounding(val, prec) : val;
61+
} else
62+
vals[i] = val;
6263
} else {
63-
vals[i] = func_(*selobjs[i]);
64+
vals[i] = val;
6465
}
6566
}
6667
out.template addColumn<ValType>(this->name_, vals, this->doc_, this->precision_);

0 commit comments

Comments
 (0)