From: Stefan Strohauer Date: Mon, 28 Oct 2013 12:11:24 +0000 (+0100) Subject: Fixed bugs: Correction of common mode calculation in MAPS.C. Added some X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=8abe68ad6155afd66febe424acb5f498f6da45a3;p=radhard.git Fixed bugs: Correction of common mode calculation in MAPS.C. Added some minor changes in PlotGraph.C and ProcessMeasurements.C --- diff --git a/PlotGraph/PlotGraph.C b/PlotGraph/PlotGraph.C index 1f1c75a..91869d5 100644 --- a/PlotGraph/PlotGraph.C +++ b/PlotGraph/PlotGraph.C @@ -38,16 +38,19 @@ #define VETO_THRESHOLD 20 #define LABORBUCH "RelevantRuns.csv" -#define DATAPATH "/local/sstrohauer/data/data_8.8.2013_19:21/" +// #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_22.10.2013_18:22/" #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_PIXEL_DISTRIBUTION_HISTOGRAMS true // examples for fit functions: gaus, landau -#define FIT_FUNC "landau" -#define DRAW_FITS true -#define DRAW_NOISE_HISTOGRAM true +#define FIT_FUNC "gaus" +#define DRAW_FITS false +#define DRAW_NOISE_HISTOGRAM 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) @@ -76,6 +79,7 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM std::vector histNtuple; std::vector histNtupleSum; std::vector histNtupleVeto; + std::vector histPixelNumIsSeed; std::vector histPixelDistribution1; std::vector histPixelDistribution2; std::vector histNoise; @@ -135,6 +139,19 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM runDetails.push_back(Form("%i\t%.1f\t%.1f\t%i\t%s\t%i\t%.2E\t%i", runNo, temperature, tempSens, chip, source.c_str(), matrix6480, radDose, submatrix)); + Int_t totalPixelNum; + if (matrix6480 == 64) { + if (submatrix < 2) + totalPixelNum = 48*48; + else + totalPixelNum = 48*32; + } + else if (matrix6480 == 80) { + if (submatrix < 2) + totalPixelNum = 51*64; + else + totalPixelNum = 51*32; + } // open the file TString path = TString(DATAPATH) + Form("%i/%i_0_%i.root", runNo, runNo, submatrix); @@ -170,14 +187,44 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM 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, 0, RIGHT_BOUNDARY)); - histPixelDistribution1.push_back(new TH1F(Form("histPixelDistribution1_%i",nHistNtuple), "Histogram title", 50000, 0, 50000)); - histPixelDistribution2.push_back(new TH1F(Form("histPixelDistribution2_%i",nHistNtuple), "Histogram title", 50000, 0, 50000)); + histPixelNumIsSeed.push_back(new TH1F(Form("histPixelNumIsSeed_%i",nHistNtuple), "Histogram title", totalPixelNum, 0, totalPixelNum)); + histPixelDistribution1.push_back(new TH1F(Form("histPixelDistribution1_%i",nHistNtuple), "Histogram title", totalPixelNum, 0, totalPixelNum)); + histPixelDistribution2.push_back(new TH1F(Form("histPixelDistribution2_%i",nHistNtuple), "Histogram title", totalPixelNum, 0, totalPixelNum)); // loop over all hits to fill histogram Int_t nentries = hitNtuple->GetEntries(); // Double_t meanNotSeedSum=0; // Int_t nhits=0; + + + + cout << "Mittelwert Hits pro frame: " << nentries/50000.0 << endl; + + + + + + for (Int_t cnt=0; cntGetEntry(cnt); + histPixelNumIsSeed[nHistNtuple]->Fill(seedPixel); + } + Float_t averageBinContent = nentries/totalPixelNum; + + + + + + + + + + + + + + + for (Int_t cnt=0; cntGetEntry(cnt); @@ -187,9 +234,31 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM // continue; + + + + // histogram with the single pixel +// if (pixel[12] > 20) +// continue; + + if (histPixelNumIsSeed[nHistNtuple]->GetBinContent(histPixelNumIsSeed[nHistNtuple]->GetXaxis()->FindBin(seedPixel)) > 3*averageBinContent) { +// cout << "seed: " << seedPixel << endl; + continue; + } histNtuple[nHistNtuple]->Fill(pixel[12]); +// cout << histPixelNumIsSeed[nHistNtuple]->GetBinContent(seedPixel) << endl; + + + + + + + + + + // histogram with the summed pixels Double_t pixelSum = 0; for (Int_t i=0; iFill(pixelSum); // search for systematics in pixel distribution - if (pixelSum > 100 && pixelSum < 150) { - histPixelDistribution1[nHistNtuple]->Fill(frame); + if (true) { + histPixelDistribution1[nHistNtuple]->Fill(seedPixel); } - else if (pixelSum > 180 && pixelSum < 300) { - histPixelDistribution2[nHistNtuple]->Fill(frame); + if (135 < pixelSum and pixelSum < 150) { + histPixelDistribution2[nHistNtuple]->Fill(seedPixel); } @@ -362,7 +431,6 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM } } - // determine maximum y-value Float_t maxY = 0; if (DRAW_SINGLE_HISTOGRAMS){ @@ -422,19 +490,27 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM Float_t maxFitMax = 1000; (*it)->Fit(fitFunc, "N,Q,W", "", 20, RIGHT_BOUNDARY); - fitMax1 = fitFunc->GetParameter(1); + fitMax1 = fitFunc->GetMaximumX(0,RIGHT_BOUNDARY); fitFunc->DrawCopy("same"); - (*it)->Fit(fitFunc, "N,Q,W", "", 20, fitMax1); - fitMax2 = fitFunc->GetParameter(1); + (*it)->Fit(fitFunc, "N,Q,W", "", 20, fitMax1+10); + fitMax2 = fitFunc->GetMaximumX(0,RIGHT_BOUNDARY); fitFunc->SetLineColor(kBlue); fitFunc->SetLineStyle(2); // dashed fitFunc->DrawCopy("same"); (*it)->Fit(fitFunc, "N,Q,W", "", fitMax1, RIGHT_BOUNDARY); - fitMax3 = fitFunc->GetParameter(1); + fitMax3 = fitFunc->GetMaximumX(0,RIGHT_BOUNDARY); fitFunc->SetLineColor(kGreen); fitFunc->DrawCopy("same"); fitFunc->SetLineStyle(1); // normal for the following fits + + + +// cout << fitMax1 << "\t" << fitMax2 << "\t" << fitMax3 << "\t" << fitFunc->GetMaximumX(0,RIGHT_BOUNDARY) << endl; + + + + // Sort the three fits and save error estimation minFitMax = TMath::Min(TMath::Min(fitMax1,fitMax2),fitMax3); maxFitMax = TMath::Max(TMath::Max(fitMax1,fitMax2),fitMax3); @@ -522,7 +598,17 @@ void PlotGraph(Float_t selTemp, Int_t selChip, std::string selSource, Int_t selM cout << endl << runDetailsHeader; for (UInt_t i=0; itm_mday << '.' << now->tm_mon+1 << '.' << now->tm_year+1900 << "_" << now->tm_hour << ':' << now->tm_min; - cout << timeSS.str() << endl; std::string logfileName = "logfile_" + timeSS.str() + ".txt"; + cout << "logfile-name: " << logfileName << endl; logfile.open(logfileName, std::ios::trunc); logfile << "This is a log file which lists all processed entries in the lab book.\n\n"; logfile << "runNo\tmatrix\tsubmtrx\tcomment\n"; @@ -65,7 +65,12 @@ void ProcessMeasurements(Bool_t overwrite = false, Bool_t useSeperateNoiseRun = std::string outputDataPath = std::string(OUTPUTDATAPATH_MAINFOLDER) + "data_" + timeSS.str() + "/"; - mkdir(outputDataPath.c_str(), 0755); // create directory for this evaluation if not existent + cout << "Working directory: " << outputDataPath << endl; + Int_t mkdirReturnValue = mkdir(outputDataPath.c_str(), 0755); + if (mkdirReturnValue != 0) { + cout << "Can not create directory (mkdir returns " << mkdirReturnValue << ")! Possible error source: No disk space available or directory already existent.\n"; // create directory for this evaluation if not existent and raise error if directory is full + return; + } // 1. case: Process one single run, chosen by the user while calling main() if (processRunNo != -1){ @@ -93,16 +98,27 @@ void ProcessMeasurements(Bool_t overwrite = false, Bool_t useSeperateNoiseRun = file >> row; // read first row (header) of the laboratory book - if (firstNoiseSecondRun == 0){ + if (firstNoiseSecondRun == 0 && useSeperateNoiseRun){ cout << "=====================================================================\n"; cout << "=====================================================================\n"; cout << "First: Analyzing only runs WITH NO source (for noise)...\n"; } - else{ + else if (useSeperateNoiseRun) { cout << "=====================================================================\n"; cout << "=====================================================================\n"; cout << "Second: Analyzing only runs WITH source...\n"; } + else if (firstNoiseSecondRun == 0 && !useSeperateNoiseRun){ + cout << "=====================================================================\n"; + cout << "=====================================================================\n"; + cout << "Analyzing run with previous noise calculation of the same file...\n"; + } + else { + cout << "=====================================================================\n"; + cout << "=====================================================================\n"; + cout << "Finished after first loop.\n"; + break; + } while(file >> row) { // for each row try { @@ -155,6 +171,13 @@ void ProcessMeasurements(Bool_t overwrite = false, Bool_t useSeperateNoiseRun = } analyzeRun(INPUTDATAPATH, outputDataPath.c_str(), runNo, matrixAB, true, false, noiseRunNo, overwrite, logfileName); } + else if (!useSeperateNoiseRun && firstNoiseSecondRun == 0) { + mkdir((outputDataPath + std::to_string(runNo) +"/").c_str(), 0755); // create directory if not existent + mkdir((outputDataPath + std::string("noise/")).c_str(), 0755); // create directory if not existent + mkdir((outputDataPath + std::string("noise/") + std::to_string(runNo) + "/").c_str(), 0755); // create directory if not existent + // use same run for calculating noise + analyzeRun(INPUTDATAPATH, outputDataPath.c_str(), runNo, matrixAB, false, false, -1, overwrite, logfileName); // noise & run + } else { cout << "==> skipped in " << firstNoiseSecondRun+1 << ". step (currently processing " << ((firstNoiseSecondRun == 0) ? "noise)":"runs)") << endl; } diff --git a/newCOMBI/MAPS.C b/newCOMBI/MAPS.C index 396d296..c95280c 100755 --- a/newCOMBI/MAPS.C +++ b/newCOMBI/MAPS.C @@ -781,7 +781,7 @@ void MAPS::filterCommonMode() { for(int column=0; column