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";
83 float fpNorm = adc[1];
91 if ( tmax < 2 || tmax > 6 )
return t_peak;
103 if ( tmax == 6 ) n_fit = 3;
105 float chi_min = 1.e10;
106 float chi_last = 1.e10;
116 while ( del_t > 1. ) {
120 for (
int j=0;
j < n_fit; ++
j ) {
121 float tdif = tb[
j] - tt0;
122 x[
j] = tdif * tdif * tdif * tdif *
exp( -p0 * tdif );
124 sxy += x[
j] * adc[
j];
130 for (
int j=0;
j < n_fit; ++
j) chi2 += (adc[
j] - fN * x[
j]) * (adc[
j] - fN * x[
j]);
133 if ( chi_last > chi2 ) {
134 if (chi2 < chi_min ){
141 tt0 = tt0 - 2. * del_t;
157 float p0 = 4./t_peak;
160 if ( tmax == 6 ) n_fit=3;
163 for (
int t = 0;
t < 4; ++
t ){
164 tb[
t] = (tmax +
t - 1) * 50.;
172 for (
int j=0;
j < n_fit; ++
j ) {
174 x[
j] = (t-tt0)*(t-tt0)*(t-tt0)*(t-tt0) *
exp( -p0 * (t-tt0) );
175 sx2 = sx2 + x[
j] * x[
j];
176 sxy = sxy + x[
j] * y[
j];
182 for (
int i = 0;
i < 3; ++
i ) {
183 float t = t_peak + (
i - 1) * 50.;
184 float q_fitted = N * (t-tt0)*(t-tt0)*(t-tt0)*(t-tt0) *
exp( -p0 * (t-tt0) );
185 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)
Exp< T >::type exp(const T &t)
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.