Performs histogram anaysis.
158 <<
" NULL pointer to base Analysis object!";
168 <<
" NULL pointer to derived Analysis object!";
189 TProfile* histoPeds = dynamic_cast<TProfile*>(
hPeds_.first);
190 TProfile* histoNoiseMean = dynamic_cast<TProfile*>(
hNoise_.first);
191 TH2S* histoNoise = dynamic_cast<TH2S*>(
hNoise2D_.first);
199 if (not histoNoiseMean) {
204 if (not histoNoise) {
210 if (histoPeds->GetNbinsX() != 256) {
216 if (histoNoiseMean->GetNbinsX() != 256) {
222 if (histoNoise->GetNbinsY() != 256) {
234 vector<float> ped_max;
235 vector<float> ped_min;
236 vector<float> raw_max;
237 vector<float> raw_min;
238 vector<float> noise_max;
239 vector<float> noise_min;
242 for (
int iStrip = 0; iStrip < histoPeds->GetNbinsX(); iStrip++) {
243 if (iStrip < histoPeds->GetNbinsX() / 2)
250 stripBin = iStrip - 128;
254 ana->
peds_[apvID][stripBin] = histoPeds->GetBinContent(iStrip + 1);
255 ana->
noise_[apvID][stripBin] = histoNoiseMean->GetBinContent(iStrip + 1);
256 ana->
raw_[apvID][stripBin] = histoPeds->GetBinError(iStrip + 1);
263 if (ped_max.size() < apvID + 1)
264 ped_max.push_back(ana->
peds_[apvID][stripBin]);
266 if (ana->
peds_[apvID][stripBin] > ped_max.at(apvID))
267 ped_max.at(apvID) = ana->
peds_[apvID][stripBin];
271 if (ped_min.size() < apvID + 1)
272 ped_min.push_back(ana->
peds_[apvID][stripBin]);
274 if (ana->
peds_[apvID][stripBin] < ped_min.at(apvID))
275 ped_min.at(apvID) = ana->
peds_[apvID][stripBin];
279 if (noise_max.size() < apvID + 1)
280 noise_max.push_back(ana->
noise_[apvID][stripBin]);
282 if (ana->
noise_[apvID][stripBin] > noise_max.at(apvID))
283 noise_max.at(apvID) = ana->
noise_[apvID][stripBin];
287 if (noise_min.size() < apvID + 1)
288 noise_min.push_back(ana->
noise_[apvID][stripBin]);
290 if (ana->
noise_[apvID][stripBin] < noise_min.at(apvID))
291 noise_min.at(apvID) = ana->
noise_[apvID][stripBin];
295 if (raw_max.size() < apvID + 1)
296 raw_max.push_back(ana->
raw_[apvID][stripBin]);
298 if (ana->
raw_[apvID][stripBin] > raw_max.at(apvID))
299 raw_max.at(apvID) = ana->
raw_[apvID][stripBin];
303 if (raw_min.size() < apvID + 1)
304 raw_min.push_back(ana->
raw_[apvID][stripBin]);
306 if (ana->
raw_[apvID][stripBin] < raw_min.at(apvID))
307 raw_min.at(apvID) = ana->
raw_[apvID][stripBin];
312 for (
unsigned int iApv = 0; iApv < ana->
pedsMean_.size(); iApv++) {
319 for (
unsigned int iApv = 0; iApv < ped_max.size(); iApv++) {
325 ana->
pedsMax_.at(iApv) = ped_max.at(iApv);
332 ana->
pedsMin_.at(iApv) = ped_min.at(iApv);
339 ana->
noiseMax_.at(iApv) = noise_max.at(iApv);
346 ana->
noiseMin_.at(iApv) = noise_min.at(iApv);
353 ana->
rawMax_.at(iApv) = raw_max.at(iApv);
360 ana->
rawMin_.at(iApv) = raw_min.at(iApv);
366 for (
int iStrip = 0; iStrip < histoNoiseMean->GetNbinsX(); iStrip++) {
367 if (iStrip < histoNoiseMean->GetNbinsX() / 2)
376 for (
unsigned int iApv = 0; iApv < ana->
pedsSpread_.size(); iApv++) {
384 TH1S* histoResidualStrip =
new TH1S(
"histoResidualStrip",
386 histoNoise->GetNbinsX(),
387 histoNoise->GetXaxis()->GetXmin(),
388 histoNoise->GetXaxis()->GetXmax());
389 histoResidualStrip->Sumw2();
390 histoResidualStrip->SetDirectory(
nullptr);
391 TF1* fitFunc =
new TF1(
"fitFunc",
"gaus(0)", histoNoise->GetXaxis()->GetXmin(), histoNoise->GetXaxis()->GetXmax());
392 TF1* fit2Gaus =
nullptr;
393 TH1F* randomHisto =
nullptr;
396 for (
int iStrip = 0; iStrip < histoNoise->GetNbinsY(); iStrip++) {
398 if (iStrip < histoNoise->GetNbinsY() / 2)
402 histoResidualStrip->Reset();
406 stripBin = iStrip - 128;
410 for (
int iBinX = 0; iBinX < histoNoise->GetNbinsX(); iBinX++) {
411 histoResidualStrip->SetBinContent(iBinX + 1, histoNoise->GetBinContent(iBinX + 1, iStrip + 1));
412 histoResidualStrip->SetBinError(iBinX + 1, histoNoise->GetBinError(iBinX + 1, iStrip + 1));
415 if (histoResidualStrip->Integral() == 0) {
436 <<
" " << fec_key.fecCrate() <<
" fecSlot " << fec_key.fecSlot() <<
" fecRing "
437 << fec_key.fecRing() <<
" ccuAddr " << fec_key.ccuAddr() <<
" ccChan "
438 << fec_key.ccuChan() <<
" lldChan " << fec_key.lldChan() <<
" apvID " << apvID
439 <<
" stripID " << iStrip;
445 ana->
residualMean_[apvID][stripBin] = histoResidualStrip->GetMean();
446 ana->
residualRMS_[apvID][stripBin] = histoResidualStrip->GetRMS();
453 (histoResidualStrip->Integral(histoResidualStrip->FindBin(ana->
residualMean_[apvID][stripBin] +
455 histoResidualStrip->GetNbinsX() + 1) +
456 histoResidualStrip->Integral(
458 histoResidualStrip->FindBin(ana->
residualMean_[apvID][stripBin] -
463 fitFunc->SetRange(histoNoise->GetXaxis()->GetXmin(), histoNoise->GetXaxis()->GetXmax());
467 result = histoResidualStrip->Fit(fitFunc,
"QSRN");
478 ana->
jbProbab_[apvID][stripBin] = ROOT::Math::chisquared_cdf_c(jbVal, 2);
481 if (randomHisto ==
nullptr)
482 randomHisto = (TH1F*)histoResidualStrip->Clone(
"randomHisto");
483 randomHisto->Reset();
484 randomHisto->SetDirectory(
nullptr);
487 randomHisto->FillRandom(
"fitFunc", histoResidualStrip->Integral());
488 if (randomHisto->Integral() != 0) {
489 ana->
ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,
"N");
490 ana->
adProbab_[apvID][stripBin] = histoResidualStrip->AndersonDarlingTest(randomHisto);
497 randomHisto->Add(fitFunc);
498 if (randomHisto->Integral() != 0) {
499 ana->
ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,
"N");
500 ROOT::Fit::BinData data1;
501 ROOT::Fit::BinData data2;
502 ROOT::Fit::FillData(data1, histoResidualStrip,
nullptr);
503 data2.Initialize(randomHisto->GetNbinsX() + 1, 1);
504 for (
int ibin = 0; ibin < randomHisto->GetNbinsX(); ibin++) {
505 if (histoResidualStrip->GetBinContent(ibin + 1) != 0
or randomHisto->GetBinContent(ibin + 1) >= 1)
506 data2.Add(randomHisto->GetBinCenter(ibin + 1),
507 randomHisto->GetBinContent(ibin + 1),
508 randomHisto->GetBinError(ibin + 1));
511 double probab,
value;
512 ROOT::Math::GoFTest::AndersonDarling2SamplesTest(data1, data2, probab,
value);
513 ana->
adProbab_[apvID][stripBin] = probab;
522 bool badStripFlag =
false;
574 fit2Gaus =
new TF1(
"dgaus",
575 "[0]*exp(-((x-[1])*(x-[1]))/(2*[2]*[2]))+[3]*exp(-((x-[4])*(x-[4]))/(2*[5]*[5]))",
576 histoNoise->GetXaxis()->GetXmin(),
577 histoNoise->GetXaxis()->GetXmax());
578 fit2Gaus->SetParameter(0, fitFunc->GetParameter(0) / 2);
579 fit2Gaus->SetParameter(3, fitFunc->GetParameter(0) / 2);
580 fit2Gaus->SetParameter(1, 1.);
581 fit2Gaus->SetParameter(4, -1.);
582 fit2Gaus->SetParameter(2, fitFunc->GetParameter(2));
583 fit2Gaus->SetParameter(5, fitFunc->GetParameter(2));
584 fit2Gaus->SetParLimits(1, 0., histoNoise->GetXaxis()->GetXmax());
585 fit2Gaus->SetParLimits(4, histoNoise->GetXaxis()->GetXmin(), 0);
586 result = histoResidualStrip->Fit(fit2Gaus,
"QSR");
589 float ashman = TMath::Power(2, 0.5) *
abs(fit2Gaus->GetParameter(1) - fit2Gaus->GetParameter(4)) /
590 (
sqrt(
pow(fit2Gaus->GetParameter(2), 2) +
pow(fit2Gaus->GetParameter(5), 2)));
592 float amplitudeRatio =
std::min(fit2Gaus->GetParameter(0), fit2Gaus->GetParameter(3)) /
593 std::max(fit2Gaus->GetParameter(0), fit2Gaus->GetParameter(3));
601 ana->
badStrip_[apvID].push_back(stripBin);
606 <<
" " << fec_key.fecCrate() <<
" fecSlot " << fec_key.fecSlot() <<
" fecRing "
607 << fec_key.fecRing() <<
" ccuAddr " << fec_key.ccuAddr() <<
" ccChan "
608 << fec_key.ccuChan() <<
" lldChan " << fec_key.lldChan() <<
" apvID " << apvID
609 <<
" stripID " << stripBin;
621 if (histoResidualStrip)
622 delete histoResidualStrip;