15 ", useParabolaFit=" << useParabolaFit <<
", useFivePoleFit=" <<
useFivePoleFit;
37 for (
size_t i=0;
i<4; ++
i){
39 sumt += adc[
i] *
float( tmax - 1 +
i );
42 return sumt/sum * 50.;
59 if ( (y1+y3) < 2.
f*y2 ) tcorr = 0.5f * ( y1 - y3 ) / ( y1 - 2.*y2 + y3 );
62 LogTrace(
"CSCFindPeakTime") <<
"[CSCFindPeakTime] tmax=" << tmax
63 <<
", parabolic peak time is tmax+" << tcorr <<
" bins, or " << tpeak*50.f <<
" ns";
90 if ( tmax < 2 || tmax > 6 )
return t_peak;
102 if ( tmax == 6 ) n_fit = 3;
104 float chi_min = 1.e10f;
105 float chi_last = 1.e10f;
115 while ( del_t > 1.
f ) {
119 for (
int j=0; j < n_fit; ++j ) {
120 float tdif = tb[j] - tt0;
121 x[j] = (tdif * tdif) * (tdif * tdif) *
std::exp( -p0 * tdif );
123 sxy += x[j] * adc[j];
129 for (
int j=0; j < n_fit; ++j) chi2 += (adc[j] - fN * x[j]) * (adc[j] - fN * x[j]);
132 if ( chi_last > chi2 ) {
133 if (chi2 < chi_min ){
139 tt0 = tt0 - 2.f * del_t;
155 float p0 = 4.f/t_peak;
158 if ( tmax == 6 ) n_fit=3;
161 for (
int t = 0;
t < 4; ++
t ){
162 tb[
t] =
float(tmax +
t - 1) * 50.f;
170 for (
int j=0; j < n_fit; ++j ) {
172 x[j] = ((t-tt0)*(t-tt0))*((t-tt0)*(t-tt0)) *
std::exp( -p0 * (t-tt0) );
173 sx2 = sx2 + x[j] * x[j];
174 sxy = sxy + x[j] * y[j];
180 for (
int i = 0;
i < 3; ++
i ) {
181 float t = t_peak +
float(
i - 1) * 50.f;
182 float q_fitted =
float(N) * ((t-tt0)*(t-tt0))*((t-tt0)*(t-tt0)) *
std::exp( -p0 * (t-tt0) );
183 adcsFit.push_back(q_fitted);
int adc(sample_type sample)
get the ADC sample (12 bits)
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.