From: Stefan Strohauer Date: Tue, 19 Nov 2013 12:09:21 +0000 (+0100) Subject: Added error calculation. X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=88c4d9e2bdb09999aee2affb24db1fd55c4ff6e3;p=radhard.git Added error calculation. --- diff --git a/PlotGraph/PlotGraph.C b/PlotGraph/PlotGraph.C index e4b5dd6..33f8b7d 100644 --- a/PlotGraph/PlotGraph.C +++ b/PlotGraph/PlotGraph.C @@ -33,28 +33,33 @@ #define COLDONE 10 #define NUMPIXELS 25 -#define RIGHT_BOUNDARY 400 +#define RIGHT_BOUNDARY 1000 +#define VETO_BINSIZE 1000 -#define VETO_THRESHOLD 10 +#define VETO_THRESHOLD 5 +// #define VETO_THRESHOLD 40 #define LABORBUCH "RelevantRuns.csv" // #define DATAPATH "/local/sstrohauer/data/data_15.10.2013_11:36/" // #define DATAPATH "/local/sstrohauer/data/data_18.10.2013_16:8/" // #define DATAPATH "/local/sstrohauer/data/data_22.10.2013_14:9/" // #define DATAPATH "/local/sstrohauer/data/data_25.10.2013_14:50/" -#define DATAPATH "/local/sstrohauer/data/data_4.11.2013_13:57/" -#define USE_SEPARATE_NOISE_RUN false +// #define DATAPATH "/local/sstrohauer/data/data_4.11.2013_13:57/" +// #define DATAPATH "/local/sstrohauer/data/data_6.11.2013_17:50/" +#define DATAPATH "/local/sstrohauer/data/data_15.11.2013_16:3/" + +#define USE_SEPARATE_NOISE_RUN true #define DRAW_SINGLE_HISTOGRAMS true -#define DRAW_SUMMED_HISTOGRAMS false -#define DRAW_VETO_HISTOGRAMS false +#define DRAW_SUMMED_HISTOGRAMS true +#define DRAW_VETO_HISTOGRAMS true #define DRAW_SEEDPIXEL_DISTRIBUTION false #define DRAW_PIXEL_DISTRIBUTION_HISTOGRAMS false // examples for fit functions: gaus, landau -#define FIT_FUNC "landau" -#define DRAW_FITS false -#define DRAW_NOISE_HISTOGRAM true -#define PRINT_HEADER true +#define FIT_FUNC "gaus" +#define DRAW_FITS true +#define DRAW_NOISE_HISTOGRAM false #define PRINT_EXPECTATION_VALUE_HITS_PER_FRAME false +#define PRINT_HEADER false void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selMatrix6480, Int_t selSubmatrix, Float_t selRadDose) { @@ -92,6 +97,9 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM std::vector fitMaxPosX; std::vector fitMaxPosXSum; std::vector fitMaxPosXVeto; + std::vector fitMaxPosXError; + std::vector fitMaxPosXSumError; + std::vector fitMaxPosXVetoError; std::vector fitLandauErrorLeft; std::vector fitLandauErrorRight; std::vector noiseMedian; @@ -190,7 +198,7 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM // create histogram histNtuple.push_back(new TH1F(Form("hist%i",nHistNtuple), "Histogram title", 200, 0, RIGHT_BOUNDARY)); histNtupleSum.push_back(new TH1F(Form("histSum%i",nHistNtuple), "Histogram title", 200, 0, RIGHT_BOUNDARY)); - histNtupleVeto.push_back(new TH1F(Form("histVeto%i",nHistNtuple), "Histogram title", 200/2, 0, RIGHT_BOUNDARY)); + histNtupleVeto.push_back(new TH1F(Form("histVeto%i",nHistNtuple), "Histogram title", VETO_BINSIZE, 0, RIGHT_BOUNDARY)); histPixelNumIsSeed.push_back(new TH1F(Form("histPixelNumIsSeed_%i",nHistNtuple), "Histogram title", totalPixelNum, 0, totalPixelNum)); histPixelNumIsSeedSelection.push_back(new TH1F(Form("histPixelNumIsSeedSelection_%i",nHistNtuple), "Histogram title", totalPixelNum, 0, totalPixelNum)); histPixelDistribution1.push_back(new TH1F(Form("histPixelDistribution1_%i",nHistNtuple), "Histogram title", totalPixelNum, 0, totalPixelNum)); @@ -447,6 +455,7 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM if (TString(FIT_FUNC)=="gaus") { (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-10, xValMax+10); posMax = fitFunc->GetParameter(1); + fitMaxPosXError.push_back(fitFunc->GetParameter(2)); // sigma of the gaus fit fitFunc->DrawCopy("same"); } else if (TString(FIT_FUNC)=="landau") { @@ -508,6 +517,8 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt]),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20 Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin()); (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-15, xValMax+15); + fitMaxPosXSumError.push_back(fitFunc->GetParameter(2)); // sigma of the gaus fit + (*it)->GetXaxis()->UnZoom(); fitFunc->DrawCopy("same"); // cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl; @@ -531,6 +542,8 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM (*it)->GetXaxis()->SetRange((*it)->GetXaxis()->FindBin(fitMaxPosX[cnt]),(*it)->GetXaxis()->FindBin(RIGHT_BOUNDARY)); // look only for maxima with x greater than 20 Int_t xValMax = (*it)->GetBinCenter((*it)->GetMaximumBin()); (*it)->Fit(fitFunc, "N,Q,W", "", xValMax-15, xValMax+15); + fitMaxPosXVetoError.push_back(fitFunc->GetParameter(2)); // sigma of the gaus fit + (*it)->GetXaxis()->UnZoom(); fitFunc->DrawCopy("same"); // cout << "Maximum bin: " << (*it)->GetBinCenter((*it)->GetMaximumBin()) << endl; @@ -569,21 +582,51 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM // print all information - TString runDetailsHeader = TString("runNo\tT\tTSens\tChip\tSource\tMatrix\tRadDose\t\tSubmtrx") + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS ? "\tColPeak":"") + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tErrL":"") + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tErrR":"") + (DRAW_SUMMED_HISTOGRAMS && DRAW_FITS ? "\tSumColPeak":"") + (DRAW_VETO_HISTOGRAMS && DRAW_FITS ? "\tCalPeak":"") + "\tNoise" + "\tNseLo17" + "\tNseHi17" + "\tS/N" + "\n"; + TString runDetailsHeader = TString("runNo\tT\tTSens\tChip\tSource\tMatrix\tRadDose\t\tSubmtrx") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="gaus" ? "\tColPeak":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="gaus" ? "\tColPkEr":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tMPV":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tErrL":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tErrR":"") + + (DRAW_SUMMED_HISTOGRAMS && DRAW_FITS ? "\tSumColPeak":"") + + (DRAW_SUMMED_HISTOGRAMS && DRAW_FITS ? "\tSumColErr":"") + + (DRAW_VETO_HISTOGRAMS && DRAW_FITS ? "\tCalPeak":"") + + (DRAW_VETO_HISTOGRAMS && DRAW_FITS ? "\tCalPkErr":"") + + "\tNoise" + + "\tNseLo17" + + "\tNseHi17" + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="gaus" ? "\tCCESeed":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="gaus" ? "\tCCESdEr":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="gaus" ? "\tCCESum":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="gaus" ? "\tCCESmEr":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tS/N":"") + + (DRAW_SINGLE_HISTOGRAMS && DRAW_FITS && TString(FIT_FUNC)=="landau" ? "\tS/NErr":"") + + "\n"; + if (PRINT_HEADER) cout << endl << runDetailsHeader; + for (UInt_t i=0; i 5*PRENOISE) { + continueCounter++; + continue; + } + PEDESTAL+=ARR[j*fPixelsSub+i]; + } + PEDESTAL = PEDESTAL/(Frames-continueCounter); + + for(Int_t j=0; j 5*PRENOISE) + continue; + NOISE+=TMath::Power(ARR[j*fPixelsSub+i]-PEDESTAL,2); + } + NOISE = TMath::Sqrt(NOISE/((Frames-continueCounter)-1)); fNoise[i] = NOISE; fPedestals[i] = PEDESTAL; diff --git a/ProcessMeasurements/ProcessMeasurements.C b/ProcessMeasurements/ProcessMeasurements.C index eff2e22..3e13c9d 100644 --- a/ProcessMeasurements/ProcessMeasurements.C +++ b/ProcessMeasurements/ProcessMeasurements.C @@ -14,7 +14,6 @@ #define COLRUNNO 0 #define COLTEMP 2 -#define COLTEMPSENS 3 #define COLCHIP 5 #define COLSOURCE 6 #define COLMATRIX 7 @@ -24,7 +23,7 @@ #define INPUTDATAPATH "/jspc12_F/Mi29/" #define OUTPUTDATAPATH_MAINFOLDER "/local/sstrohauer/data/" // use this #define for processing to a specific file -#define OUTPUTDATAPATH_FIXED_PATH "/local/sstrohauer/data/data_4.11.2013_13:57/" +// #define OUTPUTDATAPATH_FIXED_PATH "/local/sstrohauer/data/data_4.11.2013_13:57/" using std::cout; using std::endl; @@ -142,7 +141,6 @@ void ProcessMeasurements(Bool_t overwrite = false, Bool_t useSeperateNoiseRun = continue; // no relevant data in this row runNo = stoi(row[COLRUNNO]); // run number (conversion works like runNo = stoi(std::string ("300");) temperature = stod(row[COLTEMP]); // temperature - tempSens = stod(row[COLTEMPSENS]); // temperature chip = stoi(row[COLCHIP]); source = row[COLSOURCE]; matrix6480 = stoi(row[COLMATRIX]); // which matrix?