From 96c70477a5bf7c1b5396777ac7d3f91551ac989b Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Fri, 24 Nov 2023 18:28:08 +0000 Subject: [PATCH] QA: suppress warnings in the histogram fit --- core/base/CbmMatchRecoToMC.cxx | 3 ++- core/qa/CbmQaUtil.cxx | 23 ++++++++++++++------ reco/L1/qa/CbmCaOutputQa.cxx | 6 ++--- reco/L1/qa/CbmCaTrackFitQa.cxx | 3 ++- reco/L1/qa/CbmTrackerInputQaTof.cxx | 3 ++- reco/L1/qa/CbmTrackerInputQaTrd.cxx | 3 ++- reco/detectors/trd/qa/CbmTrdCalibTracker.cxx | 3 ++- 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/core/base/CbmMatchRecoToMC.cxx b/core/base/CbmMatchRecoToMC.cxx index 63ecb93969..40fa696ab1 100644 --- a/core/base/CbmMatchRecoToMC.cxx +++ b/core/base/CbmMatchRecoToMC.cxx @@ -126,7 +126,8 @@ InitStatus CbmMatchRecoToMC::Init() if (fbSuppressHitReMatching) { std::stringstream msg; msg << "\033[1;31mCbmMatchRecoToMC (\"" << fName << "\"): the cluster and hit matching routines for MVD, STS, "; - msg << "MuCh, TRD, TOF, FSD will be suppressed by a request from CbmMatchRecoToMC::SuppressHitMatching():\033[0m\n"; + msg + << "MuCh, TRD, TOF, FSD will be suppressed by a request from CbmMatchRecoToMC::SuppressHitReMatching():\033[0m\n"; LOG(warn) << msg.str(); } diff --git a/core/qa/CbmQaUtil.cxx b/core/qa/CbmQaUtil.cxx index e78e2e8371..d2cee90e54 100644 --- a/core/qa/CbmQaUtil.cxx +++ b/core/qa/CbmQaUtil.cxx @@ -105,6 +105,8 @@ namespace cbm::qa::util // returns mean and std.dev // + auto retValue = std::tuple(0., -1.); + double xMin = pHist->GetXaxis()->GetXmin(); double xMax = pHist->GetXaxis()->GetXmax(); @@ -129,16 +131,21 @@ namespace cbm::qa::util fit.SetParLimits(4, 0.00001, 5.); - // fit in a quite mode + // check if the histogram has enough entries excluding underflow and overflow bins + double entries = 0.; + for (int i = 1; i <= pHist->GetNbinsX(); ++i) { + entries += fabs(pHist->GetBinContent(i)); + } + + // fit the histogram in quite mode + if (entries > 0) { - if (pHist->GetEntries() > 0) { pHist->Fit(&fit, "Q"); - } - TF1* f = pHist->GetFunction("FitKaniadakisGaussian"); - if (nullptr != f) { - // calculate the Std Dev + TF1* f = pHist->GetFunction("FitKaniadakisGaussian"); + assert(f); + // calculate the Std Dev f->SetParameter(1, sqrt(f->CentralMoment(2, xMin, xMax))); f->SetParError(1, f->GetParError(3)); @@ -147,6 +154,8 @@ namespace cbm::qa::util f->FixParameter(2, f->GetParameter(2)); f->FixParameter(3, f->GetParameter(3)); f->FixParameter(4, f->GetParameter(4)); + + retValue = std::tuple(f->GetParameter(0), f->GetParameter(1)); } TPaveStats* stats = GetHistStats(pHist); @@ -156,7 +165,7 @@ namespace cbm::qa::util stats->SetOptStat(111110); stats->SetOptFit(100001); - return (nullptr != f) ? std::tuple(f->GetParameter(0), f->GetParameter(1)) : std::tuple(0., -1.); + return retValue; } diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx index a3fa5d153a..7dc3590589 100644 --- a/reco/L1/qa/CbmCaOutputQa.cxx +++ b/reco/L1/qa/CbmCaOutputQa.cxx @@ -526,9 +526,9 @@ InitStatus OutputQa::InitHistograms() fvpTrackHistograms[type]->Init(); }; - for (int i = 0; i < ETrackType::kEND; ++i) { - LOG(info) << i << ' ' << fvpTrackHistograms[i].get() << ' ' << fvbTrackTypeOn[i]; - } + //for (int i = 0; i < ETrackType::kEND; ++i) { + //LOG(info) << i << ' ' << fvpTrackHistograms[i].get() << ' ' << fvbTrackTypeOn[i]; + //} // TODO: Replace these parameters into the AddTrackType method!!! RegisterTrackQa("all", "all", ETrackType::kAll); diff --git a/reco/L1/qa/CbmCaTrackFitQa.cxx b/reco/L1/qa/CbmCaTrackFitQa.cxx index 7a2d1cf5f1..f109f05767 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.cxx +++ b/reco/L1/qa/CbmCaTrackFitQa.cxx @@ -15,6 +15,7 @@ #include "CaTrackFit.h" #include "CbmL1Track.h" #include "CbmQaCanvas.h" +#include "CbmQaUtil.h" #include "TF1.h" #include "TFormula.h" #include "TH1.h" @@ -79,7 +80,7 @@ CbmQaCanvas* TrackFitQa::CreatePullPlot() fit.SetParLimits(3, 0., 2.); pCanv->cd(iType + 1); fvphPulls[type]->Draw(); - fvphPulls[type]->Fit("fitpull", "Q"); + cbm::qa::util::FitKaniadakisGaussian(fvphPulls[type]); } return pCanv; diff --git a/reco/L1/qa/CbmTrackerInputQaTof.cxx b/reco/L1/qa/CbmTrackerInputQaTof.cxx index 6e1bc555cb..dd8a63c122 100644 --- a/reco/L1/qa/CbmTrackerInputQaTof.cxx +++ b/reco/L1/qa/CbmTrackerInputQaTof.cxx @@ -28,6 +28,7 @@ //#include "CbmTofParModGeo.h" //#include "CbmTofParSetDigi.h" // for CbmTofParSetDigi //#include "CbmTofParSetGeo.h" +#include "CbmQaUtil.h" #include "CbmTofPoint.h" #include <FairRootManager.h> @@ -724,7 +725,7 @@ TFolder& CbmTrackerInputQaTof::GetQa() } for (UInt_t i = 0; i < fHistList.size(); i++) { - fHistList[i]->Fit("gaus", "Q"); // Q for the quiet mode + cbm::qa::util::FitKaniadakisGaussian(fHistList[i]); } for (UInt_t i = 0; i < 3; i++) { diff --git a/reco/L1/qa/CbmTrackerInputQaTrd.cxx b/reco/L1/qa/CbmTrackerInputQaTrd.cxx index ac26273d5d..be4464037d 100644 --- a/reco/L1/qa/CbmTrackerInputQaTrd.cxx +++ b/reco/L1/qa/CbmTrackerInputQaTrd.cxx @@ -18,6 +18,7 @@ #include "CbmMatch.h" #include "CbmQaCanvas.h" //#include "CbmSetup.h" +#include "CbmQaUtil.h" #include "CbmTimeSlice.h" #include "CbmTrdCluster.h" #include "CbmTrdDigi.h" @@ -742,7 +743,7 @@ TFolder& CbmTrackerInputQaTrd::GetQa() } for (UInt_t i = 0; i < fHistList.size(); i++) { - fHistList[i]->Fit("gaus", "Q"); // Q for the quiet mode + cbm::qa::util::FitKaniadakisGaussian(fHistList[i]); } for (UInt_t i = 0; i < 6; i++) { diff --git a/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx b/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx index 259a0fe8f5..ecaf70f898 100644 --- a/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx +++ b/reco/detectors/trd/qa/CbmTrdCalibTracker.cxx @@ -18,6 +18,7 @@ #include "CbmMatch.h" #include "CbmQaCanvas.h" //#include "CbmSetup.h" +#include "CbmQaUtil.h" #include "CbmTimeSlice.h" #include "CbmTrdCluster.h" #include "CbmTrdDigi.h" @@ -818,7 +819,7 @@ TFolder& CbmTrdCalibTracker::GetQa() } for (UInt_t i = 0; i < fHistList.size(); i++) { - fHistList[i]->Fit("gaus", "Q"); // Q for the quiet mode + cbm::qa::util::FitKaniadakisGaussian(fHistList[i]); } for (UInt_t i = 0; i < 6; i++) { -- GitLab