17 std::pair<double, double>&
result,
22 TF1 fitFunction(
"fitFunction",
"gaus");
23 fitFunction.SetLineColor(2);
24 fitFunction.SetLineWidth(2);
26 std::pair<int, double> largestAmplitude(0, 0.);
27 double anAmplitude = 0.;
30 const int approxOffset = static_cast<int>(
offset);
33 const unsigned int meanPosition = 256 + approxOffset;
36 const unsigned int halfWindowSize = 33;
42 for (
unsigned int strip = meanPosition - halfWindowSize;
strip < meanPosition + halfWindowSize; ++
strip) {
45 histogram->SetBinContent(1 +
strip, anAmplitude);
46 if (anAmplitude > largestAmplitude.second) {
47 largestAmplitude.first =
strip;
48 largestAmplitude.second = anAmplitude;
54 double sum1 = 0.,
sum2 = 0.;
57 if (strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize) {
70 if (fabs(sum0) < 1.
e-3) {
71 std::cerr <<
" [LASPeakFinder::FindPeakIn] ** WARNING: Empty profile (sum=" << sum0 <<
")." << std::endl;
77 std::cerr <<
" [LASPeakFinder::FindPeakIn] ** WARNING: No reasonably large peak." << std::endl;
82 fitFunction.SetParameter(0, largestAmplitude.second);
83 fitFunction.SetParameter(1, largestAmplitude.first);
84 fitFunction.SetParameter(2, 3.);
87 fitFunction.SetParLimits(
88 0, largestAmplitude.second * 0.3, largestAmplitude.second * 1.8);
89 fitFunction.SetParLimits(
90 1, largestAmplitude.first - 12, largestAmplitude.first + 12);
91 fitFunction.SetParLimits(2, 0.5, 8.);
94 histogram->Fit(&fitFunction,
"QWEB",
"", largestAmplitude.first - 12, largestAmplitude.first + 12);
97 result.first = fitFunction.GetParameter(1);
98 result.second = fitFunction.GetParError(1);