15 ", useParabolaFit=" << useParabolaFit <<
", useFivePoleFit=" <<
useFivePoleFit;
37 for (
size_t i=0;
i<4; ++
i){
39 sumt += adc[
i] * ( tmax - 1 +
i );
42 return sumt/sum * 50.;
59 if ( (y1+y3) < 2.*y2 ) tcorr = 0.5 * ( y1 - y3 ) / ( y1 - 2.*y2 + y3 );
62 LogTrace(
"CSCRecHit|CSCFindPeakTime") <<
"CSCFindPeakTime: tmax=" << tmax
63 <<
", parabolic peak time is tmax+" << tcorr <<
" bins, or " << tpeak*50. <<
" ns";
90 if ( tmax < 2 || tmax > 6 )
return t_peak;
102 if ( tmax == 6 ) n_fit = 3;
104 float chi_min = 1.e10;
105 float chi_last = 1.e10;
115 while ( del_t > 1. ) {
119 for (
int j=0;
j < n_fit; ++
j ) {
120 float tdif = tb[
j] - tt0;
121 x[
j] = tdif * tdif * tdif * tdif *
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. * del_t;
155 float p0 = 4./t_peak;
158 if ( tmax == 6 ) n_fit=3;
161 for (
int t = 0;
t < 4; ++
t ){
162 tb[
t] = (tmax +
t - 1) * 50.;
170 for (
int j=0;
j < n_fit; ++
j ) {
172 x[
j] = (t-tt0)*(t-tt0)*(t-tt0)*(t-tt0) *
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 + (
i - 1) * 50.;
182 float q_fitted = N * (t-tt0)*(t-tt0)*(t-tt0)*(t-tt0) *
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.