From acda4da6e52159c4f801fc1e717cdefeadfdcc6b Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Fri, 26 Aug 2016 14:28:51 +0200 Subject: [PATCH] Anylyzer: Some new cuts added --- MABS_run_analyzer/ChargeSpektrum.c | 38 ++++++---- MABS_run_analyzer/ChargeSpektrumFunctions.c | 14 ++-- MABS_run_analyzer/HistogramType.c | 19 ++++- MABS_run_analyzer/HistogramType.h | 6 +- MABS_run_analyzer/MAPS.c | 2 +- MABS_run_analyzer/Run.c | 83 +++++++++++++-------- 6 files changed, 108 insertions(+), 54 deletions(-) diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index 01886f5..8527083 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -92,25 +92,34 @@ void ChargeSpektrum(TString runnumber = "") if (!isBatch) gROOT->SetBatch(kFALSE); - // Uncomment below to do classical analysis - compareHistogramClassVector.push_back(runs[runi]->histogramthreshold); - compareHistogramVector.push_back(runs[runi]->histogramthreshold->Seed); +// // Uncomment below to do classical analysis +// compareHistogramClassVector.push_back(runs[runi]->histogramthreshold); +// compareHistogramVector.push_back(runs[runi]->histogramthreshold->Seed); - // Uncomment below to do analysis without RTS pixel - compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSAggresivethreshold); - compareHistogramVector2.push_back(runs[runi]->histogramwoRTSAggresivethreshold->Seed); +// Uncomment below to do analysis without RTS pixel + compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSthreshold); +// compareHistogramVector2.push_back(runs[runi]->histogramwoRTSthreshold->Seed); + compareHistogramClassVector3.push_back(runs[runi]->histogramwoRTSthreshold->calibrated); + compareHistogramVector4.push_back(runs[runi]->histogramwoRTSthreshold->calibrated->Seed); - // RTS analysis +// RTS analysis runs[runi]->compareHistogramClassVector.push_back(runs[runi]->histogramthreshold); runs[runi]->compareHistogramClassVector.push_back(runs[runi]->histogramwoRTSthreshold); runs[runi]->compareHistogramClassVector.push_back(runs[runi]->histogramwoRTSAggresivethreshold); plotAllRuns(&runs[runi]->compareHistogramClassVector); runs[runi]->compareHistogramClassVector.clear(); -// // Leakage current -// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->LeakageCurrentInPixel, "", 0); -// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->LeakageCurrentInPixelSorted, "", 0); -// compareHistogramVector2.push_back(runs[runi]->histogram->LeakageCurrentInPixelSorted); + // RTS Hit analysis + runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTSthreshold->pixeltimefired, "", 0); +// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTSthreshold->pixeltimefiredsorted, "", 0); +// compareHistogramVector3.push_back(runs[runi]->histogramwoRTSthreshold->pixeltimefiredsorted); + compareHistogramVector6.push_back(runs[runi]->histogramwoRTSthreshold->calibrated->pixeltimefiredsorted); + + // Leakage current +// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramthreshold->LeakageCurrentInPixel, "", 0); +// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramthreshold->LeakageCurrentInPixelSorted, "", 0); +// compareHistogramVector5.push_back(runs[runi]->histogramthreshold->LeakageCurrentInPixelSorted); + compareHistogramVector7.push_back(runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixelSorted); @@ -197,10 +206,13 @@ CompareHistograms(&compareHistogramVector3); CompareHistograms(&compareHistogramVector4); CompareHistograms(&compareHistogramVector5); CompareHistograms(&compareHistogramVector6); +CompareHistograms(&compareHistogramVector7); +CompareHistograms(&compareHistogramVector8); plotAllRuns(&compareHistogramClassVector); plotAllRuns(&compareHistogramClassVector2); -// plotAllRuns(&compareHistogramClassVector2); -// plotAllRuns(&compareHistogramClassVector3); +plotAllRuns(&compareHistogramClassVector3); +plotAllRuns(&compareHistogramClassVector4); +plotAllRuns(&compareHistogramClassVector5); writeObservableToFile(); // plotAllRuns("seed threshold calibrated"); // setCustomPath("Excel/"); diff --git a/MABS_run_analyzer/ChargeSpektrumFunctions.c b/MABS_run_analyzer/ChargeSpektrumFunctions.c index 27ad90b..58b295c 100644 --- a/MABS_run_analyzer/ChargeSpektrumFunctions.c +++ b/MABS_run_analyzer/ChargeSpektrumFunctions.c @@ -56,8 +56,8 @@ Bool_t printSummaryTable(vector*); Bool_t testifMixingCalibration(vector*); /** @brief Turns a value into a string with fixed precision */ string to_str_w_prec(const Float_t a_value, int precision = 1); -vector compareHistogramClassVector, compareHistogramClassVector2, compareHistogramClassVector3, compareHistogramClassVector4, compareHistogramClassVector5, compareHistogramClassVector6; -vector compareHistogramVector, compareHistogramVector2, compareHistogramVector3, compareHistogramVector4, compareHistogramVector5, compareHistogramVector6; +vector compareHistogramClassVector, compareHistogramClassVector2, compareHistogramClassVector3, compareHistogramClassVector4, compareHistogramClassVector5, compareHistogramClassVector6, compareHistogramClassVector7, compareHistogramClassVector8; +vector compareHistogramVector, compareHistogramVector2, compareHistogramVector3, compareHistogramVector4, compareHistogramVector5, compareHistogramVector6, compareHistogramVector7, compareHistogramVector8; TString ownpath = ""; void setCustomPath(TString setOwnpath) @@ -339,8 +339,8 @@ Bool_t plotAllRuns() { Bool_t testifMixingCalibration(vector* ptCompareHistogramClassVector) { if ( !ptCompareHistogramClassVector->size() ) { - cout << colorwhite << ptCompareHistogramClassVector->size() << endl; - cout << colorred << "plotCompareHistograms(): No plots to compare, please push them into the vector: CompareHistogramClassVector" << endlr; +// cout << colorwhite << ptCompareHistogramClassVector->size() << endl; +// cout << colorred << "plotCompareHistograms(): No plots to compare, please push them into the vector: CompareHistogramClassVector" << endlr; return 1; } Bool_t calibrated = true; @@ -378,7 +378,7 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) // legend entries Float_t height = ptCompareHistogramClassVector->size() * 0.055; - TLegend* leg1 = new TLegend(0.10,0.89-height,0.95,0.89);//(0.6,0.7,0.89,0.89); + TLegend* leg1 = new TLegend(0.50,0.89-height,0.95,0.89);//(0.6,0.7,0.89,0.89); leg1->SetTextSize(0.035); leg1->SetFillStyle(0); leg1->SetTextFont(132); @@ -405,8 +405,8 @@ Bool_t plotAllRuns(vector* ptCompareHistogramClassVector) Float_t heighestval1=0; Float_t heighestval2=0; Float_t heighestval3=0; - Float_t heighestval4=0; - TString canvastitle = Form("Summary"); + Float_t heighestval4=0; + TString canvastitle = "Summary"+ptCompareHistogramClassVector->at(0)->histogramdescription; for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++) { HistogramType* curhistogramclassp = ptCompareHistogramClassVector->at(histogrami); diff --git a/MABS_run_analyzer/HistogramType.c b/MABS_run_analyzer/HistogramType.c index 93ce570..7ca45d0 100644 --- a/MABS_run_analyzer/HistogramType.c +++ b/MABS_run_analyzer/HistogramType.c @@ -48,7 +48,7 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) { initHistogram(NoiseEnd, "Noise at end" + histogramdescription, 16, style); initHistogramCustom(SeedPerc, "Seed Percentage" + histogramdescription, color, style, 0, 120, 121, Form("Entries [1/%%]"), "Q_coll [%]"); initHistogramCustom(pixeltimefired, "Pixel fired, used for " + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counts"); - initHistogramCustom(pixeltimefiredsorted, "Fire counter" + histogramdescription, color, style, 0, labbook->frames_foundDB/250-1, labbook->frames_foundDB/250, "times fired", "Counts"); + initHistogramCustom(pixeltimefiredsorted, "Fire counter" + histogramdescription, color, style, 0, labbook->frames_foundDB/100-1, labbook->frames_foundDB/100, "times fired", "Counts"); initHistogramCustom(LeakageCurrentInPixel, "Leakage current per pixel" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); initHistogram(LeakageCurrentInPixelSorted, "Leakage current" + histogramdescription, color, style); initHistogramCustom(pixelHadGoodVeto, "Number of times pixel had good veto" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counter good veto"); @@ -57,6 +57,7 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) { SeedPerc->GetXaxis()->SetRangeUser(0,50); Noise->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise); NoiseEnd->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise); + LeakageCurrentInPixelSorted->SetBins(cursystempar->nbinsnoise*10, 0, cursystempar->maxbinnoise*30); } void HistogramType::initHistogram(TH1F* &histogrampointer, TString prefix, Int_t color, Int_t style) { @@ -113,6 +114,7 @@ Bool_t HistogramType::calibrateHistograms( Float_t gotgain ) { if (Veto != 0) calibrateHistogram(calibrated->Veto, Veto); if (Noise != 0) calibrateHistogram(calibrated->Noise, Noise); if (pixeltimefired != 0) calibrated->pixeltimefired = pixeltimefired; + if (pixeltimefiredsorted != 0) calibrated->pixeltimefiredsorted = (TH1F*)pixeltimefiredsorted->Clone(); if (SeedPerc != 0) calibrated->SeedPerc = SeedPerc; if (histAvgCluster != 0) calibrate2DHistogramCounts(calibrated->histAvgCluster, histAvgCluster); if (LeakageCurrentInPixel != 0)calibrated->LeakageCurrentInPixel = (TH1F*)LeakageCurrentInPixel->Clone(); @@ -196,6 +198,7 @@ Bool_t HistogramType::normalizeHistograms( Int_t got_frames_found ) { if (Sum != 0) normalizeHistogram(normalized->Sum, Sum); if (Veto != 0) normalizeHistogram(normalized->Veto, Veto); if (pixeltimefired != 0) normalizeHistogram(normalized->pixeltimefired, pixeltimefired); + if (pixeltimefiredsorted != 0) normalizeHistogramXAxis(normalized->pixeltimefiredsorted, pixeltimefiredsorted); if (SeedPerc != 0) normalized->SeedPerc = SeedPerc; if (normalized->Noise != 0)normalized->Noise = (TH1F*)Noise->Clone(); if (normalized->histAvgCluster != 0) normalized->histAvgCluster = (TH2F*)histAvgCluster->Clone(); @@ -243,6 +246,20 @@ void HistogramType::normalizeHistogram(TH1F* &histogrampointernew, TH1F* &histog histogrampointernew->GetYaxis()->SetTitle(Form("%s\b/(%d/1000000)]",histogrampointernew->GetYaxis()->GetTitle(), frames_found)); } +void HistogramType::normalizeHistogramXAxis(TH1F* &histogrampointernew, TH1F* &histogrampointerold) { + histogrampointernew = (TH1F*)histogrampointerold->Clone(); + histogrampointernew->SetName(Form("%s norm", histogrampointerold->GetName())); + histogrampointernew->SetTitle(Form("%s, norm.", histogrampointerold->GetTitle())); + int nbins = histogrampointernew->GetXaxis()->GetNbins(); + double new_bins[nbins+1]; + for(int i=0; i <= nbins; i++){ + new_bins[i] = histogrampointernew->GetBinLowEdge(i)/frames_found*1000000; + } + histogrampointernew->SetBins(nbins, new_bins); + histogrampointernew->GetYaxis()->SetTitle(Form("%s\b/(%d/1000000)]",histogrampointernew->GetYaxis()->GetTitle(), frames_found)); +} + + Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType, Bool_t verbose, Float_t fitstart) { Double_t* parameters = 0; Float_t posMax = 0; diff --git a/MABS_run_analyzer/HistogramType.h b/MABS_run_analyzer/HistogramType.h index 57b976d..6291ce7 100644 --- a/MABS_run_analyzer/HistogramType.h +++ b/MABS_run_analyzer/HistogramType.h @@ -72,9 +72,13 @@ private: void calibrateHistogram(TH1F* &histogrampointernew, TH1F* &histogrampointerold); /** - * @brief normalizes one specific histogram with #frames_found, so it can be compared graphically */ + * @brief normalizes one specific histogram with #frames_found along the y axis, so it can be compared graphically */ void normalizeHistogram(TH1F* &histogrampointernew, TH1F* &histogrampointerold); + /** + * @brief normalizes one specific histogram with #frames_found along the x axis, so it can be compared graphically */ + void normalizeHistogramXAxis(TH1F* &histogrampointernew, TH1F* &histogrampointerold); + //***************** // OTHER //***************** diff --git a/MABS_run_analyzer/MAPS.c b/MABS_run_analyzer/MAPS.c index 1e99c0b..6ebc066 100644 --- a/MABS_run_analyzer/MAPS.c +++ b/MABS_run_analyzer/MAPS.c @@ -310,7 +310,7 @@ bool MAPS::switchsystem( ) else { cout<<"-----------------------"< 0) && (labbook.source != "Fe55")) // no veto peak position found for this run - if (labbook.source != "Fe55") // no veto peak position found for this run + if (labbook.source != "Fe55" || labbook.chipGen == "Mi19") // no veto peak position found for this run { + cout << colorwhite << "getVetoPeakPositionFromFe55Run():" << endlr; getVetoPeakPositionFromFe55Run(); } cout << colorwhite << "setSystemSpecificParameters():" << endlr; @@ -432,17 +433,20 @@ Bool_t Run::analyzeRun(Bool_t force) // processed->plotPixSignal(0,10000000,351); // do preperations before binning seed sum and veto + 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; if ((*curHistogramClass)->maskRTSpixel) { - cout << colorwhite << "FindRTSPixelToMask():" << endlr; + cout << colorwhite << " FindRTSPixelToMask():" << endlr; FindRTSPixelToMask(*curHistogramClass); } } + cout << "--------------------------------------------" << endl; cout << colorwhite << "binSeedSumVeto():" << endlr; binSeedSumVeto(); // cout << colorwhite << "binCluster():" << endlr; // binCluster(); - cout << "---------- loop over all classes --------" << endl; + cout << "---------- 2. 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; binNoise((*curHistogramClass)); @@ -467,7 +471,7 @@ Bool_t Run::analyzeRun(Bool_t force) (*curHistogramClass)->calculteStoN(true); } } - cout << "---------------------------------" << endl; + cout << "--------------------------------------------" << endl; if (labbook.source.Contains("Sr90")) { cout << colorwhite << "integrateSr90Spectra():" << endlr; histogramthreshold->integrateSr90Spectra(histogramthreshold->Seed, frames_found, -1, true); @@ -525,14 +529,14 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer) HistogramTypepointer->medianLeakageCurrent = leakagequantiles[1]; HistogramTypepointer->medianLeakageCurrentPlus = leakagequantiles[2] - leakagequantiles[1]; HistogramTypepointer->medianLeakageCurrentMinus = leakagequantiles[1] - leakagequantiles[0]; - cout << "Median is at: " << HistogramTypepointer->medianLeakageCurrent << endl; - cout << "Upper limit is at: " << leakagequantiles[2] << endl; - cout << "Lower limit is at: " << leakagequantiles[0] << endl; - cout << "Plus: " << HistogramTypepointer->medianLeakageCurrentPlus << endl; - cout << "minus: " << HistogramTypepointer->medianLeakageCurrentMinus << endl; - - cout << "last value above 1: " << HistogramTypepointer->pixeltimefiredsorted->GetBinCenter(HistogramTypepointer->pixeltimefiredsorted->FindLastBinAbove(4)) << endl; - cout << "last value above 1 in overflow TH1F: " << pixeltimefiredWithOverflow->GetBinCenter(pixeltimefiredWithOverflow->FindLastBinAbove(4)) << endl; +// cout << "Median is at: " << HistogramTypepointer->medianLeakageCurrent << endl; +// cout << "Upper limit is at: " << leakagequantiles[2] << endl; +// cout << "Lower limit is at: " << leakagequantiles[0] << endl; +// cout << "Plus: " << HistogramTypepointer->medianLeakageCurrentPlus << endl; +// cout << "minus: " << HistogramTypepointer->medianLeakageCurrentMinus << endl; + +// cout << "last value above 1: " << HistogramTypepointer->pixeltimefiredsorted->GetBinCenter(HistogramTypepointer->pixeltimefiredsorted->FindLastBinAbove(4)) << endl; +// cout << "last value above 1 in overflow TH1F: " << pixeltimefiredWithOverflow->GetBinCenter(pixeltimefiredWithOverflow->FindLastBinAbove(4)) << endl; // cout << colorcyan << "Deviation value after one more loop: " << stdeviation << endlr; HistogramTypepointer->RTSpixel.clear(); @@ -542,12 +546,12 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer) HistogramTypepointer->RTSpixel.push_back(pixeli); } } - cout << colorred << " number of RTS pixel in quantile run: " << HistogramTypepointer->RTSpixel.size() << endlr; +// cout << colorred << " number of RTS pixel in quantile run: " << HistogramTypepointer->RTSpixel.size() << endlr; meanpixeltimesfired /= numberofactivepixel; // Very rough estimate of a mean firing time // meanpixeltimesfired = leakagequantiles[1]; - cout << colorcyan << "Mean value own: " << meanpixeltimesfired << endlr; +// cout << colorcyan << "Mean value own: " << meanpixeltimesfired << endlr; // vrey rough estimate on standard deviation for (Int_t pixeli=0; pixeli < HistogramTypepointer->pixeltimefired->GetNbinsX(); pixeli++) { @@ -556,7 +560,7 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer) } stdeviation /= numberofactivepixel; stdeviation = sqrt(stdeviation); - cout << colorcyan << "Deviation value own 1: " << stdeviation << endlr; +// cout << colorcyan << "Deviation value own 1: " << stdeviation << endlr; // better estimate on average firing time Double_t meanpixeltimesfired2 = 0; @@ -573,8 +577,8 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer) } } meanpixeltimesfired2 /= numberofactivepixel2; - cout << colorred << " number of RTS pixel in first run: " << HistogramTypepointer->RTSpixel.size() << endlr; - cout << colorcyan << " mean value new: " << meanpixeltimesfired2 << endl; +// cout << colorred << " number of RTS pixel in first run: " << HistogramTypepointer->RTSpixel.size() << endlr; +// cout << colorcyan << " mean value new: " << meanpixeltimesfired2 << endl; // Estimate new standard deviation Bool_t RTSpixel =false; @@ -598,7 +602,7 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer) } stdeviation /= numberofconsideredpixel; stdeviation = sqrt(stdeviation); - cout << colorcyan << "Deviation value own 2: " << stdeviation << endlr; +// cout << colorcyan << "Deviation value own 2: " << stdeviation << endlr; // better estimate on RTS pixel @@ -619,13 +623,19 @@ Bool_t Run::FindRTSPixelToMask(HistogramType* HistogramTypepointer) } } meanpixeltimesfired /= numberofconsideredpixel; - cout << colorred << " number of RTS pixel in second run: " << HistogramTypepointer->RTSpixel.size() << endlr; - cout << colorcyan << " mean value new new: " << meanpixeltimesfired << endl; +// cout << colorred << " number of RTS pixel in second run: " << HistogramTypepointer->RTSpixel.size() << endlr; +// cout << colorcyan << " mean value new new: " << meanpixeltimesfired << endl; HistogramTypepointer->percentageofRTSpixel = (HistogramTypepointer->RTSpixel.size()*1.0)/(numberofactivepixel*1.0)*100.0; cout << " cutted away evertyhing with more then " << std::right<< Form("%.1f",HistogramTypepointer->RTSthreshold * stdeviation+meanpixeltimesfired2) << " hits" << endlr; - cout << " Pixel with RTS noise: " << std::right<< HistogramTypepointer->RTSpixel.size() << " out of " << numberofactivepixel << std::cout.width(10) << " (" << HistogramTypepointer->percentageofRTSpixel << " %)" << endlr; - cout << " Account for: " << std::right<< RTSpixelHits << " out of " << totalHits << " (" << (RTSpixelHits/totalHits * 100.0) << " %) of Hits" << endlr; + if (HistogramTypepointer->percentageofRTSpixel > 0.1) + cout << coloryellow << "Pixel with RTS noise: " << std::right<< HistogramTypepointer->RTSpixel.size() << " out of " << numberofactivepixel << std::cout.width(10) << " (" << HistogramTypepointer->percentageofRTSpixel << " %)" << endlr; + else + cout << " Pixel with RTS noise: " << std::right<< HistogramTypepointer->RTSpixel.size() << " out of " << numberofactivepixel << std::cout.width(10) << " (" << HistogramTypepointer->percentageofRTSpixel << " %)" << endlr; + if ((RTSpixelHits/totalHits * 100.0) > 5) + cout << coloryellow << " Account for: " << std::right<< RTSpixelHits << " out of " << totalHits << " (" << (RTSpixelHits/totalHits * 100.0) << " %) of Hits" << endlr; + else + cout << " Account for: " << std::right<< RTSpixelHits << " out of " << totalHits << " (" << (RTSpixelHits/totalHits * 100.0) << " %) of Hits" << endlr; // HistogramTypepointer->pixeltimefired->Draw(); return 0; } @@ -650,17 +660,17 @@ Bool_t Run::rescaleHistogramClasses() if ( histogram->posVeto > 0 ) { vetopeakposition = histogram->posVeto; - cout << colorwhite << "Use calibration obtained from this run, position veto: " << vetopeakposition << endlr; + cout << " Use calibration obtained from this run, position veto: " << vetopeakposition << endlr; } else if ( labbook.posVetoDB > 0 ) { vetopeakposition = labbook.posVetoDB; - cout << colorwhite << "Use calibration obtained from database value of this run, position veto: " << vetopeakposition << endlr; + cout << " Use calibration obtained from database value of this run, position veto: " << vetopeakposition << endlr; } else if ( Fe55run.posVeto > 0 ) { vetopeakposition = Fe55run.posVeto; - cout << colorwhite << "Use calibration obtained from Fe55 run in database, position veto: " << vetopeakposition << endlr; + cout << " Use calibration obtained from Fe55 run in database, position veto: " << vetopeakposition << endlr; cout << " Run number: " << Fe55run.posVetorunnumber << endl; cout << " Temperature: " << Fe55run.temperature << endl; } @@ -857,7 +867,9 @@ void Run::getVetoPeakPositionFromFe55Run() try { // query database and print results - TString query=prepareSQLStatement("select COALESCE(VetoPeak,-1) as VetoPeak, runnumber from radhard.labbook WHERE ChipNum='" + numberToString<>(labbook.chip) + "' AND RadiationSource='Fe55' AND Matrix='" + numberToString<>(labbook.matrix) + "' AND TempCooling=" + to_str_w_prec(labbook.temp,3) + " AND System='" + numberToString<>(labbook.system) + "'"); + // ignore temperature +// TString query=prepareSQLStatement("select COALESCE(VetoPeak,-1) as VetoPeak, runnumber from radhard.labbook WHERE ChipNum='" + numberToString<>(labbook.chip) + "' AND MABS_comment IS NULL AND RadiationSource='Fe55' AND Matrix='" + numberToString<>(labbook.matrix) + "' AND TempCooling=" + to_str_w_prec(labbook.temp,3) + " AND System='" + numberToString<>(labbook.system) + "'"); + TString query=prepareSQLStatement("select COALESCE(VetoPeak,-1) as VetoPeak, runnumber, TempCooling from radhard.labbook WHERE ChipNum='" + numberToString<>(labbook.chip) + "' AND MABS_comment IS NULL AND RadiationSource='Fe55' AND Matrix='" + numberToString<>(labbook.matrix) + "' AND System='" + numberToString<>(labbook.system) + "' ORDER BY TempCooling ASC"); res = db->Query(query.Data()); nrows = res->GetRowCount(); if (nrows > 0) @@ -866,7 +878,8 @@ void Run::getVetoPeakPositionFromFe55Run() rowsql = res->Next(); Fe55run.posVeto = (rowsql->GetField(0) != NULL)?atof(rowsql->GetField(0)):-1; Fe55run.posVetorunnumber = (rowsql->GetField(0) != NULL && rowsql->GetField(1) != NULL)?atoi(rowsql->GetField(1)):0; - Fe55run.temperature = labbook.temp; + Fe55run.temperature = (rowsql->GetField(2) != NULL)?atof(rowsql->GetField(2)):-1; + cout << colorcyan << Fe55run.posVetorunnumber << endlr; } while (Fe55run.posVeto == -1 && (--nrows)!=0); delete res; } @@ -946,8 +959,16 @@ void Run::updateDatabase() { if (histogramthreshold->normalized->avgNoise < 100) constructUpdateString(&sqlupdatequery, "Avg.NoiseADC", histogramthreshold->normalized->avgNoise); constructUpdateString(&sqlupdatequery, "Frames_found", frames_found,100000000); - constructUpdateString(&sqlupdatequery, "RTSpixel", histogramwoRTS->normalized->RTSpixel.size()); - constructUpdateString(&sqlupdatequery, "RTSpixel_percentage", histogramwoRTS->normalized->percentageofRTSpixel); + if (histogramwoRTSthreshold != 0) { + constructUpdateString(&sqlupdatequery, "RTSpixel", histogramwoRTSthreshold->normalized->RTSpixel.size()); + constructUpdateString(&sqlupdatequery, "RTSpixel_percentage", histogramwoRTSthreshold->normalized->percentageofRTSpixel); + constructUpdateString(&sqlupdatequery, "LeakageCurMedADC", histogramwoRTSthreshold->medianLeakageCurrent); + constructUpdateString(&sqlupdatequery, "LeakageCurAvgADC", histogramwoRTSthreshold->avgLeakageCurrentInChip); + if (histogramwoRTSthreshold->calibrated != 0) { + constructUpdateString(&sqlupdatequery, "LeakageCurMedE", histogramwoRTSthreshold->calibrated->medianLeakageCurrent); + constructUpdateString(&sqlupdatequery, "LeakageCurAvgE", histogramwoRTSthreshold->calibrated->avgLeakageCurrentInChip); + } + } if (histogramthreshold->normalized->calibrated != 0) if (histogramfixedthreshold != 0) constructUpdateString(&sqlupdatequery, "Sr90IntegralVal", histogramfixedthreshold->normalized->calibrated->sr90IntegralVal,1000000000); @@ -1025,8 +1046,8 @@ Bool_t Run::binLeakageCurrent(HistogramType* oneHistogramClass) oneHistogramClass->medianLeakageCurrentPlus = leakagequantiles[2] - leakagequantiles[1]; oneHistogramClass->medianLeakageCurrentMinus = leakagequantiles[1] - leakagequantiles[0]; - cout << colorcyan << "oneHistogramClass->avgLeakageCurrentInChip: " << oneHistogramClass->avgLeakageCurrentInChip << endlr; - cout << colorcyan << "oneHistogramClass->medianLeakageCurrent: " << oneHistogramClass->medianLeakageCurrent << endlr; +// cout << colorcyan << "oneHistogramClass->avgLeakageCurrentInChip: " << oneHistogramClass->avgLeakageCurrentInChip << endlr; +// cout << colorcyan << "oneHistogramClass->medianLeakageCurrent: " << oneHistogramClass->medianLeakageCurrent << endlr; return 0; } -- 2.43.0