From: Benjamin Linnik Date: Tue, 2 Jun 2015 14:10:39 +0000 (+0200) Subject: Anylyzer: added null pointer exception handling X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ec6c65c81670c313a42852f518e84ded5b3f56ac;p=radhard.git Anylyzer: added null pointer exception handling --- diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c index dba54e9..7944e4e 100644 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ b/MABS_run_analyzer/ChargeSpektrum.c @@ -16,10 +16,10 @@ Int_t* ReadRunList(); Int_t ReadRunList(std::vector*); -void plotAllRuns(); -void plotAllRuns(TString); -void writeObservableToFile(TString); -void writeObservableToFile(); +Bool_t plotAllRuns(); +Bool_t plotAllRuns(TString); +Bool_t writeObservableToFile(TString); +Bool_t writeObservableToFile(); void writeObservableToFileHistSelect(TString); Run** runs; Int_t numberRuns; @@ -227,14 +227,19 @@ Int_t ReadRunList(std::vector* runlist) // // } -void writeObservableToFile(TString histogramtype) +Bool_t writeObservableToFile(TString histogramtype) { if (histogramtype.Contains("threshold")) { if (histogramtype.Contains("calibrated")) { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated; + { + if (runs[runi]->histogramthresholdCalibrated.calibrated) + runs[runi]->plothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated; + else + return 1; + } } else { @@ -245,11 +250,14 @@ void writeObservableToFile(TString histogramtype) } else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramCalibrated; } } + if (runs[runi]->histogramCalibrated.calibrated) + runs[runi]->plothistogramstructpointer = &runs[runi]->histogramCalibrated; + else return 1; } } else { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogram; } } writeObservableToFileHistSelect(histogramtype); + return 0; } void writeObservableToFileHistSelect(TString histogramtype) { @@ -268,7 +276,7 @@ void writeObservableToFileHistSelect(TString histogramtype) writeObservableToFile(); } -void writeObservableToFile() +Bool_t writeObservableToFile() { system("mkdir "+ runs[0]->savepathresults + " -p"); TString headerInfo = ""; @@ -280,10 +288,16 @@ void writeObservableToFile() TString runnumberListe=Form("%s_",plothistogrampointer->GetName()); TString header=""; for(Int_t runi=0;runiplothistogrampointer; - runnumberListe+=Form("%d_",runs[runi]->labbook.runnumber); - header+=Form("%d\t%s\t", runs[runi]->labbook.runnumber, plothistogrampointer->GetName()); + { + if (runs[runi] != nullptr) + { + if (!runs[runi]->error) + { + plothistogrampointer = *runs[runi]->plothistogrampointer; + runnumberListe+=Form("%d_",runs[runi]->labbook.runnumber); + header+=Form("%d\t%s\t", runs[runi]->labbook.runnumber, plothistogrampointer->GetName()); + } + } } TString filename= runs[0]->savepathresults + "/" + runnumberListe + "histograms.dat"; fstream* fout = new fstream(filename,ios::out); @@ -293,26 +307,35 @@ void writeObservableToFile() { for(Int_t runi=0;runiplothistogrampointer; - TString outline; - outline=Form("%.1f\t%.1f\t",plothistogrampointer->GetBinCenter(bini),plothistogrampointer->GetBinContent(bini)); - *fout<error) + { + plothistogrampointer = *runs[runi]->plothistogrampointer; + TString outline; + outline=Form("%.1f\t%.1f\t",plothistogrampointer->GetBinCenter(bini),plothistogrampointer->GetBinContent(bini)); + *fout<close(); - return; + return 0; } -void plotAllRuns(TString histogramtype) +Bool_t plotAllRuns(TString histogramtype) { if (histogramtype.Contains("threshold")) { if (histogramtype.Contains("calibrated")) { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated; + if (runs[runi]->histogramthresholdCalibrated.calibrated) + runs[runi]->plothistogramstructpointer = &runs[runi]->histogramthresholdCalibrated; + else + return 1; } else { @@ -323,14 +346,18 @@ void plotAllRuns(TString histogramtype) } else if (histogramtype.Contains("calibrated") || histogramtype.Contains("electron")) { for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogramCalibrated; } } - else { - for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogram; } } + if (runs[runi]->histogramCalibrated.calibrated) + runs[runi]->plothistogramstructpointer = &runs[runi]->histogramCalibrated; + else + return 1; } } + else { + for(Int_t runi=0;runiplothistogramstructpointer = &runs[runi]->histogram; } } plotAllRuns(); + return 0; } -void plotAllRuns() +Bool_t plotAllRuns() { if (numberRuns > 1) { @@ -392,5 +419,6 @@ void plotAllRuns() f->Append(img); f->Write(); } + return 0; } diff --git a/MABS_run_analyzer/MAPS.c b/MABS_run_analyzer/MAPS.c index 0d57540..e5a32bf 100644 --- a/MABS_run_analyzer/MAPS.c +++ b/MABS_run_analyzer/MAPS.c @@ -821,7 +821,7 @@ bool MAPS::InitialDynNoise(Int_t startframe, Int_t frames) { getFrame(framei); for(Int_t pixeli=0; pixeli 5 * sigma of noise value from second estimate // sum up over all frames every CDS value, pixelwise @@ -876,7 +875,7 @@ bool MAPS::InitialDynNoise(Int_t startframe, Int_t frames) { getFrame(framei); for(Int_t pixeli=0; pixeli Pedestal suspiciously high!"<(fCdsmatrix , fPixels, fColumns, 1, 20); - // cout<<" Pedestial of sensor: "; - // debugStream<>(fPedestals , fPixels, fColumns, 1, 20); - // cout<<" Hitted Pixel discriminator matrix: "; - // debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1); - // exit(1); +// cout<<"\rFrame: "< Pedestal suspiciously high!"<(fCdsmatrix , fPixels, fColumns, 1, 20); +// cout<<" Pedestial of sensor: "; +// debugStream<>(fPedestals , fPixels, fColumns, 1, 20); +// cout<<" Hitted Pixel discriminator matrix: "; +// debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1); +// exit(1); } if (abs(fNoise[pixeli])>20) {