From 99c112c9d7e70e976f1c5f0801ffb5ec421df66c Mon Sep 17 00:00:00 2001 From: Tobias Bus Date: Fri, 20 Oct 2017 13:55:48 +0200 Subject: [PATCH] analyzer: added REAL fixed threshold cut, added temperature anaylsis --- MABS_run_analyzer/ChargeSpektrum.c | 88 +++++++++++++++++++++--------- MABS_run_analyzer/HistogramType.c | 2 +- MABS_run_analyzer/Run.c | 52 ++++++++++++------ MABS_run_analyzer/Run.h | 1 + 4 files changed, 98 insertions(+), 45 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index 584f251..2a0bb2d 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -49,6 +49,10 @@ void ChargeSpektrum(TString runnumber = "") datainput3 =new TNtupleO("ntuple3", "data", "x:y:xerr:yerr"); TNtupleO *prop2ndpixelfire; prop2ndpixelfire =new TNtupleO("Prop. 2nd pixel", "data", "x:y:xerr:yerr"); + TNtupleO *averageChargeCollectedSeed; + averageChargeCollectedSeed =new TNtupleO("Average charge collected by Seed", "data", "x:y:xerr:yerr"); + TNtupleO *averageChargeCollectedSum; + averageChargeCollectedSum =new TNtupleO("Average charge collected by Sum", "data", "x:y:xerr:yerr"); for(Int_t runi=0; runi0) @@ -73,6 +77,7 @@ void ChargeSpektrum(TString runnumber = "") //runs[runi]->setNoisethresholdborderE(220); // runs[runi]->analyzeFrame(680); // continue; + runs[runi]->setFixedThresholdValueADU(30); // creates or opens .root file, can analyze the RAW data @@ -108,9 +113,9 @@ void ChargeSpektrum(TString runnumber = "") compareHistogramClassVector.push_back(runs[runi]->histogram->normalized); } - if (analysisis.Contains("fixthresh") || analysisis.Contains("fixedthresh")) { // fixed threshold analysis + if (analysisis.Contains("dynthresh") || analysisis.Contains("dynamicalthresh")) { // fixed threshold analysis compareHistogramClassVector4.push_back(runs[runi]->histogram); - compareHistogramClassVector4.push_back(runs[runi]->histogramfixedthreshold); + compareHistogramClassVector4.push_back(runs[runi]->histogramdynamicalthreshold); plotAllRuns(&compareHistogramClassVector4); compareHistogramClassVector4.clear(); } @@ -120,20 +125,20 @@ void ChargeSpektrum(TString runnumber = "") } if (analysisis.Contains("depl")) { // depletion analysis - compareHistogramVector.push_back(runs[runi]->histogramfixedthreshold->SeedPerc); + compareHistogramVector.push_back(runs[runi]->histogramdynamicalthreshold->normalized->SeedPerc); - datainputPosVeto->itsHistogramType = runs[runi]->histogramfixedthreshold; + datainputPosVeto->itsHistogramType = runs[runi]->histogramdynamicalthreshold; datainputPosVeto->xaxisTitle = "Voltage"; datainputPosVeto->yaxisTitle = "Position Veto"; - datainputPosVeto->Fill(runs[runi]->labbook.depletionV,runs[runi]->histogramfixedthreshold->posVeto,0,0); + datainputPosVeto->Fill(runs[runi]->labbook.depletionV,runs[runi]->histogramdynamicalthreshold->posVeto,0,0); if (runi+1 == runnumber) ntupleVector.push_back(datainputPosVeto); - - prop2ndpixelfire->itsHistogramType = runs[runi]->histogramfixedthreshold; + + prop2ndpixelfire->itsHistogramType = runs[runi]->histogramdynamicalthreshold; prop2ndpixelfire->xaxisTitle = "Voltage"; prop2ndpixelfire->yaxisTitle = "Propability for second pixel to fire"; - prop2ndpixelfire->Fill(runs[runi]->labbook.depletionV,runs[runi]->histogramfixedthreshold->clustermultiplicity->GetBinContent(2),0,0); - cout << colorcyan << " Cluster Mult.:" << runs[runi]->histogramfixedthreshold->clustermultiplicity << endlr; + prop2ndpixelfire->Fill(runs[runi]->labbook.depletionV,runs[runi]->histogramdynamicalthreshold->clustermultiplicity->GetBinContent(2),0,0); + cout << colorcyan << " Cluster Mult.:" << runs[runi]->histogramdynamicalthreshold->clustermultiplicity << endlr; if (runi+1 == runnumber) ntupleVector3.push_back(prop2ndpixelfire); @@ -143,11 +148,11 @@ void ChargeSpektrum(TString runnumber = "") for (UInt_t sumi = 0; sumi < 9; sumi++) { AverageCharge[sumi] = 0; TotalHits[sumi] = 0; - for (Int_t bini = 1; bini <= (*runs[runi]->histogramfixedthreshold->a_Sum)[sumi]->GetXaxis()->GetNbins();++bini) { - AverageCharge[sumi] += (*runs[runi]->histogramfixedthreshold->a_Sum)[sumi]->GetBinContent(bini)*(*runs[runi]->histogramfixedthreshold->a_Sum)[sumi]->GetBinCenter(bini); - TotalHits[sumi] += (*runs[runi]->histogramfixedthreshold->a_Sum)[sumi]->GetBinContent(bini); + for (Int_t bini = 1; bini <= (*runs[runi]->histogramdynamicalthreshold->a_Sum)[sumi]->GetXaxis()->GetNbins();++bini) { + AverageCharge[sumi] += (*runs[runi]->histogramdynamicalthreshold->a_Sum)[sumi]->GetBinContent(bini)*(*runs[runi]->histogramdynamicalthreshold->a_Sum)[sumi]->GetBinCenter(bini); + TotalHits[sumi] += (*runs[runi]->histogramdynamicalthreshold->a_Sum)[sumi]->GetBinContent(bini); } - AverageCharge[sumi] /= TotalHits[sumi]/runs[runi]->histogramfixedthreshold->gain; + AverageCharge[sumi] /= TotalHits[sumi]/runs[runi]->histogramdynamicalthreshold->gain; } TNtupleO *numpixelincl; @@ -160,7 +165,7 @@ void ChargeSpektrum(TString runnumber = "") compareHistogramVector2.push_back((*runs[runi]->histogram->normalized->a_Sum)[sumi]); numpixelincl->Fill(sumi+1,AverageCharge[sumi],0,0); } - ntupleVector2.push_back(numpixelincl); + ntupleVector2.push_back(numpixelincl); } if (analysisis.Contains("rts")) { // rts studies @@ -180,11 +185,11 @@ void ChargeSpektrum(TString runnumber = "") if (analysisis.Contains("seedf")) { // seedfit: seed integral anaylsis runs[runi]->plot1DHistogram( runs[runi]->histogram->normalized->Seed, "gaus", true, false, false, runs[runi]->histogram->fixedThresholdValue); - runs[runi]->plot1DHistogram( runs[runi]->histogramfixedthreshold->normalized->Seed, "gaus", true, false, false, runs[runi]->histogram->fixedThresholdValue); + runs[runi]->plot1DHistogram( runs[runi]->histogramdynamicalthreshold->normalized->Seed, "gaus", true, false, false, runs[runi]->histogram->fixedThresholdValue); compareHistogramVector6.push_back(runs[runi]->histogram->Seed); - compareHistogramVector6.push_back(runs[runi]->histogramfixedthreshold->Seed); + compareHistogramVector6.push_back(runs[runi]->histogramdynamicalthreshold->Seed); CompareHistograms(&compareHistogramVector6); compareHistogramVector6.clear(); @@ -220,11 +225,11 @@ void ChargeSpektrum(TString runnumber = "") for (UInt_t sumi = 0; sumi < 25; sumi++) { AverageCharge25[sumi] = 0; TotalHits25[sumi] = 0; - for (Int_t bini = 1; bini <= runs[runi]->histogramfixedthreshold->a_Sum25[sumi]->GetXaxis()->GetNbins();++bini) { - AverageCharge25[sumi] += runs[runi]->histogramfixedthreshold->a_Sum25[sumi]->GetBinContent(bini)*runs[runi]->histogramfixedthreshold->a_Sum25[sumi]->GetBinCenter(bini); - TotalHits25[sumi] += runs[runi]->histogramfixedthreshold->a_Sum25[sumi]->GetBinContent(bini); + for (Int_t bini = 1; bini <= runs[runi]->histogramdynamicalthreshold->a_Sum25[sumi]->GetXaxis()->GetNbins();++bini) { + AverageCharge25[sumi] += runs[runi]->histogramdynamicalthreshold->a_Sum25[sumi]->GetBinContent(bini)*runs[runi]->histogramdynamicalthreshold->a_Sum25[sumi]->GetBinCenter(bini); + TotalHits25[sumi] += runs[runi]->histogramdynamicalthreshold->a_Sum25[sumi]->GetBinContent(bini); } -// AverageCharge25[sumi] /= TotalHits25[sumi]/runs[runi]->histogramfixedthreshold->gain; +// AverageCharge25[sumi] /= TotalHits25[sumi]/runs[runi]->histogramdynamicalthreshold->gain; } TNtupleO *numpixelincl2; @@ -243,11 +248,11 @@ void ChargeSpektrum(TString runnumber = "") for (UInt_t sumi = 0; sumi < 9; sumi++) { AverageCharge9[sumi] = 0; TotalHits9[sumi] = 0; - for (Int_t bini = 1; bini <= runs[runi]->histogramfixedthreshold->a_Sum9[sumi]->GetXaxis()->GetNbins();++bini) { - AverageCharge9[sumi] += runs[runi]->histogramfixedthreshold->a_Sum9[sumi]->GetBinContent(bini)*runs[runi]->histogramfixedthreshold->a_Sum9[sumi]->GetBinCenter(bini); - TotalHits9[sumi] += runs[runi]->histogramfixedthreshold->a_Sum9[sumi]->GetBinContent(bini); + for (Int_t bini = 1; bini <= runs[runi]->histogramdynamicalthreshold->a_Sum9[sumi]->GetXaxis()->GetNbins();++bini) { + AverageCharge9[sumi] += runs[runi]->histogramdynamicalthreshold->a_Sum9[sumi]->GetBinContent(bini)*runs[runi]->histogramdynamicalthreshold->a_Sum9[sumi]->GetBinCenter(bini); + TotalHits9[sumi] += runs[runi]->histogramdynamicalthreshold->a_Sum9[sumi]->GetBinContent(bini); } -// AverageCharge9[sumi] /= TotalHits9[sumi]/runs[runi]->histogramfixedthreshold->gain; +// AverageCharge9[sumi] /= TotalHits9[sumi]/runs[runi]->histogramdynamicalthreshold->gain; } TNtupleO *numpixelincl; @@ -263,6 +268,35 @@ void ChargeSpektrum(TString runnumber = "") } + if (analysisis.Contains("temp")) { // analyze cluster formation + compareHistogramClassVector5.push_back(runs[runi]->histogramfixedthreshold->normalized); + + Double_t AverageChargeTempSeed = 0; + Double_t AverageChargeTempSum = 0; + Double_t TotalHitsTemp = 0; + for (Int_t bini = 1; bini <= runs[runi]->histogramfixedthreshold->normalized->Seed->GetXaxis()->GetNbins();++bini) { + AverageChargeTempSeed += runs[runi]->histogramfixedthreshold->normalized->Seed->GetBinContent(bini)*runs[runi]->histogramfixedthreshold->normalized->Seed->GetBinCenter(bini); + TotalHitsTemp += runs[runi]->histogramfixedthreshold->normalized->Seed->GetBinContent(bini); + } + AverageChargeTempSeed /= TotalHitsTemp; + for (Int_t bini = 1; bini <= (*runs[runi]->histogramfixedthreshold->normalized->Sum)->GetXaxis()->GetNbins();++bini) { + AverageChargeTempSum += (*runs[runi]->histogramfixedthreshold->normalized->Sum)->GetBinContent(bini)*(*runs[runi]->histogramfixedthreshold->normalized->Sum)->GetBinCenter(bini); + } + AverageChargeTempSum /= TotalHitsTemp; + + averageChargeCollectedSeed->itsHistogramType = runs[runi]->histogramfixedthreshold->normalized; + averageChargeCollectedSeed->xaxisTitle = "Temperature [°C]"; + averageChargeCollectedSeed->yaxisTitle = "Average charge collected [ADU]"; + + averageChargeCollectedSum->itsHistogramType = runs[runi]->histogramfixedthreshold->normalized; + averageChargeCollectedSum->xaxisTitle = "Temperature [°C]"; + averageChargeCollectedSum->yaxisTitle = "Average charge collected [ADU]"; + + averageChargeCollectedSeed->Fill(runs[runi]->labbook.tempSens,AverageChargeTempSeed,2,0); + averageChargeCollectedSum->Fill(runs[runi]->labbook.tempSens,AverageChargeTempSum,2,0); + + } + @@ -274,6 +308,8 @@ void ChargeSpektrum(TString runnumber = "") } } } // loop over all runs end + ntupleVector6.push_back(averageChargeCollectedSeed); + ntupleVector6.push_back(averageChargeCollectedSum); printSummaryTable(&compareHistogramClassVector); printSummaryTable(&compareHistogramClassVector2); @@ -305,8 +341,8 @@ plot1DData(&ntupleVector6); plot1DData(&ntupleVector7); plot1DData(&ntupleVector8); plot1DData(&ntupleVector9); -CompareLeageCurrent(&compareHistogramClassVector4); -CompareLeageCurrent(&compareHistogramClassVector5); +CompareLeageCurrent(&compareHistogramClassVector8); +CompareLeageCurrent(&compareHistogramClassVector9); writeObservableToFile(); writeOneHistogramTypeToFile(&compareHistogramClassVector); diff --git a/MABS_run_analyzer/HistogramType.c b/MABS_run_analyzer/HistogramType.c index 7a63b52..046fc5e 100644 --- a/MABS_run_analyzer/HistogramType.c +++ b/MABS_run_analyzer/HistogramType.c @@ -51,7 +51,7 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) { initHistogram(Veto, "Veto" + histogramdescription, color, style); initHistogram(Noise, "Noise" + histogramdescription, color, style); initHistogram(NoiseEnd, "Noise at end" + histogramdescription, 16, style); - initHistogramCustom(SeedPerc, "Seed Percentage" + histogramdescription, color, style, 0, 120, 121, Form("Entries [1/%%]"), "Q_coll [%]"); + initHistogramCustom(SeedPerc, "Seed Percentage" + histogramdescription, color, style, 0, 120, 121, Form("Entries"), "Q_coll [%]"); initHistogramCustom(clustermultiplicity, "Cluster multiplicity" + histogramdescription, color, style, 0.5, 6.5, 6, Form("Entries"), "Number of pixel fired"); initHistogramCustom(pixeltimefired, "Pixel fired, used for " + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counts"); initHistogramCustom(pixeltimefiredDistrib, "Fire counter" + histogramdescription, color, style, 0, labbook->frames_foundDB/100, labbook->frames_foundDB/100, "times fired", "Counts"); diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index 78f1d55..ea57e6b 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -166,7 +166,10 @@ Run::Run(Int_t runnumber, Int_t loopi, TString customtitle) // dynamical cluster threshold cut histogramthreshold = new HistogramType(" Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, &labbook, this, rootcolors[plotStyle], rootlinestyle[plotStyle] ); HistogramClassVector.push_back(histogramthreshold); - // fixed threshold cut + // dynamical threshold cut + histogramdynamicalthreshold = new HistogramType(" dynamical Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, &labbook, this, rootcolors[plotStyle], rootlinestyle[plotStyle]); + HistogramClassVector.push_back(histogramdynamicalthreshold); + // fixed threshold cut histogramfixedthreshold = new HistogramType(" fixed Threshold", &cursystemparam, &cursensorinfo, humanreadablestr, &labbook, this, rootcolors[plotStyle], rootlinestyle[plotStyle]); HistogramClassVector.push_back(histogramfixedthreshold); // RTS pixel removed histograms @@ -508,9 +511,9 @@ Bool_t Run::analyzeRun(Bool_t force) cout << colorwhite << "integrateSr90Spectra():" << endlr; histogramthreshold->integrateSr90Spectra(histogramthreshold->Seed, frames_found, -1, true); histogramthreshold->integrateSr90Spectras(frames_found, -1, false); - if (histogramfixedthreshold != 0) { - histogramfixedthreshold->integrateSr90Spectra(histogramfixedthreshold->Seed, frames_found, 0); - histogramfixedthreshold->integrateSr90Spectras(frames_found, -1, false); + if (histogramdynamicalthreshold != 0) { + histogramdynamicalthreshold->integrateSr90Spectra(histogramdynamicalthreshold->Seed, frames_found, 0); + histogramdynamicalthreshold->integrateSr90Spectras(frames_found, -1, false); } } cout << colorwhite << "normalizeHistogramClasses():" << endlr; @@ -1026,7 +1029,7 @@ void Run::updateDatabase() { // Add code to set the pointer histogramclassToUseForDB to class to use for database values // histogramclassToUseForDB = histogramthreshold; if (labbook.chipGen.EqualTo("Pipper2")) { - histogramclassToUseForDB = histogramfixedthreshold; + histogramclassToUseForDB = histogramdynamicalthreshold; } else { histogramclassToUseForDB = histogramwoRTSthreshold; } @@ -1500,13 +1503,26 @@ Bool_t Run::binSeedSumVeto() } } else if (filli == 1) { // second fill round, some histograms are allready filled - // histogramfixedthreshold relies on "histogram", therefore 'histogram' has to be completly filled before a threshold can be Set + // histogramdynamicalthreshold relies on "histogram", therefore 'histogram' has to be completly filled before a threshold can be Set // bin the fixed threshold for charge histogram class - if (histogramfixedthreshold != 0 && histogram != 0) { - if (histogramfixedthreshold->fixedThresholdValue <= 0) { + if (histogramdynamicalthreshold != 0 && histogram != 0) { + if (histogramdynamicalthreshold->fixedThresholdValue <= 0) { Float_t highestval = histogram->Seed->GetMaximum(); float_t cutval = (*histogram->Sum)->GetBinCenter((*histogram->Sum)->FindLastBinAbove(highestval/4,1)); - setFixedThresholdValueADU(cutval*0.6); // change back to *0.8 + 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++; + 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]); + } + } + + // histogramfixedthreshold relies on "histogram", therefore 'histogram' has to be completly filled before a threshold can be Set + // 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 } if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster { @@ -1624,12 +1640,12 @@ Bool_t Run::binSeedSumVeto() (*curHistogramClass)->sigmaSeedPerc = parameters[2]; for (Int_t bini=1; bini <= 100; bini++) { - (*curHistogramClass)->SeedPerc->SetBinContent(bini,(*curHistogramClass)->SeedPerc->GetBinContent(bini));//((*curHistogramClass)->SeedPerc->GetEntries())); + (*curHistogramClass)->SeedPerc->SetBinContent(bini,(*curHistogramClass)->SeedPerc->GetBinContent(bini));///((*curHistogramClass)->SeedPerc->GetEntries())); } } - if (histogramfixedthreshold != 0) { - histogramfixedthreshold->noisethresholdborder=0; + if (histogramdynamicalthreshold != 0) { + histogramdynamicalthreshold->noisethresholdborder=0; } // gROOT->SetBatch(kFALSE); return 0; @@ -1727,9 +1743,9 @@ Bool_t Run::binCluster() histogram->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); if (processed->fFrameInfo.pixelthreshold[hiti]>0) histogramthreshold->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); - if (histogramfixedthreshold != 0) + if (histogramdynamicalthreshold != 0) if (processed->fFrameInfo.pixelfixedthreshold[hiti]>0) - histogramfixedthreshold->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); + histogramdynamicalthreshold->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); } } else // Diode sitzt unten im SeedPixel, da nach PitchY angeordnet @@ -1759,9 +1775,9 @@ Bool_t Run::binCluster() histogram->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); if (processed->fFrameInfo.pixelthreshold[hiti]>0) histogramthreshold->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); - if (histogramfixedthreshold != 0) + if (histogramdynamicalthreshold != 0) if (processed->fFrameInfo.pixelfixedthreshold[hiti]>0) - histogramfixedthreshold->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); + histogramdynamicalthreshold->histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); } } } @@ -1773,8 +1789,8 @@ Bool_t Run::binCluster() for (Int_t clustery = 1; clustery <=histogram->histAvgCluster->GetYaxis()->GetNbins();clustery++) { histogram->histAvgCluster->SetBinContent(clusterx,clustery,histogram->histAvgCluster->GetBinContent(clusterx,clustery)/histogram->numberofhits); histogramthreshold->histAvgCluster->SetBinContent(clusterx,clustery,histogramthreshold->histAvgCluster->GetBinContent(clusterx,clustery)/histogramthreshold->numberofhits); - if (histogramfixedthreshold != 0) - histogramfixedthreshold->histAvgCluster->SetBinContent(clusterx,clustery,histogramfixedthreshold->histAvgCluster->GetBinContent(clusterx,clustery)/histogramfixedthreshold->numberofhits); + if (histogramdynamicalthreshold != 0) + histogramdynamicalthreshold->histAvgCluster->SetBinContent(clusterx,clustery,histogramdynamicalthreshold->histAvgCluster->GetBinContent(clusterx,clustery)/histogramdynamicalthreshold->numberofhits); } } diff --git a/MABS_run_analyzer/Run.h b/MABS_run_analyzer/Run.h index 8b6231e..405cca7 100644 --- a/MABS_run_analyzer/Run.h +++ b/MABS_run_analyzer/Run.h @@ -377,6 +377,7 @@ public: HistogramType* histogram = 0; HistogramType* histogramthreshold = 0; HistogramType* histogramfixedthreshold = 0; + HistogramType* histogramdynamicalthreshold = 0; HistogramType* histogramwoRTS = 0; HistogramType* histogramwoRTSthreshold = 0; -- 2.43.0