33 for (
size_t i = 0;
i < 4; ++
i) {
37 return sumt / sum * 50.;
54 if ((
y1 + y3) < 2.
f *
y2)
55 tcorr = 0.5f * (
y1 - y3) / (
y1 - 2. *
y2 + y3);
58 LogTrace(
"CSCFindPeakTime") <<
"[CSCFindPeakTime] tmax=" <<
tmax <<
", parabolic peak time is tmax+" << tcorr
59 <<
" bins, or " << tpeak * 50.f <<
" ns";
79 constexpr
float t0peak = 133.f;
80 constexpr
float p0 = 4.f / t0peak;
85 if (tmax < 2 || tmax > 6)
101 float chi_min = 1.e10f;
102 float chi_last = 1.e10f;
112 while (del_t > 1.
f) {
116 for (
int j = 0;
j < n_fit; ++
j) {
117 float tdif = tb[
j] - tt0;
118 x[
j] = (tdif * tdif) * (tdif * tdif) *
std::exp(-p0 * tdif);
126 for (
int j = 0;
j < n_fit; ++
j)
130 if (chi_last >
chi2) {
131 if (
chi2 < chi_min) {
137 tt0 = tt0 - 2.f * del_t;
148 int tmax,
const float*
adc,
const float& t_zero,
const float& t_peak, std::vector<float>& adcsFit) {
151 float p0 = 4.f / t_peak;
158 for (
int t = 0;
t < 4; ++
t) {
167 for (
int j = 0;
j < n_fit; ++
j) {
169 x[
j] = ((
t - tt0) * (
t - tt0)) * ((
t - tt0) * (
t - tt0)) *
std::exp(-p0 * (
t - tt0));
170 sx2 = sx2 +
x[
j] *
x[
j];
171 sxy = sxy +
x[
j] *
y[
j];
176 for (
int i = 0;
i < 3; ++
i) {
177 float t = t_peak +
float(
i - 1) * 50.f;
178 float q_fitted =
float(
N) * ((
t - tt0) * (
t - tt0)) * ((
t - tt0) * (
t - tt0)) *
std::exp(-p0 * (
t - tt0));
179 adcsFit.push_back(q_fitted);
float parabolaFitTime(int tmax, const float *adc)
Parabolic fit to three time bins centered on maximum.
T getParameter(std::string const &) const
float fivePoleFitTime(int tmax, const float *adc, float t_peak)
void fivePoleFitCharge(int tmax, const float *adc, const float &t_zero, const float &t_peak, std::vector< float > &adcsFit)
static const double tmax[3]
CSCFindPeakTime(const edm::ParameterSet &ps)
float averageTime(int tmax, const float *adc)
Weighted average of time bins.
float peakTime(int tmax, const float *adc, float t_peak)
Basic result of this class.
uint16_t *__restrict__ uint16_t const *__restrict__ adc