65 {
67
68 unsigned int nstrip = sfits.size();
69
71 Identifier idStrip0 = pstrip->
identify();
72 bool measphi =
m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0);
73
74
75 ATH_MSG_DEBUG(
"CscStrip fittter input has " << nstrip <<
" strips");
76
77 for (unsigned int istrip = 0; istrip < nstrip; ++istrip) {
78 Identifier id = sfits[istrip].strip->identify();
80 }
81
82
83 std::vector<float> istrip_peaks;
84 std::vector<float> istrip_vals;
85
86
87 for (unsigned int istrip = 1; istrip < nstrip - 1; ++istrip) {
89 float qthis = sfit.charge;
90 float qlast = sfits[istrip - 1].charge;
91 float qnext = sfits[istrip + 1].charge;
92
93 if (istrip == 1 && qlast > qthis) istrip_peaks.push_back(0);
94
95 if (istrip + 2 == nstrip && qthis < qnext) istrip_peaks.push_back(nstrip - 1);
96
97 bool ispeak = qthis > qlast && qthis > qnext;
98 bool isval = qthis < qlast && qthis < qnext;
99
100
101 if (ispeak) istrip_peaks.push_back(istrip);
102 if (isval) istrip_vals.push_back(istrip);
103 if (ispeak || isval) continue;
104
105
106 if (istrip == 1 && qlast == qthis) {
107 float nstripsameCharge = 2.;
108 unsigned int theStrip = 0;
109 for (unsigned int mstrip = istrip + 1; mstrip < nstrip - 1; ++mstrip) {
110 theStrip = mstrip;
111 if (qthis == sfits[mstrip].
charge)
112 nstripsameCharge += 1.;
113 else
114 break;
115 }
116 ispeak = (qthis > sfits[theStrip].charge);
117 isval = (qthis < sfits[theStrip].charge);
118 float offset = 0.5 * (nstripsameCharge - 1);
119 if (ispeak) istrip_peaks.push_back(offset);
120
121
122 istrip +=
int(nstripsameCharge) - 2;
123 continue;
124 }
125
126
127
128
129 if (qthis == qnext) {
130 float nstripsameCharge = 2.;
131 unsigned int theStrip = 0;
132 bool sameCharge = 1;
133 for (unsigned int mstrip = istrip + 2; mstrip < nstrip - 1; ++mstrip) {
134 theStrip = mstrip;
135 if (qthis == sfits[mstrip].
charge)
136 nstripsameCharge += 1.;
137 else {
138 sameCharge = 0;
139 break;
140 }
141 }
142 if (sameCharge) {
143 ispeak = (qthis > qlast);
144 isval = (qthis < qlast);
145 } else {
146 ispeak = (qthis > qlast) && (qthis > sfits[theStrip].
charge);
147 isval = (qthis < qlast) && (qthis < sfits[theStrip].
charge);
148 }
149 float offset = 0.5 * (nstripsameCharge - 1);
150 if (ispeak) istrip_peaks.push_back(istrip + offset);
151 if (isval) istrip_vals.push_back(istrip + offset);
152 istrip +=
int(nstripsameCharge) - 1;
153 continue;
154 }
155 }
156
158
159
160
161
162
163
164 std::vector<unsigned int> splitOnValley;
165 for (
unsigned int ival = 0;
ival < istrip_vals.size() && ival + 1 < istrip_peaks.size(); ++ival) {
166
167 float istrip_peak0 = istrip_peaks[
ival];
168 float istrip_peak1 = istrip_peaks[
ival + 1];
169 float istrip_val = istrip_vals[
ival];
170
171 float dist_ptov = istrip_val - istrip_peak0;
172 float dist_vtop = istrip_peak1 - istrip_val;
173
174 ATH_MSG_DEBUG(
" [ " << istrip_peak0 <<
", " << istrip_val <<
", " << istrip_peak1 <<
"] "
175 << "dist p2v:v2p " << dist_ptov << " : " << dist_vtop);
176
177 if (dist_ptov < 0 || dist_vtop < 0) {
178 ATH_MSG_WARNING(
" Peak-to-Val dist is " << dist_ptov <<
" Val-to-Peak dist is " << dist_vtop
179 << " Shouldnot be negative value :" << istrip_peak0 << " " << istrip_val << " "
180 << istrip_peak1);
181 }
182
183 float qlpeak = sfits[
int(istrip_peak0)].charge;
184 float qval = sfits[
int(istrip_val)].charge;
185 float qrpeak = sfits[
int(istrip_peak1)].charge;
186
187 ATH_MSG_DEBUG(
"qlpk:qval:qrpk " << qlpeak <<
" " << qval <<
" " << qrpeak <<
" " << qval / qlpeak <<
" " << qval / qrpeak
189
191 splitOnValley.push_back(0);
192 else
193 splitOnValley.push_back(1);
194 }
195
196 unsigned int cnt = 0;
197 for (unsigned int ii = 0; ii < splitOnValley.size(); ii++)
198 if (splitOnValley[ii] == 1)
cnt++;
199
200 if (cnt == 0) {
202 ICscClusterFitter::Result
res;
207 }
209
210
211 unsigned int nvals = splitOnValley.size();
212 if (istrip_vals[nvals - 1] != nstrip - 1) {
213 istrip_vals.push_back(nstrip - 1);
214 splitOnValley.push_back(1);
215 nvals = splitOnValley.size();
216 }
217
218
219
220
221
223 unsigned int firstStripID = 0;
224 unsigned int thisfirstStripID = 0;
225 for (unsigned int isplit = 0; isplit < nvals; ++isplit) {
226 if (splitOnValley[isplit]) {
227 sfits_split.clear();
228
229 for (unsigned int ist = firstStripID; ist <= istrip_vals[isplit]; ++ist) {
230 ATH_MSG_DEBUG(ist <<
" " << firstStripID <<
" " << istrip_vals <<
" lsplit " << splitOnValley);
231
232 sfits_split.push_back(sfits[ist]);
233 }
234
235
236
237
238 thisfirstStripID = firstStripID;
239 firstStripID =
int(istrip_vals[isplit]);
240
242 std::vector<ICscClusterFitter::Result> local_results;
243 ICscClusterFitter::Result
res;
244
247
249 res = local_results[0];
251 if (fitresult) {
253 } else {
255 }
256 }
257
260
261 if (fitresult) {
264 res = local_results[0];
266 if (fitresult) {
268 } else {
270 }
271
273 }
274
275 if (prec_fitresult) {
276 res.fitStatus = 20 + prec_fitresult;
277
296
297 } else {
300 }
301
302
303
304 res.strip =
res.strip + thisfirstStripID;
305 res.fstrip =
res.fstrip + thisfirstStripID;
306 res.lstrip =
res.lstrip + thisfirstStripID;
307
308 ATH_MSG_DEBUG(
" res.fitStatus " <<
res.fitStatus <<
" fitresult " << fitresult);
309
311 }
312 }
313
315}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double charge(const T &p)
std::pair< std::vector< unsigned int >, bool > res
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< ICscClusterFitter > m_pfitter_prec
ToolHandle< ICscClusterFitter > m_pfitter_def
ICscStripFitter::Result StripFit
std::vector< Result > Results
std::vector< StripFit > StripFitList
Identifier identify() const
return the identifier
CscClusterStatus
Enum to represent the cluster status - see the specific enum values for more details.
@ CscStatusSimple
Cluster with non-precision fit.
@ CscStatusStripFitFailed
@ CscStatusSplitQratInconsistent
Positions from Qrat_left and Qrat_right is not consistent after split cluster.
@ CscStatusUndefined
Undefined, should not happen, most likely indicates a problem.
@ CscStatusSplitStripFitFailed
@ CscStatusSkewed
Skewed, e.g.
@ CscStatusSplitUnspoiled
Clean cluster with precision fit after split cluster.
@ CscStatusEdge
Cluster reaches the edge of plane.
@ CscStatusSplitWide
Too wide.
@ CscStatusSplitEdge
Cluster reaches the edge of plane after split cluster.
@ CscStatusSplitSaturated
@ CscStatusSplitSimple
Cluster with non-precision fit after split cluster.
@ CscStatusMultiPeak
More than one peak in cluster.
@ CscStatusSplitSkewed
Skewed, e.g.
@ CscStatusSplitNarrow
Too narrow after split cluster.
@ CscStatusSplitMultiPeak
More than one peak in cluster after split cluster.
@ CscStatusQratInconsistent
Positions from Qrat_left and Qrat_right is not consistent.
@ CscStatusNarrow
Too narrow.