From f26a28baa59863fffa43a74f26a821c4497e13fb Mon Sep 17 00:00:00 2001 From: Tobias Bus Date: Fri, 19 May 2017 14:03:55 +0200 Subject: [PATCH] analyzer: found a big bug in integral function, it was a sum not an integral all along, until now! --- MABS_run_analyzer/ChargeSpektrum.c | 9 ++++++--- MABS_run_analyzer/HistogramType.c | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index e632ea1..6d48a5a 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -105,8 +105,8 @@ void ChargeSpektrum(TString runnumber = "") // compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized); // compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS); // compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); - compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized); - compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); +// compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized); + compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized); // runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefired, "", 0); //compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS); // compareHistogramClassVector2.push_back(runs[runi]->histogramthreshold); @@ -116,7 +116,10 @@ void ChargeSpektrum(TString runnumber = "") // runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized->calibrated, runs[runi]->processed->fNoiseInfo.fPedestals, "", 1); // runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized, runs[runi]->histogramwoRTS->normalized->calibrated->Seed, "landau", 1, 1, 0, 200); // runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0); -// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Seed, "landau", true); + +// Integralberechnung vom Veto Peak + runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized, runs[runi]->histogramwoRTS->normalized->Seed, "GaussTail", true); + // runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Sum, "gaus", true); // // Uncomment below to do analysis without RTS pixel diff --git a/MABS_run_analyzer/HistogramType.c b/MABS_run_analyzer/HistogramType.c index 238be69..4ef06b1 100644 --- a/MABS_run_analyzer/HistogramType.c +++ b/MABS_run_analyzer/HistogramType.c @@ -351,7 +351,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType, // cout << colorred << gMinuit->fCstatu.Data() << endlr; } while (gMinuit->fCstatu.Contains("FAILED") && fittries++ < 8); posMax = histogrampointer->GetXaxis()->GetBinCenter(histogrampointer->GetMaximumBin()); // Methode 1 - integralPeak = histogrampointer->Integral(min+fittries*min/20, histogrampointer->GetXaxis()->FindBin(posMaxValHist)); + integralPeak = histogrampointer->Integral(min+fittries*min/20, histogrampointer->GetXaxis()->FindBin(posMaxValHist), "width"); // if (verbose) // { // cout << coloryellow << "min " << histogrampointer->GetXaxis()->GetBinCenter( min ) << endlr; @@ -366,7 +366,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType, } else { histogrampointer->Fit(fitFunc, "N,Q,W", "", noiseborder, posMaxValHist); noiseborder = FindBorderToPeak(histogrampointer, noiseborder,fitFunc->GetParameter(1), verbose); // starting point of histogram integration - integralPeak = histogrampointer->Integral(histogrampointer->GetXaxis()->FindBin(noiseborder), histogrampointer->GetXaxis()->FindBin(posMaxValHist)); + integralPeak = histogrampointer->Integral(histogrampointer->GetXaxis()->FindBin(noiseborder), histogrampointer->GetXaxis()->FindBin(posMaxValHist), "width"); posMax = fitFunc->GetMaximumX(); // Methode 2 fitFunc->SetLineStyle(1); // normal for the following fits if (verbose) @@ -629,7 +629,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType, //parameters[7] = FindBorderToPeak(histogrampointer, noiseborder,def_peakcenter, verbose); // starting point of histogram integration parameters[7] = parameters[1] - 2*parameters[2] ; // starting point of histogram integration parameters[8] = parameters[1] + 2*parameters[2] ; // end point of histogram integration - parameters[6] = histogrampointer->Integral(histogrampointer->GetXaxis()->FindBin( parameters[1] - 2*parameters[2] ), histogrampointer->GetXaxis()->FindBin( parameters[1] + 2*parameters[2])); // integral value of histogram (NOT fit) + parameters[6] = histogrampointer->Integral(histogrampointer->GetXaxis()->FindBin( parameters[1] - 2*parameters[2] ), histogrampointer->GetXaxis()->FindBin( parameters[1] + 2*parameters[2]), "width"); // integral value of histogram (NOT fit) TF1 *bgfct = new TF1("f1","[0] +[1]*x",0,posMaxValHist); bgfct->SetParameters(parameters[5],parameters[4]); @@ -637,10 +637,14 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType, parameters[6] -= integralbg; if (verbose) { + cout << colorcyan << "Depletion voltage: " << labbook->depletionV << endlr; cout << colorcyan << "Integral from bin : " << histogrampointer->FindBin(parameters[7]) << " to " << histogrampointer->GetXaxis()->FindBin(parameters[8]) << endlr; - cout << colorcyan << "Integral from val : " << parameters[7] << " to " << parameters[8] << endlr; - cout << colorcyan << "Integral value: " << parameters[6] << endlr; - cout << colorcyan << "Integral bg: " << integralbg << endlr; + cout << colorcyan << "Integral from val : " << parameters[7] << " to " << parameters[8] << endlr; + cout << colorcyan << "Integral bg: " << integralbg << endlr; + cout << colorcyan << "Integral value without bg: " << parameters[6] << endlr; + cout << colorcyan << "Integral value with bg: " << parameters[6] + integralbg << endlr; + cout << colorcyan << "Gauss Sigma: " << parameters[2] << endlr; + cout << colorcyan << "Number of events : " << frames_found << endlr; } // DEBUG @@ -842,9 +846,8 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_ } } } -// sr90IntegralVal = histogrampointer->integral(thresholdbincurcandidate,histogrampointer->GetNbinsX(), sr90IntegralErr); - sr90IntegralVal = histogrampointer->Integral(thresholdbincurcandidate,histogrampointer->GetNbinsX()); -// histogrampointer->Integral(min+fittries*min/20, histogrampointer->GetXaxis()->FindBin(posMaxValHist)); + sr90IntegralVal = histogrampointer->Integral(thresholdbincurcandidate,histogrampointer->GetNbinsX(), "width"); +// histogrampointer->Integral(min+fittries*min/20, histogrampointer->GetXaxis()->FindBin(posMaxValHist), "width"); // for ( // cout << "Integrate from bin " << thresholdbincurcandidate << " to " << histogrampointer->GetNbinsX() << endl; // sr90IntegralErr /= sr90IntegralVal/100; -- 2.43.0