Skip to content
Snippets Groups Projects
Commit c1c039e1 authored by Sergey Gorbunov's avatar Sergey Gorbunov
Browse files

qa: fiw warnings in the histogram fit

parent da046d6d
No related branches found
No related tags found
No related merge requests found
......@@ -134,19 +134,25 @@ namespace cbm::qa::util
// 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));
if (fabs(pHist->GetBinContent(i)) > 0.) {
entries++;
}
}
// fit the histogram in quite mode
if (entries > 0) {
pHist->Fit(&fit, "Q");
TF1* f = pHist->GetFunction("FitKaniadakisGaussian");
assert(f);
// calculate the Std Dev
f->SetParameter(1, sqrt(f->CentralMoment(2, xMin, xMax)));
// calculate the Std Dev and put it to parameter [1]
if (entries > 1) {
f->SetParameter(1, sqrt(f->CentralMoment(2, xMin, xMax)));
}
else {
f->SetParameter(1, f->GetParameter(3));
}
f->SetParError(1, f->GetParError(3));
// fix some parameters to prevent them from showing up in the stat window
......@@ -154,7 +160,6 @@ 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));
}
......
......@@ -28,12 +28,7 @@
#include "CbmMuchPoint.h"
#include "CbmQaCanvas.h"
#include "CbmTimeSlice.h"
#include "FairRootManager.h"
#include <FairSink.h>
#include <FairTask.h>
#include <Logger.h>
#include "TArrayI.h"
#include "TF1.h"
#include "TFile.h"
......@@ -41,6 +36,11 @@
#include "TParameter.h"
#include "TPaveStats.h"
#include "TStyle.h"
#include <FairSink.h>
#include <FairTask.h>
#include <Logger.h>
#include <TClonesArray.h>
#include <TGenericClassInfo.h>
#include <TH1.h>
......@@ -312,7 +312,9 @@ void CbmMuchHitFinderQa::Exec(Option_t*)
void CbmMuchHitFinderQa::FinishTask()
{
if (fVerbose > 0) { printf(" CbmMuchHitFinderQa FinishTask\n"); }
if (fVerbose > 0) {
printf(" CbmMuchHitFinderQa FinishTask\n");
}
gStyle->SetPaperSize(20, 20);
......@@ -333,11 +335,13 @@ void CbmMuchHitFinderQa::FinishTask()
for (UInt_t i = 0; i < vResHistos.size(); i++) {
TH1D* histo = vResHistos[i];
histo->Sumw2();
histo->Fit("gaus", "Q");
auto f = histo->GetFunction("gaus");
if (f) {
f->SetLineWidth(3);
f->SetLineColor(kRed);
if (histo->GetRMS() > 0.) {
histo->Fit("gaus", "Q");
auto f = histo->GetFunction("gaus");
if (f) {
f->SetLineWidth(3);
f->SetLineColor(kRed);
}
}
// histo->SetStats(kTRUE);
}
......@@ -598,7 +602,9 @@ void CbmMuchHitFinderQa::PullsQa()
continue;
}
if (verbose) { printf(" file %i event %i pointId %i", link.GetFile(), link.GetEntry(), link.GetIndex()); }
if (verbose) {
printf(" file %i event %i pointId %i", link.GetFile(), link.GetEntry(), link.GetIndex());
}
CbmMuchPoint* point = (CbmMuchPoint*) fPoints->Get(link);
Double_t xMC = 0.5 * (point->GetXIn() + point->GetXOut());
......@@ -650,7 +656,9 @@ void CbmMuchHitFinderQa::ClusterDeconvQa()
for (Int_t iPoint = 0; iPoint < nMuchPoints; iPoint++) {
link.SetIndex(iPoint);
link.SetWeight(0.);
if (IsSignalPoint(link)) { fSignalPoints.SetVal(fSignalPoints.GetVal() + 1); }
if (IsSignalPoint(link)) {
fSignalPoints.SetVal(fSignalPoints.GetVal() + 1);
}
vPoints.push_back(link);
}
}
......@@ -678,7 +686,9 @@ void CbmMuchHitFinderQa::ClusterDeconvQa()
assert(it != vPoints.end());
if (it->GetWeight() > 0.) continue;
it->SetWeight(1.);
if (IsSignalPoint(pointLink)) { fSignalHits.SetVal(fSignalHits.GetVal() + 1); }
if (IsSignalPoint(pointLink)) {
fSignalHits.SetVal(fSignalHits.GetVal() + 1);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment