From: Tobias Bus Date: Fri, 1 Sep 2017 14:54:43 +0000 (+0200) Subject: analyzer: added automatic threshold setting for fixed threshold histo, fixed veto... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=29a9c1c461f9d3bf28dca1deb53d1cc9f051b4c7;p=radhard.git analyzer: added automatic threshold setting for fixed threshold histo, fixed veto spectrum, adjusted sum spectrum array generation --- diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index 36350d0..77b121c 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -60,12 +60,13 @@ void ChargeSpektrum(TString runnumber = "") // if (runi == 2) // runs[runi]->setSubMatrixBorders(100,120,100,120); //runs[runi]->setFixedThresholdValueElectrons(1440); - runs[runi]->setFixedThresholdValueADU(runs[runi]->labbook.posSeedDB*0.7); +// float_t cutval = runs[runi]->histogramwoRTS->Sum->GetBinCenter(runs[runi]->histogramwoRTS->Sum->FindLastBinAbove(3,1)); +// runs[runi]->setFixedThresholdValueADU(cutval*0.6); //runs[runi]->setNoisethresholdborderADU(800); //runs[runi]->setNoisethresholdborderE(220); // runs[runi]->analyzeFrame(6384); -// runs[runi]->analyzeFrame(6605); +// runs[runi]->analyzeFrame(1970548); // runs[runi]->analyzeFrame(1994914); // runs[runi]->analyzeFrame(680); // runs[runi]->analyzeFrame(685); @@ -103,9 +104,13 @@ 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); + compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold); + // compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS); -// compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); + compareHistogramClassVector2.push_back(runs[runi]->histogram->normalized); + compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized); + compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSAggresive->normalized); // compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized); // compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized); // compareHistogramClassVector.push_back(runs[runi]->histogramfixedthreshold->normalized); @@ -119,12 +124,20 @@ void ChargeSpektrum(TString runnumber = "") // compareHistogramVector.push_back(runs[runi]->histogramfixedthreshold->Seed); // compareHistogramVector.push_back(runs[runi]->histogramfixedthreshold->normalized->Seed); // runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Seed, "gaus", true, false, false, 500); - runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->normalized->Seed, "GaussTail"); + //runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->normalized->Seed, "GaussTail"); + //runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->a_Sum[0]); + compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[0]); // Seed + compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[1]); // Seed + next bigger charge pixel + compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[2]); // Seed + 2 + compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[8]); // Sum over 9 pixel in cluster + compareHistogramVector.push_back(runs[runi]->histogramwoRTS->a_Sum[24]); // Sum over 25 pixel in cluster + + // runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Seed, "gaus", true, false, false, runs[runi]->histogramfixedthreshold->normalized->fixedThresholdValue); // runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Sum, "gaus", true, false, false, 500); // plot RTS pixel histogram -// runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->pixeltimefiredDistrib, "", 0); + runs[runi]->plot1DHistogram( runs[runi]->histogramwoRTS->pixeltimefiredDistrib, "", 0); diff --git a/MABS_run_analyzer/HistogramType.h b/MABS_run_analyzer/HistogramType.h index c1fbe66..51ecb57 100644 --- a/MABS_run_analyzer/HistogramType.h +++ b/MABS_run_analyzer/HistogramType.h @@ -228,7 +228,7 @@ public: * It is set as a multiply of the standard deviation * */ - Float_t RTSthreshold = 4; + Float_t RTSthreshold = 10; //***************** // GETTER AND SETTER diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index 978587f..ffdcc1f 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -179,7 +179,7 @@ Run::Run(Int_t runnumber, Int_t loopi, TString customtitle) histogramwoRTSAggresive = new HistogramType(" more RTS cleaned", &cursystemparam, &cursensorinfo, humanreadablestr, &labbook, this, rootcolors[plotStyle], rootlinestyle[plotStyle]); histogramwoRTSAggresive->maskRTSpixel = true; - histogramwoRTSAggresive->RTSthreshold = 1.5; + histogramwoRTSAggresive->RTSthreshold = 4; HistogramClassVector.push_back(histogramwoRTSAggresive); // histogramwoRTSAggresivethreshold = new HistogramType(" Threshold, more RTS cleaned", &cursystemparam, &cursensorinfo, humanreadablestr, &labbook, this, rootcolors[plotStyle], rootlinestyle[plotStyle] ); // histogramwoRTSAggresivethreshold->maskRTSpixel = true; @@ -255,7 +255,7 @@ void Run::setSystemSpecificParameters() systemparam systemparamPXI (800*16,800,75,150,150); systemparam systemparamFSBB (2800,2800/4,25,10,100); systemparam systemparamUSBMi19 (400/*maxbin*/,400/1/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/); - systemparam systemparamPipper2 (1000,200,15,10,100); + systemparam systemparamPipper2 (1000,200,25,10,100); if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") ) cursystemparam = systemparamUSB; else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("FSBB") ) @@ -1027,8 +1027,8 @@ void Run::updateDatabase() { constructUpdateString(&sqlupdatequery, "Avg.Noise+", histogramclassToUseForDB->normalized->calibrated->avgNoisePlus, 3, 0, 1000); if (histogramclassToUseForDB->normalized->calibrated != 0) constructUpdateString(&sqlupdatequery, "Avg.Noise-", histogramclassToUseForDB->normalized->calibrated->avgNoiseMinus, 3, 0, 1000); - constructUpdateString(&sqlupdatequery, "CCE_1", histogramclassToUseForDB->normalized->CCE_in_Perc_1, 2, 0 , 100); - constructUpdateString(&sqlupdatequery, "CCE_25", histogramclassToUseForDB->normalized->CCE_in_Perc_25, 2, 0 , 100); + constructUpdateString(&sqlupdatequery, "CCE_1", histogramclassToUseForDB->normalized->CCE_in_Perc_1, 2, 0 , 110); + constructUpdateString(&sqlupdatequery, "CCE_25", histogramclassToUseForDB->normalized->CCE_in_Perc_25, 2, 0 , 110); constructUpdateString(&sqlupdatequery, "StoN", histogramclassToUseForDB->normalized->StoN, 3, 0 , 100); constructUpdateString(&sqlupdatequery, "Avg.NoiseADC", histogramclassToUseForDB->normalized->avgNoise, 2, 0 , 1000); constructUpdateString(&sqlupdatequery, "Avg.NoiseADC+", histogramclassToUseForDB->normalized->avgNoisePlus, 2, 0 , 1000); @@ -1252,7 +1252,7 @@ Bool_t Run::binF0() Bool_t Run::binSeedSumVeto() { - /// collected charge in cluster + /// size of cluster array, 5 x 5 = 25 Int_t completeclustersize = processed->clustersize*processed->clustersize; Float_t a_pixelSum[completeclustersize]; Float_t a_notSeedSum[completeclustersize]; @@ -1298,20 +1298,21 @@ Bool_t Run::binSeedSumVeto() a_pixelSum[clusteri] = 0; a_notSeedSum[clusteri] = 0; } + //cout << colorpurple << framei << endlr; // look only at 3x3 cluster around seed -// if( labbook.chipGen=="FSBB" || labbook.chipGen=="Pipper2") { -// for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = 0; -// for (Int_t clusteri=completeclustersize-sqrt(completeclustersize); clusterifFrameInfo.p[clusteri][hiti] = 0; -// for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = 0; -// for (Int_t clusteri=4; clusterifFrameInfo.p[clusteri][hiti] = 0; -// } + if( labbook.chipGen=="FSBB" || labbook.chipGen=="Pipper2") { + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; + for (Int_t clusteri=completeclustersize-sqrt(completeclustersize); clusterifFrameInfo.p[clusteri][hiti] = -9999; + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; + for (Int_t clusteri=4; clusterifFrameInfo.p[clusteri][hiti] = -9999; + } - // DEBUG +// DEBUG // for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri*5+clusterj][hiti]; @@ -1327,18 +1328,19 @@ Bool_t Run::binSeedSumVeto() TMath::Sort(completeclustersize,clusterArray,index,1); for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti]; - for (Int_t clusterj=clusteri; clusterj -9000) { + pixelSum += clusterArray[index[clusteri]]; + for (Int_t clusterj=clusteri; clusterjfFrameInfo.p[index[clusteri]][hiti]; + for (Int_t clusterj=clusteri; clusterjSum->Fill(pixelSum); for (Int_t clusterj=0; clusterjVeto->Fill(processed->fFrameInfo.p[12][hiti]); // histogram with the single pixel - - // bin the fixed threshold for charge histogram class - if (histogramfixedthreshold != 0) { - if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster - { - histogramfixedthreshold->numberofhits++; - fillAHistogramsinclass(histogramfixedthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); - } - } - + if (processed->fFrameInfo.pixelthreshold[hiti]>0) { histogramthreshold->numberofhits++; @@ -1440,6 +1433,79 @@ Bool_t Run::binSeedSumVeto() } // end loop over hits in frame } } // end loop over all frames + + // histogramfixedthreshold relies on "histogram", therefore histogram has to be completly filled before a threshold can be Set + for (Int_t framei=0; frameifHitTree->GetEntries(); framei++) // loop over all frames + { + processed->fHitTree->GetEntry(framei); + { + for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) + { + uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%cursensorinfo.columns; // column of seed + uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/cursensorinfo.columns; // row of seed + if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet + { + pixelSum = 0; + notSeedSum = 0; + // sum histogram + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; + for (Int_t clusteri=completeclustersize-sqrt(completeclustersize); clusterifFrameInfo.p[clusteri][hiti] = -9999; + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; + for (Int_t clusteri=4; clusterifFrameInfo.p[clusteri][hiti] = -9999; + } + + Float_t clusterArray[completeclustersize];// temp variable clusterArray necessary, because Sort only accepts 1-dim arrays + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti]; + } + Int_t index[completeclustersize]; + TMath::Sort(completeclustersize,clusterArray,index,1); + for (Int_t clusteri=0; clusteri -9000) { + pixelSum += clusterArray[index[clusteri]]; + for (Int_t clusterj=clusteri; clusterjfFrameInfo.p[index[clusteri]][hiti]; + for (Int_t clusterj=clusteri; clusterjfixedThresholdValue <= 0) { + float_t cutval = histogram->Sum->GetBinCenter(histogram->Sum->FindLastBinAbove(3,1)); + setFixedThresholdValueADU(cutval*0.8); + } + if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster + { + histogramfixedthreshold->numberofhits++; + fillAHistogramsinclass(histogramfixedthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } + } + } + } + } + } + + + // gROOT->SetBatch(kTRUE); for (vector::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++) { Double_t* parameters = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment diff --git a/MABS_run_analyzer/Run.h b/MABS_run_analyzer/Run.h index 7457e8c..8112a85 100644 --- a/MABS_run_analyzer/Run.h +++ b/MABS_run_analyzer/Run.h @@ -424,9 +424,9 @@ public: */ Bool_t plotClusterDistribution(HistogramType*); - TCanvas* plot1DHistogram(HistogramType* histogramtypepointer, TH1FO* onehistogram, TString fitFuncType = "landau", Bool_t verbose = false, Bool_t logscale =false, Bool_t withOverflow=false, Float_t fitstart=-1, TString titlestr = "", TString legendstr = ""); TCanvas* plot1DHistogram(TH1FO* onehistogram, TString fitFuncType = "landau", Bool_t verbose = false, Bool_t logscale =false, Bool_t withOverflow=false, Float_t fitstart=-1, TString titlestr = "", TString legendstr = ""); - + TCanvas* plot1DHistogram(HistogramType* histogramtypepointer, TH1FO* onehistogram, TString fitFuncType = "landau", Bool_t verbose = false, Bool_t logscale =false, Bool_t withOverflow=false, Float_t fitstart=-1, TString titlestr = "", TString legendstr = ""); + pixelinfo pixelinfoMi34[32]; /// analyze only half of matrix diff --git a/MABS_run_analyzer/help.h b/MABS_run_analyzer/help.h index d0aae5c..880334e 100644 --- a/MABS_run_analyzer/help.h +++ b/MABS_run_analyzer/help.h @@ -196,6 +196,7 @@ const TString colorwhite = "\033[1;29m"; const TString colorred = "\033[1;31m"; const TString coloryellow = "\033[1;33m"; const TString colorgreen = "\033[1;32m"; +const TString colorpurple = "\033[1;35m"; const TString colorcyan = "\033[1;36m"; const TString colorreset = "\033[0m"; const TString endlr = "\033[0m\n";