106 {
107
108
109 int lflag[44][288] = { { 0 } };
110 int pflag[44][288] = { { 0 } };
111 int ix, iy, iyp, iyn, cellMax;
112
113
114 int ipoison = 0;
115
116 int lastlay =
gm->nLayer();
117
118
119 int k = 0;
121 {
123 k++;
125 }
126
127
128 if ( ipoison )
129 {
130 for (
ix = 0;
ix < lastlay;
ix++ )
131 {
132 cellMax =
gm->Layer(
ix )->nWires();
133
134 for ( iy = 0; iy < cellMax; iy++ )
135 {
136 iyp = iy + 1;
137 if ( iyp == cellMax ) iyp = 0;
138 iyn = iy - 1;
139 if ( iyn == -1 ) iyn = cellMax - 1;
140 if ( ( lflag[
ix][iyp] != 0 ) && ( lflag[
ix][iyn] != 0 ) )
141 {
144
145 }
146 }
147
148 }
149 }
150
153 int lastsl =
gm->nSuper();
154
155
156 for (
sl = 0;
sl < lastsl;
sl++ )
157 {
159 int l0 = fsl, l1 = fsl + 1, l2 = fsl + 2, l3 = fsl + 3;
160 int iprt = 0;
161
162 const MdcLayer* layArray[4];
163 const MdcSuperLayer* slayer =
gm->SuperLayer(
sl );
165 for (
int i = 0; i < nslay; i++ ) layArray[i] = slayer->
layer( i );
167 {
168 cout <<
"slayer No. " << slayer->
index() << endl;
169 }
170
171 cellMax = layArray[1]->
nWires();
172
173
174 for ( int cellIndex = 0; cellIndex < cellMax; cellIndex++ )
175 {
177 unsigned int sig_mark = 0;
178 for ( int ilayer = l0; ilayer <= l3; ilayer++ )
179 {
180 for ( int iwire = 3; iwire >= 0; iwire-- )
181 {
182 if ( lflag[ilayer][
w[4 * ( ilayer - l0 ) + iwire]] ) { sig_mark |= 0x1; }
183 sig_mark <<= 1;
184 }
185 }
186 sig_mark >>= 1;
187
188 int goodSegNo = 0;
190 int iPat = ( sig_mark & 0x0200 ) ? 0 : 11;
191 for ( ; iPat < nPat; iPat++ )
192 {
194 if ( ( pat & sig_mark ) == pat )
195 {
197 {
198
199 cout << "pat " << pat << " with wire";
200 for ( int tmpi = 0; tmpi < 4; tmpi++ )
201 {
202 cout << "(" << l0 + tmpi << ","
203 <<
w[4 * tmpi +
m_segPat.wirePat4[iPat][tmpi] - 1] <<
")";
204 }
205 cout << endl;
206 }
207 int w0 = lflag[l0][
w[0 +
m_segPat.wirePat4[iPat][0] - 1]] - 1;
208 int w1 = lflag[l1][
w[4 +
m_segPat.wirePat4[iPat][1] - 1]] - 1;
209 int w2 = lflag[l2][
w[8 +
m_segPat.wirePat4[iPat][2] - 1]] - 1;
210 int w3 = lflag[l3][
w[12 +
m_segPat.wirePat4[iPat][3] - 1]] - 1;
211 int tw[4] = { w0, w1, w2, w3 };
212
213 int namb =
m_segPat.ambPat4_size[iPat];
214 for ( int iamb = 0; iamb < namb; iamb++ )
215 {
216 int amb =
m_segPat.ambigPatt4[iPat][iamb];
219 {
220 cout <<
"chisq " <<
fithel.Chisq() <<
" <? csmax4 " << csmax_4 << endl;
221 if (
fithel.Chisq() < csmax_4 ) { cout <<
"Accept this seg" << endl; }
222 else { cout << "DROP this seg" << endl; }
223 }
225 if (
fithel.Chisq() < csmax_4 )
226 {
229 goodSegNo++;
230 }
231 }
232 }
233 }
234 if ( goodSegNo != 0 ) continue;
236 iPat = ( sig_mark & 0x0200 ) ? 0 : 14;
237 for ( ; iPat < nPat; iPat++ )
238 {
239 if ( iPat > nPat - 3 )
240 {
241 if ( ( iPat == nPat - 2 ) && ( sig_mark & 0x2121 == 0x2121 ) ) continue;
242 if ( ( iPat == nPat - 1 ) && ( sig_mark & 0x2122 == 0x2122 ) ) continue;
243 }
245 if ( ( pat & sig_mark ) == pat )
246 {
248 {
249
250 cout << "MdcxFindSegs: in pat " << pat << " with wire";
251 for ( int tmpi = 0; tmpi < 4; tmpi++ )
252 {
253 if (
m_segPat.wirePat3[iPat][tmpi] == 0 )
continue;
254 cout << " (" << l0 + tmpi << ","
255 <<
w[4 * tmpi +
m_segPat.wirePat3[iPat][tmpi] - 1] <<
")";
256 }
257 cout << endl;
258 }
259 int wn[3];
260 for ( int iw = 0, iwp = 0; iwp < 4; iwp++ )
261 {
263 if (
wireNo == 0 )
continue;
264 wn[iw++] = lflag[l0 + iwp][
w[4 * iwp +
wireNo - 1]] - 1;
265 }
266
267 int namb =
m_segPat.ambPat3_size[iPat];
268 for ( int iamb = 0; iamb < namb; iamb++ )
269 {
270 int amb =
m_segPat.ambigPatt3[iPat][iamb];
273 {
274 cout <<
"chisq " <<
fithel.Chisq() <<
" <? csmax3 " << csmax_3 << endl;
275 if (
fithel.Chisq() < csmax_3 ) { cout <<
"Accept this seg" << endl; }
276 else { cout << "DROP this seg" << endl; }
277 }
279 if (
fithel.Chisq() < csmax_3 )
280 {
283 }
284 }
285 }
286 }
287 }
288 }
289
291 { cout <<
"MdcxFindSegs found " <<
MdcxSeglist.length() <<
" segs" << endl; }
292 return;
293}
AIDA::IHistogram1D * g_csmax3
AIDA::IHistogram1D * g_csmax4
void appendseg(MdcxFittedHel &fithel, int pat, int amb)
MdcxFittedHel trial(int i1, int i2, int i3, int i4, int amb)
void printseg(MdcxFittedHel &fithel, int pat, int amb, int subtry=0)