From: Benjamin Linnik Date: Mon, 4 Sep 2017 09:43:29 +0000 (+0200) Subject: Analyzer: cleaned up code X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=475542baa538d2fb71651f887895c5cc5e47b63c;p=radhard.git Analyzer: cleaned up code --- diff --git a/MABS_run_analyzer/HistogramType.c b/MABS_run_analyzer/HistogramType.c index 566596c..d0f5c2b 100644 --- a/MABS_run_analyzer/HistogramType.c +++ b/MABS_run_analyzer/HistogramType.c @@ -50,12 +50,12 @@ void HistogramType::initHistograms(Int_t gotcolor, Int_t gotstyle) { initHistogram(Noise, "Noise" + histogramdescription, color, style); initHistogram(NoiseEnd, "Noise at end" + histogramdescription, 16, style); initHistogramCustom(SeedPerc, "Seed Percentage" + histogramdescription, color, style, 0, 120, 121, Form("Entries [1/%%]"), "Q_coll [%]"); - initHistogramCustom(pixeltimefired, "Pixel fired, used for " + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counts"); - initHistogramCustom(pixeltimefiredDistrib, "Fire counter" + histogramdescription, color, style, 0, labbook->frames_foundDB/100-1, labbook->frames_foundDB/100, "times fired", "Counts"); - initHistogramCustom(LeakageCurrentInPixel, "Leakage current per pixel" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); - initHistogramCustom(LeakageCurrentInPixelSorted, "Leakage current per pixel sorted" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); + initHistogramCustom(pixeltimefired, "Pixel fired, used for " + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counts"); + initHistogramCustom(pixeltimefiredDistrib, "Fire counter" + histogramdescription, color, style, 0, labbook->frames_foundDB/100, labbook->frames_foundDB/100, "times fired", "Counts"); + initHistogramCustom(LeakageCurrentInPixel, "Leakage current per pixel" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); + initHistogramCustom(LeakageCurrentInPixelSorted, "Leakage current per pixel sorted" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Average CDS"); // initHistogram(LeakageCurrentInPixelSorted, "Leakage current" + histogramdescription, color, style); - initHistogramCustom(pixelHadGoodVeto, "Number of times pixel had good veto" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows-1, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counter good veto"); + initHistogramCustom(pixelHadGoodVeto, "Number of times pixel had good veto" + histogramdescription, color, style, 0, cursensorinfo->columns*cursensorinfo->rows, cursensorinfo->columns*cursensorinfo->rows, "Pixel index", "Counter good veto"); SeedPerc->GetXaxis()->SetRangeUser(0,50); Noise->SetBins(cursystempar->nbinsnoise, 0, cursystempar->maxbinnoise); diff --git a/MABS_run_analyzer/Run.c b/MABS_run_analyzer/Run.c index ffdcc1f..8c840d9 100644 --- a/MABS_run_analyzer/Run.c +++ b/MABS_run_analyzer/Run.c @@ -1095,7 +1095,7 @@ Bool_t Run::binLeakageCurrent(HistogramType* oneHistogramClass) Bool_t RTSpixel =false; u_int numberofconsideredpixel=0; u_int poscounter = 0; - for (u_int pixeli=0; (int)pixeliLeakageCurrentInPixel->SetBinContent(pixeli, 0); for (u_int RTSpixeli=poscounter; RTSpixeli < oneHistogramClass->RTSpixel.size(); RTSpixeli++) { // loop over all RTS pixel @@ -1131,15 +1131,15 @@ Bool_t Run::binLeakageCurrent(HistogramType* oneHistogramClass) // th1->Run(); // std::vector sortedHistogram; - for (Int_t pixeli=0; pixeli < oneHistogramClass->LeakageCurrentInPixel->GetNbinsX(); pixeli++) { + for (Int_t pixeli=1; pixeli <= oneHistogramClass->LeakageCurrentInPixel->GetNbinsX(); pixeli++) { if (oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli) != 0) // != 0 TODO sortedHistogram.push_back(oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli)); // cout << oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli) << " " << endl; } std::sort(sortedHistogram.begin(),sortedHistogram.end()); // oneHistogramClass->LeakageCurrentInPixelSorted->SetBins(sortedHistogram.size(), 0, sortedHistogram.size()); - for (UInt_t pixeli=0; pixeli < sortedHistogram.size(); pixeli++) { - oneHistogramClass->LeakageCurrentInPixelSorted->SetBinContent(pixeli, sortedHistogram.at(pixeli)); + for (UInt_t pixeli=1; pixeli <= sortedHistogram.size(); pixeli++) { + oneHistogramClass->LeakageCurrentInPixelSorted->SetBinContent(pixeli, sortedHistogram.at(pixeli-1)); } oneHistogramClass->avgLeakageCurrentInChip /= numberofconsideredpixel; @@ -1264,248 +1264,229 @@ Bool_t Run::binSeedSumVeto() } Bool_t RTSpixel = false; - - for (Int_t framei=0; frameifHitTree->GetEntries(); framei++) // loop over all frames - { - processed->fHitTree->GetEntry(framei); - // account only frames with less then 10 hits -// cout << colorcyan << processed->fFrameInfo.hits << endlr; -// if (processed->fFrameInfo.hits<(unsigned int)10) + + // used by goodveto hisogramtype + Double_t* parameters = (Double_t *)calloc(11, sizeof(Double_t)); + Double_t gausscenter = 0; + Double_t gausssigma = 0; + + + for (Int_t filli=0; filli<3; filli++) { // first and second fill loop + for (Int_t framei=0; frameifHitTree->GetEntries(); framei++) // loop over all frames { - for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) + processed->fHitTree->GetEntry(framei); + // account only frames with less then 10 hits + // if (processed->fFrameInfo.hits<(unsigned int)10) { -// if (!hiti && framei==1994914) -// cout << coloryellow << " " << framei << endlr; - uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%cursensorinfo.columns; // column of seed - uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/cursensorinfo.columns; // row of seed - if (false) { - cout << "submatrix_x_start: " << submatrix_x_start << ", submatrix_x_end: " << submatrix_x_end << endl; - cout << "submatrix_y_start: " << submatrix_y_start << ", submatrix_y_end: " << submatrix_y_end << endl; - cout << "pixel_column_x: " << pixel_column_x << ", pixel_row_y: " << pixel_row_y << endl; - } - if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet + for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) { - histogram->numberofhits++; - - // histogram with the single pixel - histogram->Seed->Fill(processed->fFrameInfo.p[12][hiti]); -// cout << colorcyan << "filled seed" << endlr; - - pixelSum = 0; - notSeedSum = 0; - // sum histogram - for (Int_t clusteri=0; clusterifFrameInfo.pixel[hiti]; // number of pixel fired (seed) + uint pixel_column_x = pixelno%cursensorinfo.columns; // column of seed + uint pixel_row_y = pixelno/cursensorinfo.columns; // row of seed + if (false) { + cout << "submatrix_x_start: " << submatrix_x_start << ", submatrix_x_end: " << submatrix_x_end << endl; + cout << "submatrix_y_start: " << submatrix_y_start << ", submatrix_y_end: " << submatrix_y_end << endl; + cout << "pixel_column_x: " << pixel_column_x << ", pixel_row_y: " << pixel_row_y << endl; } - //cout << colorpurple << framei << endlr; - - // look only at 3x3 cluster around seed - if( labbook.chipGen=="FSBB" || labbook.chipGen=="Pipper2") { - for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; - for (Int_t clusteri=completeclustersize-sqrt(completeclustersize); clusterifFrameInfo.p[clusteri][hiti] = -9999; - for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; - for (Int_t clusteri=4; clusterifFrameInfo.p[clusteri][hiti] = -9999; - } - -// DEBUG -// for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri*5+clusterj][hiti]; -// cout << endl; -// } -// cout << "......." << endl; + if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet + { + pixelSum = 0; + notSeedSum = 0; + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti]; - } - Int_t index[completeclustersize]; - TMath::Sort(completeclustersize,clusterArray,index,1); - for (Int_t clusteri=0; clusteri -9000) { - pixelSum += clusterArray[index[clusteri]]; - for (Int_t clusterj=clusteri; clusterjfFrameInfo.p[index[clusteri]][hiti]; - for (Int_t clusterj=clusteri; clusterjSum->Fill(pixelSum); - for (Int_t clusterj=0; clusterja_Sum[clusterj]->Fill(a_pixelSum[clusterj]); - } - - // seed percentage spectrum - histogram->SeedPerc->Fill(processed->fFrameInfo.p[12][hiti]/pixelSum*100); -// if (framei==1994914) { -// cout << "pixel_column_x: " << pixel_column_x << ", pixel_row_y: " << pixel_row_y << " pixelcharge: " << processed->fFrameInfo.p[12][hiti] << endl; -// cout << coloryellow << processed->fFrameInfo.p[12][hiti]/pixelSum*100 << endlr; -// } - - // veto spectrum - if (TMath::Abs(notSeedSum) < cursystemparam.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd"))) - histogram->Veto->Fill(processed->fFrameInfo.p[12][hiti]); // histogram with the single pixel - - - if (processed->fFrameInfo.pixelthreshold[hiti]>0) - { - histogramthreshold->numberofhits++; - fillAHistogramsinclass(histogramthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + // look only at 3x3 cluster around seed + if( labbook.chipGen=="FSBB" || labbook.chipGen=="Pipper2") { + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] += -9999; + for (Int_t clusteri=completeclustersize-sqrt(completeclustersize); clusterifFrameInfo.p[clusteri][hiti] += -9999; + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] += -9999; + for (Int_t clusteri=4; clusterifFrameInfo.p[clusteri][hiti] += -9999; + } - // bin the RTS cleaned histogram class - if (histogramwoRTSthreshold != 0) { - RTSpixel = false; - for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTSthreshold->RTSpixel.size(); RTSpixeli++) { - if (processed->fFrameInfo.pixel[hiti] == histogramwoRTSthreshold->RTSpixel[RTSpixeli]) - { - RTSpixel = true; -// cout << "not binned! RTS pixel #" << processed->fFrameInfo.pixel[hiti] << endl; + // DEBUG + // for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri*5+clusterj][hiti]; + // cout << endl; + // } + // cout << "......." << endl; + + Float_t clusterArray[completeclustersize];// temp variable clusterArray necessary, because Sort only accepts 1-dim arrays + for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti]; + } + Int_t index[completeclustersize]; + TMath::Sort(completeclustersize,clusterArray,index,1); + for (Int_t clusteri=0; clusteri -9000) { + pixelSum += clusterArray[index[clusteri]]; + for (Int_t clusterj=clusteri; clusterjfFrameInfo.p[index[clusteri]][hiti]; + for (Int_t clusterj=clusteri; clusterjRTSpixel.size(); RTSpixeli++) { - if (processed->fFrameInfo.pixel[hiti] == histogramwoRTSAggresivethreshold->RTSpixel[RTSpixeli]) - { - RTSpixel = true; - // cout << "not binned! RTS pixel #" << processed->fFrameInfo.pixel[hiti] << endl; + if (filli == 0) { // first fill round + histogram->numberofhits++; + // histogram with the single pixel + histogram->Seed->Fill(processed->fFrameInfo.p[12][hiti]); + histogram->Sum->Fill(pixelSum); + for (Int_t clusterj=0; clusterja_Sum[clusterj]->Fill(a_pixelSum[clusterj]); + } + + // seed percentage spectrum + histogram->SeedPerc->Fill(processed->fFrameInfo.p[12][hiti]/pixelSum*100); + + // veto spectrum + if (TMath::Abs(notSeedSum) < cursystemparam.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd"))) + histogram->Veto->Fill(processed->fFrameInfo.p[12][hiti]); // histogram with the single pixel + + + if (processed->fFrameInfo.pixelthreshold[hiti]>0) + { + histogramthreshold->numberofhits++; + fillAHistogramsinclass(histogramthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + + // bin the RTS cleaned histogram class + if (histogramwoRTSthreshold != 0) { + RTSpixel = false; + for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTSthreshold->RTSpixel.size(); RTSpixeli++) { + if (pixelno == histogramwoRTSthreshold->RTSpixel[RTSpixeli]) + { + RTSpixel = true; + } + } + if (!RTSpixel) { + fillAHistogramsinclass(histogramwoRTSthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } + } + // bin the more agressive RTS histogram class + if (histogramwoRTSAggresivethreshold != 0) { + RTSpixel = false; + for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTSAggresivethreshold->RTSpixel.size(); RTSpixeli++) { + if (pixelno == histogramwoRTSAggresivethreshold->RTSpixel[RTSpixeli]) + { + RTSpixel = true; + // cout << "not binned! RTS pixel #" << pixelno << endl; + } + } + if (!RTSpixel) { + fillAHistogramsinclass(histogramwoRTSAggresivethreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } } + } - if (!RTSpixel) { - fillAHistogramsinclass(histogramwoRTSAggresivethreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + // bin the RTS cleaned histogram class + if (histogramwoRTS != 0) { + RTSpixel = false; + for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTS->RTSpixel.size(); RTSpixeli++) { + if (pixelno == histogramwoRTS->RTSpixel[RTSpixeli]) + { + RTSpixel = true; + break; + } + + } + if (!RTSpixel) { + fillAHistogramsinclass(histogramwoRTS, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } + } + // bin the more agressive RTS histogram class + if (histogramwoRTSAggresive != 0) { + RTSpixel = false; + for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTSAggresive->RTSpixel.size(); RTSpixeli++) { + if (pixelno == histogramwoRTSAggresive->RTSpixel[RTSpixeli]) + { + RTSpixel = true; + // cout << "not binned! RTS pixel #" << processed->fFrameInfo.pixel[hiti] << " with charge: " << processed->fFrameInfo.p[12][hiti] << endl; + // cout << "not binned! RTS pixel #" << processed->fFrameInfo.pixel[hiti] << " with charge: " << processed->fFrameInfo.p[12][hiti] << endl; + } + } + if (!RTSpixel) { + fillAHistogramsinclass(histogramwoRTSAggresive, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } } - } - - } - // bin the RTS cleaned histogram class - if (histogramwoRTS != 0) { -// cout << "is " << processed->fFrameInfo.pixel[hiti] << " an RTS pixel? size of rts pixel matrix: " << histogramwoRTS->RTSpixel.size(); - RTSpixel = false; - for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTS->RTSpixel.size(); RTSpixeli++) { - if (processed->fFrameInfo.pixel[hiti] == histogramwoRTS->RTSpixel[RTSpixeli]) - { - // if (RTSpixeli == 0) - RTSpixel = true; - break; + } else if (filli == 1) { // second fill round, some histograms are allready filled + + // histogramfixedthreshold relies on "histogram", therefore 'histogram' has to be completly filled before a threshold can be Set + // bin the fixed threshold for charge histogram class + if (histogramfixedthreshold != 0 && histogram != 0) { + if (histogramfixedthreshold->fixedThresholdValue <= 0) { + float_t cutval = histogram->Sum->GetBinCenter(histogram->Sum->FindLastBinAbove(3,1)); + setFixedThresholdValueADU(cutval*0.8); + } + if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster + { + histogramfixedthreshold->numberofhits++; + fillAHistogramsinclass(histogramfixedthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } } - } -// if (RTSpixel) -// cout << " yes"; -// cout << endlr; - if (!RTSpixel) { - fillAHistogramsinclass(histogramwoRTS, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); - } - } - // bin the more agressive RTS histogram class - if (histogramwoRTSAggresive != 0) { - RTSpixel = false; - for (u_int RTSpixeli=0; RTSpixeli < histogramwoRTSAggresive->RTSpixel.size(); RTSpixeli++) { - if (processed->fFrameInfo.pixel[hiti] == histogramwoRTSAggresive->RTSpixel[RTSpixeli]) - { - RTSpixel = true; -// cout << "not binned! RTS pixel #" << processed->fFrameInfo.pixel[hiti] << " with charge: " << processed->fFrameInfo.p[12][hiti] << endl; - // cout << "not binned! RTS pixel #" << processed->fFrameInfo.pixel[hiti] << " with charge: " << processed->fFrameInfo.p[12][hiti] << endl; + if (histogramGoodVeto != 0 && histogram != 0) { + if (framei == 0) { // only one time job, do while in first frame only + histogram->FindNoisethresholdborder(histogram->Seed, false, false); + if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) { + parameters = histogram->FitPerform(histogram->Veto, "GaussTail"); + histogramGoodVeto->posVeto = parameters[1]; + gausscenter = parameters[1]; + gausssigma = parameters[2]; + cout << colorcyan << "gausscenter: " << gausscenter << endlr; + cout << colorcyan << "gausssigma: " << gausssigma << endlr; + } + if (TMath::Abs(notSeedSum) < cursystemparam.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) && abs(processed->fFrameInfo.p[12][hiti]-gausscenter) < abs(3.0*gausssigma)) { + histogramGoodVeto->pixelHadGoodVeto->Fill(pixelno); + }// if good veto + } + } + + } else if (filli == 2) { // third fill round, some histograms are allready filled + + if (histogramGoodVeto != 0 && histogram != 0) { + + if (framei == 0) { // only one time job, do while in first frame only + uint numberofgoodvetopixels = 0; + // calculate the percentage of veto "good" pixel on chip + for (Int_t pixeli=1; pixeli <= histogramGoodVeto->pixelHadGoodVeto->GetNbinsX(); pixeli++) { + if (histogramGoodVeto->pixelHadGoodVeto->GetBinContent(pixeli) > 0) { + numberofgoodvetopixels++; + } + } + Float_t percentageofGoodVetoPixel = 0; + cout << colorcyan << "numberofgoodvetopixels: " << numberofgoodvetopixels << endlr; + cout << colorcyan << "numberofactivepixel: " << numberofactivepixel << endlr; + percentageofGoodVetoPixel = (numberofgoodvetopixels*100.0)/numberofactivepixel; + cout << colorcyan << "percentageodGoodVetoPixel: " << percentageofGoodVetoPixel << endlr; + } + + if (histogramGoodVeto->pixelHadGoodVeto->GetBinContent(pixelno+1) > 1) { + histogramGoodVeto->numberofhits++; + fillAHistogramsinclass(histogramGoodVeto, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); + } } - } - if (!RTSpixel) { - fillAHistogramsinclass(histogramwoRTSAggresive, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); - } - } - } // end if in range for submatrix analysis - } // end loop over hits in frame - } - } // end loop over all frames - - // histogramfixedthreshold relies on "histogram", therefore histogram has to be completly filled before a threshold can be Set - for (Int_t framei=0; frameifHitTree->GetEntries(); framei++) // loop over all frames - { - processed->fHitTree->GetEntry(framei); - { - for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) - { - uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%cursensorinfo.columns; // column of seed - uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/cursensorinfo.columns; // row of seed - if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet - { - pixelSum = 0; - notSeedSum = 0; - // sum histogram - for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; - for (Int_t clusteri=completeclustersize-sqrt(completeclustersize); clusterifFrameInfo.p[clusteri][hiti] = -9999; - for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti] = -9999; - for (Int_t clusteri=4; clusterifFrameInfo.p[clusteri][hiti] = -9999; - } - Float_t clusterArray[completeclustersize];// temp variable clusterArray necessary, because Sort only accepts 1-dim arrays - for (Int_t clusteri=0; clusterifFrameInfo.p[clusteri][hiti]; - } - Int_t index[completeclustersize]; - TMath::Sort(completeclustersize,clusterArray,index,1); - for (Int_t clusteri=0; clusteri -9000) { - pixelSum += clusterArray[index[clusteri]]; - for (Int_t clusterj=clusteri; clusterjfFrameInfo.p[index[clusteri]][hiti]; - for (Int_t clusterj=clusteri; clusterjfixedThresholdValue <= 0) { - float_t cutval = histogram->Sum->GetBinCenter(histogram->Sum->FindLastBinAbove(3,1)); - setFixedThresholdValueADU(cutval*0.8); - } - if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster - { - histogramfixedthreshold->numberofhits++; - fillAHistogramsinclass(histogramfixedthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0]); - } - } - } - } - } - } - - - + } // if fill round == 2 (third round) + } // end if in range for submatrix analysis + }// end loop over hits in frame + } + } // end loop over all frames + } // end of loop of fill round counter + + // gROOT->SetBatch(kTRUE); for (vector::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++) { Double_t* parameters = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment @@ -1547,127 +1528,7 @@ Bool_t Run::binSeedSumVeto() for (Int_t bini=1; bini <= 100; bini++) { (*curHistogramClass)->SeedPerc->SetBinContent(bini,(*curHistogramClass)->SeedPerc->GetBinContent(bini));//((*curHistogramClass)->SeedPerc->GetEntries())); } - } - if (histogramGoodVeto != 0 && histogram != 0) { - Double_t* parameters = (Double_t *)calloc(8, sizeof(Double_t)); - Double_t gausssigma = 0; - Double_t gausscenter = 0; - if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) { - parameters = histogram->FitPerform(histogram->Veto, "GaussTail"); - histogramGoodVeto->posVeto = parameters[1]; - gausscenter = parameters[1]; - gausssigma = parameters[2]; - cout << colorcyan << "gausscenter: " << gausscenter << endlr; - cout << colorcyan << "gausssigma: " << gausssigma << endlr; - } - - for (Int_t framei=0; frameifHitTree->GetEntries(); framei++) // loop over all frames - { - processed->fHitTree->GetEntry(framei); - for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) - { - uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%cursensorinfo.columns; // column of seed - uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/cursensorinfo.columns; // row of seed - if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet - { - pixelSum = 0; - notSeedSum = 0; - if(labbook.chipGen=="FSBB") - { - 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]; - for (Int_t clusteri=0; clustericlustersize*processed->clustersize; clusteri++) - { - clusterArray[clusteri] = processed->fFrameInfo.p[clusteri][hiti]; - if (clusteri != 12) - notSeedSum += processed->fFrameInfo.p[clusteri][hiti]; - } - TMath::Sort(processed->clustersize*processed->clustersize,clusterArray,index,1); - for (Int_t clusteri=0; clusteri<4; clusteri++) - { - pixelSum += clusterArray[index[clusteri]]; - - } - } - else - { - for (Int_t clusteri=0; clustericlustersize*processed->clustersize; clusteri++) - { - pixelSum += processed->fFrameInfo.p[clusteri][hiti]; - if (clusteri != 12) - notSeedSum += processed->fFrameInfo.p[clusteri][hiti]; - } - } - if (TMath::Abs(notSeedSum) < cursystemparam.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) && abs(processed->fFrameInfo.p[12][hiti]-gausscenter) < abs(3.0*gausssigma)) { - histogramGoodVeto->pixelHadGoodVeto->Fill(processed->fFrameInfo.pixel[hiti]); - }// if good veto - } // if in submatrix range (if defined) - } // loop over hots - } // loop over frames - uint numberofgoodvetopixels = 0; - // calculate the percentage of veto "good" pixel on chip - for (Int_t pixeli=0; pixeli < histogramGoodVeto->pixelHadGoodVeto->GetNbinsX(); pixeli++) { - if (histogramGoodVeto->pixelHadGoodVeto->GetBinContent(pixeli) > 0) { - numberofgoodvetopixels++; - } - } - Float_t percentageofGoodVetoPixel = 0; - cout << colorcyan << "numberofgoodvetopixels: " << numberofgoodvetopixels << endlr; - cout << colorcyan << "numberofactivepixel: " << numberofactivepixel << endlr; - percentageofGoodVetoPixel = (numberofgoodvetopixels*100.0)/numberofactivepixel; - cout << colorcyan << "percentageodGoodVetoPixel: " << percentageofGoodVetoPixel << endlr; - - - for (Int_t framei=0; frameifHitTree->GetEntries(); framei++) // loop over all frames - { - processed->fHitTree->GetEntry(framei); - for(Int_t hiti=0; (unsigned int)hitifFrameInfo.hits;hiti++) - { - uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%cursensorinfo.columns; // column of seed - uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/cursensorinfo.columns; // row of seed - uint pixeli = processed->fFrameInfo.pixel[hiti]; - if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet - { - if (histogramGoodVeto->pixelHadGoodVeto->GetBinContent(pixeli) > 1) { - histogramGoodVeto->numberofhits++; - histogramGoodVeto->Seed->Fill(processed->fFrameInfo.p[12][hiti]); - pixelSum = 0; - notSeedSum = 0; - if(labbook.chipGen=="FSBB") - { - 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]; - for (Int_t clusteri=0; clustericlustersize*processed->clustersize; clusteri++) - { - clusterArray[clusteri] = processed->fFrameInfo.p[clusteri][hiti]; - if (clusteri != 12) - notSeedSum += processed->fFrameInfo.p[clusteri][hiti]; - } - TMath::Sort(processed->clustersize*processed->clustersize,clusterArray,index,1); - for (Int_t clusteri=0; clusteri<4; clusteri++) - { - pixelSum += clusterArray[index[clusteri]]; - - } - } - else - { - for (Int_t clusteri=0; clustericlustersize*processed->clustersize; clusteri++) - { - pixelSum += processed->fFrameInfo.p[clusteri][hiti]; - if (clusteri != 12) - notSeedSum += processed->fFrameInfo.p[clusteri][hiti]; - } - } - histogramGoodVeto->Sum->Fill(pixelSum); - histogramGoodVeto->SeedPerc->Fill(processed->fFrameInfo.p[12][hiti]/pixelSum*100); - if (TMath::Abs(notSeedSum) < cursystemparam.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd"))) - histogramGoodVeto->Veto->Fill(processed->fFrameInfo.p[12][hiti]); // histogram with the single pixel - } - } - } - } - } // clause for histogramGoodVeto + } if (histogramfixedthreshold != 0) { histogramfixedthreshold->noisethresholdborder=0;