From: Benjamin Linnik Date: Mon, 31 Aug 2015 14:22:52 +0000 (+0200) Subject: Run analyzer: Small bugfixes, defollowed ChargeSpectrum.c: individual changes should... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=299b23bdb6cf4281c2791a04b87f79c2ebc8e368;p=radhard.git Run analyzer: Small bugfixes, defollowed ChargeSpectrum.c: individual changes should not be overwritten here --- diff --git a/.gitignore b/.gitignore index 2b48b41..aa483a7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ *.log *.MOV */results/* -*runlist.txt \ No newline at end of file +*runlist.txt +ChargeSpektrum.c +MABS_run_analyzer/html/* +MABS_run_analyzer/latex/* \ No newline at end of file diff --git a/MABS_run_analyzer/ChargeSpektrum.c b/MABS_run_analyzer/ChargeSpektrum.c deleted file mode 100644 index 38698c7..0000000 --- a/MABS_run_analyzer/ChargeSpektrum.c +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @file ChargeSpektrum.c - * @brief Use brief, otherwise the index won't have a brief explanation. - * - * Detailed explanation. - * - * - */ - -#include "MAPS.c" -#include "Run.c" -#include "CSVRow.h" -#include "CSVRow.C" -#include - -Run** runs; -Int_t numberRuns; -Bool_t isBatch = kFALSE; - -#include "ChargeSpektrumFunctions.c" - -void ChargeSpektrum(TString runnumber = "") -{ - cout << endl << endl; - if (gROOT->IsBatch()) - isBatch = kTRUE; - - numberRuns=0; - std::vector runList; - if (runnumber.Length() > 0) - { - if (runnumber.Contains("-")) - { - TObjArray* runarray = runnumber.Tokenize("-"); - if (runarray->GetEntries()==2) - { - TObjString* tempstrobj; - tempstrobj=static_cast(runarray->At(0)); - if (tempstrobj->GetString().Length()>0) - { - Int_t tempintstart = tempstrobj->GetString().Atoi(); - tempstrobj=static_cast(runarray->At(1)); - if (tempstrobj->GetString().Length()>0) - { - Int_t tempintend = tempstrobj->GetString().Atoi(); - if (tempintend-tempintstart > 0) - { - for (Int_t i=tempintstart; i <= tempintend; i++) - { - runList.push_back(i); - numberRuns++; - } - } - else - cout << coloryellow << "Invalid run number range "<< colorreset << colorwhite << tempintstart << " till " << tempintend << endlr; - } - else - cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr; - - } - else - cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr; - } - else - { - cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << " or 2 runnumbers devided by " << colorreset << colorwhite << "-" << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset << colorred << "'." << endlr; - cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl; - exit(1); - } - - } - else - { - TObjArray* runarray = runnumber.Tokenize(","); - if (runarray->GetEntries()>0) - { - TObjString* tempstrobj; - for (Int_t i=0; i < runarray->GetEntries(); i++) - { - tempstrobj=static_cast(runarray->At(i)); - if (tempstrobj->GetString().Length()>0) - { - Int_t tempint = tempstrobj->GetString().Atoi(); - if (tempint > 0) - { - runList.push_back(tempint); - numberRuns++; - } - else - cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempint << endlr; - } - else - cout << coloryellow << "Invalid run number "<< colorreset << colorwhite << tempstrobj->GetString() << endlr; - } - } - else - { - cout << endl << colorred << "Given parameters have wrong format, please enter integer run numbers devided by '" << colorreset << colorwhite << "," << colorreset << colorred << "' and surrounded by '" << colorreset << colorwhite << "\"" << colorreset << colorred << "'." << endlr; - cout << "For example run: " << colorwhite << "root -l 'ChargeSpektrum.c+(\"342815,342816\")'" << endl; - exit(1); - } - } - } - else - { - /// number of runs to be analyzed, number of lines read by @c ReadRunList() - ReadRunList(&runList); - } - runs = new Run*[numberRuns]; - - cout << "Found " << numberRuns << " run(s) in 'runlist.txt' or given as parameters." << endl; - for(Int_t runi=0;runi0) - { - runs[runi] = new Run(runList[runi], runi); - if (!runs[runi]->error) - { - if (runi%2) - { - // check if devided matrix is investigated - if (runList[runi-1] == runList[runi]) - { - cout << "Using devided matrix upper" << endl; - runs[runi]->dividedmatrix = 1; - runs[runi]->upperpart = 1; - } - } - if (runi+1 < numberRuns) - { - if (runList[runi] == runList[runi+1] ) - { - cout << "Using devided matrix lower" << endl; - runs[runi]->dividedmatrix = 1; - runs[runi]->upperpart = 0; - } - } - runs[runi]->setResultsPath("./results/"); - runs[runi]->error=runs[runi]->initRun(); - runs[runi]->setDynamicalNoiseMode("simple"); - runs[runi]->useDynamicalNoise(true); - -// runs[runi]->analyzeFrame(15684); -// runs[runi]->analyzeFrame(803316); - // runs[runi]->analyzeFrame(734); - // runs[runi]->analyzeFrame(4072); - // creates or opens .root file, can analyze the RAW data - runs[runi]->error=runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data - if (!runs[runi]->error) - { - // gROOT->SetBatch(kTRUE); - // runs[runi]->plotSeed(); - -// runs[runi]->plotSeedThresholdCalibrated(); -// runs[runi]->plotSeedThreshold(); -// runs[runi]->plotSeed(); - // runs[runi]->plotSum(); - // runs[runi]->plotVeto(); - // runs[runi]->plotNoise(); - if (!isBatch) - gROOT->SetBatch(kFALSE); -// runs[runi]->plotAllHistograms(); -// runs[runi]->plotAllHistogramsThresholdCluster(); - runs[runi]->plotClusterDistribution(&runs[runi]->histogramthresholdCalibrated); -// runs[runi]->plotAllHistogramsThresholdClusterCalibrated(); -// runs[runi]->plotAllHistogramsCalibrated(); -// runs[runi]->writeAllHistogramsToFile(); - } - } - } - } -// plotAllRuns(""); - plotAllRuns("seed calibrated"); - setCustomPath("Excel/"); -// writeObservableToFile("seed threshold calibrated"); -// writeObservableToFile("seed threshold"); - writeObservableToFile("seed threshold"); - writeObservableToFile("sum threshold"); -} diff --git a/MABS_run_analyzer/ChargeSpektrumFunctions.c b/MABS_run_analyzer/ChargeSpektrumFunctions.c index ec9ea9b..82c404b 100644 --- a/MABS_run_analyzer/ChargeSpektrumFunctions.c +++ b/MABS_run_analyzer/ChargeSpektrumFunctions.c @@ -141,12 +141,7 @@ Bool_t writeObservableToFile() } } } -<<<<<<< HEAD TString filename= runs[0]->savepathresults + "/" + ownpath + runnumberListe + "histograms.dat"; -======= - runnumberListe+=Form("%s_",plothistogrampointer->GetName()); - TString filename= runs[0]->savepathresults + "/" + runnumberListe + "histograms.dat"; ->>>>>>> without_FSBB fstream* fout = new fstream(filename,ios::out); *fout << headerInfo << endl; *fout << header << endl; diff --git a/MABS_run_analyzer/MAPS.c b/MABS_run_analyzer/MAPS.c index a2e2e99..1f0f2dd 100644 --- a/MABS_run_analyzer/MAPS.c +++ b/MABS_run_analyzer/MAPS.c @@ -165,10 +165,14 @@ void MAPS::save() { if(fSave && fOk) { cout<< endl << "----------------------------------------------------------------"< 1.0) cout << coloryellow; if ((1.0*fPedestalhighFrames/fEventsSum*100) > 10.0) cout << colorred; + cout << " Frames with suspicious pedestial value: " << std::cout.width(10)<< std::right << fPedestalhighFrames << " out of " << fEventsSum << " (" << (1.0*fPedestalhighFrames/fEventsSum*100) << " %)" << endlr; + if ((1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) > 1.0) cout << coloryellow; if ((1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) > 10.0) cout << colorred; + cout << " Pixel with suspicious pedestial value: " << std::cout.width(10) << std::right << fPedestalhighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) << " %)" << endlr; + if ((1.0*fNoiseHighFrames/fEventsSum*100) > 1.0) cout << coloryellow; if ((1.0*fNoiseHighFrames/fEventsSum*100) > 10.0) cout << colorred; + cout << " Frames with suspicious noise value: " << std::cout.width(10) << std::right<< fNoiseHighFrames << " out of " << fEventsSum << " (" << (1.0*fNoiseHighFrames/fEventsSum*100) << " %)" << endlr; + if ((1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) > 1.0) cout << coloryellow; if ((1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) > 10.0) cout << colorred; + cout << " Pixel with suspicious noise value: " << std::cout.width(10) << std::right << fNoiseHighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) << " %)" << endlr; cout<<"----------------------------------------------------------------"<cd(); @@ -992,7 +996,9 @@ void MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t preci cout << colorwhite << "----------------------------------" << colorreset << endl; for (int i=0; i highlightabove) + if (a[i] > highlightabove) + std::cout << colorgreen; + else if ((-1)*a[i] > highlightabove) std::cout << colorred; std::cout.width(precision+5); std::cout << std::fixed; @@ -1345,7 +1351,7 @@ void MAPS::hitana() { } // maybe this is unnecessary, if upper if clause is a >= comparison else if ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 ) { - cout << "WARNING: next pixel value identical to precessor" << endl; + cout << "WARNING: next pixel value identical to precessor, frame : " << fFrameInfo.frame << ", values: " << pixelchargeincluster[i] << " == " << pixelchargeincluster[12] << endl; CHANCE=0; //NOTE: potential error source break; } @@ -1544,7 +1550,7 @@ void MAPS::hitana() { } // maybe this is unnecessary, if upper if clause is a >= comparison else if ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 ) { - cout << "WARNING: next pixel value identical to precessor" << endl; + cout << "WARNING: next pixel value identical to precessor, frame : " << fFrameInfo.frame << ", values: " << pixelchargeincluster[i] << " == " << pixelchargeincluster[12] << endl; CHANCE=0; //NOTE: potential error source break; } @@ -1752,7 +1758,7 @@ void MAPS::plotFrame(Int_t FrameNumber) { cout<<"Hitted pixel discriminator matrix:"<(fHittedPixel, fPixels, fColumns, 1, 1); - TCanvas* cm1 = new TCanvas(TString(FrameNumber),TString(FrameNumber),50,100,1200,800); + TCanvas* cm1 = new TCanvas(Form("Frame %d",FrameNumber),Form("Frame %d",FrameNumber),50,100,1200,800); cm1->Divide(2,3); gStyle->SetOptFit(1011); gStyle->SetPalette(1); @@ -1820,9 +1826,11 @@ void MAPS::plotFrame(Int_t FrameNumber) { h5->Draw(); h5->GetXaxis()->SetTitle("Signal [ADC]"); h5->GetYaxis()->SetTitle("Counts"); - - cm1->DrawClone(); + + TCanvas* canvasFrame = (TCanvas*) cm1->DrawClone(); cm1->Close(); + canvasFrame->SetTitle(cm1->GetTitle()); + canvasFrame->SetName(cm1->GetName()); cm1->Update(); cout<<"\rPIXELMATRIX plotted! "<InitialDynNoise(100); processed->getFrame(frame); - - processed->filterCommonMode(); + // processed->filterCommonMode(); processed->hitana(); - exit(1); processed->plotFrame(frame); delete processed; return 0; @@ -887,7 +885,7 @@ Bool_t Run::binCluster() xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi()); ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi()); } -// cout << colorwhite << "unten: xcoord: " << xcoord << ", ycoord: " << ycoord << endl; + // cout << colorwhite << "unten: xcoord: " << xcoord << ", ycoord: " << ycoord << endl; histogram.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]); if (processed->fFrameInfo.pixelthreshold[hiti]>0) @@ -1013,17 +1011,6 @@ Bool_t Run:: findRotatedClusterDimension(Float_t rotateangle) ycoord_abs_max=(ycoord>ycoord_abs_max?ycoord:ycoord_abs_max); } } - // xcoord_min_step=abs(curpixelinfo.pitchX*cos(rotateangle/180*M_PI)-curpixelinfo.pitchY*sin(rotateangle/180*M_PI)); - // ycoord_min_step=abs(curpixelinfo.pitchX*sin(rotateangle/180*M_PI)+curpixelinfo.pitchY*cos(rotateangle/180*M_PI)); -// cout << "xcoord_min: " << xcoord_min << " xcoord_max: " << xcoord_max << endl; -// cout << "ycoord_min: " << ycoord_min << " ycoord_max: " << ycoord_max << endl; -// cout << "xcoord_min_step: " << xcoord_min_step << " ycoord_min_step: " << ycoord_min_step << endl; - // double deleteme = curpixelinfo.pitchX*processed->clustersize*cos(rotateangle/180*M_PI)-curpixelinfo.pitchY*processed->clustersize*sin(rotateangle/180*M_PI); - // double deleteme2 = curpixelinfo.pitchX*processed->clustersize*sin(rotateangle/180*M_PI)+curpixelinfo.pitchY*processed->clustersize*cos(rotateangle/180*M_PI); - // cout << "xmax2: " << deleteme << " ymax2: " << deleteme2 << endl; -// sizearrrotx= (int)((xcoord_max-xcoord_min+1)/xcoord_min_step)+1; -// sizearrroty = (int)((ycoord_max-ycoord_min+1)/ycoord_min_step)+1; -// cout << "sizearrrotx: " << sizearrrotx << " sizearrroty: " << sizearrroty << endl; initClusters(xcoord_min_step, xcoord_abs_min, xcoord_abs_max, ycoord_min_step, ycoord_abs_min, ycoord_abs_max); //sizearrrotx*2, xcoord_abs_min,xcoord_abs_max,sizearrroty*2,ycoord_abs_min,ycoord_abs_max); @@ -1288,13 +1275,13 @@ Bool_t Run::plotClusterDistribution(histogramstruct* histogramstructpointer) canvas->Draw(); - TImageDump *img2 = new TImageDump(savepathresults + "/" + canvastitle + ".png"); - canvas->Paint(); - img2->Close(); - - f->Append(canvas); - f->Append(img2); - f->Write(); +// TImageDump *img2 = new TImageDump(savepathresults + "/" + canvastitle + ".png"); +// canvas->Paint(); +// img2->Close(); +// +// f->Append(canvas); +// f->Append(img2); +// f->Write(); // .Data(), Form("Avg. cluster distribution; x; y %s", humanreadablestr.Data()),sizearrrotx, xcoord_abs_min,xcoord_abs_max,sizearrroty,ycoord_abs_min,ycoord_abs_max); return 0; @@ -1877,7 +1864,17 @@ void Run::initHistogram(TH1F* &histogrampointer, TString prefix) } void Run::initClusters(Float_t xcoord_min_step, Float_t xcoord_abs_min, Float_t xcoord_abs_max, Float_t ycoord_min_step, Float_t ycoord_abs_min, Float_t ycoord_abs_max) -{ +{ + if (true) // set to true to debug + { + cout << "xcoord_abs_min: " << xcoord_abs_min << " xcoord_abs_max: " << xcoord_abs_max << endl; + cout << "ycoord_abs_min: " << ycoord_abs_min << " ycoord_abs_max: " << ycoord_abs_max << endl; + cout << "xcoord_min_step: " << xcoord_min_step << " ycoord_min_step: " << ycoord_min_step << endl; + Int_t sizearrrotx= (int)((xcoord_abs_max-xcoord_abs_min)/xcoord_min_step+0.5); + Int_t sizearrroty= (int)((ycoord_abs_max-ycoord_abs_min)/ycoord_min_step+0.5); + cout << "sizearrrotx: " << sizearrrotx << " sizearrroty: " << sizearrroty << endl; + } + initCluster(&histogram, "", xcoord_min_step, xcoord_abs_min, xcoord_abs_max, ycoord_min_step, ycoord_abs_min, ycoord_abs_max); initCluster(&histogramthreshold, "_threshold", xcoord_min_step, xcoord_abs_min, xcoord_abs_max, ycoord_min_step, ycoord_abs_min, ycoord_abs_max); }