From ff2640d9e93dc2af179e79434f77df44e870cc36 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Thu, 17 Sep 2015 11:04:03 +0200 Subject: [PATCH] Run analyzer: Last commit, before adding the class Histogram.c and seriously reorganizing Run.c --- MABS_run_analyzer/Run.c | 107 +++++++++++++++++----------------------- MABS_run_analyzer/Run.h | 3 +- 2 files changed, 47 insertions(+), 63 deletions(-) diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index 35c5c44..ee7d58c 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -202,6 +202,45 @@ Bool_t Run::debugDBreadout() return 0; } +void Run::setSystemSpecificParameters() +{ + if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") ) + systemparamcur = systemparamUSB; + else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("FSBB") ) + systemparamcur = systemparamUSB; + else if (labbook.system.EqualTo("PXI")) // && labbook.chipGen.EqualTo("34") ) + systemparamcur = systemparamPXI; + else if (labbook.system.EqualTo("Pegasus")) // && labbook.chipGen.EqualTo("34") ) + systemparamcur = systemparamPegasus; + + setSensorInSystemParam(); +} + +void Run::setSensorInSystemParam() +{ + sensorinfostruct sensorinfoMi34USB( 8, 64 ); + sensorinfostruct sensorinfoMi34PXI( 16, /* rows */ 64 /* columns */ ); + sensorinfostruct sensorinfoPegasus( 8, 56 ); + sensorinfostruct sensorinfoFSBB( 4, 416 ); + + if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") ) + sensorinfocur=sensorinfoMi34USB; + else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("FSBB") ) + sensorinfocur=sensorinfoFSBB; + else if (labbook.system.EqualTo("PXI")) // && labbook.chipGen.EqualTo("34") ) + sensorinfocur=sensorinfoMi34PXI; + else if (labbook.system.EqualTo("Pegasus")) // && labbook.chipGen.EqualTo("34") ) + sensorinfocur=sensorinfoPegasus; +} + +void Run::setMatrixSpecificParameters() +{ + submatrix_x_start = 0; + submatrix_x_end = sensorinfocur.columns; + submatrix_y_start = 0; + submatrix_y_end = sensorinfocur.rows; +} + Bool_t Run::useDynamicalNoise(Bool_t var) { cout<<" Dynamical Noise calc. : " << colorwhite << (var?"1":"0") << colorreset << " <-- only used if RAW files are analyzed, force analysis to make sure" << endl; @@ -282,7 +321,6 @@ Bool_t Run::initRun() return 1; } - Bool_t Run::analyzeRun(Bool_t force) { if (!error) @@ -504,12 +542,6 @@ Bool_t Run::analyzeFrame(Int_t frame) return 1; } -// generateSeedSpectrum() -// { -// /// pointer to the TTree of "hit" -// TTree* hitNtuple = (TTree*) f->Get("hit"); -// } - Bool_t Run::runAllreadyAnalyzed() { return (checkFileExists(storepathRAWLinux + "/rootfilecreated") && checkFileExists(storepathOutLinux + Form("/RUN_%i_i.root",labbook.runnumber))); @@ -523,6 +555,8 @@ Bool_t Run::checkFileExists(TString file) Bool_t Run::generateReadableRunCode() { + humanreadablestr = Form("%s, %s, chip %s, %s, %sT=%.1f", labbook.source.Data(), labbook.chipGen.Data(), labbook.chip.Data(), labbook.matrix.Data(), humanreadablesuffix.Data(), labbook.temp); + runcode = Form("%i_", labbook.runnumber); if (labbook.chip.Length() < 2) runcode+= "0" + labbook.chip; @@ -577,7 +611,6 @@ string Run::removePunctuation(std::string x) return x; } - template string Run::numberToString ( T number ) { @@ -596,47 +629,6 @@ Float_t Run::stringToNumber ( string Text ) return ss >> result ? result : 0; } - -void Run::setSystemSpecificParameters() -{ - if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") ) - systemparamcur = systemparamUSB; - else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("FSBB") ) - systemparamcur = systemparamUSB; - else if (labbook.system.EqualTo("PXI")) // && labbook.chipGen.EqualTo("34") ) - systemparamcur = systemparamPXI; - else if (labbook.system.EqualTo("Pegasus")) // && labbook.chipGen.EqualTo("34") ) - systemparamcur = systemparamPegasus; - - setSensorInSystemParam(); -} - -void Run::setSensorInSystemParam() -{ - sensorinfostruct sensorinfoMi34USB( 8, 64 ); - sensorinfostruct sensorinfoMi34PXI( 16, /* rows */ 64 /* columns */ ); - sensorinfostruct sensorinfoPegasus( 8, 56 ); - sensorinfostruct sensorinfoFSBB( 4, 416 ); - - if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") ) - sensorinfocur=sensorinfoMi34USB; - else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("FSBB") ) - sensorinfocur=sensorinfoFSBB; - else if (labbook.system.EqualTo("PXI")) // && labbook.chipGen.EqualTo("34") ) - sensorinfocur=sensorinfoMi34PXI; - else if (labbook.system.EqualTo("Pegasus")) // && labbook.chipGen.EqualTo("34") ) - sensorinfocur=sensorinfoPegasus; -} - -void Run::setMatrixSpecificParameters() -{ - submatrix_x_start = 0; - submatrix_x_end = sensorinfocur.columns; - submatrix_y_start = 0; - submatrix_y_end = sensorinfocur.rows; -} - - void Run::setSubMatrixBorders(u_int x_start, u_int x_end, u_int y_start, u_int y_end, Bool_t addtoruncodesuffix) { submatrix_x_start = x_start; @@ -648,6 +640,7 @@ void Run::setSubMatrixBorders(u_int x_start, u_int x_end, u_int y_start, u_int y runcodesuffix += Form("_row%u-%u_colu%u-%u_", x_start, x_end, y_start, y_end); humanreadablesuffix += Form("Row: %u - %u, Column: %u - %u, ", x_start, x_end, y_start, y_end); } + generateReadableRunCode(); } void Run::selectSubMatrixFSBB(TString matrixname) @@ -1209,11 +1202,6 @@ Bool_t Run::plotVeto() return 1; } -// Int_t findMaxBin(TH1F* th1fpointer) { -// Int_t maxbinval = th1fpointer->GetM -// -// } - Bool_t Run::plotCompareHistograms() { @@ -1302,7 +1290,6 @@ Bool_t Run::plotCompareHistograms() return 1; } - Bool_t Run::plotAllHistograms(histogramstruct* histogramstructpointer) { if (!error) @@ -1821,7 +1808,6 @@ Double_t Run::lorentzianPeak(Double_t *x, Double_t *par) { + .25*par[1]*par[1]); } - void Run::plotVerticalLine(TH1F* histogrampointer, Float_t xVal) { if (xVal > 0) { @@ -2067,7 +2053,6 @@ void Run::initHistograms(histogramstruct* histogramstructpointer, TString suffix TString prefix = "Noise " + suffix; - TString humanreadablestr = Form("%s, %s spectrum, %s, chip %s, %s, %sT=%.1f",prefix.Data(), labbook.source.Data(), labbook.chipGen.Data(), labbook.chip.Data(), labbook.matrix.Data(), humanreadablesuffix.Data(), labbook.temp); if (suffix.Contains("threshold")) { histogramstructpointer->thresholdcluster = 1; @@ -2075,7 +2060,7 @@ void Run::initHistograms(histogramstruct* histogramstructpointer, TString suffix } else { - histogramstructpointer->Noise=new TH1F(prefix.Data(), humanreadablestr.Data(), systemparamcur.nbinsnoise, 0, systemparamcur.maxbinnoise); + histogramstructpointer->Noise=new TH1F(prefix.Data(), Form("%s, %s", prefix.Data(), humanreadablestr.Data()), systemparamcur.nbinsnoise, 0, systemparamcur.maxbinnoise); histogramstructpointer->Noise->SetLineStyle(rootlinestyle[plotStyle]); histogramstructpointer->Noise->SetLineColor(rootcolors[plotStyle]); histogramstructpointer->Noise->SetLineWidth(3); @@ -2090,8 +2075,7 @@ void Run::initHistograms(histogramstruct* histogramstructpointer, TString suffix void Run::initHistogram(TH1F* &histogrampointer, TString prefix) { - TString humanreadablestr = Form("%s, %s spectrum, %s, chip %s, %s, %sT=%.1f",prefix.Data(), labbook.source.Data(), labbook.chipGen.Data(), labbook.chip.Data(), labbook.matrix.Data(), humanreadablesuffix.Data(), labbook.temp); - histogrampointer=new TH1F(prefix.Data(), humanreadablestr.Data(), systemparamcur.nbins, 0, systemparamcur.maxbin); + histogrampointer=new TH1F(prefix.Data(), Form("%s, %s", prefix.Data(), humanreadablestr.Data()), systemparamcur.nbins, 0, systemparamcur.maxbin); histogrampointer->SetLineStyle(rootlinestyle[plotStyle]); histogrampointer->SetLineColor(rootcolors[plotStyle]); histogrampointer->SetStats(kTRUE); @@ -2123,12 +2107,11 @@ void Run::initClusters(Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t void Run::initCluster(histogramstruct* histogramstructpointer, TString suffix, Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t xcoord_abs_max, Float_t ycoord_min_step, Float_t ycoord_abs_min, Float_t ycoord_abs_max) { TString prefix = "Cluster" + suffix; - TString humanreadablestr = Form("%s, %s cluster, %s, chip %s, %s %sT=%.1f",prefix.Data(), labbook.source.Data(), labbook.chipGen.Data(), labbook.chip.Data(), labbook.matrix.Data(), humanreadablesuffix.Data(), labbook.temp); Int_t sizearrrotx= (int)((xcoord_abs_max-xcoord_abs_min)/xcoord_min_step+0.5); Int_t sizearrroty = (int)((ycoord_abs_max-ycoord_abs_min)/ycoord_min_step+0.5); // cout << "xcoord_abs_min: " << xcoord_abs_min << ", xcoord_abs_max: " << xcoord_abs_max << ", xcoord_min_step: " << xcoord_min_step << endl; // cout << "ycoord_abs_min: " << ycoord_abs_min << ", ycoord_abs_max: " << ycoord_abs_max << ", ycoord_min_step: " << ycoord_min_step << endl; - histogramstructpointer->histAvgCluster = new TH2F(prefix.Data(), Form("Avg. cluster distribution; x; y %s", humanreadablestr.Data()),sizearrrotx, xcoord_abs_min,xcoord_abs_max,sizearrroty,ycoord_abs_min,ycoord_abs_max); + histogramstructpointer->histAvgCluster = new TH2F(prefix.Data(), Form("Avg. cluster distribution; x; y %s", Form("%s, %s", prefix.Data(), humanreadablestr.Data())),sizearrrotx, xcoord_abs_min,xcoord_abs_max,sizearrroty,ycoord_abs_min,ycoord_abs_max); // you can increase the resolution, especially usefull if you observe an rotated (originally staggered) pixel cluster // histogramstructpointer->histAvgCluster = new TH2F(prefix.Data(), Form("Avg. cluster distribution; x; y %s", humanreadablestr.Data()),2*sizearrrotx, xcoord_abs_min,xcoord_abs_max,sizearrroty*2,ycoord_abs_min,ycoord_abs_max); } diff --git a/MABS_run_analyzer/Run.h b/MABS_run_analyzer/Run.h index f396971..226286c 100644 --- a/MABS_run_analyzer/Run.h +++ b/MABS_run_analyzer/Run.h @@ -171,7 +171,8 @@ private: /// noise quantiles: mean value, sigma in postive direction and sigma in negative direction Double_t noisequantiles[3]; - + /// A string representing the current run database information in a human readable format + TString humanreadablestr=""; /** * @brief Plots vertical dotted red line from x-axis to graph at place x -- 2.43.0