30 declareInterface<ICscClusterFitter>(
this);
48 return StatusCode::SUCCESS;
58 unsigned int nstrip = sfits.size();
65 if (sfits.size() != nstrip) {
72 if (sfits.empty() || !sfits[0].strip) {
85 ATH_MSG_ERROR(
"Null pointer to the MuonDetectorManager conditions object");
90 bool measphi =
m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0);
93 int strip0 =
m_idHelperSvc->cscIdHelper().strip(idStrip0) - 1;
96 int station =
m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49;
97 int phisec =
m_idHelperSvc->cscIdHelper().stationPhi(idStrip0);
99 int sector = zsec * (2 * phisec - station + 1);
104 bool edge = (strip0 == 0);
114 unsigned int istrip_peak = 0;
115 double lastqpeak = 0;
117 float q_second_last = 0.;
119 for (
unsigned int istrip = 0; istrip < nstrip; ++istrip) {
120 const StripFit& sfit = sfits[istrip];
121 const float qthis = sfit.
charge;
122 const float qnext = (istrip + 1 < nstrip) ? sfits[istrip + 1].
charge : 0.;
123 const float q_over_next = (istrip + 2 < nstrip) ? sfits[istrip + 2].
charge : 0.;
124 countstrip = istrip + 1;
126 stripidx = strip0 + istrip;
130 qxsum += qthis * stripidx;
132 if (countstrip == 2 && qthis < qlast) ++peak_count;
133 if (countstrip > 2 && qthis < qlast && qlast >= q_second_last) ++peak_count;
135 bool ispeak = qthis > qlast && qthis > qnext;
141 if (!ispeak && qthis == qnext) { ispeak = qthis > qlast && q_over_next < qthis; }
145 if (!ispeak && istrip == 1 && qthis == qlast) {
146 ispeak = qthis > qnext;
150 if (ispeak && qthis > lastqpeak) {
151 istrip_peak = istrip;
155 q_second_last = qlast;
158 if (stripidx == maxstrip - 1) edge =
true;
160 if (countstrip == 1) ++peak_count;
161 if (countstrip > 1 && sfits[nstrip - 1].
charge >= sfits[nstrip - 2].
charge) ++peak_count;
168 double savg = strip0 + istrip_peak;
169 res.position = pitch * (savg + 0.5 - 0.5 * maxstrip);
170 res.strip = istrip_peak;
172 res.dposition = errorScaler * pitch / sqrt(12.0);
176 res.lstrip = nstrip - 1;
177 res.time = sfits[istrip_peak].time;
178 res.timeStatus = sfits[istrip_peak].timeStatus;
179 res.qpeak = sfits[istrip_peak].charge;
182 res.charge_beforeBPCorr = sfits[
res.strip].charge_beforeBPCorr;
187 if (istrip_peak >= 1) {
188 res.qleft = sfits[istrip_peak - 1].charge;
190 res.charge_beforeBPCorr += sfits[istrip_peak - 1].charge_beforeBPCorr;
192 if (istrip_peak + 1 < nstrip) {
193 res.qright = sfits[istrip_peak + 1].charge;
195 res.charge_beforeBPCorr += sfits[istrip_peak + 1].charge_beforeBPCorr;
197 res.time_beforeT0Corr = sfits[
res.strip].time_beforeT0Corr;
198 res.time_beforeBPCorr = sfits[
res.strip].time_beforeBPCorr;
205 double strip_mean = xsum / nstrip;
206 double strip_qmean = qxsum / qsum;
207 qerravg = qerravg / nstrip;
214 else if (peak_count > 1)
221 savg = strip0 + istrip_peak;
222 }
else if (
m_option ==
"CENTROID") {
232 if (measphi) savg = strip_mean;
237 res.strip = istrip_peak;
240 res.position = pitch * (savg + 0.5 - 0.5 * maxstrip);
248 double wmeas = pitch * nstrip;
250 double weffmin = 0.5 * wmeas;
251 if (weff < weffmin) weff = weffmin;
253 res.dposition = errorScaler * weff / sqrt(12.0);
272 <<
" nstr=" << nstrip <<
"[sector:wlay:measphi]= " << sector <<
":" << wlay <<
":" << measphi <<
" strip0=" << strip0
273 <<
" istrip_peak=" << istrip_peak <<
" peaktime=" << sfits[istrip_peak].
time
274 <<
" peakstatus=" << sfits[istrip_peak].
status <<
" peaktimeStatus=" << sfits[istrip_peak].timeStatus
275 <<
" pos=" <<
res.position <<
" dpos=" <<
res.dposition <<
" chg=" << qsum);
279 res.lstrip = nstrip - 1;
280 res.time = sfits[istrip_peak].time;
281 res.timeStatus = sfits[istrip_peak].timeStatus;
282 res.qpeak = sfits[istrip_peak].charge;
285 res.charge_beforeBPCorr = sfits[
res.strip].charge_beforeBPCorr;
290 if (istrip_peak >= 1) {
291 res.qleft = sfits[istrip_peak - 1].charge;
293 res.charge_beforeBPCorr += sfits[istrip_peak - 1].charge_beforeBPCorr;
295 if (istrip_peak + 1 < nstrip) {
296 res.qright = sfits[istrip_peak + 1].charge;
298 res.charge_beforeBPCorr += sfits[istrip_peak + 1].charge_beforeBPCorr;
300 res.time_beforeT0Corr = sfits[
res.strip].time_beforeT0Corr;
301 res.time_beforeBPCorr = sfits[
res.strip].time_beforeBPCorr;