From fbfc7cb29454a952225b9f9a62d53e824c31cb59 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Mon, 7 Dec 2015 13:34:52 +0100 Subject: [PATCH] Run analyzer: push for Dennis, small changes --- MABS_run_analyzer/ChargeSpektrum.c | 6 +-- MABS_run_analyzer/ChargeSpektrumFunctions.c | 11 ++--- MABS_run_analyzer/Run.c | 2 +- MABS_run_analyzer/Run.h | 1 - MABS_run_analyzer/help.h | 48 +++++++++++++++++++++ 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index a52a2ae..5b470d0 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -155,11 +155,11 @@ void ChargeSpektrum(TString runnumber = "") // runs[runi]->compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold); // runs[runi]->plotCompareHistograms(); runs[runi]->plotAllHistograms(runs[runi]->histogramthreshold); - compareHistogramClassVector.push_back(runs[runi]->histogramthreshold->calibrated); -// compareHistogramClassVector2.push_back(runs[runi]->histogram->calibrated); + compareHistogramClassVector.push_back(runs[runi]->histogramthreshold); + //compareHistogramClassVector.push_back(runs[runi]->histogram); // runs[runi]->plot1DHistogram(runs[runi]->histogramthreshold, runs[runi]->histogramthreshold->Veto, "gaus"); // runs[runi]->plot1DHistogram(runs[runi]->histogramthreshold, runs[runi]->histogramthreshold->SeedPerc, "landau", 0); - compareHistogramVector.push_back(runs[runi]->histogramthreshold->calibrated->Seed); + compareHistogramVector.push_back(runs[runi]->histogramthreshold->Seed); runs[runi]->writeAllHistogramsToFile(); } //cout << runs[runi]->histogram diff --git a/MABS_run_analyzer/ChargeSpektrumFunctions.c b/MABS_run_analyzer/ChargeSpektrumFunctions.c index e2872f6..5fbbc2b 100644 --- a/MABS_run_analyzer/ChargeSpektrumFunctions.c +++ b/MABS_run_analyzer/ChargeSpektrumFunctions.c @@ -215,8 +215,7 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) // Tl.SetNDC(); // Tl.DrawText(0.3, 0.2, "Titel titel"); //TPaveText *t = new TPaveText(0.0, 0.9, 0.3, 1.0, "brNDC"); // left-up -// curhistogramclone->SetLineColor(rootcolors[histogrami]); - + curhistogramclone->SetLineColor(rootcolors[histogrami%13]); curhistogramclone->Draw("SAME"); legendEntry = Form("%d %s", curhistogramclassp->labbook->runnumber, curhistogramclone->GetTitle()); leg1->AddEntry(curhistogramclone, legendEntry, "l"); @@ -230,7 +229,7 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) canvas->cd(2); curhistogramclone = (TH1F*) curhistogramclassp->Sum->Clone(); -// curhistogramclone->SetLineColor(rootcolors[histogrami]); + curhistogramclone->SetLineColor(rootcolors[histogrami%13]); curhistogramclone->Draw("SAME"); leg1->Draw("SAME"); lastbin2 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin2)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin2; @@ -242,7 +241,7 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) canvas->cd(3); curhistogramclone = (TH1F*) curhistogramclassp->Veto->Clone(); -// curhistogramclone->SetLineColor(rootcolors[histogrami]); + curhistogramclone->SetLineColor(rootcolors[histogrami%13]); curhistogramclone->Draw("SAME"); leg1->Draw("SAME"); lastbin3 = (curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1))>lastbin3)?curhistogramclone->GetBinCenter(curhistogramclone->FindLastBinAbove(2,1)):lastbin3; @@ -253,7 +252,7 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) canvas->cd(4); curhistogramclone = (TH1F*) curhistogramclassp->Noise->Clone(); -// curhistogramclone->SetLineColor(rootcolors[histogrami]); + curhistogramclone->SetLineColor(rootcolors[histogrami%13]); curhistogramclone->Draw("SAME"); legendEntry = Form("%d Noise: %.2f + %.2f - %.2f",curhistogramclassp->labbook->runnumber, curhistogramclassp->avgNoise, curhistogramclassp->avgNoisePlus, curhistogramclassp->avgNoiseMinus); leg2->AddEntry(curhistogramclone, legendEntry, "l"); @@ -276,6 +275,8 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) f->Append(img); f->Write(); + MSaveBigPNG(savepathresults + "/" + canvastitle + ".png"); + return 0; } return 1; diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index ad45663..f1d67cb 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -408,6 +408,7 @@ Bool_t Run::analyzeRun(Bool_t force) } cout << "---------------------------------" << endl; cout << colorwhite << "integrateSr90Spectra():" << endlr; +// histogramthreshold->noisethresholdborder = 35.0; // TODO remove the overwriting of automatic noise threshold setting histogramthreshold->integrateSr90Spectra(histogramthreshold->Seed, frames_found, -1, true); histogramfixedthreshold->integrateSr90Spectra(histogramfixedthreshold->Seed, frames_found, 0); rescaleHistogramClasses(); @@ -1677,7 +1678,6 @@ void Run::initClusters(Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t void Run::initRootParameters() { - rootcolors = new Int_t[13]{1, 2, 4, 6, 8, 13, 46, 28, 32, 33, 12, 20, 40}; rootlinestyle = new Int_t[13]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; } diff --git a/MABS_run_analyzer/Run.h b/MABS_run_analyzer/Run.h index c0dd624..cba89f5 100644 --- a/MABS_run_analyzer/Run.h +++ b/MABS_run_analyzer/Run.h @@ -182,7 +182,6 @@ private: }; pixelinfo curpixelinfo; - Int_t* rootcolors; Int_t* rootlinestyle; /** @brief calls #initCluster for each structure of type @c Run::histogram diff --git a/MABS_run_analyzer/help.h b/MABS_run_analyzer/help.h index 851462d..ba5a2fa 100644 --- a/MABS_run_analyzer/help.h +++ b/MABS_run_analyzer/help.h @@ -11,6 +11,7 @@ #include "TStopwatch.h" #include +#include #define MAXHITS 1000000 //#################################################################### @@ -160,6 +161,7 @@ const TString colorgreen = "\033[1;32m"; const TString colorcyan = "\033[1;36m"; const TString colorreset = "\033[0m"; const TString endlr = "\033[0m\n"; +Int_t* rootcolors = new Int_t[13]{1, 2, 4, 6, 8, 13, 46, 28, 32, 33, 12, 20, 40}; /** * @brief stores information from the SQL database @@ -249,5 +251,51 @@ void preparecanvas() { // return 0; } +void MSaveBigPNG(TString filename="", double scale=2) { + TCanvas* old_canv = gPad->GetCanvas(); + + gROOT->SetBatch(kTRUE); + gROOT->ForceStyle(kTRUE); + + Int_t orig_msz = gStyle->GetMarkerSize(); + Int_t orig_mst = gStyle->GetMarkerStyle(); + Int_t orig_lt = gStyle->GetLineWidth(); + + gStyle->SetMarkerSize(1.0+scale/5); + gStyle->SetMarkerStyle(20); + gStyle->SetLineWidth(orig_lt*scale); + gStyle->SetHistLineWidth(orig_lt*scale); + gStyle->SetFuncWidth(orig_lt*scale); + + if(filename == "") { + filename = old_canv->GetName(); + filename += ".png"; + } + + Int_t old_width = old_canv->GetWindowWidth(); + Int_t old_height = old_canv->GetWindowHeight(); + + Int_t new_width = old_width * scale; + Int_t new_height= old_height* scale; + + TCanvas* temp_canvas = new TCanvas("temp", "", new_width, new_height); + old_canv->DrawClonePad(); + + temp_canvas->Draw(); + temp_canvas->SaveAs(filename); + temp_canvas->Close(); + + gStyle->SetMarkerSize(orig_msz); + gStyle->SetMarkerStyle(orig_mst); + gStyle->SetLineWidth(orig_lt); + gStyle->SetHistLineWidth(orig_lt); + gStyle->SetFuncWidth(orig_lt); + + gROOT->ForceStyle(kFALSE); + gROOT->SetBatch(kFALSE); + + return; +} + //#################################################################### #endif \ No newline at end of file -- 2.43.0