From a0c82cfc842881f3de1b724ee9d468dbd8d82145 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Mon, 21 Sep 2015 18:29:02 +0200 Subject: [PATCH] Run analyzer: bugfix in spectrum integration, noise border was not found correctly --- MABS_run_analyzer/HistogramType.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/MABS_run_analyzer/HistogramType.c b/MABS_run_analyzer/HistogramType.c index 590d37f..7d76841 100644 --- a/MABS_run_analyzer/HistogramType.c +++ b/MABS_run_analyzer/HistogramType.c @@ -319,27 +319,28 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_ TH1F* smoothedcurce = (TH1F*)histogrampointer->Clone(); smoothedcurce->Smooth(4); + smoothedcurce->SetAxisRange(0,histogrampointer->GetBinCenter(histogrampointer->GetNbinsX())); - // Int_t random = random1->Rndm()*100000; - // TString canvastitle = Form("%s %s sdfasdf", histogrampointer->GetName(), runcode.Data()); - // TString canvasname = Form("%s %s %d dfgsdfgsdfg", histogrampointer->GetName(), runcode.Data(), random); - // TCanvas* canvas = new TCanvas(canvasname, canvastitle, 900, 700); - // smoothedcurce->Draw(); +// TString canvastitle = Form("%s sdfasdf", histogrampointer->GetName()); +// TString canvasname = Form("%s dfgsdfgsdfg", histogrampointer->GetName()); +// TCanvas* canvas = new TCanvas(canvasname, canvastitle, 900, 700); +// smoothedcurce->Draw(); Int_t thresholdbincurcandidate = 0; if (thresholdborder < 0) { Int_t rising = 0; Int_t bini =smoothedcurce->GetMaximumBin(); + thresholdbincurcandidate = bini; Float_t curval = smoothedcurce->GetXaxis()->GetBinCenter(bini); - // cout << "smoothedcurce->GetXaxis()->GetBinCenter(" << bini << "): " << curval << endl; +// cout << "GetMaximumBin: smoothedcurce->GetXaxis()->GetBinCenter(" << bini << "): " << curval << endl; do { curval=smoothedcurce->GetBinContent(bini++); if (curval*0.95 <= smoothedcurce->GetBinContent(bini)) { rising++; - // cout << "rising at " << smoothedcurce->GetXaxis()->GetBinCenter(bini) << " as " << curval << " < " << smoothedcurce->GetBinContent(bini) << endl; // debug +// cout << "rising at " << smoothedcurce->GetXaxis()->GetBinCenter(bini) << " as " << curval << " < " << smoothedcurce->GetBinContent(bini) << endl; // debug } else { @@ -360,6 +361,8 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_ // Float_t posChargeMax= histogrampointer->GetMaximum(); noisethresholdborder = histogrampointer->GetXaxis()->GetBinUpEdge(thresholdbincurcandidate); +// cout << "thresholdbincurcandidate: " << thresholdbincurcandidate << endl; +// cout << "noisethresholdborder: " << noisethresholdborder << endl; if (verbose) { cout << " Integrating " << histogrampointer->GetTitle() << endlr; -- 2.43.0