From 5d7039e16f5acb54b5f491c609fe99ae58775c13 Mon Sep 17 00:00:00 2001 From: James Shen <46590537+JamesJieranShen@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:23:57 -0500 Subject: [PATCH] have fitcentroid correctly set position to be invalid when charge = 0. (#215) --- src/fit/src/FitCentroidProc.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fit/src/FitCentroidProc.cc b/src/fit/src/FitCentroidProc.cc index 832e016e..3309ce22 100644 --- a/src/fit/src/FitCentroidProc.cc +++ b/src/fit/src/FitCentroidProc.cc @@ -50,9 +50,14 @@ Processor::Result FitCentroidProc::Event(DS::Root *ds, DS::EV *ev) { centroid += Qpow * pmtpos; } - centroid *= 1.0 / totalQ; DS::FitResult *fit = new DS::FitResult("FitCentroid"); - fit->SetPosition(centroid); + fit->SetEnablePosition(true); + if (totalQ) { + centroid *= 1.0 / totalQ; + fit->SetPosition(centroid); + } else { + fit->SetValidPosition(false); + } ev->AddFitResult(fit); return Processor::OK;