From 76bed47d6b8568afd7336d4f952c2c6d57234c80 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Mon, 18 May 2015 02:42:37 +0200 Subject: [PATCH] Run analyzer: ThresholdHistogram calibrated added --- MABS_run_analyzer/ChargeSpektrum.c | 53 ++++++++++++++++++++++-------- MABS_run_analyzer/Run.c | 34 +++++++++++++++++++ MABS_run_analyzer/Run.h | 5 +++ 3 files changed, 78 insertions(+), 14 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index 30a9c0b..c106661 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -170,15 +170,17 @@ void ChargeSpektrum(TString runnumber = "") { // gROOT->SetBatch(kTRUE); // runs[runi]->plotSeed(); - runs[runi]->plotSeedThreshold(); +// runs[runi]->plotSeedThresholdCalibrated(); +// runs[runi]->plotSeedThreshold(); // runs[runi]->plotSeed(); // runs[runi]->plotSum(); // runs[runi]->plotVeto(); // runs[runi]->plotNoise(); if (!isBatch) gROOT->SetBatch(kFALSE); - // runs[runi]->plotAllHistograms(); - runs[runi]->plotAllHistogramsThresholdCluster(); + // runs[runi]->plotAllHistograms(); +// runs[runi]->plotAllHistogramsThresholdCluster(); +// runs[runi]->plotAllHistogramsThresholdClusterCalibrated(); // runs[runi]->plotAllHistogramsCalibrated(); runs[runi]->writeAllHistogramsToFile(); } @@ -186,8 +188,9 @@ void ChargeSpektrum(TString runnumber = "") } } // plotAllRuns(""); - plotAllRuns("threshold"); - writeObservableToFile("Seed"); + plotAllRuns("threshold calibrated"); +// writeObservableToFile("seed threshold calibrated"); + writeObservableToFile("seed threshold"); } Int_t ReadRunList(std::vector* runlist) @@ -220,9 +223,20 @@ Int_t ReadRunList(std::vector* runlist) void writeObservableToFile(TString histogramtype) { - if (histogramtype.Contains("threshold")) { - for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthreshold; } } + if (histogramtype.Contains("threshold")) + { + if (histogramtype.Contains("calibrated")) + { + for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated; + } + else + { + for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthreshold; + } + + } else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramCalibrated; } } @@ -287,15 +301,26 @@ void writeObservableToFile() void plotAllRuns(TString histogramtype) { - if (histogramtype.Contains("threshold")) { - for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthreshold; } } + if (histogramtype.Contains("threshold")) + { + if (histogramtype.Contains("calibrated")) + { + for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated; + } + else + { + for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthreshold; + } + + } else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramCalibrated; } } - else { - for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogram; } } + else { + for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogram; } } plotAllRuns(); } diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index 2cd06e6..3fb01cd 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -250,6 +250,7 @@ Bool_t Run::analyzeRun(Bool_t force) binSeedSumVeto(); cout << colorwhite << "rescaleHistograms():" << endlr; histogramCalibrated.calibrated = rescaleHistograms(); + histogramthresholdCalibrated.calibrated = histogramCalibrated.calibrated; cout << colorwhite << "calculateCCE():" << endlr; calculteCCE(); cout << colorwhite << "updateDatabase():" << endlr; @@ -313,6 +314,18 @@ Bool_t Run::rescaleHistograms() histogramCalibrated.avgNoise = histogram.avgNoise * gain; histogramCalibrated.avgNoisePlus = histogram.avgNoisePlus * gain; histogramCalibrated.avgNoiseMinus = histogram.avgNoiseMinus * gain; + + rescaleHistogram(histogramthresholdCalibrated.Seed, histogramthreshold.Seed); + rescaleHistogram(histogramthresholdCalibrated.Sum, histogramthreshold.Sum); + rescaleHistogram(histogramthresholdCalibrated.Veto, histogramthreshold.Veto); + rescaleHistogram(histogramthresholdCalibrated.Noise, histogramthreshold.Noise); + + histogramthresholdCalibrated.posSeed = histogramthreshold.posSeed * gain; + histogramthresholdCalibrated.posSum = histogramthreshold.posSum * gain; + histogramthresholdCalibrated.posVeto = histogramthreshold.posVeto * gain; + histogramthresholdCalibrated.avgNoise = histogramthreshold.avgNoise * gain; + histogramthresholdCalibrated.avgNoisePlus = histogramthreshold.avgNoisePlus * gain; + histogramthresholdCalibrated.avgNoiseMinus = histogramthreshold.avgNoiseMinus * gain; return 1; } @@ -722,6 +735,17 @@ Bool_t Run::plotSeedThreshold() return 1; } +Bool_t Run::plotSeedThresholdCalibrated() +{ + if (!error) + { + plot1DHistogram(histogramthresholdCalibrated.Seed, "landau"); + return 0; + } + return 1; +} + + Bool_t Run::plotSum() { @@ -838,6 +862,16 @@ Bool_t Run::plotAllHistogramsThresholdCluster() return 1; } +Bool_t Run::plotAllHistogramsThresholdClusterCalibrated() +{ + if (!error) + { + plotAllHistograms(&histogramthresholdCalibrated); + return 0; + } + return 1; +} + Float_t Run::FitPerform(TH1F* histogrampointer, TString fitFuncType, Bool_t verbose) { Float_t posMax = 0; diff --git a/MABS_run_analyzer/Run.h b/MABS_run_analyzer/Run.h index e2da7b3..76d5402 100644 --- a/MABS_run_analyzer/Run.h +++ b/MABS_run_analyzer/Run.h @@ -261,6 +261,9 @@ public: /** @brief Plot all histograms from #histogramthreshold into one canvas */ Bool_t plotAllHistogramsThresholdCluster(); + /** @brief Plot all histograms from #histogramthreshold into one canvas */ + Bool_t plotAllHistogramsThresholdClusterCalibrated(); + /** @brief Writes a given histogram into a file */ Bool_t writeHistogramToFile(TH1F* onehistogram); @@ -297,6 +300,7 @@ public: Bool_t plotNoise(); Bool_t plotSeed(); Bool_t plotSeedThreshold(); + Bool_t plotSeedThresholdCalibrated(); Bool_t plotSum(); Bool_t plotVeto(); @@ -419,6 +423,7 @@ public: histogramstruct histogram; histogramstruct histogramCalibrated; histogramstruct histogramthreshold; + histogramstruct histogramthresholdCalibrated; histogramstruct* plothistogramstructpointer; TH1F** plothistogrampointer; -- 2.43.0