233 |
c$$$ enddo |
c$$$ enddo |
234 |
c$$$ if(ibest.eq.0)goto 880 !>> no good candidates |
c$$$ if(ibest.eq.0)goto 880 !>> no good candidates |
235 |
|
|
236 |
rchi2best=1000000000. |
* ------------------------------------------------------- |
237 |
|
* order track-candidates according to: |
238 |
|
* 1st) decreasing n.points |
239 |
|
* 2nd) increasing chi**2 |
240 |
|
* ------------------------------------------------------- |
241 |
|
rchi2best=1000000000. |
242 |
ndofbest=0 !(1) |
ndofbest=0 !(1) |
243 |
do i=1,ntracks |
do i=1,ntracks |
244 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
ndof=0 !(1) |
245 |
$ RCHI2_STORE(i).gt.0)then |
do ii=1,nplanes !(1) |
246 |
ndof=0 !(1) |
ndof=ndof !(1) |
247 |
do ii=1,nplanes !(1) |
$ +int(xgood_store(ii,i)) !(1) |
248 |
ndof=ndof !(1) |
$ +int(ygood_store(ii,i)) !(1) |
249 |
$ +int(xgood_store(ii,i)) !(1) |
enddo !(1) |
250 |
$ +int(ygood_store(ii,i)) !(1) |
if(ndof.gt.ndofbest)then !(1) |
251 |
enddo !(1) |
ibest=i |
252 |
if(ndof.ge.ndofbest)then !(1) |
rchi2best=RCHI2_STORE(i) |
253 |
|
ndofbest=ndof !(1) |
254 |
|
elseif(ndof.eq.ndofbest)then !(1) |
255 |
|
if(RCHI2_STORE(i).lt.rchi2best.and. |
256 |
|
$ RCHI2_STORE(i).gt.0)then |
257 |
ibest=i |
ibest=i |
258 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
259 |
ndofbest=ndof !(1) |
ndofbest=ndof !(1) |
260 |
endif !(1) |
endif !(1) |
261 |
endif |
endif |
262 |
enddo |
enddo |
263 |
|
|
264 |
|
c$$$ rchi2best=1000000000. |
265 |
|
c$$$ ndofbest=0 !(1) |
266 |
|
c$$$ do i=1,ntracks |
267 |
|
c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. |
268 |
|
c$$$ $ RCHI2_STORE(i).gt.0)then |
269 |
|
c$$$ ndof=0 !(1) |
270 |
|
c$$$ do ii=1,nplanes !(1) |
271 |
|
c$$$ ndof=ndof !(1) |
272 |
|
c$$$ $ +int(xgood_store(ii,i)) !(1) |
273 |
|
c$$$ $ +int(ygood_store(ii,i)) !(1) |
274 |
|
c$$$ enddo !(1) |
275 |
|
c$$$ if(ndof.ge.ndofbest)then !(1) |
276 |
|
c$$$ ibest=i |
277 |
|
c$$$ rchi2best=RCHI2_STORE(i) |
278 |
|
c$$$ ndofbest=ndof !(1) |
279 |
|
c$$$ endif !(1) |
280 |
|
c$$$ endif |
281 |
|
c$$$ enddo |
282 |
|
|
283 |
if(ibest.eq.0)goto 880 !>> no good candidates |
if(ibest.eq.0)goto 880 !>> no good candidates |
284 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
285 |
* The best track candidate (ibest) is selected and a new fitting is performed. |
* The best track candidate (ibest) is selected and a new fitting is performed. |
1496 |
goto 20 !charge not consistent |
goto 20 !charge not consistent |
1497 |
endif |
endif |
1498 |
endif |
endif |
|
|
|
|
* ------------------> COUPLE <------------------ |
|
|
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
|
|
clx(nplx,ncp_plane(nplx))=icx |
|
|
cly(nply,ncp_plane(nplx))=icy |
|
|
cl_single(icx)=0 |
|
|
cl_single(icy)=0 |
|
1499 |
|
|
1500 |
if(ncp_plane(nplx).eq.ncouplemax)then |
if(ncp_plane(nplx).gt.ncouplemax)then |
1501 |
if(verbose)print*, |
if(verbose)print*, |
1502 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
1503 |
$ 'couples on plane ',nplx, |
$ 'couples on plane ',nplx, |
1505 |
$ ,'( ',ncouplemax,' ) --> masked!' |
$ ,'( ',ncouplemax,' ) --> masked!' |
1506 |
mask_view(nviewx(nplx)) = 2 |
mask_view(nviewx(nplx)) = 2 |
1507 |
mask_view(nviewy(nply)) = 2 |
mask_view(nviewy(nply)) = 2 |
1508 |
|
goto 10 |
1509 |
endif |
endif |
1510 |
|
|
1511 |
|
* ------------------> COUPLE <------------------ |
1512 |
|
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
1513 |
|
clx(nplx,ncp_plane(nplx))=icx |
1514 |
|
cly(nply,ncp_plane(nplx))=icy |
1515 |
|
cl_single(icx)=0 |
1516 |
|
cl_single(icy)=0 |
1517 |
* ---------------------------------------------- |
* ---------------------------------------------- |
1518 |
|
|
1519 |
endif |
endif |
2353 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
2354 |
enddo |
enddo |
2355 |
|
|
2356 |
if(nplused.lt.nplxz_min)goto 888 !next doublet |
c if(nplused.lt.nplxz_min)goto 888 !next doublet |
2357 |
|
if(nplused.lt.nplyz_min)goto 888 !next doublet |
2358 |
if(ncp_ok.lt.ncpok)goto 888 !next cloud |
if(ncp_ok.lt.ncpok)goto 888 !next cloud |
2359 |
|
|
2360 |
if(DEBUG)then |
if(DEBUG)then |