| 215 |
c include 'momanhough_init.f' |
c include 'momanhough_init.f' |
| 216 |
|
|
| 217 |
logical FIMAGE ! |
logical FIMAGE ! |
| 218 |
|
real trackimage(NTRACKSMAX) |
| 219 |
real*8 AL_GUESS(5) |
real*8 AL_GUESS(5) |
| 220 |
|
|
| 221 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
| 332 |
iimage=0 |
iimage=0 |
| 333 |
endif |
endif |
| 334 |
if(icand.eq.0)then |
if(icand.eq.0)then |
| 335 |
if(VERBOSE)then |
if(VERBOSE.EQ.1)then |
| 336 |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
| 337 |
$ ,ibest,iimage |
$ ,ibest,iimage |
| 338 |
endif |
endif |
| 361 |
jstep=0 !# minimization steps |
jstep=0 !# minimization steps |
| 362 |
|
|
| 363 |
iprint=0 |
iprint=0 |
| 364 |
c if(DEBUG)iprint=1 |
c if(DEBUG.EQ.1)iprint=1 |
| 365 |
if(VERBOSE)iprint=1 |
if(VERBOSE.EQ.1)iprint=1 |
| 366 |
if(DEBUG)iprint=2 |
if(DEBUG.EQ.1)iprint=2 |
| 367 |
call mini2(jstep,ifail,iprint) |
call mini2(jstep,ifail,iprint) |
| 368 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
| 369 |
if(VERBOSE)then |
if(VERBOSE.EQ.1)then |
| 370 |
print *, |
print *, |
| 371 |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
| 372 |
$ ,iev |
$ ,iev |
| 381 |
c chi2=-chi2 |
c chi2=-chi2 |
| 382 |
endif |
endif |
| 383 |
|
|
| 384 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 385 |
print*,'----------------------------- improved track coord' |
print*,'----------------------------- improved track coord' |
| 386 |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
| 387 |
do ip=1,6 |
do ip=1,6 |
| 392 |
endif |
endif |
| 393 |
|
|
| 394 |
c rchi2=chi2/dble(ndof) |
c rchi2=chi2/dble(ndof) |
| 395 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 396 |
print*,' ' |
print*,' ' |
| 397 |
print*,'****** SELECTED TRACK *************' |
print*,'****** SELECTED TRACK *************' |
| 398 |
print*,'# R. chi2 RIG' |
print*,'# R. chi2 RIG' |
| 408 |
* ------------- search if the track has an IMAGE ------------- |
* ------------- search if the track has an IMAGE ------------- |
| 409 |
* ------------- (also this is stored ) ------------- |
* ------------- (also this is stored ) ------------- |
| 410 |
if(FIMAGE)goto 122 !>>> jump! (this is already an image) |
if(FIMAGE)goto 122 !>>> jump! (this is already an image) |
| 411 |
* now search for track-image, by comparing couples IDs |
|
| 412 |
|
* ----------------------------------------------------- |
| 413 |
|
* first check if the track is ambiguous |
| 414 |
|
* ----------------------------------------------------- |
| 415 |
|
* (modified on august 2007 by ElenaV) |
| 416 |
|
is1=0 |
| 417 |
|
do ip=1,NPLANES |
| 418 |
|
if(SENSOR_STORE(ip,icand).ne.0)then |
| 419 |
|
is1=SENSOR_STORE(ip,icand) |
| 420 |
|
if(ip.eq.6)is1=3-is1 !last plane inverted |
| 421 |
|
endif |
| 422 |
|
enddo |
| 423 |
|
if(is1.eq.0)then |
| 424 |
|
if(WARNING.EQ.1)print*,'** WARNING ** sensor=0' |
| 425 |
|
goto 122 !jump |
| 426 |
|
endif |
| 427 |
|
c print*,'is1 ',is1 |
| 428 |
|
do ip=1,NPLANES |
| 429 |
|
is2 = SENSOR_STORE(ip,icand) !sensor |
| 430 |
|
c print*,'is2 ',is2,' ip ',ip |
| 431 |
|
if(ip.eq.6.and.is2.ne.0)is2=3-is2 !last plane inverted |
| 432 |
|
if( |
| 433 |
|
$ (is1.ne.is2.and.is2.ne.0) |
| 434 |
|
$ )goto 122 !jump (this track cannot have an image) |
| 435 |
|
enddo |
| 436 |
|
if(DEBUG.eq.1)print*,' >>> ambiguous track! ' |
| 437 |
|
* now search for track-image among track candidates |
| 438 |
|
c$$$ do i=1,ntracks |
| 439 |
|
c$$$ iimage=i |
| 440 |
|
c$$$ do ip=1,nplanes |
| 441 |
|
c$$$ if( CP_STORE(nplanes-ip+1,icand).ne. |
| 442 |
|
c$$$ $ -1*CP_STORE(nplanes-ip+1,i).and. |
| 443 |
|
c$$$ $ CP_STORE(nplanes-ip+1,i).ne.0.and. |
| 444 |
|
c$$$ $ CP_STORE(nplanes-ip+1,icand).ne.0 )iimage=0 |
| 445 |
|
c$$$ print*,' track ',i,' CP ',CP_STORE(nplanes-ip+1,i) |
| 446 |
|
c$$$ $ ,CP_STORE(nplanes-ip+1,icand),iimage |
| 447 |
|
c$$$ enddo |
| 448 |
|
c$$$ if( iimage.ne.0.and. |
| 449 |
|
c$$$c $ RCHI2_STORE(i).le.CHI2MAX.and. |
| 450 |
|
c$$$c $ RCHI2_STORE(i).gt.0.and. |
| 451 |
|
c$$$ $ .true.)then |
| 452 |
|
c$$$ if(DEBUG.EQ.1)print*,'Track candidate ',iimage |
| 453 |
|
c$$$ $ ,' >>> TRACK IMAGE >>> of' |
| 454 |
|
c$$$ $ ,ibest |
| 455 |
|
c$$$ goto 122 !image track found |
| 456 |
|
c$$$ endif |
| 457 |
|
c$$$ enddo |
| 458 |
|
* --------------------------------------------------------------- |
| 459 |
|
* take the candidate with the greatest number of matching couples |
| 460 |
|
* if more than one satisfies the requirement, |
| 461 |
|
* choose the one with more points and lower chi2 |
| 462 |
|
* --------------------------------------------------------------- |
| 463 |
|
* count the number of matching couples |
| 464 |
|
ncpmax = 0 |
| 465 |
|
iimage = 0 !id of candidate with better matching |
| 466 |
do i=1,ntracks |
do i=1,ntracks |
| 467 |
iimage=i |
ncp=0 |
| 468 |
do ip=1,nplanes |
do ip=1,nplanes |
| 469 |
if( CP_STORE(nplanes-ip+1,icand).ne. |
if(CP_STORE(nplanes-ip+1,icand).ne.0)then |
| 470 |
$ -1*CP_STORE(nplanes-ip+1,i) )iimage=0 |
if( |
| 471 |
|
$ CP_STORE(nplanes-ip+1,i).ne.0 |
| 472 |
|
$ .and. |
| 473 |
|
$ CP_STORE(nplanes-ip+1,icand).eq. |
| 474 |
|
$ -1*CP_STORE(nplanes-ip+1,i) |
| 475 |
|
$ )then |
| 476 |
|
ncp=ncp+1 !ok |
| 477 |
|
elseif( |
| 478 |
|
$ CP_STORE(nplanes-ip+1,i).ne.0 |
| 479 |
|
$ .and. |
| 480 |
|
$ CP_STORE(nplanes-ip+1,icand).ne. |
| 481 |
|
$ -1*CP_STORE(nplanes-ip+1,i) |
| 482 |
|
$ )then |
| 483 |
|
ncp = 0 |
| 484 |
|
goto 117 !it is not an image candidate |
| 485 |
|
else |
| 486 |
|
|
| 487 |
|
endif |
| 488 |
|
endif |
| 489 |
|
c$$$ print*,' track ',i,' CP ',CP_STORE(nplanes-ip+1,i) |
| 490 |
|
c$$$ $ ,CP_STORE(nplanes-ip+1,icand),ncp |
| 491 |
enddo |
enddo |
| 492 |
if( iimage.ne.0.and. |
117 continue |
| 493 |
c $ RCHI2_STORE(i).le.CHI2MAX.and. |
trackimage(i)=ncp !number of matching couples |
| 494 |
c $ RCHI2_STORE(i).gt.0.and. |
if(ncp>ncpmax)then |
| 495 |
$ .true.)then |
ncpmax=ncp |
| 496 |
if(DEBUG)print*,'Track candidate ',iimage |
iimage=i |
|
$ ,' >>> TRACK IMAGE >>> of' |
|
|
$ ,ibest |
|
|
goto 122 !image track found |
|
| 497 |
endif |
endif |
| 498 |
enddo |
enddo |
| 499 |
|
* check if there are more than one image candidates |
| 500 |
|
ngood=0 |
| 501 |
|
do i=1,ntracks |
| 502 |
|
if( ncpmax.ne.0.and.trackimage(i).eq.ncpmax )ngood=ngood+1 |
| 503 |
|
enddo |
| 504 |
|
* if there are, choose the best one |
| 505 |
|
if(ngood.gt.1)then |
| 506 |
|
* ------------------------------------------------------- |
| 507 |
|
* order track-candidates according to: |
| 508 |
|
* 1st) decreasing n.points |
| 509 |
|
* 2nd) increasing chi**2 |
| 510 |
|
* ------------------------------------------------------- |
| 511 |
|
rchi2best=1000000000. |
| 512 |
|
ndofbest=0 |
| 513 |
|
do i=1,ntracks |
| 514 |
|
if( trackimage(i).eq.ncpmax )then |
| 515 |
|
ndof=0 |
| 516 |
|
do ii=1,nplanes |
| 517 |
|
ndof=ndof |
| 518 |
|
$ +int(xgood_store(ii,i)) |
| 519 |
|
$ +int(ygood_store(ii,i)) |
| 520 |
|
enddo |
| 521 |
|
if(ndof.gt.ndofbest)then |
| 522 |
|
iimage=i |
| 523 |
|
rchi2best=RCHI2_STORE(i) |
| 524 |
|
ndofbest=ndof |
| 525 |
|
elseif(ndof.eq.ndofbest)then |
| 526 |
|
if(RCHI2_STORE(i).lt.rchi2best.and. |
| 527 |
|
$ RCHI2_STORE(i).gt.0)then |
| 528 |
|
iimage=i |
| 529 |
|
rchi2best=RCHI2_STORE(i) |
| 530 |
|
ndofbest=ndof |
| 531 |
|
endif |
| 532 |
|
endif |
| 533 |
|
endif |
| 534 |
|
enddo |
| 535 |
|
|
| 536 |
|
endif |
| 537 |
|
|
| 538 |
|
if(DEBUG.EQ.1)print*,'Track candidate ',iimage |
| 539 |
|
$ ,' >>> TRACK IMAGE >>> of' |
| 540 |
|
$ ,ibest |
| 541 |
|
|
| 542 |
122 continue |
122 continue |
| 543 |
|
|
| 544 |
|
|
| 545 |
* --- and store the results -------------------------------- |
* --- and store the results -------------------------------- |
| 546 |
ntrk = ntrk + 1 !counter of found tracks |
ntrk = ntrk + 1 !counter of found tracks |
| 547 |
if(.not.FIMAGE |
if(.not.FIMAGE |
| 554 |
c $ ,iimage,fimage,ntrk,image(ntrk) |
c $ ,iimage,fimage,ntrk,image(ntrk) |
| 555 |
|
|
| 556 |
if(ntrk.eq.NTRKMAX)then |
if(ntrk.eq.NTRKMAX)then |
| 557 |
if(verbose) |
if(verbose.eq.1) |
| 558 |
$ print*, |
$ print*, |
| 559 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 560 |
$ 'tracks exceeds vector dimension ' |
$ 'tracks exceeds vector dimension ' |
| 590 |
$ rchi2best.le.CHI2MAX.and. |
$ rchi2best.le.CHI2MAX.and. |
| 591 |
c $ rchi2best.lt.15..and. |
c $ rchi2best.lt.15..and. |
| 592 |
$ .true.)then |
$ .true.)then |
| 593 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 594 |
print*,'***** NEW SEARCH ****' |
print*,'***** NEW SEARCH ****' |
| 595 |
endif |
endif |
| 596 |
goto 11111 !try new search |
goto 11111 !try new search |
| 727 |
viewx = VIEW(icx) |
viewx = VIEW(icx) |
| 728 |
nldx = nld(MAXS(icx),VIEW(icx)) |
nldx = nld(MAXS(icx),VIEW(icx)) |
| 729 |
nplx = npl(VIEW(icx)) |
nplx = npl(VIEW(icx)) |
| 730 |
resxPAM = RESXAV |
c resxPAM = RESXAV |
| 731 |
stripx = float(MAXS(icx)) |
stripx = float(MAXS(icx)) |
| 732 |
|
|
| 733 |
if( |
if( |
| 747 |
* -------------------------- |
* -------------------------- |
| 748 |
* magnetic-field corrections |
* magnetic-field corrections |
| 749 |
* -------------------------- |
* -------------------------- |
| 750 |
angtemp = ax |
stripx = stripx + fieldcorr(viewx,bfy) |
| 751 |
bfytemp = bfy |
angx = effectiveangle(ax,viewx,bfy) |
|
* ///////////////////////////////// |
|
|
* AAAAHHHHHHHH!!!!!!!!!!!!!!!!!!!!! |
|
|
* *grvzkkjsdgjhhhgngbn###>:( |
|
|
* ///////////////////////////////// |
|
|
c if(nplx.eq.6) angtemp = -1. * ax |
|
|
c if(nplx.eq.6) bfytemp = -1. * bfy |
|
|
if(viewx.eq.12) angtemp = -1. * ax |
|
|
if(viewx.eq.12) bfytemp = -1. * bfy |
|
|
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
|
|
angx = 180.*atan(tgtemp)/acos(-1.) |
|
|
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
|
|
c$$$ print*,nplx,ax,bfy/10. |
|
|
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
|
|
c$$$ print*,'========================' |
|
|
c$$$ if(bfy.ne.0.)print*,viewx,'-x- ' |
|
|
c$$$ $ ,bfy,-1*0.5*pmuH_h*bfytemp*0.00001*SiDimZ |
|
|
* -------------------------- |
|
|
|
|
|
c$$$ print*,'--- x-cl ---' |
|
|
c$$$ istart = INDSTART(ICX) |
|
|
c$$$ istop = TOTCLLENGTH |
|
|
c$$$ if(icx.lt.NCLSTR1)istop=INDSTART(ICX+1)-1 |
|
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
|
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
|
|
c$$$ print*,INDMAX(icx) |
|
|
c$$$ print*,cog(4,icx) |
|
|
c$$$ print*,fbad_cog(4,icx) |
|
| 752 |
|
|
| 753 |
|
call applypfa(PFAx,icx,angx,corr,res) |
| 754 |
if(PFAx.eq.'COG1')then |
stripx = stripx + corr |
| 755 |
|
resxPAM = res |
|
stripx = stripx |
|
|
resxPAM = 1e-4*pitchX/sqrt(12.)!!resxPAM |
|
|
|
|
|
elseif(PFAx.eq.'COG2')then |
|
|
|
|
|
stripx = stripx + cog(2,icx) |
|
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
|
|
resxPAM = resxPAM*fbad_cog(2,icx) |
|
|
|
|
|
elseif(PFAx.eq.'COG3')then |
|
|
|
|
|
stripx = stripx + cog(3,icx) |
|
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
|
|
resxPAM = resxPAM*fbad_cog(3,icx) |
|
|
|
|
|
elseif(PFAx.eq.'COG4')then |
|
|
|
|
|
stripx = stripx + cog(4,icx) |
|
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
|
|
resxPAM = resxPAM*fbad_cog(4,icx) |
|
|
|
|
|
elseif(PFAx.eq.'ETA2')then |
|
|
|
|
|
stripx = stripx + pfaeta2(icx,angx) |
|
|
resxPAM = risxeta2(abs(angx)) |
|
|
resxPAM = resxPAM*fbad_cog(2,icx) |
|
|
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
|
|
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
|
|
|
|
|
elseif(PFAx.eq.'ETA3')then |
|
|
|
|
|
stripx = stripx + pfaeta3(icx,angx) |
|
|
resxPAM = risxeta3(abs(angx)) |
|
|
resxPAM = resxPAM*fbad_cog(3,icx) |
|
|
c if(DEBUG.and.fbad_cog(3,icx).ne.1) |
|
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
|
|
|
|
|
elseif(PFAx.eq.'ETA4')then |
|
|
|
|
|
stripx = stripx + pfaeta4(icx,angx) |
|
|
resxPAM = risxeta4(abs(angx)) |
|
|
resxPAM = resxPAM*fbad_cog(4,icx) |
|
|
c if(DEBUG.and.fbad_cog(4,icx).ne.1) |
|
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
|
|
|
|
|
elseif(PFAx.eq.'ETA')then |
|
|
|
|
|
stripx = stripx + pfaeta(icx,angx) |
|
|
c resxPAM = riseta(icx,angx) |
|
|
resxPAM = riseta(viewx,angx) |
|
|
resxPAM = resxPAM*fbad_eta(icx,angx) |
|
|
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
|
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
|
|
|
|
|
elseif(PFAx.eq.'ETAL')then |
|
|
|
|
|
stripx = stripx + pfaetal(icx,angx) |
|
|
resxPAM = riseta(viewx,angx) |
|
|
resxPAM = resxPAM*fbad_eta(icx,angx) |
|
|
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
|
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
|
|
|
|
|
elseif(PFAx.eq.'COG')then |
|
|
|
|
|
stripx = stripx + cog(0,icx) |
|
|
resxPAM = risx_cog(abs(angx)) |
|
|
resxPAM = resxPAM*fbad_cog(0,icx) |
|
|
|
|
|
else |
|
|
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
|
|
endif |
|
|
|
|
|
|
|
|
* ====================================== |
|
|
* temporary patch for saturated clusters |
|
|
* ====================================== |
|
|
if( nsatstrips(icx).gt.0 )then |
|
|
stripx = stripx + cog(4,icx) |
|
|
resxPAM = pitchX*1e-4/sqrt(12.) |
|
|
cc=cog(4,icx) |
|
|
c$$$ print*,icx,' *** ',cc |
|
|
c$$$ print*,icx,' *** ',resxPAM |
|
|
endif |
|
| 756 |
|
|
| 757 |
10 endif |
10 endif |
|
|
|
| 758 |
|
|
| 759 |
* ----------------- |
* ----------------- |
| 760 |
* CLUSTER Y |
* CLUSTER Y |
| 765 |
viewy = VIEW(icy) |
viewy = VIEW(icy) |
| 766 |
nldy = nld(MAXS(icy),VIEW(icy)) |
nldy = nld(MAXS(icy),VIEW(icy)) |
| 767 |
nply = npl(VIEW(icy)) |
nply = npl(VIEW(icy)) |
| 768 |
resyPAM = RESYAV |
c resyPAM = RESYAV |
| 769 |
stripy = float(MAXS(icy)) |
stripy = float(MAXS(icy)) |
| 770 |
|
|
| 771 |
if( |
if( |
| 783 |
endif |
endif |
| 784 |
|
|
| 785 |
if(icx.ne.0.and.(nply.ne.nplx.or.nldy.ne.nldx))then |
if(icx.ne.0.and.(nply.ne.nplx.or.nldy.ne.nldx))then |
| 786 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
| 787 |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
| 788 |
$ ,icx,icy |
$ ,icx,icy |
| 789 |
endif |
endif |
| 790 |
goto 100 |
goto 100 |
| 791 |
endif |
endif |
| 792 |
|
|
| 793 |
* -------------------------- |
* -------------------------- |
| 794 |
* magnetic-field corrections |
* magnetic-field corrections |
| 795 |
* -------------------------- |
* -------------------------- |
| 796 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
stripy = stripy + fieldcorr(viewy,bfx) |
| 797 |
angy = 180.*atan(tgtemp)/acos(-1.) |
angy = effectiveangle(ay,viewy,bfx) |
|
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
|
|
c$$$ if(bfx.ne.0.)print*,viewy,'-y- ' |
|
|
c$$$ $ ,bfx,0.5*pmuH_e*bfx*0.00001*SiDimZ |
|
|
* -------------------------- |
|
| 798 |
|
|
| 799 |
c$$$ print*,'--- y-cl ---' |
call applypfa(PFAy,icy,angy,corr,res) |
| 800 |
c$$$ istart = INDSTART(ICY) |
stripy = stripy + corr |
| 801 |
c$$$ istop = TOTCLLENGTH |
resyPAM = res |
|
c$$$ if(icy.lt.NCLSTR1)istop=INDSTART(ICY+1)-1 |
|
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
|
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
|
|
c$$$ print*,INDMAX(icy) |
|
|
c$$$ print*,cog(4,icy) |
|
|
c$$$ print*,fbad_cog(4,icy) |
|
|
|
|
|
if(PFAy.eq.'COG1')then |
|
|
|
|
|
stripy = stripy |
|
|
resyPAM = 1e-4*pitchY/sqrt(12.)!resyPAM |
|
|
|
|
|
elseif(PFAy.eq.'COG2')then |
|
|
|
|
|
stripy = stripy + cog(2,icy) |
|
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
|
|
resyPAM = resyPAM*fbad_cog(2,icy) |
|
|
|
|
|
elseif(PFAy.eq.'COG3')then |
|
|
|
|
|
stripy = stripy + cog(3,icy) |
|
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
|
|
resyPAM = resyPAM*fbad_cog(3,icy) |
|
|
|
|
|
elseif(PFAy.eq.'COG4')then |
|
|
|
|
|
stripy = stripy + cog(4,icy) |
|
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
|
|
resyPAM = resyPAM*fbad_cog(4,icy) |
|
|
|
|
|
elseif(PFAy.eq.'ETA2')then |
|
|
|
|
|
stripy = stripy + pfaeta2(icy,angy) |
|
|
resyPAM = risyeta2(abs(angy)) |
|
|
resyPAM = resyPAM*fbad_cog(2,icy) |
|
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
|
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
|
|
|
|
|
elseif(PFAy.eq.'ETA3')then |
|
|
|
|
|
stripy = stripy + pfaeta3(icy,angy) |
|
|
resyPAM = resyPAM*fbad_cog(3,icy) |
|
|
c if(DEBUG.and.fbad_cog(3,icy).ne.1) |
|
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
|
|
|
|
|
elseif(PFAy.eq.'ETA4')then |
|
|
|
|
|
stripy = stripy + pfaeta4(icy,angy) |
|
|
resyPAM = resyPAM*fbad_cog(4,icy) |
|
|
c if(DEBUG.and.fbad_cog(4,icy).ne.1) |
|
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
|
|
|
|
|
elseif(PFAy.eq.'ETA')then |
|
|
|
|
|
stripy = stripy + pfaeta(icy,angy) |
|
|
c resyPAM = riseta(icy,angy) |
|
|
resyPAM = riseta(viewy,angy) |
|
|
resyPAM = resyPAM*fbad_eta(icy,angy) |
|
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
|
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
|
|
|
|
|
elseif(PFAy.eq.'ETAL')then |
|
|
|
|
|
stripy = stripy + pfaetal(icy,angy) |
|
|
resyPAM = riseta(viewy,angy) |
|
|
resyPAM = resyPAM*fbad_eta(icy,angy) |
|
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
|
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
|
|
|
|
|
elseif(PFAy.eq.'COG')then |
|
|
|
|
|
stripy = stripy + cog(0,icy) |
|
|
resyPAM = risy_cog(abs(angy)) |
|
|
resyPAM = resyPAM*fbad_cog(0,icy) |
|
|
|
|
|
else |
|
|
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
|
|
endif |
|
|
|
|
|
|
|
|
* ====================================== |
|
|
* temporary patch for saturated clusters |
|
|
* ====================================== |
|
|
if( nsatstrips(icy).gt.0 )then |
|
|
stripy = stripy + cog(4,icy) |
|
|
resyPAM = pitchY*1e-4/sqrt(12.) |
|
|
cc=cog(4,icy) |
|
|
c$$$ print*,icy,' *** ',cc |
|
|
c$$$ print*,icy,' *** ',resyPAM |
|
|
endif |
|
|
|
|
| 802 |
|
|
| 803 |
20 endif |
20 endif |
| 804 |
|
|
| 814 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 815 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 816 |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
| 817 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
| 818 |
print*,'xyz_PAM (couple):', |
print*,'xyz_PAM (couple):', |
| 819 |
$ ' WARNING: false X strip: strip ',stripx |
$ ' WARNING: false X strip: strip ',stripx |
| 820 |
endif |
endif |
| 823 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
| 824 |
zi = 0. |
zi = 0. |
| 825 |
|
|
|
|
|
| 826 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 827 |
c (xrt,yrt,zrt) = rototranslated coordinates in the silicon sensor frame |
c (xrt,yrt,zrt) = rototranslated coordinates in the silicon sensor frame |
| 828 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 908 |
c if((stripx.le.3).or.(stripx.ge.1022)) then !X has 1018 strips... |
c if((stripx.le.3).or.(stripx.ge.1022)) then !X has 1018 strips... |
| 909 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 910 |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
| 911 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
| 912 |
print*,'xyz_PAM (X-singlet):', |
print*,'xyz_PAM (X-singlet):', |
| 913 |
$ ' WARNING: false X strip: strip ',stripx |
$ ' WARNING: false X strip: strip ',stripx |
| 914 |
endif |
endif |
| 933 |
c print*,yi_A,' <--> ',yi_B |
c print*,yi_A,' <--> ',yi_B |
| 934 |
|
|
| 935 |
else |
else |
| 936 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
| 937 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
| 938 |
print *,'icx = ',icx |
print *,'icx = ',icx |
| 939 |
print *,'icy = ',icy |
print *,'icy = ',icy |
| 1002 |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
| 1003 |
|
|
| 1004 |
else |
else |
| 1005 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
| 1006 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
| 1007 |
print *,'icx = ',icx |
print *,'icx = ',icx |
| 1008 |
print *,'icy = ',icy |
print *,'icy = ',icy |
| 1047 |
c$$$ PFAx = 'COG4'!PFA |
c$$$ PFAx = 'COG4'!PFA |
| 1048 |
c$$$ PFAy = 'COG4'!PFA |
c$$$ PFAy = 'COG4'!PFA |
| 1049 |
|
|
| 1050 |
|
|
| 1051 |
if(icx.gt.nclstr1.or.icy.gt.nclstr1)then |
if(icx.gt.nclstr1.or.icy.gt.nclstr1)then |
| 1052 |
print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1053 |
$ ,' does not exists (nclstr1=',nclstr1,')' |
$ ,' does not exists (nclstr1=',nclstr1,')' |
| 1060 |
call idtoc(pfaid,PFAx) |
call idtoc(pfaid,PFAx) |
| 1061 |
call idtoc(pfaid,PFAy) |
call idtoc(pfaid,PFAy) |
| 1062 |
|
|
| 1063 |
|
cc print*,PFAx,PFAy |
| 1064 |
|
|
| 1065 |
c$$$ call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
c$$$ call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1066 |
|
|
| 1067 |
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
| 1190 |
|
|
| 1191 |
endif |
endif |
| 1192 |
|
|
| 1193 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 1194 |
c print*,'----------------------------- track coord' |
c print*,'----------------------------- track coord' |
| 1195 |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
| 1196 |
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
| 1641 |
integer iflag |
integer iflag |
| 1642 |
|
|
| 1643 |
integer badseed,badclx,badcly |
integer badseed,badclx,badcly |
| 1644 |
|
|
| 1645 |
|
if(DEBUG.EQ.1)print*,'cl_to_couples:' |
| 1646 |
|
|
| 1647 |
* init variables |
* init variables |
| 1648 |
ncp_tot=0 |
ncp_tot=0 |
| 1675 |
if( ncl_view(iv).gt. nclusterlimit)then |
if( ncl_view(iv).gt. nclusterlimit)then |
| 1676 |
c mask_view(iv) = 1 |
c mask_view(iv) = 1 |
| 1677 |
mask_view(iv) = mask_view(iv) + 2**0 |
mask_view(iv) = mask_view(iv) + 2**0 |
| 1678 |
if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' |
if(DEBUG.EQ.1) |
| 1679 |
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
$ print*,' * WARNING * cl_to_couple: n.clusters > ' |
| 1680 |
|
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
| 1681 |
endif |
endif |
| 1682 |
enddo |
enddo |
| 1683 |
|
|
| 1815 |
endif |
endif |
| 1816 |
|
|
| 1817 |
if(ncp_plane(nplx).gt.ncouplemax)then |
if(ncp_plane(nplx).gt.ncouplemax)then |
| 1818 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
| 1819 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 1820 |
$ 'couples on plane ',nplx, |
$ 'couples on plane ',nplx, |
| 1821 |
$ 'exceeds vector dimention ' |
$ 'exceeds vector dimention ' |
| 1853 |
enddo |
enddo |
| 1854 |
|
|
| 1855 |
|
|
| 1856 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 1857 |
print*,'clusters ',nclstr1 |
print*,'clusters ',nclstr1 |
| 1858 |
print*,'good ',(cl_good(i),i=1,nclstr1) |
print*,'good ',(cl_good(i),i=1,nclstr1) |
| 1859 |
print*,'singles ',(cl_single(i),i=1,nclstr1) |
print*,'singlets',(cl_single(i),i=1,nclstr1) |
| 1860 |
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
| 1861 |
endif |
endif |
| 1862 |
|
|
| 1916 |
real xc,zc,radius |
real xc,zc,radius |
| 1917 |
* ----------------------------- |
* ----------------------------- |
| 1918 |
|
|
| 1919 |
|
if(DEBUG.EQ.1)print*,'cp_to_doubtrip:' |
| 1920 |
|
|
| 1921 |
* -------------------------------------------- |
* -------------------------------------------- |
| 1922 |
* put a limit to the maximum number of couples |
* put a limit to the maximum number of couples |
| 1954 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
| 1955 |
if( mask_view(nviewx(ip2)).ne.0 .or. |
if( mask_view(nviewx(ip2)).ne.0 .or. |
| 1956 |
$ mask_view(nviewy(ip2)).ne.0 )goto 20 !skip plane |
$ mask_view(nviewy(ip2)).ne.0 )goto 20 !skip plane |
| 1957 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
|
|
|
| 1958 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
| 1959 |
icx2=clx(ip2,icp2) |
icx2=clx(ip2,icp2) |
| 1960 |
icy2=cly(ip2,icp2) |
icy2=cly(ip2,icp2) |
| 1973 |
* (2 couples needed) |
* (2 couples needed) |
| 1974 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 1975 |
if(ndblt.eq.ndblt_max)then |
if(ndblt.eq.ndblt_max)then |
| 1976 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
| 1977 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 1978 |
$ 'doublets exceeds vector dimention ' |
$ 'doublets exceeds vector dimention ' |
| 1979 |
$ ,'( ',ndblt_max,' )' |
$ ,'( ',ndblt_max,' )' |
| 2037 |
ym3=yPAM |
ym3=yPAM |
| 2038 |
zm3=zPAM |
zm3=zPAM |
| 2039 |
* find the circle passing through the three points |
* find the circle passing through the three points |
| 2040 |
|
c$$$ call tricircle(3,xp,zp,angp,resp,chi |
| 2041 |
|
c$$$ $ ,xc,zc,radius,iflag) |
| 2042 |
|
iflag = DEBUG |
| 2043 |
call tricircle(3,xp,zp,angp,resp,chi |
call tricircle(3,xp,zp,angp,resp,chi |
| 2044 |
$ ,xc,zc,radius,iflag) |
$ ,xc,zc,radius,iflag) |
| 2045 |
c print*,xc,zc,radius |
c print*,xc,zc,radius |
| 2056 |
* (3 couples needed) |
* (3 couples needed) |
| 2057 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2058 |
if(ntrpt.eq.ntrpt_max)then |
if(ntrpt.eq.ntrpt_max)then |
| 2059 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
| 2060 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2061 |
$ 'triplets exceeds vector dimention ' |
$ 'triplets exceeds vector dimention ' |
| 2062 |
$ ,'( ',ntrpt_max,' )' |
$ ,'( ',ntrpt_max,' )' |
| 2118 |
10 continue |
10 continue |
| 2119 |
enddo !end loop on planes - COPPIA 1 |
enddo !end loop on planes - COPPIA 1 |
| 2120 |
|
|
| 2121 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2122 |
print*,'--- doublets ',ndblt |
print*,'--- doublets ',ndblt |
| 2123 |
print*,'--- triplets ',ntrpt |
print*,'--- triplets ',ntrpt |
| 2124 |
endif |
endif |
| 2165 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
| 2166 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
| 2167 |
|
|
| 2168 |
|
if(DEBUG.EQ.1)print*,'doub_to_YZcloud:' |
| 2169 |
|
|
| 2170 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2171 |
* classification of DOUBLETS |
* classification of DOUBLETS |
| 2292 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
| 2293 |
|
|
| 2294 |
if(nclouds_yz.ge.ncloyz_max)then |
if(nclouds_yz.ge.ncloyz_max)then |
| 2295 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
| 2296 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2297 |
$ 'YZ clouds exceeds vector dimention ' |
$ 'YZ clouds exceeds vector dimention ' |
| 2298 |
$ ,'( ',ncloyz_max,' )' |
$ ,'( ',ncloyz_max,' )' |
| 2320 |
c print*,'>> ',ipt,db_all(ipt) |
c print*,'>> ',ipt,db_all(ipt) |
| 2321 |
enddo |
enddo |
| 2322 |
npt_tot=npt_tot+npt |
npt_tot=npt_tot+npt |
| 2323 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2324 |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
| 2325 |
print*,'>>>> cloud ',nclouds_yz,' --- ',npt,' points' |
print*,'>>>> cloud ',nclouds_yz,' --- ',npt,' points' |
| 2326 |
print*,'- alfayz1 ',alfayz1_av(nclouds_yz) |
print*,'- alfayz1 ',alfayz1_av(nclouds_yz) |
| 2327 |
print*,'- alfayz2 ',alfayz2_av(nclouds_yz) |
print*,'- alfayz2 ',alfayz2_av(nclouds_yz) |
| 2328 |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
| 2329 |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
| 2330 |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
print*,'cpcloud_yz ' |
| 2331 |
|
$ ,(cpcloud_yz(nclouds_yz,icp),icp=1,ncp_tot) |
| 2332 |
|
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
| 2333 |
c$$$ print*,'nt-uple: ptcloud_yz(',nclouds_yz,') = ' |
c$$$ print*,'nt-uple: ptcloud_yz(',nclouds_yz,') = ' |
| 2334 |
c$$$ $ ,ptcloud_yz(nclouds_yz) |
c$$$ $ ,ptcloud_yz(nclouds_yz) |
| 2335 |
c$$$ print*,'nt-uple: db_cloud(...) = ' |
c$$$ print*,'nt-uple: db_cloud(...) = ' |
| 2347 |
goto 90 |
goto 90 |
| 2348 |
endif |
endif |
| 2349 |
|
|
| 2350 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2351 |
print*,'---------------------- ' |
print*,'---------------------- ' |
| 2352 |
print*,'Y-Z total clouds ',nclouds_yz |
print*,'Y-Z total clouds ',nclouds_yz |
| 2353 |
print*,' ' |
print*,' ' |
| 2396 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
| 2397 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
| 2398 |
|
|
| 2399 |
|
if(DEBUG.EQ.1)print*,'trip_to_XZcloud:' |
| 2400 |
|
|
| 2401 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2402 |
* classification of TRIPLETS |
* classification of TRIPLETS |
| 2403 |
* according to distance in parameter space |
* according to distance in parameter space |
| 2455 |
$ +((alfaxz2(itrref)-alfaxz2(itr2))/Dalfaxz2)**2 |
$ +((alfaxz2(itrref)-alfaxz2(itr2))/Dalfaxz2)**2 |
| 2456 |
distance = sqrt(distance) |
distance = sqrt(distance) |
| 2457 |
|
|
| 2458 |
if(distance.lt.cutdistxz)then |
* ------------------------------------------------------------------------ |
| 2459 |
|
* FORCE INCLUSION OF TRIPLETS COMPOSED BY SAME COUPLES, IGNORING THE IMAGE |
| 2460 |
|
* ------------------------------------------------------------------------ |
| 2461 |
|
* (added in august 2007) |
| 2462 |
|
istrimage=0 |
| 2463 |
|
if( |
| 2464 |
|
$ abs(cpxz1(itrref)).eq.abs(cpxz1(itr2)).and. |
| 2465 |
|
$ abs(cpxz2(itrref)).eq.abs(cpxz2(itr2)).and. |
| 2466 |
|
$ abs(cpxz3(itrref)).eq.abs(cpxz3(itr2)).and. |
| 2467 |
|
$ .true.)istrimage=1 |
| 2468 |
|
|
| 2469 |
|
if(distance.lt.cutdistxz.or.istrimage.eq.1)then |
| 2470 |
c print*,idb1,idb2,distance,' cloud ',nclouds_yz |
c print*,idb1,idb2,distance,' cloud ',nclouds_yz |
| 2471 |
if(cpxz1(itr2).gt.0)cp_useds2(cpxz1(itr2))=1 |
if(cpxz1(itr2).gt.0)cp_useds2(cpxz1(itr2))=1 |
| 2472 |
if(cpxz1(itr2).lt.0)cp_useds1(-cpxz1(itr2))=1 |
if(cpxz1(itr2).lt.0)cp_useds1(-cpxz1(itr2))=1 |
| 2530 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
| 2531 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
| 2532 |
if(nclouds_xz.ge.ncloxz_max)then |
if(nclouds_xz.ge.ncloxz_max)then |
| 2533 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
| 2534 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2535 |
$ 'XZ clouds exceeds vector dimention ' |
$ 'XZ clouds exceeds vector dimention ' |
| 2536 |
$ ,'( ',ncloxz_max,' )' |
$ ,'( ',ncloxz_max,' )' |
| 2557 |
enddo |
enddo |
| 2558 |
npt_tot=npt_tot+npt |
npt_tot=npt_tot+npt |
| 2559 |
|
|
| 2560 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2561 |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
| 2562 |
print*,'>>>> cloud ',nclouds_xz,' --- ',npt,' points' |
print*,'>>>> cloud ',nclouds_xz,' --- ',npt,' points' |
| 2563 |
print*,'- alfaxz1 ',alfaxz1_av(nclouds_xz) |
print*,'- alfaxz1 ',alfaxz1_av(nclouds_xz) |
| 2564 |
print*,'- alfaxz2 ',alfaxz2_av(nclouds_xz) |
print*,'- alfaxz2 ',alfaxz2_av(nclouds_xz) |
| 2565 |
print*,'- alfaxz3 ',alfaxz3_av(nclouds_xz) |
print*,'- alfaxz3 ',alfaxz3_av(nclouds_xz) |
| 2566 |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
| 2567 |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
| 2568 |
|
print*,'cpcloud_xz ' |
| 2569 |
|
$ ,(cpcloud_xz(nclouds_xz,icp),icp=1,ncp_tot) |
| 2570 |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
| 2571 |
c$$$ print*,'nt-uple: ptcloud_xz(',nclouds_xz,') = ' |
c$$$ print*,'nt-uple: ptcloud_xz(',nclouds_xz,') = ' |
| 2572 |
c$$$ $ ,ptcloud_xz(nclouds_xz) |
c$$$ $ ,ptcloud_xz(nclouds_xz) |
| 2584 |
goto 91 |
goto 91 |
| 2585 |
endif |
endif |
| 2586 |
|
|
| 2587 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2588 |
print*,'---------------------- ' |
print*,'---------------------- ' |
| 2589 |
print*,'X-Z total clouds ',nclouds_xz |
print*,'X-Z total clouds ',nclouds_xz |
| 2590 |
print*,' ' |
print*,' ' |
| 2636 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
| 2637 |
* variables for track fitting |
* variables for track fitting |
| 2638 |
double precision AL_INI(5) |
double precision AL_INI(5) |
|
c double precision tath |
|
| 2639 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
|
c real fitz(nplanes) !z coordinates of the planes in cm |
|
| 2640 |
|
|
| 2641 |
|
if(DEBUG.EQ.1)print*,'clouds_to_ctrack:' |
| 2642 |
|
|
| 2643 |
|
|
| 2644 |
ntracks=0 !counter of track candidates |
ntracks=0 !counter of track candidates |
| 2660 |
enddo |
enddo |
| 2661 |
enddo |
enddo |
| 2662 |
ncp_ok=0 |
ncp_ok=0 |
| 2663 |
do icp=1,ncp_tot !loop on couples |
do icp=1,ncp_tot !loop over couples |
| 2664 |
* get info on |
* get info on |
| 2665 |
cpintersec(icp)=min( |
cpintersec(icp)=min( |
| 2666 |
$ cpcloud_yz(iyz,icp), |
$ cpcloud_yz(iyz,icp), |
| 2669 |
$ (cpcloud_yz(iyz,icp).eq.1.and.cpcloud_xz(ixz,icp).eq.2).or. |
$ (cpcloud_yz(iyz,icp).eq.1.and.cpcloud_xz(ixz,icp).eq.2).or. |
| 2670 |
$ (cpcloud_yz(iyz,icp).eq.2.and.cpcloud_xz(ixz,icp).eq.1).or. |
$ (cpcloud_yz(iyz,icp).eq.2.and.cpcloud_xz(ixz,icp).eq.1).or. |
| 2671 |
$ .false.)cpintersec(icp)=0 |
$ .false.)cpintersec(icp)=0 |
| 2672 |
|
* cpintersec is >0 if yz and xz clouds contain the same image of couple icp |
| 2673 |
if(cpintersec(icp).ne.0)then |
if(cpintersec(icp).ne.0)then |
| 2674 |
ncp_ok=ncp_ok+1 |
ncp_ok=ncp_ok+1 |
| 2675 |
|
|
| 2702 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
| 2703 |
enddo |
enddo |
| 2704 |
|
|
|
c if(nplused.lt.nplxz_min)goto 888 !next doublet |
|
|
if(nplused.lt.nplyz_min)goto 888 !next doublet |
|
|
if(ncp_ok.lt.ncpok)goto 888 !next cloud |
|
| 2705 |
|
|
| 2706 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2707 |
print*,'Combination ',iyz,ixz |
print*,'Combination ',iyz,ixz |
| 2708 |
$ ,' db ',ptcloud_yz(iyz) |
$ ,' db ',ptcloud_yz(iyz) |
| 2709 |
$ ,' tr ',ptcloud_xz(ixz) |
$ ,' tr ',ptcloud_xz(ixz) |
| 2710 |
$ ,' -----> # matching couples ',ncp_ok |
$ ,' -----> # matching couples ',ncp_ok |
| 2711 |
endif |
endif |
| 2712 |
|
|
| 2713 |
|
c if(nplused.lt.nplxz_min)goto 888 !next combination |
| 2714 |
|
if(nplused.lt.nplyz_min)goto 888 !next combination |
| 2715 |
|
if(ncp_ok.lt.ncpok)goto 888 !next combination |
| 2716 |
|
|
| 2717 |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 2718 |
c$$$ print*,'Configurazione cluster XZ' |
c$$$ print*,'Configurazione cluster XZ' |
| 2719 |
c$$$ print*,'1 -- ',(clx(1,i),i=1,ncp_plane(1)) |
c$$$ print*,'1 -- ',(clx(1,i),i=1,ncp_plane(1)) |
| 2759 |
c$$$ |
c$$$ |
| 2760 |
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
| 2761 |
|
|
| 2762 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2763 |
|
print*,'track candidate', ntracks+1 |
| 2764 |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
| 2765 |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
| 2766 |
print*,'3 >>> ',(cp_match(4,i),i=1,ncp_match(4)) |
print*,'3 >>> ',(cp_match(4,i),i=1,ncp_match(4)) |
| 2793 |
hit_plane(6)=icp6 |
hit_plane(6)=icp6 |
| 2794 |
if(ncp_match(6).eq.0)hit_plane(6)=0 !-icp6 |
if(ncp_match(6).eq.0)hit_plane(6)=0 !-icp6 |
| 2795 |
|
|
| 2796 |
|
* --------------------------------------- |
| 2797 |
|
* check if this group of couples has been |
| 2798 |
|
* already fitted |
| 2799 |
|
* --------------------------------------- |
| 2800 |
|
do ica=1,ntracks |
| 2801 |
|
isthesame=1 |
| 2802 |
|
do ip=1,NPLANES |
| 2803 |
|
if(hit_plane(ip).ne.0)then |
| 2804 |
|
if( CP_STORE(nplanes-ip+1,ica) |
| 2805 |
|
$ .ne. |
| 2806 |
|
$ cp_match(ip,hit_plane(ip)) ) |
| 2807 |
|
$ isthesame=0 |
| 2808 |
|
else |
| 2809 |
|
if( CP_STORE(nplanes-ip+1,ica) |
| 2810 |
|
$ .ne. |
| 2811 |
|
$ 0 ) |
| 2812 |
|
$ isthesame=0 |
| 2813 |
|
endif |
| 2814 |
|
enddo |
| 2815 |
|
if(isthesame.eq.1)then |
| 2816 |
|
if(DEBUG.eq.1) |
| 2817 |
|
$ print*,'(already fitted)' |
| 2818 |
|
goto 666 !jump to next combination |
| 2819 |
|
endif |
| 2820 |
|
enddo |
| 2821 |
|
|
| 2822 |
call track_init !init TRACK common |
call track_init !init TRACK common |
| 2823 |
|
|
| 2824 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes (bottom to top) |
| 2825 |
if(hit_plane(ip).ne.0)then |
if(hit_plane(ip).ne.0)then |
| 2826 |
id=cp_match(ip,hit_plane(ip)) |
id=cp_match(ip,hit_plane(ip)) |
| 2827 |
is=is_cp(id) |
is=is_cp(id) |
| 2865 |
ifail=0 !error flag in chi^2 computation |
ifail=0 !error flag in chi^2 computation |
| 2866 |
jstep=0 !number of minimization steps |
jstep=0 !number of minimization steps |
| 2867 |
iprint=0 |
iprint=0 |
| 2868 |
c if(DEBUG)iprint=1 |
c if(DEBUG.EQ.1)iprint=1 |
| 2869 |
if(DEBUG)iprint=2 |
if(DEBUG.EQ.1)iprint=2 |
| 2870 |
call mini2(jstep,ifail,iprint) |
call mini2(jstep,ifail,iprint) |
| 2871 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
| 2872 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2873 |
print *, |
print *, |
| 2874 |
$ '*** MINIMIZATION FAILURE *** ' |
$ '*** MINIMIZATION FAILURE *** ' |
| 2875 |
$ //'(clouds_to_ctrack)' |
$ //'(clouds_to_ctrack)' |
| 2894 |
* -------------------------- |
* -------------------------- |
| 2895 |
if(ntracks.eq.NTRACKSMAX)then |
if(ntracks.eq.NTRACKSMAX)then |
| 2896 |
|
|
| 2897 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
| 2898 |
$ '** warning ** number of candidate tracks '// |
$ '** warning ** number of candidate tracks '// |
| 2899 |
$ ' exceeds vector dimension ' |
$ ' exceeds vector dimension ' |
| 2900 |
$ ,'( ',NTRACKSMAX,' )' |
$ ,'( ',NTRACKSMAX,' )' |
| 2910 |
|
|
| 2911 |
ntracks = ntracks + 1 |
ntracks = ntracks + 1 |
| 2912 |
|
|
| 2913 |
do ip=1,nplanes |
do ip=1,nplanes !top to bottom |
| 2914 |
|
|
| 2915 |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
| 2916 |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
| 2927 |
AYV_STORE(ip,ntracks)=sngl(ayv(ip)) |
AYV_STORE(ip,ntracks)=sngl(ayv(ip)) |
| 2928 |
XGOOD_STORE(ip,ntracks)=sngl(xgood(ip)) |
XGOOD_STORE(ip,ntracks)=sngl(xgood(ip)) |
| 2929 |
YGOOD_STORE(ip,ntracks)=sngl(ygood(ip)) |
YGOOD_STORE(ip,ntracks)=sngl(ygood(ip)) |
| 2930 |
|
* NB! hit_plane is defined from bottom to top |
| 2931 |
if(hit_plane(ip).ne.0)then |
if(hit_plane(ip).ne.0)then |
| 2932 |
CP_STORE(nplanes-ip+1,ntracks)= |
CP_STORE(nplanes-ip+1,ntracks)= |
| 2933 |
$ cp_match(ip,hit_plane(ip)) |
$ cp_match(ip,hit_plane(ip)) |
| 2943 |
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
| 2944 |
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
| 2945 |
endif |
endif |
| 2946 |
BX_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
BX_STORE(ip,ntracks)=0!I dont need it now |
| 2947 |
BY_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
BY_STORE(ip,ntracks)=0!I dont need it now |
| 2948 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
CLS_STORE(ip,ntracks)=0 |
| 2949 |
do i=1,5 |
do i=1,5 |
| 2950 |
AL_STORE(i,ntracks)=sngl(AL(i)) |
AL_STORE(i,ntracks)=sngl(AL(i)) |
| 2951 |
enddo |
enddo |
| 2974 |
return |
return |
| 2975 |
endif |
endif |
| 2976 |
|
|
| 2977 |
c$$$ if(DEBUG)then |
c$$$ if(DEBUG.EQ.1)then |
| 2978 |
c$$$ print*,'****** TRACK CANDIDATES ***********' |
c$$$ print*,'****** TRACK CANDIDATES ***********' |
| 2979 |
c$$$ print*,'# R. chi2 RIG' |
c$$$ print*,'# R. chi2 RIG' |
| 2980 |
c$$$ do i=1,ntracks |
c$$$ do i=1,ntracks |
| 2983 |
c$$$ enddo |
c$$$ enddo |
| 2984 |
c$$$ print*,'***********************************' |
c$$$ print*,'***********************************' |
| 2985 |
c$$$ endif |
c$$$ endif |
| 2986 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 2987 |
print*,'****** TRACK CANDIDATES *****************' |
print*,'****** TRACK CANDIDATES *****************' |
| 2988 |
print*,'# R. chi2 RIG ndof' |
print*,'# R. chi2 RIG ndof' |
| 2989 |
do i=1,ntracks |
do i=1,ntracks |
| 3035 |
real xyzp(3),bxyz(3) |
real xyzp(3),bxyz(3) |
| 3036 |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
| 3037 |
|
|
| 3038 |
|
if(DEBUG.EQ.1)print*,'refine_track:' |
| 3039 |
* ================================================= |
* ================================================= |
| 3040 |
* new estimate of positions using ETA algorithm |
* new estimate of positions using ETA algorithm |
| 3041 |
* and |
* and |
| 3117 |
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
| 3118 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
| 3119 |
|
|
| 3120 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 3121 |
print*, |
print*, |
| 3122 |
$ '------ Plane ',ip,' intersected on LADDER ',nldt |
$ '------ Plane ',ip,' intersected on LADDER ',nldt |
| 3123 |
$ ,' SENSOR ',ist |
$ ,' SENSOR ',ist |
| 3128 |
* =========================================== |
* =========================================== |
| 3129 |
* STEP 1 >>>>>>> try to include a new couple |
* STEP 1 >>>>>>> try to include a new couple |
| 3130 |
* =========================================== |
* =========================================== |
| 3131 |
c if(DEBUG)print*,'>>>> try to include a new couple' |
c if(DEBUG.EQ.1)print*,'>>>> try to include a new couple' |
| 3132 |
distmin=1000000. |
distmin=1000000. |
| 3133 |
xmm = 0. |
xmm = 0. |
| 3134 |
ymm = 0. |
ymm = 0. |
| 3160 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3161 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3162 |
id=id_cp(ip,icp,ist) |
id=id_cp(ip,icp,ist) |
| 3163 |
if(DEBUG)print*,'( couple ',id |
if(DEBUG.EQ.1)print*,'( couple ',id |
| 3164 |
$ ,' ) distance ',distance |
$ ,' ) distance ',distance |
| 3165 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3166 |
xmm = xPAM |
xmm = xPAM |
| 3192 |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
| 3193 |
* ----------------------------------- |
* ----------------------------------- |
| 3194 |
CP_STORE(nplanes-ip+1,ibest)=idm |
CP_STORE(nplanes-ip+1,ibest)=idm |
| 3195 |
if(DEBUG)print*,'%%%% included couple ',idm |
if(DEBUG.EQ.1)print*,'%%%% included couple ',idm |
| 3196 |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
| 3197 |
goto 133 !next plane |
goto 133 !next plane |
| 3198 |
endif |
endif |
| 3200 |
* STEP 2 >>>>>>> try to include a single cluster |
* STEP 2 >>>>>>> try to include a single cluster |
| 3201 |
* either from a couple or single |
* either from a couple or single |
| 3202 |
* ================================================ |
* ================================================ |
| 3203 |
c if(DEBUG)print*,'>>>> try to include a new cluster' |
c if(DEBUG.EQ.1)print*,'>>>> try to include a new cluster' |
| 3204 |
distmin=1000000. |
distmin=1000000. |
| 3205 |
xmm_A = 0. !--------------------------- |
xmm_A = 0. !--------------------------- |
| 3206 |
ymm_A = 0. ! init variables that |
ymm_A = 0. ! init variables that |
| 3237 |
$ ) |
$ ) |
| 3238 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3239 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3240 |
if(DEBUG)print*,'( cl-X ',icx |
if(DEBUG.EQ.1)print*,'( cl-X ',icx |
| 3241 |
$ ,' in cp ',id,' ) distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
| 3242 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3243 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
| 3270 |
$ ) |
$ ) |
| 3271 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3272 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3273 |
if(DEBUG)print*,'( cl-Y ',icy |
if(DEBUG.EQ.1)print*,'( cl-Y ',icy |
| 3274 |
$ ,' in cp ',id,' ) distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
| 3275 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3276 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
| 3315 |
|
|
| 3316 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3317 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3318 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG.EQ.1)print*,'( cl-s ',icl |
| 3319 |
$ ,' ) distance ',distance,'<',distmin,' ?' |
$ ,' ) distance ',distance |
| 3320 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3321 |
if(DEBUG)print*,'YES' |
c if(DEBUG.EQ.1)print*,'YES' |
| 3322 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
| 3323 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
| 3324 |
zmm_A = zPAM_A |
zmm_A = zPAM_A |
| 3364 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
| 3365 |
XGOOD(nplanes-ip+1)=1. |
XGOOD(nplanes-ip+1)=1. |
| 3366 |
resx(nplanes-ip+1)=rxmm |
resx(nplanes-ip+1)=rxmm |
| 3367 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
if(DEBUG.EQ.1)print*,'%%%% included X-cl ',iclm |
| 3368 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
| 3369 |
$ ,', dist.= ',distmin |
$ ,', dist.= ',distmin |
| 3370 |
$ ,', cut ',clinc,' )' |
$ ,', cut ',clinc,' )' |
| 3371 |
else |
else |
| 3372 |
YGOOD(nplanes-ip+1)=1. |
YGOOD(nplanes-ip+1)=1. |
| 3373 |
resy(nplanes-ip+1)=rymm |
resy(nplanes-ip+1)=rymm |
| 3374 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(DEBUG.EQ.1)print*,'%%%% included Y-cl ',iclm |
| 3375 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
| 3376 |
$ ,', dist.= ', distmin |
$ ,', dist.= ', distmin |
| 3377 |
$ ,', cut ',clinc,' )' |
$ ,', cut ',clinc,' )' |
| 3413 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
| 3414 |
include 'level2.f' |
include 'level2.f' |
| 3415 |
|
|
| 3416 |
|
if(DEBUG.EQ.1)print*,'clean_XYclouds:' |
| 3417 |
|
|
| 3418 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
| 3419 |
|
|
| 3420 |
id=CP_STORE(nplanes-ip+1,ibest) |
id=CP_STORE(nplanes-ip+1,ibest) |
| 3423 |
if(id.ne.0)then |
if(id.ne.0)then |
| 3424 |
iclx=clx(ip,icp_cp(id)) |
iclx=clx(ip,icp_cp(id)) |
| 3425 |
icly=cly(ip,icp_cp(id)) |
icly=cly(ip,icp_cp(id)) |
| 3426 |
cl_used(iclx)=ntrk !tag used clusters |
c$$$ cl_used(iclx)=ntrk !tag used clusters |
| 3427 |
cl_used(icly)=ntrk !tag used clusters |
c$$$ cl_used(icly)=ntrk !tag used clusters |
| 3428 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
| 3429 |
cl_used(icl)=ntrk !tag used clusters |
c$$$ cl_used(icl)=ntrk !tag used clusters |
| 3430 |
endif |
endif |
| 3431 |
|
|
| 3432 |
* ----------------------------- |
* ----------------------------- |
| 3445 |
$ cly(ip,icp).eq.icl |
$ cly(ip,icp).eq.icl |
| 3446 |
$ )then |
$ )then |
| 3447 |
id=id_cp(ip,icp,1) |
id=id_cp(ip,icp,1) |
| 3448 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
| 3449 |
print*,ip,' <<< cp ',id |
print*,ip,' <<< cp ',id |
| 3450 |
$ ,' ( cl-x ' |
$ ,' ( cl-x ' |
| 3451 |
$ ,clx(ip,icp) |
$ ,clx(ip,icp) |
| 3526 |
DEDX_Y(IP,IT) = 0 |
DEDX_Y(IP,IT) = 0 |
| 3527 |
CLTRX(IP,IT) = 0 |
CLTRX(IP,IT) = 0 |
| 3528 |
CLTRY(IP,IT) = 0 |
CLTRY(IP,IT) = 0 |
| 3529 |
|
multmaxx(ip,it) = 0 |
| 3530 |
|
seedx(ip,it) = 0 |
| 3531 |
|
xpu(ip,it) = 0 |
| 3532 |
|
multmaxy(ip,it) = 0 |
| 3533 |
|
seedy(ip,it) = 0 |
| 3534 |
|
ypu(ip,it) = 0 |
| 3535 |
enddo |
enddo |
| 3536 |
do ipa=1,5 |
do ipa=1,5 |
| 3537 |
AL_nt(IPA,IT) = 0 |
AL_nt(IPA,IT) = 0 |
| 3711 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
zv_nt(ip,ntr) = sngl(zv(ip)) |
| 3712 |
axv_nt(ip,ntr) = sngl(axv(ip)) |
axv_nt(ip,ntr) = sngl(axv(ip)) |
| 3713 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
| 3714 |
c l'avevo dimenticato!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
| 3715 |
factor = sqrt( |
factor = sqrt( |
| 3716 |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
| 3717 |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
| 3718 |
$ 1. ) |
$ 1. ) |
| 3719 |
c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
| 3720 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
| 3721 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
| 3722 |
|
|
| 3724 |
ay = ayv_nt(ip,ntr) |
ay = ayv_nt(ip,ntr) |
| 3725 |
bfx = BX_STORE(ip,IDCAND) |
bfx = BX_STORE(ip,IDCAND) |
| 3726 |
bfy = BY_STORE(ip,IDCAND) |
bfy = BY_STORE(ip,IDCAND) |
| 3727 |
if(ip.eq.6) ax = -1. * axv_nt(ip,ntr) |
c$$$ if(ip.eq.6) ax = -1. * axv_nt(ip,ntr) |
| 3728 |
if(ip.eq.6) bfy = -1. * BY_STORE(ip,IDCAND) |
c$$$ if(ip.eq.6) bfy = -1. * BY_STORE(ip,IDCAND) |
| 3729 |
tgtemp = tan(ax*acos(-1.)/180.) + pmuH_h*bfy*0.00001 |
c$$$ tgtemp = tan(ax*acos(-1.)/180.) + pmuH_h*bfy*0.00001 |
| 3730 |
angx = 180.*atan(tgtemp)/acos(-1.) |
c$$$ angx = 180.*atan(tgtemp)/acos(-1.) |
| 3731 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
c$$$ tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
| 3732 |
angy = 180.*atan(tgtemp)/acos(-1.) |
c$$$ angy = 180.*atan(tgtemp)/acos(-1.) |
| 3733 |
|
|
| 3734 |
|
angx = effectiveangle(ax,2*ip,bfy) |
| 3735 |
|
angy = effectiveangle(ay,2*ip-1,bfx) |
| 3736 |
|
|
| 3737 |
|
|
| 3738 |
c print*,'* ',ip,bfx,bfy,angx,angy |
c print*,'* ',ip,bfx,bfy,angx,angy |
| 3739 |
|
|
| 3750 |
c >>> is a couple |
c >>> is a couple |
| 3751 |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
| 3752 |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
| 3753 |
|
|
| 3754 |
c$$$ nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
cl_used(cltrx(ip,ntr)) = 1 !tag used clusters |
| 3755 |
c$$$ nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
cl_used(cltry(ip,ntr)) = 1 !tag used clusters |
| 3756 |
c$$$ xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) |
|
|
c$$$ ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) |
|
| 3757 |
xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) |
xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) |
| 3758 |
ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) |
ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) |
| 3759 |
|
|
| 3763 |
if(nsatstrips(cly(nplanes-ip+1,icp_cp(id))).gt.0) |
if(nsatstrips(cly(nplanes-ip+1,icp_cp(id))).gt.0) |
| 3764 |
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
| 3765 |
|
|
| 3766 |
|
multmaxx(ip,ntr) = maxs(cltrx(ip,ntr)) |
| 3767 |
|
$ +10000*mult(cltrx(ip,ntr)) |
| 3768 |
|
seedx(ip,ntr) = clsignal(indmax(cltrx(ip,ntr))) |
| 3769 |
|
$ /clsigma(indmax(cltrx(ip,ntr))) |
| 3770 |
|
call applypfa(PFA,cltrx(ip,ntr),angx,corr,res) |
| 3771 |
|
xpu(ip,ntr) = corr |
| 3772 |
|
|
| 3773 |
|
multmaxy(ip,ntr) = maxs(cltry(ip,ntr)) |
| 3774 |
|
$ +10000*mult(cltry(ip,ntr)) |
| 3775 |
|
seedy(ip,ntr) = clsignal(indmax(cltry(ip,ntr))) |
| 3776 |
|
$ /clsigma(indmax(cltry(ip,ntr))) |
| 3777 |
|
call applypfa(PFA,cltry(ip,ntr),angy,corr,res) |
| 3778 |
|
ypu(ip,ntr) = corr |
| 3779 |
|
|
| 3780 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
| 3781 |
|
|
| 3782 |
|
cl_used(icl) = 1 !tag used clusters |
| 3783 |
|
|
| 3784 |
if(mod(VIEW(icl),2).eq.0)then |
if(mod(VIEW(icl),2).eq.0)then |
| 3785 |
cltrx(ip,ntr)=icl |
cltrx(ip,ntr)=icl |
| 3786 |
c$$$ nnnnn = npfastrips(icl,PFA,angx) |
|
|
c$$$ xbad(ip,ntr) = nbadstrips(nnnnn,icl) |
|
| 3787 |
xbad(ip,ntr) = nbadstrips(4,icl) |
xbad(ip,ntr) = nbadstrips(4,icl) |
| 3788 |
|
|
| 3789 |
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
| 3790 |
|
|
| 3791 |
|
multmaxx(ip,ntr) = maxs(cltrx(ip,ntr)) |
| 3792 |
|
$ +10000*mult(cltrx(ip,ntr)) |
| 3793 |
|
seedx(ip,ntr) = clsignal(indmax(cltrx(ip,ntr))) |
| 3794 |
|
$ /clsigma(indmax(cltrx(ip,ntr))) |
| 3795 |
|
call applypfa(PFA,cltrx(ip,ntr),angx,corr,res) |
| 3796 |
|
xpu(ip,ntr) = corr |
| 3797 |
|
|
| 3798 |
elseif(mod(VIEW(icl),2).eq.1)then |
elseif(mod(VIEW(icl),2).eq.1)then |
| 3799 |
cltry(ip,ntr)=icl |
cltry(ip,ntr)=icl |
| 3800 |
c$$$ nnnnn = npfastrips(icl,PFA,angy) |
|
|
c$$$ ybad(ip,ntr) = nbadstrips(nnnnn,icl) |
|
| 3801 |
ybad(ip,ntr) = nbadstrips(4,icl) |
ybad(ip,ntr) = nbadstrips(4,icl) |
| 3802 |
|
|
| 3803 |
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
| 3804 |
|
|
| 3805 |
|
multmaxy(ip,ntr) = maxs(cltry(ip,ntr)) |
| 3806 |
|
$ +10000*mult(cltry(ip,ntr)) |
| 3807 |
|
seedy(ip,ntr) = clsignal(indmax(cltry(ip,ntr))) |
| 3808 |
|
$ /clsigma(indmax(cltry(ip,ntr))) |
| 3809 |
|
call applypfa(PFA,cltry(ip,ntr),angy,corr,res) |
| 3810 |
|
ypu(ip,ntr) = corr |
| 3811 |
|
|
| 3812 |
endif |
endif |
| 3813 |
|
|
| 3814 |
endif |
endif |
| 3815 |
|
|
| 3816 |
enddo |
enddo |
| 3817 |
|
|
| 3818 |
|
if(DEBUG.eq.1)then |
| 3819 |
|
print*,'> STORING TRACK ',ntr |
| 3820 |
|
print*,'clusters: ' |
| 3821 |
|
do ip=1,6 |
| 3822 |
|
print*,'> ',ip,' -- ',cltrx(ip,ntr),cltry(ip,ntr) |
| 3823 |
|
enddo |
| 3824 |
|
endif |
| 3825 |
|
|
| 3826 |
c$$$ print*,(xgood(i),i=1,6) |
c$$$ print*,(xgood(i),i=1,6) |
| 3827 |
c$$$ print*,(ygood(i),i=1,6) |
c$$$ print*,(ygood(i),i=1,6) |
| 3856 |
good2(iv) = good2(iv) + mask_view(iv)*2**8 |
good2(iv) = good2(iv) + mask_view(iv)*2**8 |
| 3857 |
enddo |
enddo |
| 3858 |
|
|
| 3859 |
|
if(DEBUG.eq.1)then |
| 3860 |
|
print*,'> STORING SINGLETS ' |
| 3861 |
|
endif |
| 3862 |
|
|
| 3863 |
do icl=1,nclstr1 |
do icl=1,nclstr1 |
| 3864 |
|
|
| 3865 |
|
ip=nplanes-npl(VIEW(icl))+1 |
| 3866 |
|
|
| 3867 |
if(cl_used(icl).eq.0)then !cluster not included in any track |
if(cl_used(icl).eq.0)then !cluster not included in any track |
|
ip=nplanes-npl(VIEW(icl))+1 |
|
| 3868 |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
| 3869 |
nclsx = nclsx + 1 |
nclsx = nclsx + 1 |
| 3870 |
planex(nclsx) = ip |
planex(nclsx) = ip |
| 3904 |
|
|
| 3905 |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
| 3906 |
whichtrack(icl) = cl_used(icl) |
whichtrack(icl) = cl_used(icl) |
| 3907 |
|
* -------------------------------------------------- |
| 3908 |
|
* per non perdere la testa... |
| 3909 |
|
* whichtrack(icl) e` una variabile del common level1 |
| 3910 |
|
* che serve solo per sapere quali cluster sono stati |
| 3911 |
|
* associati ad una traccia, e permettere di salvare |
| 3912 |
|
* solo questi nell'albero di uscita |
| 3913 |
|
* -------------------------------------------------- |
| 3914 |
|
|
| 3915 |
|
|
| 3916 |
|
c$$$ print*,' cl ',icl,' --> ',cl_used(icl) |
| 3917 |
|
c$$$ |
| 3918 |
|
c$$$ if( cl_used(icl).ne.0 )then |
| 3919 |
|
c$$$ if( |
| 3920 |
|
c$$$ $ mod(VIEW(icl),2).eq.0.and. |
| 3921 |
|
c$$$ $ cltrx(ip,whichtrack(icl)).ne.icl ) |
| 3922 |
|
c$$$ $ print*,'**WARNING** cltrx(',ip,',',whichtrack(icl) |
| 3923 |
|
c$$$ $ ,')=',cltrx(ip,whichtrack(icl)),'.ne.',icl |
| 3924 |
|
c$$$ if( |
| 3925 |
|
c$$$ $ mod(VIEW(icl),2).eq.1.and. |
| 3926 |
|
c$$$ $ cltry(ip,whichtrack(icl)).ne.icl ) |
| 3927 |
|
c$$$ $ print*,'**WARNING** cltry(',ip,',',whichtrack(icl) |
| 3928 |
|
c$$$ $ ,')=',cltry(ip,whichtrack(icl)),'.ne.',icl |
| 3929 |
|
c$$$ endif |
| 3930 |
|
|
| 3931 |
|
|
| 3932 |
enddo |
enddo |
| 3933 |
end |
end |