*.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
+++ /dev/null
-/**
- * @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 <TTimeStamp.h>
-
-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<int> runList;
- if (runnumber.Length() > 0)
- {
- if (runnumber.Contains("-"))
- {
- TObjArray* runarray = runnumber.Tokenize("-");
- if (runarray->GetEntries()==2)
- {
- TObjString* tempstrobj;
- tempstrobj=static_cast<TObjString*>(runarray->At(0));
- if (tempstrobj->GetString().Length()>0)
- {
- Int_t tempintstart = tempstrobj->GetString().Atoi();
- tempstrobj=static_cast<TObjString*>(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<TObjString*>(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;runi<numberRuns;runi++) // loop over runs read from file
- {
- if (runList[runi]>0)
- {
- 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");
-}
}
}
}
-<<<<<<< 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;
if(fSave && fOk)
{
cout<< endl << "----------------------------------------------------------------"<<endl;
- cout << " Frames with suspicious pedestial value: " << std::cout.width(10)<< std::right << fPedestalhighFrames << " out of " << fEventsSum << " (" << (1.0*fPedestalhighFrames/fEventsSum*100) << " %)" << endl;
- cout << " Pixel with suspicious pedestial value: " << std::cout.width(10) << std::right << fPedestalhighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fPedestalhighPixel/(fEventsSum*fPixels)*100) << " %)" << endl;
- cout << " Frames with suspicious noise value: " << std::cout.width(10) << std::right<< fNoiseHighFrames << " out of " << fEventsSum << " (" << (1.0*fNoiseHighFrames/fEventsSum*100) << " %)" << endl;
- cout << " Pixel with suspicious pedestial value: " << std::cout.width(10) << std::right << fNoiseHighPixel << " out of " << fEventsSum*fPixels<< " (" << (1.0*fNoiseHighPixel/(fEventsSum*fPixels)*100) << " %)" << endl;
+ if ((1.0*fPedestalhighFrames/fEventsSum*100) > 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<<"----------------------------------------------------------------"<<endl;
fOutputFile->cd();
cout << colorwhite << "----------------------------------" << colorreset << endl;
for (int i=0; i<n;i++)
{
- if (abs(a[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;
}
// 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;
}
}
// 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;
}
cout<<"Hitted pixel discriminator matrix:"<<endl;
debugStream<>(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);
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! "<<endl;
cout<<"-------------------"<<endl;
const TString colorwhite = "\033[1;29m";
const TString colorred = "\033[1;31m";
const TString coloryellow = "\033[1;33m";
+ const TString colorgreen = "\033[1;32m";
+ const TString colorcyan = "\033[1;36m";
const TString colorreset = "\033[0m";
/// resets color and prints a new line
const TString endlr = "\033[0m\n";
// storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/jspc53_H");
storepathRAWLinux = storepathRAWLinux.ReplaceAll("H:","/d/garlic");
storepathRAWLinux = storepathRAWLinux.ReplaceAll("h:","/d/garlic");
- if (TString(hostname).EqualTo("jspc48"))
- {
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/d/jspc28/jspc53_U");
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/d/jspc28/jspc53_U");
- }
- else
- {
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/jspc53_U");
- storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/jspc53_U");
- }
+// if (TString(hostname).EqualTo("jspc48"))
+// {
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/d/garlic");
+ storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/d/garlic");
+// }
+// else
+// {
+// storepathRAWLinux = storepathRAWLinux.ReplaceAll("U:","/jspc53_U");
+// storepathRAWLinux = storepathRAWLinux.ReplaceAll("u:","/jspc53_U");
+// }
storepathRAWLinux = storepathRAWLinux.ReplaceAll("F:","/jspc12_F");
storepathRAWLinux = storepathRAWLinux.ReplaceAll("f:","/jspc12_F");
storepathRAWLinux = storepathRAWLinux.ReplaceAll("O:","/d/garlic");
{
processed->InitialDynNoise(100);
processed->getFrame(frame);
-
- processed->filterCommonMode();
+ // processed->filterCommonMode();
processed->hitana();
- exit(1);
processed->plotFrame(frame);
delete processed;
return 0;
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)
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);
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;
}
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);
}