17 std::pair<double, double>&
result,
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) {
61 sum2 +=
pow(anAmplitude, 2);
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);
88 0, largestAmplitude.second * 0.3, largestAmplitude.second * 1.8);
90 1, largestAmplitude.first - 12, largestAmplitude.first + 12);
94 histogram->Fit(&
fitFunction,
"QWEB",
"", largestAmplitude.first - 12, largestAmplitude.first + 12);
double fitFunction(double *x, double *par)
double GetValue(unsigned int theStripNumber) const
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
bool FindPeakIn(const LASModuleProfile &, std::pair< double, double > &, TH1D *, const double)
double amplitudeThreshold
void SetAmplitudeThreshold(double)