From 89a567251277673547b9b8a88609d5aaf414cc99 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Tue, 2 May 2017 12:53:21 +0200 Subject: [PATCH] Analyzer: Small bug fixes# --- MABS_run_analyzer/ChargeSpektrum.c | 12 +++++++----- MABS_run_analyzer/ChargeSpektrumFunctions.c | 11 +++++++---- MABS_run_analyzer/HistogramType.c | 20 +++++++++++++++----- MABS_run_analyzer/MAPS.c | 9 ++++++++- MABS_run_analyzer/Run.c | 9 +++++---- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index 068b0a7..e632ea1 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -61,6 +61,7 @@ void ChargeSpektrum(TString runnumber = "") // runs[runi]->setSubMatrixBorders(100,120,100,120); //runs[runi]->setFixedThresholdValueElectrons(1440); //runs[runi]->setNoisethresholdborderADU(30); + //runs[runi]->setNoisethresholdborderE(220); // runs[runi]->analyzeFrame(6384); // runs[runi]->analyzeFrame(6605); @@ -101,19 +102,20 @@ void ChargeSpektrum(TString runnumber = "") gROOT->SetBatch(kFALSE); // Uncomment below to do classical analysis withour RTS -// compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized); +// compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized); // compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS); - compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); +// compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized); - runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefired, "", 0); + compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); +// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefired, "", 0); //compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS); // compareHistogramClassVector2.push_back(runs[runi]->histogramthreshold); //compareHistogramVector.push_back(runs[runi]->histogram->normalized->calibrated->Seed); //compareHistogramVector2.push_back(runs[runi]->histogram->normalized->Seed); // runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized->calibrated, runs[runi]->processed->fNoiseInfo.fPedestals, "", 1); - runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized->calibrated, runs[runi]->histogram->normalized->calibrated->Seed, "landau", 1); - runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0); +// 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); // runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Sum, "gaus", true); diff --git a/MABS_run_analyzer/ChargeSpektrumFunctions.c b/MABS_run_analyzer/ChargeSpektrumFunctions.c index 5a283b6..eff8451 100644 --- a/MABS_run_analyzer/ChargeSpektrumFunctions.c +++ b/MABS_run_analyzer/ChargeSpektrumFunctions.c @@ -717,7 +717,10 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) hs->Add(curhistogramclone); legendEntry = Form("%s", curhistogramclone->GetTitle()); if (legendStringsVector.size() > 0) + { legendEntry = Form("%s", legendStringsVector.at(histogrami).Data()); + cout << colorcyan << legendEntry << endlr; + } leg2->AddEntry(curhistogramclone, legendEntry, "l"); leg2->Draw("SAME"); // hs->Add(leg1); @@ -899,7 +902,7 @@ Bool_t FindGoodTitle(vector* ptCompareHistogramClassVector) { // same_System = kFALSE; } - // construct header stringö + // construct header string TString title1 = ""; if (same_Source) title1.Append(Form(", %s", firstlabbook.source.Data())); @@ -916,7 +919,7 @@ Bool_t FindGoodTitle(vector* ptCompareHistogramClassVector) { title1.Append(Form(", %.1f*10^{13} n_{eq}/cm^{2}", firstlabbook.radDoseNonIon)); if (same_Clock) title1.Append(Form(", %.2f Mhz", firstlabbook.clock)); - if (same_Depletion && firstlabbook.depletionV > 0) + if (same_Depletion && firstlabbook.depletionV >= 0) title1.Append(Form(", U_{dep}=%.1f V", firstlabbook.depletionV)); headerStringsVector.push_back(title1); @@ -946,7 +949,7 @@ Bool_t FindGoodTitle(vector* ptCompareHistogramClassVector) { legendstr.Append(Form("%.1f*10^{13} n_{eq}/cm^{2}", curlabbook.radDoseNonIon)); } if (!same_Clock) { if (legendstr.Length()) legendstr.Append(", "); legendstr.Append(Form("%.2f Mhz", curlabbook.clock)); } - if (!same_Depletion && curlabbook.depletionV > 0) { if (legendstr.Length()) legendstr.Append(", "); + if (!same_Depletion && curlabbook.depletionV >= 0) { if (legendstr.Length()) legendstr.Append(", "); legendstr.Append(Form("U_{dep}=%.1f V", curlabbook.depletionV)); } legendStringsVector.push_back(legendstr); } @@ -972,7 +975,7 @@ Bool_t FindGoodTitle(vector* ptCompareHistogramClassVector) { if (!same_Clock) for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++) folderadd.Append(Form(" %.2f Mhz", ptCompareHistogramClassVector->at(histogrami)->labbook->clock)); - if (!same_Depletion && curlabbook.depletionV > 0) + if (!same_Depletion && curlabbook.depletionV >= 0) for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++) folderadd.Append(Form(" %.1fV", ptCompareHistogramClassVector->at(histogrami)->labbook->depletionV)); diff --git a/MABS_run_analyzer/HistogramType.c b/MABS_run_analyzer/HistogramType.c index db2eb9d..238be69 100644 --- a/MABS_run_analyzer/HistogramType.c +++ b/MABS_run_analyzer/HistogramType.c @@ -234,7 +234,7 @@ Bool_t HistogramType::normalizeHistograms( Int_t got_frames_found ) { normalized->avgNoise = avgNoise; normalized->avgNoisePlus = avgNoisePlus; normalized->avgNoiseMinus = avgNoiseMinus; - normalized->sr90IntegralVal = sr90IntegralVal/frames_found*pow10(6); + normalized->sr90IntegralVal = sr90IntegralVal; normalized->StoN = StoN; normalized->CCE_in_Perc_1 = CCE_in_Perc_1; normalized->CCE_in_Perc_25 = CCE_in_Perc_25; @@ -674,6 +674,7 @@ Bool_t HistogramType::calculteCCE(Bool_t verbose) { Bool_t HistogramType::FindNoisethresholdborder(TH1F* histogrampointer, Bool_t overwrite, Bool_t verbose) { if (overwrite || noisethresholdborder == -1) { +// cout << colorcyan << "Find border" << endl; Float_t posMaxValHist = histogrampointer->GetXaxis()->GetXmax(); TH1F* smoothedcurce = (TH1F*)histogrampointer->Clone(); @@ -809,9 +810,12 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_ if (thresholdborder < 0) { if (noisethresholdborder < 0) { +// cout << "noisethresholdborder is not set, searching" << endl; FindNoisethresholdborder(histogrampointer, true, verbose); } thresholdbincurcandidate = histogrampointer->GetXaxis()->FindBin(noisethresholdborder); +// cout << colorcyan << "noisethresholdborder: " << noisethresholdborder << endl; +// cout << colorcyan << "thresholdbincurcandidate: " << thresholdbincurcandidate << endl; } else { @@ -838,9 +842,12 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_ } } } - sr90IntegralVal = histogrampointer->IntegralAndError(thresholdbincurcandidate,histogrampointer->GetNbinsX(), sr90IntegralErr); +// sr90IntegralVal = histogrampointer->integral(thresholdbincurcandidate,histogrampointer->GetNbinsX(), sr90IntegralErr); + sr90IntegralVal = histogrampointer->Integral(thresholdbincurcandidate,histogrampointer->GetNbinsX()); +// histogrampointer->Integral(min+fittries*min/20, histogrampointer->GetXaxis()->FindBin(posMaxValHist)); +// for ( // cout << "Integrate from bin " << thresholdbincurcandidate << " to " << histogrampointer->GetNbinsX() << endl; - sr90IntegralErr /= sr90IntegralVal/100; +// sr90IntegralErr /= sr90IntegralVal/100; // cout << " Unscaled integral is " << Form("%e",sr90IntegralVal) << ", error " << sr90IntegralErr << "%" << endl; // cout << " "; if (verbose) @@ -848,11 +855,14 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_ if (frames_found>0) { sr90IntegralVal/=frames_found; + cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << colorreset << endl; if (verbose) cout << "Scaled "; } - if (verbose) - cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << colorreset << ", error " << sr90IntegralErr << "%" << endl; + if (verbose) { +// cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << colorreset << ", error " << sr90IntegralErr << "%" << endl; + cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << endlr; + } return 0; } diff --git a/MABS_run_analyzer/MAPS.c b/MABS_run_analyzer/MAPS.c index 7cca3ae..6f96291 100644 --- a/MABS_run_analyzer/MAPS.c +++ b/MABS_run_analyzer/MAPS.c @@ -1821,6 +1821,13 @@ void MAPS::plotFrame(Int_t FrameNumber) { // canvasFrame->SetName(cm1->GetName()); cm1->Update(); cout<<"\rPIXELMATRIX plotted! "<Draw(); + + cout<<"-------------------"<noisethresholdborder = noisethresholdborderADU; if (noisethresholdborderE > -1) { if (labbook.gainDB > 0) { - (*curHistogramClass)->noisethresholdborder = noisethresholdborderE / labbook.gainDB; + (*curHistogramClass)->noisethresholdborder = noisethresholdborderE / labbook.gainDB; + cout << colorcyan << "Set noisethresholdborder to : " << (*curHistogramClass)->noisethresholdborder << " (" << noisethresholdborderE << " e)" << endlr; } else { cout << colorred << "Could not set noise threshold border in units of electrons to " << noisethresholdborderE << "e, no calibration done yet. Please rerun after first analysis." <normalized->calibrated != 0) -// if (histogramfixedthreshold != 0) + if (labbook.source.Contains("Sr") && histogramthreshold->normalized->calibrated->sr90IntegralVal > 0) constructUpdateString(&sqlupdatequery, "Sr90IntegralVal", histogramthreshold->normalized->calibrated->sr90IntegralVal,1000000000); if (sqlupdatequery.length()>0) -- 2.43.0