//runs[runi]->setFixedThresholdValueElectrons(1440);
//runs[runi]->setNoisethresholdborderADU(30);
-// runs[runi]->analyzeFrame(1000);
+// runs[runi]->analyzeFrame(6384);
+// runs[runi]->analyzeFrame(6604);
+// runs[runi]->analyzeFrame(675);
+// runs[runi]->analyzeFrame(680);
+// runs[runi]->analyzeFrame(685);
+// runs[runi]->analyzeFrame(690);
+// continue;
+
// creates or opens .root file, can analyze the RAW data
if (runListForceAnalysis.size() >= (unsigned)runi+1)
runs[runi]->error=runs[runi]->analyzeRun(true);
}
if (!runs[runi]->error)
- {
+ {
if (runListCustomTitle.size() >= (unsigned)runi+1)
{
if (runListCustomTitle[runi].Length()>0)
if (!isBatch)
gROOT->SetBatch(kFALSE);
-// // Uncomment below to do classical analysis
-// compareHistogramClassVector.push_back(runs[runi]->histogramthreshold);
-// compareHistogramVector.push_back(runs[runi]->histogramthreshold->Seed);
+ // Uncomment below to do classical analysis withour RTS
+// compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized->calibrated);
+ compareHistogramClassVector.push_back(runs[runi]->histogram);
+ compareHistogramClassVector2.push_back(runs[runi]->histogramthreshold);
+// compareHistogramVector2.push_back(runs[runi]->histogramwoRTS->normalized->calibrated->Seed);
+// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Seed, "landau", true);
+// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Sum, "gaus", true);
// // Uncomment below to do analysis without RTS pixel
// compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSthreshold);
// compareHistogramVector6.push_back(runs[runi]->histogramwoRTSthreshold->calibrated->pixeltimefiredsorted);
// Leakage current
- runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixel, "", 0);
+// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->calibrated->LeakageCurrentInPixel, "", 0);
// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramthreshold->LeakageCurrentInPixelSorted, "", 0);
- compareHistogramVector5.push_back(runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixelSorted);
- compareHistogramClassVector4.push_back(runs[runi]->histogramwoRTSthreshold->calibrated);
- compareHistogramClassVector5.push_back(runs[runi]->histogramwoRTSthreshold);
-// compareHistogramVector7.push_back(runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixelSorted);
+// compareHistogramVector5.push_back(runs[runi]->histogram->calibrated->LeakageCurrentInPixelSorted);
+// compareHistogramClassVector4.push_back(runs[runi]->histogramwoRTS->calibrated);
+// compareHistogramClassVector5.push_back(runs[runi]->histogramwoRTS);
+// compareHistogramVector7.push_back(runs[runi]->histogram->calibrated->LeakageCurrentInPixelSorted);
// compareHistogramVector3.push_back(runs[runi]->histogramwoRTS->pixeltimefiredsorted);
// compareHistogramVector.push_back(runs[runi]->histogramwoRTS->normalized->Seed);
// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->pixeltimefired, "", 0);
-// runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->pixeltimefired, "", 0);
+ runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->Seed, "landau", 1);
// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0, true, true);
// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->pixeltimefired, "", 0, true, true);
// runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->LeakageCurrentInPixel, "", 0);
-// if (numberRuns>0)
-// runs[0]->setLabel("Not irradiated");
-// // runs[0]->setLabel("33x33 #mum, S(D)=8 #mum^2, F(D)=15 #mum^2");
-// if (numberRuns>1)
-// runs[1]->setLabel("10^{13} n_{eq}/cm^{2}");
-// if (numberRuns>2)
-// runs[2]->setLabel("10^{14} n_{eq}/cm^{2}");
-// runs[1]->setLabel("66x33 #mum, S(D)=8 #mum^2, F(D)=15 #mum^2");
-// if (numberRuns>2)
-// runs[2]->setLabel("33x33 #mum, S(D)=11 #mum^2, F(D)=11 #mum^2");
-// runs[3]->setLabel("HR18, P13, 5.0 V");
+// if (numberRuns>0)
+// runs[0]->setLabel("Not irradiated, -20 {}^{0}C");
+// if (numberRuns>1)
+// runs[1]->setLabel(" +20 {}^{0}C");
+// if (numberRuns>2)
+// runs[2]->setLabel("Irradiated with Lead, Dose 4, -20 {}^{0}C");
+// if (numberRuns>3)
+// runs[3]->setLabel(" +20 {}^{0}C");
+
printSummaryTable(&compareHistogramClassVector);
printSummaryTable(&compareHistogramClassVector2);
printSummaryTable(&compareHistogramClassVector4);
plotAllRuns(&compareHistogramClassVector5);
CompareLeageCurrent(&compareHistogramClassVector4);
CompareLeageCurrent(&compareHistogramClassVector5);
- writeObservableToFile();
+writeObservableToFile();
+writeOneHistogramTypeToFile(&compareHistogramClassVector);
// plotAllRuns("seed threshold calibrated");
// setCustomPath("Excel/");
// writeObservableToFile("seed threshold calibrated");
*/
Bool_t CompareHistograms(vector<TH1F*>* ptCompareHistogramVector, TString titlestr = "", TString YAxisTitle = "");
+Bool_t writeOneHistogramTypeToFile(vector<HistogramType*>*);
+
Bool_t writeObservableToFile();
/** @brief A vector able to hold pointer of type #Run::histogramstruct
*
return numberRuns;
}
+Bool_t writeOneHistogramTypeToFile(vector<HistogramType*>* ptCompareHistogramClassVector)
+{
+ if (ptCompareHistogramClassVector->size() > 0)
+ {
+ system("mkdir "+ runs[0]->savepathresults + " -p");
+
+ TString filename = Form("%s/Spectrum_%s", runs[0]->savepathresults.Data(), ptCompareHistogramClassVector->at(0)->histogramdescription.Data());
+
+ TString header = "";
+ for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+ {
+ if (ptCompareHistogramClassVector->at(runi) != nullptr)
+ {
+ // header += Form("#%s, %s\n", ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->histogramdescription.Data());
+ }
+ }
+ filename+=".dat";
+ fstream* fout = new fstream(filename,ios::out);
+ for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+ {
+ header += Form("Energy\tSeed\tSum\tVeto\t");
+ }
+ header += Form("\n");
+ for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+ {
+ header += Form("%s\t\t\t\t", ptCompareHistogramClassVector->at(runi)->iscalibrated?"e":"ADU");
+ }
+ header += Form("\n");
+ for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+ {
+ header += Form("%s\t%s\t%s\t%s\t", ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data());
+ }
+ *fout << header << endl;
+ TString outline;
+ for(Int_t bin=1;bin<=ptCompareHistogramClassVector->at(0)->Seed->GetNbinsX();bin++)
+ {
+ outline ="";
+ for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+ {
+ outline+=Form("%.1f\t%.1f\t%.1f\t%.1f\t", ptCompareHistogramClassVector->at(runi)->Seed->GetBinCenter(bin), ptCompareHistogramClassVector->at(runi)->Seed->GetBinContent(bin), ptCompareHistogramClassVector->at(runi)->Sum->GetBinContent(bin), ptCompareHistogramClassVector->at(runi)->Veto->GetBinContent(bin));
+ }
+ *fout<<outline<<endl;
+ }
+ fout->close();
+ return 0;
+
+ }
+ return 0;
+}
+
Bool_t writeObservableToFile()
{
// legend entries
Float_t height = ptCompareHistogramClassVector->size() * 0.055;
- TLegend* leg1 = new TLegend(0.50,0.89-height,0.95,0.89);//(0.6,0.7,0.89,0.89);
+ TLegend* leg1 = new TLegend(0.4,0.89-height,0.95,0.89);//(0.6,0.7,0.89,0.89);
leg1->SetTextSize(0.035);
leg1->SetFillStyle(0);
leg1->SetTextFont(132);
fstream* fout = new fstream(filename,ios::out);
const int width = 15;
- cout << endlr << colorwhite << right << setw(width*9) << setfill('=') << " " << endl;
+ cout << endlr << colorwhite << right << setw(width*11) << setfill('=') << " " << endl;
cout << left << setw(width*1) << setfill(' ') << "Cut type: "<< left << setw(width*8) << setfill(' ') << ptCompareHistogramClassVector->at(0)->histogramdescription << endl; filecontent += Form("Cut type: %s\n", ptCompareHistogramClassVector->at(0)->histogramdescription.Data());
cout << left << setw(width-5) << setfill(' ') << "Runnumber"; filecontent += Form("Runnumber\t");
cout << left << setw(width-5) << setfill(' ') << "Frames"; filecontent += Form("Frames\t");
cout << left << setw(width-10) << setfill(' ') << "Chp#"; filecontent += Form("Chp#\t");
+ Bool_t printtemp = 1; // always print temperature
+ for (vector<HistogramType*>::iterator curHistogramClass = ptCompareHistogramClassVector->begin(); curHistogramClass != ptCompareHistogramClassVector->end(); curHistogramClass++) {
+ if ((*curHistogramClass)->labbook->temp != ptCompareHistogramClassVector->at(0)->labbook->temp)
+ printtemp = 1;
+ }
+ if (printtemp)
+ cout << left << setw(width-8) << setfill(' ') << "Temp"; filecontent += Form("Temp\t");
cout << left << setw(width-10) << setfill(' ') << "Mtrx"; filecontent += Form("Mtrx\t");
Float_t printradion = 0;
for (vector<HistogramType*>::iterator curHistogramClass = ptCompareHistogramClassVector->begin(); curHistogramClass != ptCompareHistogramClassVector->end(); curHistogramClass++)
// cout << left << setw(width+2) << setfill(' ') << "Veto Integral"; filecontent += Form("Veto Integral\t");
// cout << left << setw(width+2) << setfill(' ') << "Sum Integral"; filecontent += Form("Veto Integral\t");
cout << left << setw(width-2) << setfill(' ') << "RTS pixel"; filecontent += Form("RTS pixel\t");
- cout << left << setw(width-2) << setfill(' ') << "Leakage"; filecontent += Form("Leakage cur.\t");
+ cout << left << setw(width+2) << setfill(' ') << "Leakage"; filecontent += Form("Leakage cur.\t");
cout << left << setw(width-2) << setfill(' ') << "Noise"; filecontent += Form("Noise\t");
cout << left << setw(width) << setfill(' ') << "Noise threshold"; filecontent += Form("Noise threshold\t");
cout << endl; filecontent += Form("\n");
cout << left << setw(width-5) << setfill(' ') << to_str_w_prec(curhistogramclassp->frames_found); filecontent += Form("%s\t", to_str_w_prec(curhistogramclassp->frames_found).c_str());
// cout << "2" << endl;
cout << left << setw(width-10) << setfill(' ') << curhistogramclassp->labbook->chip; filecontent += Form("%s\t", curhistogramclassp->labbook->chip.Data());
+ if (printtemp) { cout << left << setw(width-8) << setfill(' ') << curhistogramclassp->labbook->temp; filecontent += Form("%.1f\t", curhistogramclassp->labbook->temp); }
// cout << "!" << endl;
cout << left << setw(width-10) << setfill(' ') << curhistogramclassp->labbook->matrix; filecontent += Form("%s\t", curhistogramclassp->labbook->matrix.Data());
if (printradion > 0) { cout << left << setw(width-5) << setfill(' ') << curhistogramclassp->labbook->radDoseIon; filecontent += Form("%.1f\t", curhistogramclassp->labbook->radDoseIon); }
// cout << left << setw(width+2) << setfill(' ') << printTableElement(curhistogramclassp->integralVeto,ptCompareHistogramClassVector->at(0)->integralVeto,2); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralVeto,ptCompareHistogramClassVector->at(0)->integralVeto,4).c_str());
// cout << left << setw(width+2) << setfill(' ') << printTableElement(curhistogramclassp->integralSum,ptCompareHistogramClassVector->at(0)->integralSum,2); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralSum,ptCompareHistogramClassVector->at(0)->integralSum,4).c_str());
cout << left << setw(width-2) << setfill(' ') << printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0).c_str());
- cout << left << setw(width-2) << setfill(' ') << printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1).c_str());
+ cout << left << setw(width+2) << setfill(' ') << printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1).c_str());
cout << left << setw(width-2) << setfill(' ') << printTableElement(curhistogramclassp->avgNoise,ptCompareHistogramClassVector->at(0)->avgNoise); filecontent += Form("%s\t", printTableElement(curhistogramclassp->avgNoise,ptCompareHistogramClassVector->at(0)->avgNoise).c_str());
cout << left << setw(width) << setfill(' ') << printTableElement(curhistogramclassp->noisethresholdborder,ptCompareHistogramClassVector->at(0)->noisethresholdborder); filecontent += Form("%s\t", printTableElement(curhistogramclassp->noisethresholdborder,ptCompareHistogramClassVector->at(0)->noisethresholdborder).c_str());
cout << "" << endl; filecontent += Form("\n");
}
- cout << right << setw(width*9) << setfill('=') << " " << endl;
+ cout << right << setw(width*11) << setfill('=') << " " << endl;
*fout << filecontent << endl;
fout->close();
}
histogrampointer->SetLineColor(color);
histogrampointer->SetStats(kTRUE);
histogrampointer->SetStats(111111111);
- histogrampointer->SetLineWidth(3); // TODO: set to 3 again
+ histogrampointer->SetLineWidth(2); // TODO: set to 3 again
histogrampointer->GetXaxis()->SetTitle("Q_coll [ADU]");
histogrampointer->GetYaxis()->SetTitle(Form("Entries [1/%.1f ADU]",histogrampointer->GetBinWidth(1)));
histogrampointer->GetXaxis()->CenterTitle();
histogrampointernew->SetTitle(Form("%s, norm.", histogrampointerold->GetTitle()));
int nbins = histogrampointernew->GetXaxis()->GetNbins();
for(int x=0; x <= nbins; x++){
- histogrampointernew->SetBinContent(x,histogrampointerold->GetBinContent(x)/frames_found*1000000);
+ histogrampointernew->SetBinContent(x,histogrampointerold->GetBinContent(x)/frames_found*1000000.0);
}
histogrampointernew->GetYaxis()->SetTitle(Form("%s\b/(%d/1000000)]",histogrampointernew->GetYaxis()->GetTitle(), frames_found));
}
histogrampointer->GetXaxis()->SetRange(histogrampointer->GetXaxis()->FindBin(noiseborder),histogrampointer->GetXaxis()->FindBin(posMaxValHist)); // look only for maxima with x greater than noiseborder, cut away noise
// TCanvas* canvas = new TCanvas("2121", "212121212", 900, 700);
// histogrampointer->Draw();if (verbose)
+ fitFunc->SetLineStyle(1); // normal for the following fits
if (verbose)
fitFunc->DrawCopy("same");
} else {
noiseborder = FindBorderToPeak(histogrampointer, noiseborder,fitFunc->GetParameter(1), verbose); // starting point of histogram integration
integralPeak = histogrampointer->Integral(histogrampointer->GetXaxis()->FindBin(noiseborder), histogrampointer->GetXaxis()->FindBin(posMaxValHist));
posMax = fitFunc->GetMaximumX(); // Methode 2
+ fitFunc->SetLineStyle(1); // normal for the following fits
if (verbose)
fitFunc->Draw("SAME");
}
for (Int_t pari=0; pari<3; pari++)
parameters[pari]=fitFunc->GetParameter(pari);
// posMax = fitFunc->GetParameter(1); // new method, just use MPV of fit, as noise border is well known. Compare with old method anyway and warn if something suspecious.
- parameters[1]=fitFunc->GetMaximumX();
+// parameters[1]=fitFunc->GetMaximumX();
posMax = fitFunc->GetMaximumX(); // new method, just use MPV of fit, as noise border is well known. Compare with old method anyway and warn if something suspecious.
// cout << "fitFunc->GetParameter(0): " << fitFunc->GetParameter(0) << endl;
// cout << "fitFunc->GetParameter(1): " << fitFunc->GetParameter(1) << endl;
// histogrampointer->Fit(fitFunc, "N,Q,W", "", fitMax1, histogrampointer->GetBinCenter(bini));
fitMax3 = fitFunc->GetMaximumX();
fitFunc->SetLineColor(kGreen);
-// fitFunc->DrawCopy("same");
fitFunc->SetLineStyle(1); // normal for the following fits
+ if (verbose)
+ fitFunc->DrawCopy("same");
//Sort the three fits and save error estimation
minFitMax = TMath::Min(TMath::Min(fitMax1,fitMax2),fitMax3);
// fitFcn->FixParameter(0,21655.90045);
// fitFcn->FixParameter(1,34.31885101);
fitFcn->FixParameter(2,histogrampointer->GetXaxis()->GetBinCenter((int)(histogrampointer->GetXaxis()->GetNbins()/2.0+0.5)));
+ fitFcn->SetLineStyle(1); // normal for the following fits
+ if (verbose)
+ fitFcn->DrawCopy("same");
// fitFcn->FixParameter(3,-22.43016284);
//histogrampointer->Fit("fitFcn","V+","ep");
// histogrampointer->Fit(fitFunc, "N,M,W,Q", "", noiseborder, posMaxValHist);
// for (Int_t pari=0; pari<6; pari++)
// parameters[pari]=fitFunc->GetParameter(pari);
- parameters[1] = parameters[1] + histogrampointer->GetBinWidth(0);
+ parameters[1] = parameters[1] - histogrampointer->GetBinWidth(0)*2;
parameters[7] = FindBorderToPeak(histogrampointer, noiseborder,def_peakcenter, verbose); // starting point of histogram integration
// TCanvas* canvas = new TCanvas(histogrampointer->GetName(), histogrampointer->GetName(), 900, 700);
// histogrampointer->Draw();
// fitFunc->Draw("SAME");
-
+
+ fitFunc->SetLineStyle(1); // normal for the following fits
if (verbose)
fitFunc->Draw("SAME");
* It is set as a multiply of the standard deviation
*
*/
- Float_t RTSthreshold = 5;
+ Float_t RTSthreshold = 4;
//*****************
// GETTER AND SETTER
fNoiseTree->Branch("pixelnumber", &fNoiseInfo.pixelnumber , "pixelnumber/i" , 32000);
fNoiseTree->Branch("noise" , &fNoiseInfo.fNoise[0] , "noise[pixelnumber]/F" , 32000);
fNoiseTree->Branch("pedestal" , &fNoiseInfo.fPedestals[0] , "pedestal[pixelnumber]/F" , 32000);
- fNoiseTree->Branch("F0" , &fNoiseInfo.fF0[0] , "F0[pixelnumber]/i" , 32000);
+ fNoiseTree->Branch("AvgF0" , &fNoiseInfo.AvgF0 , "AvgF0/D" , 32000);
initHistograms();
cout<<"-----------------------"<<endl;
fNoiseTree->SetBranchAddress("frame" , &fFrameInfo.frame);
fNoiseTree->SetBranchAddress("noise" , &fNoiseInfo.fNoise[0]);
fNoiseTree->SetBranchAddress("pedestal" , &fNoiseInfo.fPedestals[0]);
- fNoiseTree->SetBranchAddress("F0" , &fNoiseInfo.fF0[0]);
+ fNoiseTree->SetBranchAddress("AvgF0" , &fNoiseInfo.AvgF0);
initHistograms();
cout<<"-----------------------"<<endl;
fCdsmatrix = new Float_t [fPixelsData]();
fHittedPixel= new Int_t [fPixelsData]();
fNoiseInfo.fNoise = new Float_t [fPixelsData]();
- fNoiseInfo.fPedestals = new Float_t [fPixelsData]();
- fNoiseInfo.fF0 = new Int_t [fPixelsData]();
+ fNoiseInfo.fPedestals = new Float_t [fPixelsData]();
//-----------------------------------------------
return true;
}
fHittedPixel= new Int_t [fPixelsData]();
fNoiseInfo.fNoise = new Float_t [fPixelsData]();
fNoiseInfo.fPedestals = new Float_t [fPixelsData]();
- fNoiseInfo.fF0 = new Int_t [fPixelsData]();
//-----------------------------------------------
return true;
}
fF1matrix [i] = value2 [(UChar_t)RAWDATA[4*i]] [(UChar_t)RAWDATA[4*i+1]];
}
fCdsmatrix [i] = fF0matrix[i] - fF1matrix[i];
- fNoiseInfo.fF0[i] = fF0matrix[i];
}
+// cout << fCdsmatrix [50] << " " << " Frame: "<< FrameNumber << " ";
//==========================================================================
// -----------------
// If pixel array is different from 'standard',
startframe = 0;
if (startframe+frames>=GetNumberFrames())
startframe=GetNumberFrames()-frames;
+
+ fNoiseInfo.AvgF0=0;
// first estimate
// sum up over all frames every CDS value, pixelwise
for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
{
+ // Average F0 value
+ fNoiseInfo.AvgF0+=fF0matrix[pixeli];
+
fNoiseInfo.fPedestals[pixeli] += fCdsmatrix[pixeli];
}
}
// calculate average pedestal of each pixel
for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
{
- fNoiseInfo.fPedestals[pixeli] /= frames;
+ fNoiseInfo.fPedestals[pixeli] /= frames;
}
+ fNoiseInfo.AvgF0/=frames*fPixels;
// sum up over all frames every variance from the pedestial, pixelwise
for(Int_t framei=startframe; framei<frames+startframe; framei++)
bool MAPS::regetDynNoise(Int_t Frames) {
Bool_t pedestalhighinthisframe = false;
Bool_t noisehighinthisframe = false;
+ fNoiseInfo.AvgF0=0;
for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
{
// if (fHittedPixel[fColumns]==0)
if (fHittedPixel[pixeli]==0)
{
+ fNoiseInfo.AvgF0+=fF0matrix[pixeli];
if (useexponentialdecayingnoisewindow)
{
fNoiseInfo.fNoise[pixeli] = TMath::Sqrt(( (Frames-2)*TMath::Power(fNoiseInfo.fNoise[pixeli],2) + TMath::Power(1.*fCdsmatrix[pixeli]-fNoiseInfo.fPedestals[pixeli],2) )/(Frames-1));
fNoiseInfo.fPedestals[pixeli] -= (CDSlastframes[pixeli].front()-fCdsmatrix[pixeli])/CDSlastframes[pixeli].size();
CDSlastframes[pixeli].pop();
CDSlastframes[pixeli].push(fCdsmatrix[pixeli]);
- }
+ }
if (abs(fNoiseInfo.fPedestals[pixeli])>20)
{
fPedestalhighPixel++;
// cout << "Skipped pixel " << pixeli << " for noise calc in frame " << fFrameNumber << ", because fHittedPixel: " << fHittedPixel[pixeli] << endl;
}
}
+// cout << "fNoiseInfo.AvgF0 : " << fNoiseInfo.AvgF0 << endl;
+ fNoiseInfo.AvgF0/=fPixels;
// if (pedestalhighinthisframe)
// cout<<"\rFrame: "<<fFrameNumber<< " --> Pedestal suspiciously high!"<<endl;
// if (noisehighinthisframe)
}
}
}
+// cout<<"Frame : " << fFrameNumber << ", hit: " << hit << ", bordercluster: " << (bordercluster?"Yes":"No") << endl;
+//
// cout<<"Hitted pixel discriminator matrix:"<<endl;
// debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+
if (bordercluster)
fHittedPixel[Hitlist[hit]] = -2;
else
{
fFrameInfo.p [clupos][fHits] = pixelchargeincluster[clupos];
}
- // for(Int_t row=0; row<5; row++)
- // {
- // for(Int_t column=0; column<5; column++)
- // {
- // std::cout.width(10);
- // std::cout << std::fixed;
- // std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
- // }
- // cout << endl;
- // }
- // cout << endl;
+
+ // comment me out
+// for(Int_t row=0; row<5; row++)
+// {
+// for(Int_t column=0; column<5; column++)
+// {
+// std::cout.width(10);
+// std::cout << std::fixed;
+// std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
+// }
+// cout << endl;
+// }
+// cout << endl;
+
// if cluster charge > clusternoise * const
- if(fOrderCode=="FSBB")
+ if(fOrderCode=="FSBB" || fOrderCode=="Mi19")
{
if (1.0*chargesumincluster4 > noisesumincluster4*6.0)
fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
void MAPS::filterCommonMode() {
Float_t CommonModeInRow = 0;
+ Float_t AverageF0InRow = 0;
bool warning;
Float_t* Arr = new Float_t[fColumns]();
{
warning = false;
CommonModeInRow = 0;
+ AverageF0InRow = 0;
for(int column=0; column<fColumns; column++ )
{
Arr[column] = fCdsmatrix[ row*fColumns+column ] - fNoiseInfo.fPedestals[ row*fColumns+column ]; // Bugfix: Considered pedestals in common mode calculation
+ AverageF0InRow += fF0matrix[row*fColumns+column];
+// cout << Arr[column] << " ";
}
+// cout << endl;
+ AverageF0InRow /= fColumns;
CommonModeInRow = TMath::Median(fColumns, Arr); // Don't use mean, consider hitted pixel !
if (CommonModeInRow < 0)
else
minus++;
- if(TMath::Abs(CommonModeInRow)>1000) // TODO better warning criteria
+ if(TMath::Abs(CommonModeInRow)>AverageF0InRow/10.0) // more than 10 % correction
{
warning = true;
}
+// cout << "CommonModeInRow: " << CommonModeInRow << endl;
+// cout << "AverageF0InRow: " << AverageF0InRow << endl;
if(warning) { cout<<"\rFrame: "<<fFrameNumber<< " row: " << row << " Median of row: " << CommonModeInRow << " --> Common Mode suspiciously high! "<<endl;
debugStream<>(fCdsmatrix, fPixels, fColumns, 1, 20);
debugStream<>(Arr, fColumns, fColumns, 1, 20);
else {
cout <<endl <<endl << colorwhite << "---------------- FRAME " << fFrameNumber << " ----------------" << colorreset << endl << endl;
cout<<"F0 matrix:"<<endl;
- debugStream<>(fF0matrix, fPixels/fColumns, fColumns, 0, 39);
+ debugStream<>(fF0matrix, fPixels, fColumns, 0, 39);
cout<<"F1 matrix:"<<endl;
- debugStream<>(fF1matrix, fPixels/fColumns, fColumns, 0, 39);
+ debugStream<>(fF1matrix, fPixels, fColumns, 0, 39);
cout<<"CDS matrix:"<<endl;
- debugStream<>(fCdsmatrix, fPixels/fColumns, fColumns, 0, 39);
+ debugStream<>(fCdsmatrix, fPixels, fColumns, 0, 39);
Float_t cdsmatrixCorrPed[fPixels];
for(Int_t i=0; i<fPixels; i++)
{
cdsmatrixCorrPed[i]=(float)(1.*fCdsmatrix[i]-fNoiseInfo.fPedestals[i]);
}
cout<<"CDS matrix minus pedestals:"<<endl;
- debugStream<>(cdsmatrixCorrPed, fPixels/fColumns, fColumns, 0, 10);
+ debugStream<>(cdsmatrixCorrPed, fPixels, fColumns, 0, 10);
// cout<<fCdsmatrix[0]<<","<<fCdsmatrix[1]<<","<<fCdsmatrix[2]<<","<<fCdsmatrix[3]<<","<<fCdsmatrix[4]<<","<<fCdsmatrix[5]<<","<<fCdsmatrix[6]<<endl;
cout<<"Hitted pixel discriminator matrix:"<<endl;
- debugStream<>(fHittedPixel, fPixels/fColumns, fColumns, 1, 1);
+ debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
TCanvas* cm1 = new TCanvas(Form("Frame %d",FrameNumber),Form("Frame %d",FrameNumber),50,100,1200,800);
cm1->Divide(2,3);
void Run::setSystemSpecificParameters()
{
// systemparam systemparamUSB (2800/*maxbin*/,2800/4/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/); // TODO: uncomment and add again old binning
- systemparam systemparamUSB (2800/*maxbin*/,2800/4/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
+ systemparam systemparamUSB (2800/*maxbin*/,2800/6/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
systemparam systemparamPegasus (2800,2800/2,20,10,100);
systemparam systemparamPXI (800*16,800,75,150,150);
systemparam systemparamFSBB (2800,2800/4,25,10,100);
systemparam systemparamUSBMi19 (400/*maxbin*/,400/1/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
+ systemparam systemparamPipper2 (2800,2800/4,15,10,100);
if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") )
cursystemparam = systemparamUSB;
else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("FSBB") )
cursystemparam = systemparamPegasus;
if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi19") )
cursystemparam = systemparamUSBMi19;
+ if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Pipper2") )
+ cursystemparam = systemparamPipper2;
else if (labbook.system.EqualTo("USB")) // && labbook.chipGen.EqualTo("34") )
cursystemparam = systemparamUSB;
sensorinfostruct sensorinfoPegasus( 8, 56 );
sensorinfostruct sensorinfoFSBB( 4, 416 );
sensorinfostruct sensorinfoMi19USB( 192, /* rows */ 192 /* columns */ );
+ sensorinfostruct sensorinfoPipper2( 8, 128 );
if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi34") )
cursensorinfo=sensorinfoMi34USB;
cursensorinfo=sensorinfoPegasus;
else if (labbook.system.EqualTo("USB") && labbook.chipGen.EqualTo("Mi19") )
cursensorinfo=sensorinfoMi19USB;
+ else if (labbook.chipGen.EqualTo("Pipper2") )
+ cursensorinfo=sensorinfoPipper2;
}
void Run::setMatrixSpecificParameters()
processed->InitialDynNoise();
int start = 0;
int nframes = processed->GetNumberFrames();
-// for(int i=0; i<200;i++) // TODO remove 100000 run 342272
+// for(int i=0; i<1000;i++) // TODO remove 100000 run 342272
for(int i=0; i<nframes;i++) // TODO remove 100000 run 342272
{
// cout << "getframe " << i << endl;
cout << colorwhite << "initOldRootFile():" << endlr;
}
if (processed->initOldRootFile()) return 1;
+ cout << colorcyan << "9TEST" << endlr;
frames_found = processed->GetNumberFrames();
// cout << colorwhite << "plotPixSignal():"<< flush << endlr;
// processed->plotPixSignal(0,10000000,351);
cout << "Processing histograms in class: <" << colorwhite << (*curHistogramClass)->histogramdescription << colorreset << " >" << endlr;
if ((*curHistogramClass)->maskRTSpixel) {
cout << colorwhite << " FindRTSPixelToMask():" << endlr;
- FindRTSPixelToMask(*curHistogramClass);
+// FindRTSPixelToMask(*curHistogramClass);
}
}
cout << "--------------------------------------------" << endl;
+ cout << colorwhite << "binF0():" << endlr;
+ binF0();
cout << colorwhite << "binSeedSumVeto():" << endlr;
binSeedSumVeto();
// cout << colorwhite << "binCluster():" << endlr;
int entries = processed->GetNumberFrames();
if (frame < entries)
{
- processed->InitialDynNoise(100);
+ processed->InitialDynNoise();
processed->getFrame(frame);
if (commonModeFilter)
processed->filterCommonMode();
processed->hitana();
+ if (dynamicalNoise)
+ processed->regetDynNoise();
processed->plotFrame(frame);
- delete processed;
+// delete processed;
return 0;
}
else
cout << "\033[1;33mFrame number too big, max frame: " << entries << "\033[0m" << endl;
}
}
- delete processed;
+// delete processed;
return 1;
}
constructUpdateString(&sqlupdatequery, "Gain", histogramthreshold->normalized->gain);
constructUpdateString(&sqlupdatequery, "SumPeak", histogramthreshold->normalized->posSum, 4);
constructUpdateString(&sqlupdatequery, "SeedPeak", histogramthreshold->normalized->posSeed, 4);
+ constructUpdateString(&sqlupdatequery, "AvgF0", labbook.averageF0, 6);
+ constructUpdateString(&sqlupdatequery, "SigmaF0", labbook.sigmaF0, 6);
constructUpdateString(&sqlupdatequery, "VetoPeak", histogramthreshold->normalized->posVeto, 4);
constructUpdateString(&sqlupdatequery, "VetoIntegral", histogramthreshold->normalized->integralVeto, 10);
constructUpdateString(&sqlupdatequery, "SumIntegral", histogramthreshold->normalized->integralSum, 10);
// cout << colorcyan << "oneHistogramClass->avgLeakageCurrentInChip: " << oneHistogramClass->avgLeakageCurrentInChip << endlr;
// cout << colorcyan << "oneHistogramClass->medianLeakageCurrent: " << oneHistogramClass->medianLeakageCurrent << endlr;
- TCanvas *c1 = new TCanvas("c1","c1",600,400);
- TH2F *hcandle = new TH2F("hcandle","Option CANDLE6 example ",40,-4,4,40,-20,20);
- Float_t px, py;
- for (Int_t pixeli=0; pixeli < oneHistogramClass->LeakageCurrentInPixel->GetNbinsX(); pixeli++) {
- hcandle->Fill(1,oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli));
- }
- hcandle->SetMarkerSize(0.5);
- hcandle->SetBarWidth(1.0);
- hcandle->Draw("CANDLEX5");
+// TCanvas *c1 = new TCanvas("c1","c1",600,400);
+// TH2F *hcandle = new TH2F("hcandle","Option CANDLE6 example ",40,-4,4,40,-20,20);
+// Float_t px, py;
+// for (Int_t pixeli=0; pixeli < oneHistogramClass->LeakageCurrentInPixel->GetNbinsX(); pixeli++) {
+// hcandle->Fill(1,oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli));
+// }
+// hcandle->SetMarkerSize(0.5);
+// hcandle->SetBarWidth(1.0);
+// hcandle->Draw("CANDLEX5");
// gPad->BuildLegend(0.6,0.7,0.7,0.8);
return 0;
return 0;
}
+Bool_t Run::binF0()
+{
+ averageF0Hist =new TH1F(Form("%d AvgF0",labbook.runnumber), Form("%d AvgF0",labbook.runnumber), processed->fHitTree->GetEntries(), 0, processed->fHitTree->GetEntries());
+ averageF0Hist->SetLineStyle(rootlinestyle[plotStyle]);
+ averageF0Hist->SetLineColor(rootcolors[plotStyle]);
+ averageF0Hist->SetStats(kTRUE);
+ averageF0Hist->SetStats(111111111);
+ averageF0Hist->SetLineWidth(3); // TODO: set to 3 again
+ averageF0Hist->GetXaxis()->SetTitle("time [frame]");
+ averageF0Hist->GetYaxis()->SetTitle("AverageF0");
+ averageF0Hist->GetXaxis()->CenterTitle();
+ averageF0Hist->GetYaxis()->CenterTitle();
+ labbook.averageF0 = 0;
+ labbook.sigmaF0 = 0;
+ for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
+ {
+ processed->fHitTree->GetEntry(framei);
+ Float_t avgF0InCurFrame = processed->fNoiseInfo.AvgF0;
+ averageF0Hist->SetBinContent(framei, avgF0InCurFrame);
+ labbook.averageF0+=avgF0InCurFrame;
+// labbook.averageF0 + = avgF0InCurFrame;
+ }
+ labbook.averageF0 /= processed->fHitTree->GetEntries();
+ for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
+ {
+ Float_t avgF0InCurFrame = processed->fNoiseInfo.AvgF0;
+ labbook.sigmaF0 += pow(avgF0InCurFrame-labbook.averageF0,2);
+ // labbook.averageF0 + = avgF0InCurFrame;
+ }
+ labbook.sigmaF0 /= processed->fHitTree->GetEntries();
+ labbook.sigmaF0 = sqrt(labbook.sigmaF0);
+ return 0;
+}
+
Bool_t Run::binSeedSumVeto()
{
/// collected charge in cluster
// sum histogram
pixelSum = 0;
notSeedSum = 0;
- if(labbook.chipGen=="FSBB")
+ if(labbook.chipGen=="FSBB" || labbook.chipGen=="Mi19")
{
Float_t clusterArray[processed->clustersize*processed->clustersize];// temp variable clusterArray necessary, because Sort only accepts 1-dim arrays
Int_t index[processed->clustersize*processed->clustersize];
(*curHistogramClass)->posVeto = parameters[1];
if (labbook.runnumber == 343056)
(*curHistogramClass)->posVeto = 234;
+ if (labbook.runnumber == 345045)
+ (*curHistogramClass)->posVeto = 425;
+ if (labbook.runnumber == 342824)
+ (*curHistogramClass)->posVeto = 425;
+ if (labbook.runnumber == 342265)
+ (*curHistogramClass)->posVeto = 417;
+ if (labbook.runnumber == 345054)
+ (*curHistogramClass)->posVeto = 417;
// cout << (*curHistogramClass)->histogramdescription << ": " << colorcyan << parameters[1] << endlr;
(*curHistogramClass)->integralVeto = parameters[6];
}
TString header = Form("#%s %lu frames\n", runcode.Data(), frames_found);
header += Form("#posVeto, run: %.1f, DB: %.1f, Fe55 DB (%d, %.1f): %.1f\n", histogram->posVeto, labbook.posVetoDB, Fe55run.posVetorunnumber, Fe55run.temperature, Fe55run.posVeto);
header += Form("#\t\t");
+
for (vector<HistogramType*>::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++) {
header += Form("%s\t\t\tnorm.\t\t\t", (*curHistogramClass)->histogramdescription.Data());
}
/**
* @brief fills Seedm, Sum and Veto #Run::histogramstruct */
Bool_t binSeedSumVeto();
+
+ /**
+ * @brief fills averageF0Hist with average F0 values */
+ Bool_t binF0();
/**
* @brief fills the average cluster distribution into a 2 dimension histogram #Run::histogramstruct */
Bool_t binCluster();
/** @brief finds and and masks RTS pixel if maskRTSpixel isset to true */
Bool_t FindRTSPixelToMask(HistogramType* histogramtypepointer);
-
+
public:
/** @brief empty constructor */
Run (void);
// holds all used HistogramType classes
vector<HistogramType*> HistogramClassVector;
+ /** @brief The average F0 value of the run over the complete chip in dependance of the time */
+ TH1F* averageF0Hist = 0;
+
/** @brief Plots all histograms from #Run::HistogramType into one canvas
*
/// Array with pedestial information of given pixel
Float_t* fPedestals; //[MAXPIXELS];
// Array with F0 information of given pixel
- Int_t* fF0;
+ Double_t AvgF0;
};
Float_t percentageofRTSpixel = -1;
/// percentage of pixel showing RTS signature
Float_t HitsInRTSpixel = -1;
+ /// average F0 in current run
+ Float_t averageF0 = -1;
+ Float_t sigmaF0 = -1;
};
void preparecanvas() {