From 0816ba0a1976245100f33c63780e6208e9fb3f40 Mon Sep 17 00:00:00 2001 From: Ali Yazgili Date: Tue, 28 Nov 2017 11:26:26 +0100 Subject: [PATCH] Run analyzer: Benny is cleaning the code, adding comments --- MABS_run_analyzer/ChargeSpektrumFunctions.c | 2 +- MABS_run_analyzer/Run.c | 23 ++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrumFunctions.c b/MABS_run_analyzer/ChargeSpektrumFunctions.c index 734b607..f7ed149 100644 --- a/MABS_run_analyzer/ChargeSpektrumFunctions.c +++ b/MABS_run_analyzer/ChargeSpektrumFunctions.c @@ -1384,7 +1384,7 @@ Bool_t printSummaryTable(vector* ptCompareHistogramClassVector) // cout << left << setw(width+2) << setfill(' ') << printTableElement(curhistogramclassp->integralSum,ptCompareHistogramClassVector->at(0)->integralSum,2); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralSum,ptCompareHistogramClassVector->at(0)->integralSum,4).c_str()); if (printRTSpixel > 0) { cout << left << setw(width-2) << setfill(' ') << printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0).c_str()); } if (printSeedIntegral > 0) { cout << left << setw(width) << setfill(' ') << printTableElement(curhistogramclassp->integralSeed,ptCompareHistogramClassVector->at(0)->integralSeed); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralSeed,ptCompareHistogramClassVector->at(0)->integralSeed).c_str()); } - if (printLeakage > 0.0) { cout << left << setw(width+2) << setfill(' ') << printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1).c_str()); } + if (printLeakage > 0.0) { cout << left << setw(width+2) << setfill(' ') << printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,2); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1).c_str()); } cout << left << setw(width-2) << setfill(' ') << printTableElement(curhistogramclassp->avgNoise,ptCompareHistogramClassVector->at(0)->avgNoise); filecontent += Form("%s\t", printTableElement(curhistogramclassp->avgNoise,ptCompareHistogramClassVector->at(0)->avgNoise).c_str()); if (printnsethr > 0) { cout << left << setw(width) << setfill(' ') << printTableElement(curhistogramclassp->noisethresholdborder,ptCompareHistogramClassVector->at(0)->noisethresholdborder); filecontent += Form("%s\t", printTableElement(curhistogramclassp->noisethresholdborder,ptCompareHistogramClassVector->at(0)->noisethresholdborder).c_str()); } cout << "" << endl; filecontent += Form("\n"); diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index 93faba2..f43a7e7 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -1620,11 +1620,12 @@ Bool_t Run::binSeedSumVeto() if (histogramdynamicalthreshold->fixedThresholdValue <= 0) { Float_t highestval = histogram->Seed->GetMaximum(); float_t cutval = (*histogram->Sum)->GetBinCenter((*histogram->Sum)->FindLastBinAbove(highestval/4,1)); + cout << " Setting 'maybe better' noise border for 'histogramdynamicalthreshold' cut class" << endlr; setFixedThresholdValueADU(histogramdynamicalthreshold, cutval*0.6); // change back to *0.8 } if (pixelSum > histogramdynamicalthreshold->fixedThresholdValue) // charge is more then histogramdynamicalthreshold->fixedThresholdValue in whole cluster { - histogramdynamicalthreshold->numberofhits++; + histogramdynamicalthreshold->numberofhits++; fillAHistogramsinclass(histogramdynamicalthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0], pixelSum25, notSeedSum25, &a_pixelSum25[0], &a_notSeedSum25[0], pixelSum9, notSeedSum9, &a_pixelSum9[0], &a_notSeedSum9[0]); } } @@ -1633,7 +1634,8 @@ Bool_t Run::binSeedSumVeto() // bin the fixed threshold for charge histogram class if (histogramfixedthreshold != 0 && histogram != 0) { if (histogramfixedthreshold->fixedThresholdValue <= 0) { - setFixedThresholdValueADU(histogramfixedthreshold, 30); // change back to *0.8 + cout << " Setting fixed noise border for 'histogramfixedthreshold' cut class" << endlr; + setFixedThresholdValueADU(histogramfixedthreshold, 30); } if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster { @@ -1642,8 +1644,8 @@ Bool_t Run::binSeedSumVeto() } } - if (histogramGoodVeto != 0 && histogram != 0) { - if (framei == 0) { // only one time job, do while in first frame only + if (histogramGoodVeto != 0 && histogram != 0) { // histogramGoodVeto not used any more + if (framei == 0) { // only one time job, do one time only, main job was done in first fill round, see 'filli == 1' above histogram->FindNoisethresholdborder(histogram->Seed, false, false); if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) { parameters = histogram->FitPerform(histogram->Veto, "GaussTail"); @@ -1661,7 +1663,7 @@ Bool_t Run::binSeedSumVeto() } else if (filli == 2) { // third fill round, some histograms are allready filled - if (histogramGoodVeto != 0 && histogram != 0) { + if (histogramGoodVeto != 0 && histogram != 0) {// histogramGoodVeto not used any more if (framei == 0) { // only one time job, do while in first frame only uint numberofgoodvetopixels = 0; @@ -1695,10 +1697,15 @@ Bool_t Run::binSeedSumVeto() // 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 + + cout << colorcyan << "Start fitting" << endlr; + cout << colorcyan << (*curHistogramClass)->histogramdescription << endlr; (*curHistogramClass)->FindNoisethresholdborder((*curHistogramClass)->Seed, false, false); if (labbook.runnumber == 343056) (*curHistogramClass)->noisethresholdborder = 34; if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) { + + cout << colorcyan << "Veto" << endlr; parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Veto, "GaussTail"); (*curHistogramClass)->posVeto = parameters[1]; if (labbook.runnumber == 343056) @@ -1714,6 +1721,7 @@ Bool_t Run::binSeedSumVeto() // cout << (*curHistogramClass)->histogramdescription << ": " << colorcyan << parameters[1] << endlr; (*curHistogramClass)->integralVeto = parameters[6]; } + cout << colorcyan << "Seed" << endlr; if (labbook.chipGen.EqualTo("Pipper2") || labbook.chipGen.EqualTo("Pegasus")) parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "gaus", 0, false, (*curHistogramClass)->fixedThresholdValue); else @@ -1721,6 +1729,8 @@ Bool_t Run::binSeedSumVeto() (*curHistogramClass)->integralSeed = parameters[6]; (*curHistogramClass)->posSeed = parameters[1]; (*curHistogramClass)->integralSeedErr = parameters[9]; + + cout << colorcyan << "Sum" << endlr; parameters = (*curHistogramClass)->FitPerform((*(*curHistogramClass)->Sum), "gaus", 0, false, (*curHistogramClass)->fixedThresholdValue); //TODO change back to gauss (*curHistogramClass)->posSum = parameters[1]; (*curHistogramClass)->integralSum = parameters[6]; @@ -1729,6 +1739,7 @@ Bool_t Run::binSeedSumVeto() for (Int_t bini = 1; bini <= (*curHistogramClass)->clustermultiplicity->GetNbinsX(); bini++) { (*curHistogramClass)->clustermultiplicity->SetBinContent(bini, (*curHistogramClass)->clustermultiplicity->GetBinContent(bini)/(*curHistogramClass)->numberofhits); } + cout << colorcyan << "Sum9" << endlr; for (u_int sumi = 0; sumi < (*curHistogramClass)->a_Sum9.size(); sumi++) { // Float_t integratestart = (*curHistogramClass)->FindNoisethresholdborder((*curHistogramClass)->a_Sum[sumi], false, false); // parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->a_Sum[sumi], "gaus", 0, false, integratestart); //TODO change back to gauss @@ -1737,6 +1748,7 @@ Bool_t Run::binSeedSumVeto() (*curHistogramClass)->a_integralSum9.push_back(parameters[6]); (*curHistogramClass)->a_integralSumErr9.push_back(parameters[9]); } + cout << colorcyan << "Sum25" << endlr; for (u_int sumi = 0; sumi < (*curHistogramClass)->a_Sum25.size(); sumi++) { // Float_t integratestart = (*curHistogramClass)->FindNoisethresholdborder((*curHistogramClass)->a_Sum[sumi], false, false); // parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->a_Sum[sumi], "gaus", 0, false, integratestart); //TODO change back to gauss @@ -1746,6 +1758,7 @@ Bool_t Run::binSeedSumVeto() (*curHistogramClass)->a_integralSumErr25.push_back(parameters[9]); } + cout << colorcyan << "SeedPerc" << endlr; parameters =(*curHistogramClass)->FitPerform((*curHistogramClass)->SeedPerc, "landau"); (*curHistogramClass)->posSeedPerc = parameters[1]; (*curHistogramClass)->sigmaSeedPerc = parameters[2]; -- 2.43.0