From fa009470a4f80a7f1a2a41d0aeb45a69eeb6f367 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Wed, 20 Dec 2017 12:55:17 +0100 Subject: [PATCH] Analyzer: Leakage current can be very high and even negative, adjusted Histogram 'LeakagecurrentDistr' to be able to hold these values --- MABS_run_analyzer/ChargeSpektrum.c | 20 ++++++++-- MABS_run_analyzer/HistogramType.cpp | 2 +- MABS_run_analyzer/Run.cpp | 61 +++++++++++++++++------------ MABS_run_analyzer/Run.h | 4 ++ 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index 2539522..e764fe7 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -278,14 +278,26 @@ void ChargeSpektrum(TString runnumber = "") if (analysisType.Contains("leak")) { // analyze cluster formation + if (analysisType.Contains("rts")) { + vector compareHistogramVectorLeakage; + compareHistogramVectorLeakage.push_back(runs[runi]->histogramwoRTS->LeakageCurrentDistrib); + compareHistogramVectorLeakage.push_back(runs[runi]->histogram->LeakageCurrentDistrib); + // plot and clear compareHistogramClassVectorRTS vector, + CompareHistograms(&compareHistogramVectorLeakage); + compareHistogramVectorLeakage.clear(); + } + // Plot leakage current - compareHistogramLeakageCurrent.push_back(runs[runi]->histogram->LeakageCurrentDistrib); + compareHistogramLeakageCurrent.push_back(HistogramTypeDefaultPt->LeakageCurrentDistrib); if (runi+1 == numberRuns) { compareHistogramVectorVector.push_back(compareHistogramLeakageCurrent); } - - runs[runi]->plot1DHistogram(runs[runi]->histogramdynamicalthreshold->Veto, "GaussTail", true); - runs[runi]->plot1DHistogram(runs[runi]->histogram->LeakageCurrentInPixelSorted, "", false, true); + if (runs[runi]->labbook.chipGen.EqualTo("Pipper2")) { + runs[runi]->plot1DHistogram(runs[runi]->histogramdynamicalthreshold->Veto, "GaussTail", true); + } else { + runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->Veto, "GaussTail", true); + } + runs[runi]->plot1DHistogram(HistogramTypeDefaultPt->LeakageCurrentInPixelSorted, "", false, true); } if (analysisType.Contains("seedf")) { // seedfit: seed integral anaylsis diff --git a/MABS_run_analyzer/HistogramType.cpp b/MABS_run_analyzer/HistogramType.cpp index 82aed94..9e3e871 100644 --- a/MABS_run_analyzer/HistogramType.cpp +++ b/MABS_run_analyzer/HistogramType.cpp @@ -56,7 +56,7 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) { initHistogramCustom(pixeltimefiredDistrib, "Fire counter" + histogramdescription, color, style, 0, labbook->frames_foundDB/100, labbook->frames_foundDB/100, "times fired", "Counts"); initHistogramCustom(LeakageCurrentInPixel, "Leakage current per pixel" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); initHistogramCustom(LeakageCurrentInPixelSorted, "Leakage current per pixel sorted" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); - initHistogramCustom(LeakageCurrentDistrib, "Average Leakage current per pixel" + histogramdescription, color, style, 0, 20, 200, "Average CDS", "Count"); + initHistogramCustom(LeakageCurrentDistrib, "Average Leakage current per pixel" + histogramdescription, color, style, -100, 400, 1000, "Average CDS", "Count"); // initHistogram(LeakageCurrentInPixelSorted, "Leakage current" + histogramdescription, color, style); initHistogramCustom(pixelHadGoodVeto, "Number of times pixel had good veto" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counter good veto"); diff --git a/MABS_run_analyzer/Run.cpp b/MABS_run_analyzer/Run.cpp index 2d28e81..353d98b 100644 --- a/MABS_run_analyzer/Run.cpp +++ b/MABS_run_analyzer/Run.cpp @@ -465,6 +465,7 @@ Bool_t Run::analyzeRun(Bool_t force) cout << "---------- 1. loop over all classes --------" << endl; for (vector::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++) { cout << "Processing histograms in class: <" << colorwhite << (*curHistogramClass)->histogramdescription << colorreset << " >" << endlr; + BinFiringRates(*curHistogramClass); if ((*curHistogramClass)->maskRTSpixel) { // if (labbook.chipGen=="Mi19") { cout << colorwhite << " FindRTSPixelToMask():" << endlr; @@ -533,17 +534,9 @@ Bool_t Run::analyzeRun(Bool_t force) return 1; } -Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer, Bool_t verbose) -{ - - Double_t meanpixeltimesfired = 0; - Double_t RTSpixelHits = 0; - Double_t totalHits = 0; - Double_t stdeviation = 0; - numberofactivepixel = 0; - - labbook.numberofRTSpixel = 0; - + +Bool_t Run::BinFiringRates(HistogramType* HistogramTypepointer, Bool_t verbose) +{ // first run, bin number of times pixel fired, sort by pixelindex uint pixelnumber = 0; uint binnumber = 0; @@ -552,8 +545,6 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer, Bool_t verbo for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) { // loop over hits in a frame pixelnumber = processed->fFrameInfo.pixel[hiti]; binnumber = HistogramTypepointer->pixeltimefired->Fill(pixelnumber); - // cout << "binnumber: " << binnumber; // Pixel #10 will be saved in bin number 11 (!) - // cout << colorcyan << " Pixel " << pixelnumber << " fired in frame " << framei << " hiti " << hiti << endlr; } } @@ -562,17 +553,37 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer, Bool_t verbo for (Int_t pixeli=1; pixeli <= HistogramTypepointer->pixeltimefired->GetNbinsX(); pixeli++) { if (HistogramTypepointer->pixeltimefired->GetBinContent(pixeli) > 0) { HistogramTypepointer->pixeltimefiredDistrib->Fill(HistogramTypepointer->pixeltimefired->GetBinContent(pixeli)); + } + } + return 0; +} + + +Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer, Bool_t verbose) +{ + + Double_t meanpixeltimesfired = 0; + Double_t RTSpixelHits = 0; + Double_t totalHits = 0; + Double_t stdeviation = 0; + numberofactivepixel = 0; + + labbook.numberofRTSpixel = 0; + + // calculate the mean firing times and bin fireing times in a propability histogram, first approach + for (Int_t pixeli=1; pixeli <= HistogramTypepointer->pixeltimefired->GetNbinsX(); pixeli++) { + if (HistogramTypepointer->pixeltimefired->GetBinContent(pixeli) > 0) { meanpixeltimesfired += HistogramTypepointer->pixeltimefired->GetBinContent(pixeli); numberofactivepixel++; - // HistogramTypepointer->pixeltimefiredsorted->Fill(2000); } } meanpixeltimesfired /= numberofactivepixel; // Very rough estimate of a mean firing time // vrey rough estimate on standard deviation for (Int_t pixeli=1; pixeli <= HistogramTypepointer->pixeltimefired->GetNbinsX(); pixeli++) { - if (HistogramTypepointer->pixeltimefired->GetBinContent(pixeli) > 0) + if (HistogramTypepointer->pixeltimefired->GetBinContent(pixeli) > 0) { stdeviation += pow(HistogramTypepointer->pixeltimefired->GetBinContent(pixeli)-meanpixeltimesfired,2); + } } stdeviation /= numberofactivepixel; stdeviation = sqrt(stdeviation); @@ -1178,16 +1189,16 @@ Bool_t Run::binLeakageCurrent(HistogramType* oneHistogramClass) oneHistogramClass->medianLeakageCurrentMinus = oneHistogramClass->LeakageCurrentInPixelSorted->GetBinContent(lastbinabovezero*probabilities[0]); oneHistogramClass->medianLeakageCurrentMinus = oneHistogramClass->medianLeakageCurrentMinus - oneHistogramClass->medianLeakageCurrent; - // TCanvas *c1 = new TCanvas("c1","c1",600,400); - // oneHistogramClass->LeakageCurrentInPixelSorted->Draw(""); - // c1->Update(); - // TCanvas *c2 = new TCanvas("c2","c2",600,400); - // oneHistogramClass->LeakageCurrentDistrib->Draw(""); - // c2->Update(); - // cout << "medianLeakageCurrent: " << oneHistogramClass->medianLeakageCurrent << endl; - // cout << "medianLeakageCurrentPlus: " << oneHistogramClass->medianLeakageCurrentPlus << endl; - // cout << "medianLeakageCurrentMinus: " << oneHistogramClass->medianLeakageCurrentMinus << endl; - // +// TCanvas *c1 = new TCanvas("c1","c1",600,400); +// oneHistogramClass->LeakageCurrentInPixelSorted->Draw(""); +// c1->Update(); +// TCanvas *c2 = new TCanvas(oneHistogramClass->histogramdescription,oneHistogramClass->histogramdescription,600,400); +// oneHistogramClass->LeakageCurrentDistrib->Draw(""); +// c2->Update(); +// cout << "medianLeakageCurrent: " << oneHistogramClass->medianLeakageCurrent << endl; +// cout << "medianLeakageCurrentPlus: " << oneHistogramClass->medianLeakageCurrentPlus << endl; +// cout << "medianLeakageCurrentMinus: " << oneHistogramClass->medianLeakageCurrentMinus << endl; +// // // // oneHistogramClass->medianLeakageCurrent = leakagequantiles[1]; // oneHistogramClass->medianLeakageCurrentPlus = leakagequantiles[2]; diff --git a/MABS_run_analyzer/Run.h b/MABS_run_analyzer/Run.h index eac0fd2..61cb3c6 100644 --- a/MABS_run_analyzer/Run.h +++ b/MABS_run_analyzer/Run.h @@ -207,6 +207,10 @@ private: /** @brief finds and and masks RTS pixel if maskRTSpixel isset to true */ Bool_t FindRTSPixelToMask(HistogramType* histogramtypepointer, Bool_t verbose = kFALSE); + + /** @brief Bins firing rates, filled in all histogram classes, used by rts pixel masing for specified #HistogramType classes */ + Bool_t BinFiringRates(HistogramType* histogramtypepointer, Bool_t verbose = kFALSE); + public: /** @brief empty constructor */ -- 2.43.0