From 4f45a14936f9d2f39f48f4a718c3e86f010763a2 Mon Sep 17 00:00:00 2001 From: Andrew Gilbert Date: Thu, 18 Jul 2024 21:46:47 +0200 Subject: [PATCH] fix major bug in fast vertical morph --- src/CMSHistFunc.cc | 1 + src/CMSHistSum.cc | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CMSHistFunc.cc b/src/CMSHistFunc.cc index 49cbfeb228f..11b5b9944f5 100644 --- a/src/CMSHistFunc.cc +++ b/src/CMSHistFunc.cc @@ -607,6 +607,7 @@ void CMSHistFunc::updateCache() const { cache_.CopyValues(mcache_[idx].step2); if (vtype_ == VerticalSetting::LogQuadLinear) { cache_.Exp(); + cache_.Scale(mcache_[idx].step1.Integral() / mcache_[idx].step2.Integral()); } cache_.CropUnderflows(); if (enable_fast_vertical_) fast_vertical_ = true; diff --git a/src/CMSHistSum.cc b/src/CMSHistSum.cc index 0f53d6bdfa9..0df55526700 100644 --- a/src/CMSHistSum.cc +++ b/src/CMSHistSum.cc @@ -283,9 +283,9 @@ void CMSHistSum::updateMorphs() const { compcache_[ip][ibin] *= extdata[ibin]; } } - } - if (vtype_[ip] == CMSHistFunc::VerticalSetting::LogQuadLinear) { - compcache_[ip].Log(); + if (vtype_[ip] == CMSHistFunc::VerticalSetting::LogQuadLinear) { + compcache_[ip].Log(); + } } } int n_morphs = vmorphpars_.size(); @@ -362,6 +362,7 @@ void CMSHistSum::updateCache() const { staging_ = compcache_[i]; if (vtype_[i] == CMSHistFunc::VerticalSetting::LogQuadLinear) { staging_.Exp(); + staging_.Scale(storage_[process_fields_[i]].Integral() / staging_.Integral()); } staging_.CropUnderflows(); vectorized::mul_add(valsum_.size(), coeffvals_[i], &(staging_[0]), &valsum_[0]);