| 20 |
include 'calib.f' |
include 'calib.f' |
| 21 |
include 'level2.f' |
include 'level2.f' |
| 22 |
|
|
| 23 |
c include 'momanhough_init.f' |
|
| 24 |
|
|
| 25 |
|
c print*,'======================================================' |
| 26 |
|
c$$$ do ic=1,NCLSTR1 |
| 27 |
|
c$$$ if(.false. |
| 28 |
|
c$$$ $ .or.nsatstrips(ic).gt.0 |
| 29 |
|
c$$$c $ .or.nbadstrips(0,ic).gt.0 |
| 30 |
|
c$$$c $ .or.nbadstrips(4,ic).gt.0 |
| 31 |
|
c$$$c $ .or.nbadstrips(3,ic).gt.0 |
| 32 |
|
c$$$ $ .or..false.)then |
| 33 |
|
c$$$ print*,'--- cl-',ic,' ------------------------' |
| 34 |
|
c$$$ istart = INDSTART(IC) |
| 35 |
|
c$$$ istop = TOTCLLENGTH |
| 36 |
|
c$$$ if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
| 37 |
|
c$$$ print*,'ADC ',(CLADC(i),i=istart,istop) |
| 38 |
|
c$$$ print*,'s/n ',(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
| 39 |
|
c$$$ print*,'sgnl ',(CLSIGNAL(i),i=istart,istop) |
| 40 |
|
c$$$ print*,'strip ',(i-INDMAX(ic),i=istart,istop) |
| 41 |
|
c$$$ print*,'view ',VIEW(ic) |
| 42 |
|
c$$$ print*,'maxs ',MAXS(ic) |
| 43 |
|
c$$$ print*,'COG4 ',cog(4,ic) |
| 44 |
|
c$$$ ff = fbad_cog(4,ic) |
| 45 |
|
c$$$ print*,'fbad ',ff |
| 46 |
|
c$$$ print*,(CLBAD(i),i=istart,istop) |
| 47 |
|
c$$$ bb=nbadstrips(0,ic) |
| 48 |
|
c$$$ print*,'#BAD (tot)',bb |
| 49 |
|
c$$$ bb=nbadstrips(4,ic) |
| 50 |
|
c$$$ print*,'#BAD (4)',bb |
| 51 |
|
c$$$ bb=nbadstrips(3,ic) |
| 52 |
|
c$$$ print*,'#BAD (3)',bb |
| 53 |
|
c$$$ ss=nsatstrips(ic) |
| 54 |
|
c$$$ print*,'#saturated ',ss |
| 55 |
|
c$$$ endif |
| 56 |
|
c$$$ enddo |
| 57 |
|
|
| 58 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
| 59 |
* STEP 1 |
* STEP 1 |
| 74 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
| 75 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
| 76 |
|
|
| 77 |
c iflag=0 |
|
| 78 |
call cl_to_couples(iflag) |
call cl_to_couples(iflag) |
| 79 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
| 80 |
goto 880 !go to next event |
goto 880 !go to next event |
| 108 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
| 109 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
| 110 |
|
|
| 111 |
c iflag=0 |
|
| 112 |
call cp_to_doubtrip(iflag) |
call cp_to_doubtrip(iflag) |
| 113 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
| 114 |
goto 880 !go to next event |
goto 880 !go to next event |
| 272 |
* 2nd) increasing chi**2 |
* 2nd) increasing chi**2 |
| 273 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
| 274 |
rchi2best=1000000000. |
rchi2best=1000000000. |
| 275 |
ndofbest=0 !(1) |
ndofbest=0 |
| 276 |
do i=1,ntracks |
do i=1,ntracks |
| 277 |
ndof=0 !(1) |
ndof=0 |
| 278 |
do ii=1,nplanes !(1) |
do ii=1,nplanes |
| 279 |
ndof=ndof !(1) |
ndof=ndof |
| 280 |
$ +int(xgood_store(ii,i)) !(1) |
$ +int(xgood_store(ii,i)) |
| 281 |
$ +int(ygood_store(ii,i)) !(1) |
$ +int(ygood_store(ii,i)) |
| 282 |
enddo !(1) |
enddo |
| 283 |
if(ndof.gt.ndofbest)then !(1) |
if(ndof.gt.ndofbest)then |
| 284 |
ibest=i |
ibest=i |
| 285 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
| 286 |
ndofbest=ndof !(1) |
ndofbest=ndof |
| 287 |
elseif(ndof.eq.ndofbest)then !(1) |
elseif(ndof.eq.ndofbest)then |
| 288 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
if(RCHI2_STORE(i).lt.rchi2best.and. |
| 289 |
$ RCHI2_STORE(i).gt.0)then |
$ RCHI2_STORE(i).gt.0)then |
| 290 |
ibest=i |
ibest=i |
| 291 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
| 292 |
ndofbest=ndof !(1) |
ndofbest=ndof |
| 293 |
endif !(1) |
endif |
| 294 |
endif |
endif |
| 295 |
enddo |
enddo |
| 296 |
|
|
| 331 |
iimage=0 |
iimage=0 |
| 332 |
endif |
endif |
| 333 |
if(icand.eq.0)then |
if(icand.eq.0)then |
| 334 |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
if(VERBOSE)then |
| 335 |
$ ,ibest,iimage |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
| 336 |
|
$ ,ibest,iimage |
| 337 |
|
endif |
| 338 |
return |
return |
| 339 |
endif |
endif |
| 340 |
|
|
| 558 |
include 'commontracker.f' |
include 'commontracker.f' |
| 559 |
include 'level1.f' |
include 'level1.f' |
| 560 |
include 'calib.f' |
include 'calib.f' |
|
c include 'level1.f' |
|
| 561 |
include 'common_align.f' |
include 'common_align.f' |
| 562 |
include 'common_mech.f' |
include 'common_mech.f' |
| 563 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
|
c include 'common_resxy.f' |
|
|
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
| 564 |
|
|
| 565 |
integer icx,icy !X-Y cluster ID |
integer icx,icy !X-Y cluster ID |
| 566 |
integer sensor |
integer sensor |
| 575 |
double precision xrt,yrt,zrt |
double precision xrt,yrt,zrt |
| 576 |
double precision xrt_A,yrt_A,zrt_A |
double precision xrt_A,yrt_A,zrt_A |
| 577 |
double precision xrt_B,yrt_B,zrt_B |
double precision xrt_B,yrt_B,zrt_B |
|
c double precision xi,yi,zi |
|
|
c double precision xi_A,yi_A,zi_A |
|
|
c double precision xi_B,yi_B,zi_B |
|
| 578 |
|
|
| 579 |
|
|
| 580 |
parameter (ndivx=30) |
parameter (ndivx=30) |
| 581 |
|
|
| 582 |
|
|
| 583 |
|
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
| 584 |
|
|
| 585 |
resxPAM = 0 |
resxPAM = 0 |
| 586 |
resyPAM = 0 |
resyPAM = 0 |
| 595 |
yPAM_B = 0. |
yPAM_B = 0. |
| 596 |
zPAM_B = 0. |
zPAM_B = 0. |
| 597 |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
| 598 |
|
|
| 599 |
|
if(sensor.lt.1.or.sensor.gt.2)then |
| 600 |
|
print*,'xyz_PAM ***ERROR*** wrong input ' |
| 601 |
|
print*,'sensor ',sensor |
| 602 |
|
icx=0 |
| 603 |
|
icy=0 |
| 604 |
|
endif |
| 605 |
|
|
| 606 |
* ----------------- |
* ----------------- |
| 607 |
* CLUSTER X |
* CLUSTER X |
| 608 |
* ----------------- |
* ----------------- |
|
|
|
| 609 |
if(icx.ne.0)then |
if(icx.ne.0)then |
| 610 |
|
|
| 611 |
viewx = VIEW(icx) |
viewx = VIEW(icx) |
| 612 |
nldx = nld(MAXS(icx),VIEW(icx)) |
nldx = nld(MAXS(icx),VIEW(icx)) |
| 613 |
nplx = npl(VIEW(icx)) |
nplx = npl(VIEW(icx)) |
| 614 |
resxPAM = RESXAV |
resxPAM = RESXAV |
| 615 |
stripx = float(MAXS(icx)) |
stripx = float(MAXS(icx)) |
| 616 |
|
|
| 617 |
|
if( |
| 618 |
|
$ viewx.lt.1.or. |
| 619 |
|
$ viewx.gt.12.or. |
| 620 |
|
$ nldx.lt.1.or. |
| 621 |
|
$ nldx.gt.3.or. |
| 622 |
|
$ stripx.lt.1.or. |
| 623 |
|
$ stripx.gt.3072.or. |
| 624 |
|
$ .false.)then |
| 625 |
|
print*,'xyz_PAM ***ERROR*** wrong input ' |
| 626 |
|
print*,'icx ',icx,'view ',viewx,'nld ',nldx,'strip ',stripx |
| 627 |
|
icx = 0 |
| 628 |
|
goto 10 |
| 629 |
|
endif |
| 630 |
|
|
| 631 |
* -------------------------- |
* -------------------------- |
| 632 |
* magnetic-field corrections |
* magnetic-field corrections |
| 633 |
* -------------------------- |
* -------------------------- |
|
c$$$ print*,nplx,ax,bfy/10. |
|
| 634 |
angtemp = ax |
angtemp = ax |
| 635 |
bfytemp = bfy |
bfytemp = bfy |
| 636 |
if(nplx.eq.6) angtemp = -1. * ax |
* ///////////////////////////////// |
| 637 |
if(nplx.eq.6) bfytemp = -1. * bfy |
* AAAAHHHHHHHH!!!!!!!!!!!!!!!!!!!!! |
| 638 |
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
* *grvzkkjsdgjhhhgngbn###>:( |
| 639 |
angx = 180.*atan(tgtemp)/acos(-1.) |
* ///////////////////////////////// |
| 640 |
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
c if(nplx.eq.6) angtemp = -1. * ax |
| 641 |
|
c if(nplx.eq.6) bfytemp = -1. * bfy |
| 642 |
|
if(viewx.eq.12) angtemp = -1. * ax |
| 643 |
|
if(viewx.eq.12) bfytemp = -1. * bfy |
| 644 |
|
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
| 645 |
|
angx = 180.*atan(tgtemp)/acos(-1.) |
| 646 |
|
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
| 647 |
|
c$$$ print*,nplx,ax,bfy/10. |
| 648 |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
| 649 |
c$$$ print*,'========================' |
c$$$ print*,'========================' |
| 650 |
|
c$$$ if(bfy.ne.0.)print*,viewx,'-x- ' |
| 651 |
|
c$$$ $ ,bfy,-1*0.5*pmuH_h*bfytemp*0.00001*SiDimZ |
| 652 |
* -------------------------- |
* -------------------------- |
| 653 |
|
|
| 654 |
|
c$$$ print*,'--- x-cl ---' |
| 655 |
|
c$$$ istart = INDSTART(ICX) |
| 656 |
|
c$$$ istop = TOTCLLENGTH |
| 657 |
|
c$$$ if(icx.lt.NCLSTR1)istop=INDSTART(ICX+1)-1 |
| 658 |
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
| 659 |
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
| 660 |
|
c$$$ print*,INDMAX(icx) |
| 661 |
|
c$$$ print*,cog(4,icx) |
| 662 |
|
c$$$ print*,fbad_cog(4,icx) |
| 663 |
|
|
| 664 |
|
|
| 665 |
if(PFAx.eq.'COG1')then |
if(PFAx.eq.'COG1')then |
| 666 |
stripx = stripx |
|
| 667 |
resxPAM = resxPAM |
stripx = stripx |
| 668 |
|
resxPAM = 1e-4*pitchX/sqrt(12.)!!resxPAM |
| 669 |
|
|
| 670 |
elseif(PFAx.eq.'COG2')then |
elseif(PFAx.eq.'COG2')then |
| 671 |
stripx = stripx + cog(2,icx) |
|
| 672 |
|
stripx = stripx + cog(2,icx) |
| 673 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
| 674 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
| 675 |
|
|
| 676 |
elseif(PFAx.eq.'COG3')then |
elseif(PFAx.eq.'COG3')then |
| 677 |
stripx = stripx + cog(3,icx) |
|
| 678 |
|
stripx = stripx + cog(3,icx) |
| 679 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
| 680 |
resxPAM = resxPAM*fbad_cog(3,icx) |
resxPAM = resxPAM*fbad_cog(3,icx) |
| 681 |
|
|
| 682 |
elseif(PFAx.eq.'COG4')then |
elseif(PFAx.eq.'COG4')then |
| 683 |
c print*,'COG4' |
|
| 684 |
stripx = stripx + cog(4,icx) |
stripx = stripx + cog(4,icx) |
| 685 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
| 686 |
resxPAM = resxPAM*fbad_cog(4,icx) |
resxPAM = resxPAM*fbad_cog(4,icx) |
| 687 |
|
|
| 688 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
| 689 |
stripx = stripx + pfaeta2(icx,angx) |
|
| 690 |
resxPAM = risx_eta2(abs(angx)) |
stripx = stripx + pfaeta2(icx,angx) |
| 691 |
|
resxPAM = risxeta2(abs(angx)) |
| 692 |
|
resxPAM = resxPAM*fbad_cog(2,icx) |
| 693 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
| 694 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 695 |
resxPAM = resxPAM*fbad_cog(2,icx) |
|
| 696 |
elseif(PFAx.eq.'ETA3')then |
elseif(PFAx.eq.'ETA3')then |
| 697 |
stripx = stripx + pfaeta3(icx,angx) |
|
| 698 |
resxPAM = risx_eta3(abs(angx)) |
stripx = stripx + pfaeta3(icx,angx) |
| 699 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) |
resxPAM = risxeta3(abs(angx)) |
|
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
|
| 700 |
resxPAM = resxPAM*fbad_cog(3,icx) |
resxPAM = resxPAM*fbad_cog(3,icx) |
| 701 |
|
c if(DEBUG.and.fbad_cog(3,icx).ne.1) |
| 702 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
| 703 |
|
|
| 704 |
elseif(PFAx.eq.'ETA4')then |
elseif(PFAx.eq.'ETA4')then |
| 705 |
stripx = stripx + pfaeta4(icx,angx) |
|
| 706 |
resxPAM = risx_eta4(abs(angx)) |
stripx = stripx + pfaeta4(icx,angx) |
| 707 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) |
resxPAM = risxeta4(abs(angx)) |
|
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
|
| 708 |
resxPAM = resxPAM*fbad_cog(4,icx) |
resxPAM = resxPAM*fbad_cog(4,icx) |
| 709 |
|
c if(DEBUG.and.fbad_cog(4,icx).ne.1) |
| 710 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
| 711 |
|
|
| 712 |
elseif(PFAx.eq.'ETA')then |
elseif(PFAx.eq.'ETA')then |
| 713 |
c print*,'ETA' |
|
| 714 |
stripx = stripx + pfaeta(icx,angx) |
stripx = stripx + pfaeta(icx,angx) |
| 715 |
resxPAM = ris_eta(icx,angx) |
c resxPAM = riseta(icx,angx) |
| 716 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
resxPAM = riseta(viewx,angx) |
| 717 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_eta(icx,angx) |
| 718 |
|
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
| 719 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 720 |
|
|
| 721 |
|
elseif(PFAx.eq.'ETAL')then |
| 722 |
|
|
| 723 |
|
stripx = stripx + pfaetal(icx,angx) |
| 724 |
|
resxPAM = riseta(viewx,angx) |
| 725 |
resxPAM = resxPAM*fbad_eta(icx,angx) |
resxPAM = resxPAM*fbad_eta(icx,angx) |
| 726 |
|
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
| 727 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 728 |
|
|
| 729 |
elseif(PFAx.eq.'COG')then |
elseif(PFAx.eq.'COG')then |
| 730 |
stripx = stripx + cog(0,icx) |
|
| 731 |
|
stripx = stripx + cog(0,icx) |
| 732 |
resxPAM = risx_cog(abs(angx)) |
resxPAM = risx_cog(abs(angx)) |
| 733 |
resxPAM = resxPAM*fbad_cog(0,icx) |
resxPAM = resxPAM*fbad_cog(0,icx) |
| 734 |
|
|
| 735 |
else |
else |
| 736 |
print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
| 737 |
endif |
endif |
| 738 |
|
|
|
c print*,'%%%%%%%%%%%%' |
|
| 739 |
|
|
| 740 |
endif |
* ====================================== |
| 741 |
|
* temporary patch for saturated clusters |
| 742 |
|
* ====================================== |
| 743 |
|
if( nsatstrips(icx).gt.0 )then |
| 744 |
|
stripx = stripx + cog(4,icx) |
| 745 |
|
resxPAM = pitchX*1e-4/sqrt(12.) |
| 746 |
|
cc=cog(4,icx) |
| 747 |
|
c$$$ print*,icx,' *** ',cc |
| 748 |
|
c$$$ print*,icx,' *** ',resxPAM |
| 749 |
|
endif |
| 750 |
|
|
| 751 |
|
10 endif |
| 752 |
|
|
| 753 |
|
|
| 754 |
* ----------------- |
* ----------------- |
| 755 |
* CLUSTER Y |
* CLUSTER Y |
| 756 |
* ----------------- |
* ----------------- |
| 763 |
resyPAM = RESYAV |
resyPAM = RESYAV |
| 764 |
stripy = float(MAXS(icy)) |
stripy = float(MAXS(icy)) |
| 765 |
|
|
| 766 |
|
if( |
| 767 |
|
$ viewy.lt.1.or. |
| 768 |
|
$ viewy.gt.12.or. |
| 769 |
|
$ nldy.lt.1.or. |
| 770 |
|
$ nldy.gt.3.or. |
| 771 |
|
$ stripy.lt.1.or. |
| 772 |
|
$ stripy.gt.3072.or. |
| 773 |
|
$ .false.)then |
| 774 |
|
print*,'xyz_PAM ***ERROR*** wrong input ' |
| 775 |
|
print*,'icy ',icy,'view ',viewy,'nld ',nldy,'strip ',stripy |
| 776 |
|
icy = 0 |
| 777 |
|
goto 20 |
| 778 |
|
endif |
| 779 |
|
|
| 780 |
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 |
| 781 |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
if(DEBUG) then |
| 782 |
$ ,icx,icy |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
| 783 |
|
$ ,icx,icy |
| 784 |
|
endif |
| 785 |
goto 100 |
goto 100 |
| 786 |
endif |
endif |
| 787 |
* -------------------------- |
* -------------------------- |
| 790 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
| 791 |
angy = 180.*atan(tgtemp)/acos(-1.) |
angy = 180.*atan(tgtemp)/acos(-1.) |
| 792 |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
| 793 |
|
c$$$ if(bfx.ne.0.)print*,viewy,'-y- ' |
| 794 |
|
c$$$ $ ,bfx,0.5*pmuH_e*bfx*0.00001*SiDimZ |
| 795 |
* -------------------------- |
* -------------------------- |
| 796 |
|
|
| 797 |
if(PFAy.eq.'COG1')then !(1) |
c$$$ print*,'--- y-cl ---' |
| 798 |
stripy = stripy !(1) |
c$$$ istart = INDSTART(ICY) |
| 799 |
resyPAM = resyPAM !(1) |
c$$$ istop = TOTCLLENGTH |
| 800 |
|
c$$$ if(icy.lt.NCLSTR1)istop=INDSTART(ICY+1)-1 |
| 801 |
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
| 802 |
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
| 803 |
|
c$$$ print*,INDMAX(icy) |
| 804 |
|
c$$$ print*,cog(4,icy) |
| 805 |
|
c$$$ print*,fbad_cog(4,icy) |
| 806 |
|
|
| 807 |
|
if(PFAy.eq.'COG1')then |
| 808 |
|
|
| 809 |
|
stripy = stripy |
| 810 |
|
resyPAM = 1e-4*pitchY/sqrt(12.)!resyPAM |
| 811 |
|
|
| 812 |
elseif(PFAy.eq.'COG2')then |
elseif(PFAy.eq.'COG2')then |
| 813 |
stripy = stripy + cog(2,icy) |
|
| 814 |
|
stripy = stripy + cog(2,icy) |
| 815 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
| 816 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
| 817 |
|
|
| 818 |
elseif(PFAy.eq.'COG3')then |
elseif(PFAy.eq.'COG3')then |
| 819 |
stripy = stripy + cog(3,icy) |
|
| 820 |
|
stripy = stripy + cog(3,icy) |
| 821 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
| 822 |
resyPAM = resyPAM*fbad_cog(3,icy) |
resyPAM = resyPAM*fbad_cog(3,icy) |
| 823 |
|
|
| 824 |
elseif(PFAy.eq.'COG4')then |
elseif(PFAy.eq.'COG4')then |
| 825 |
stripy = stripy + cog(4,icy) |
|
| 826 |
|
stripy = stripy + cog(4,icy) |
| 827 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
| 828 |
resyPAM = resyPAM*fbad_cog(4,icy) |
resyPAM = resyPAM*fbad_cog(4,icy) |
| 829 |
|
|
| 830 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
| 831 |
c cog2 = cog(2,icy) |
|
| 832 |
c etacorr = pfaeta2(cog2,viewy,nldy,angy) |
stripy = stripy + pfaeta2(icy,angy) |
| 833 |
c stripy = stripy + etacorr |
resyPAM = risyeta2(abs(angy)) |
|
stripy = stripy + pfaeta2(icy,angy) !(3) |
|
|
resyPAM = risy_eta2(abs(angy)) ! (4) |
|
| 834 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
| 835 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 836 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 837 |
elseif(PFAy.eq.'ETA3')then !(3) |
|
| 838 |
stripy = stripy + pfaeta3(icy,angy) !(3) |
elseif(PFAy.eq.'ETA3')then |
| 839 |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
|
| 840 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
stripy = stripy + pfaeta3(icy,angy) |
| 841 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
resyPAM = resyPAM*fbad_cog(3,icy) |
| 842 |
elseif(PFAy.eq.'ETA4')then !(3) |
c if(DEBUG.and.fbad_cog(3,icy).ne.1) |
| 843 |
stripy = stripy + pfaeta4(icy,angy) !(3) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
| 844 |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
|
| 845 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
elseif(PFAy.eq.'ETA4')then |
| 846 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
|
| 847 |
elseif(PFAy.eq.'ETA')then !(3) |
stripy = stripy + pfaeta4(icy,angy) |
| 848 |
stripy = stripy + pfaeta(icy,angy) !(3) |
resyPAM = resyPAM*fbad_cog(4,icy) |
| 849 |
resyPAM = ris_eta(icy,angy) ! (4) |
c if(DEBUG.and.fbad_cog(4,icy).ne.1) |
| 850 |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
| 851 |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
|
| 852 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) !(3) |
elseif(PFAy.eq.'ETA')then |
| 853 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy)!(3) |
|
| 854 |
|
stripy = stripy + pfaeta(icy,angy) |
| 855 |
|
c resyPAM = riseta(icy,angy) |
| 856 |
|
resyPAM = riseta(viewy,angy) |
| 857 |
|
resyPAM = resyPAM*fbad_eta(icy,angy) |
| 858 |
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 859 |
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 860 |
|
|
| 861 |
|
elseif(PFAy.eq.'ETAL')then |
| 862 |
|
|
| 863 |
|
stripy = stripy + pfaetal(icy,angy) |
| 864 |
|
resyPAM = riseta(viewy,angy) |
| 865 |
|
resyPAM = resyPAM*fbad_eta(icy,angy) |
| 866 |
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 867 |
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 868 |
|
|
| 869 |
elseif(PFAy.eq.'COG')then |
elseif(PFAy.eq.'COG')then |
| 870 |
stripy = stripy + cog(0,icy) |
|
| 871 |
resyPAM = risy_cog(abs(angy)) ! (4) |
stripy = stripy + cog(0,icy) |
| 872 |
c resyPAM = ris_eta(icy,angy) ! (4) |
resyPAM = risy_cog(abs(angy)) |
| 873 |
resyPAM = resyPAM*fbad_cog(0,icy) |
resyPAM = resyPAM*fbad_cog(0,icy) |
| 874 |
|
|
| 875 |
else |
else |
| 876 |
print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
| 877 |
endif |
endif |
| 878 |
|
|
|
endif |
|
| 879 |
|
|
| 880 |
c print*,'## stripx,stripy ',stripx,stripy |
* ====================================== |
| 881 |
|
* temporary patch for saturated clusters |
| 882 |
|
* ====================================== |
| 883 |
|
if( nsatstrips(icy).gt.0 )then |
| 884 |
|
stripy = stripy + cog(4,icy) |
| 885 |
|
resyPAM = pitchY*1e-4/sqrt(12.) |
| 886 |
|
cc=cog(4,icy) |
| 887 |
|
c$$$ print*,icy,' *** ',cc |
| 888 |
|
c$$$ print*,icy,' *** ',resyPAM |
| 889 |
|
endif |
| 890 |
|
|
| 891 |
|
|
| 892 |
|
20 endif |
| 893 |
|
|
| 894 |
|
c$$$ print*,'## stripx,stripy ',stripx,stripy |
| 895 |
|
|
| 896 |
c=========================================================== |
c=========================================================== |
| 897 |
C COUPLE |
C COUPLE |
| 903 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 904 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 905 |
$ .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... |
| 906 |
print*,'xyz_PAM (couple):', |
if(DEBUG) then |
| 907 |
$ ' WARNING: false X strip: strip ',stripx |
print*,'xyz_PAM (couple):', |
| 908 |
|
$ ' WARNING: false X strip: strip ',stripx |
| 909 |
|
endif |
| 910 |
endif |
endif |
| 911 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
| 912 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
| 998 |
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... |
| 999 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 1000 |
$ .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... |
| 1001 |
print*,'xyz_PAM (X-singlet):', |
if(DEBUG) then |
| 1002 |
$ ' WARNING: false X strip: strip ',stripx |
print*,'xyz_PAM (X-singlet):', |
| 1003 |
|
$ ' WARNING: false X strip: strip ',stripx |
| 1004 |
|
endif |
| 1005 |
endif |
endif |
| 1006 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
| 1007 |
|
|
| 1023 |
c print*,yi_A,' <--> ',yi_B |
c print*,yi_A,' <--> ',yi_B |
| 1024 |
|
|
| 1025 |
else |
else |
| 1026 |
|
if(DEBUG) then |
| 1027 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
| 1028 |
print *,'icx = ',icx |
print *,'icx = ',icx |
| 1029 |
print *,'icy = ',icy |
print *,'icy = ',icy |
| 1030 |
|
endif |
| 1031 |
goto 100 |
goto 100 |
| 1032 |
|
|
| 1033 |
endif |
endif |
| 1092 |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
| 1093 |
|
|
| 1094 |
else |
else |
| 1095 |
|
if(DEBUG) then |
| 1096 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
| 1097 |
print *,'icx = ',icx |
print *,'icx = ',icx |
| 1098 |
print *,'icy = ',icy |
print *,'icy = ',icy |
| 1099 |
|
endif |
| 1100 |
endif |
endif |
| 1101 |
|
|
| 1102 |
|
|
| 1107 |
100 continue |
100 continue |
| 1108 |
end |
end |
| 1109 |
|
|
| 1110 |
|
************************************************************************ |
| 1111 |
|
* Call xyz_PAM subroutine with default PFA and fill the mini2 common. |
| 1112 |
|
* (done to be called from c/c++) |
| 1113 |
|
************************************************************************ |
| 1114 |
|
|
| 1115 |
|
subroutine xyzpam(ip,icx,icy,lad,sensor,ax,ay,bfx,bfy) |
| 1116 |
|
|
| 1117 |
|
include 'commontracker.f' |
| 1118 |
|
include 'level1.f' |
| 1119 |
|
include 'common_mini_2.f' |
| 1120 |
|
include 'common_xyzPAM.f' |
| 1121 |
|
include 'common_mech.f' |
| 1122 |
|
include 'calib.f' |
| 1123 |
|
|
| 1124 |
|
* flag to chose PFA |
| 1125 |
|
c$$$ character*10 PFA |
| 1126 |
|
c$$$ common/FINALPFA/PFA |
| 1127 |
|
|
| 1128 |
|
integer icx,icy !X-Y cluster ID |
| 1129 |
|
integer sensor |
| 1130 |
|
character*4 PFAx,PFAy !PFA to be used |
| 1131 |
|
real ax,ay !X-Y geometric angle |
| 1132 |
|
real bfx,bfy !X-Y b-field components |
| 1133 |
|
|
| 1134 |
|
ipx=0 |
| 1135 |
|
ipy=0 |
| 1136 |
|
|
| 1137 |
|
c$$$ PFAx = 'COG4'!PFA |
| 1138 |
|
c$$$ PFAy = 'COG4'!PFA |
| 1139 |
|
|
| 1140 |
|
if(icx.gt.nclstr1.or.icy.gt.nclstr1)then |
| 1141 |
|
print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1142 |
|
$ ,' does not exists (nclstr1=',nclstr1,')' |
| 1143 |
|
icx = -1*icx |
| 1144 |
|
icy = -1*icy |
| 1145 |
|
return |
| 1146 |
|
|
| 1147 |
|
endif |
| 1148 |
|
|
| 1149 |
|
call idtoc(pfaid,PFAx) |
| 1150 |
|
call idtoc(pfaid,PFAy) |
| 1151 |
|
|
| 1152 |
|
c$$$ call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1153 |
|
|
| 1154 |
|
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
| 1155 |
|
|
| 1156 |
|
if(icx.ne.0.and.icy.ne.0)then |
| 1157 |
|
|
| 1158 |
|
ipx=npl(VIEW(icx)) |
| 1159 |
|
ipy=npl(VIEW(icy)) |
| 1160 |
|
c$$$ if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) |
| 1161 |
|
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1162 |
|
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
| 1163 |
|
|
| 1164 |
|
if( (nplanes-ipx+1).ne.ip )then |
| 1165 |
|
print*,'xyzpam: ***WARNING*** cluster ',icx |
| 1166 |
|
$ ,' does not belong to plane: ',ip |
| 1167 |
|
icx = -1*icx |
| 1168 |
|
return |
| 1169 |
|
endif |
| 1170 |
|
if( (nplanes-ipy+1).ne.ip )then |
| 1171 |
|
print*,'xyzpam: ***WARNING*** cluster ',icy |
| 1172 |
|
$ ,' does not belong to plane: ',ip |
| 1173 |
|
icy = -1*icy |
| 1174 |
|
return |
| 1175 |
|
endif |
| 1176 |
|
|
| 1177 |
|
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1178 |
|
|
| 1179 |
|
xgood(ip) = 1. |
| 1180 |
|
ygood(ip) = 1. |
| 1181 |
|
resx(ip) = resxPAM |
| 1182 |
|
resy(ip) = resyPAM |
| 1183 |
|
|
| 1184 |
|
xm(ip) = xPAM |
| 1185 |
|
ym(ip) = yPAM |
| 1186 |
|
zm(ip) = zPAM |
| 1187 |
|
xm_A(ip) = 0. |
| 1188 |
|
ym_A(ip) = 0. |
| 1189 |
|
xm_B(ip) = 0. |
| 1190 |
|
ym_B(ip) = 0. |
| 1191 |
|
|
| 1192 |
|
c zv(ip) = zPAM |
| 1193 |
|
|
| 1194 |
|
elseif(icx.eq.0.and.icy.ne.0)then |
| 1195 |
|
|
| 1196 |
|
ipy=npl(VIEW(icy)) |
| 1197 |
|
c$$$ if((nplanes-ipy+1).ne.ip) |
| 1198 |
|
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1199 |
|
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
| 1200 |
|
if( (nplanes-ipy+1).ne.ip )then |
| 1201 |
|
print*,'xyzpam: ***WARNING*** cluster ',icy |
| 1202 |
|
$ ,' does not belong to plane: ',ip |
| 1203 |
|
icy = -1*icy |
| 1204 |
|
return |
| 1205 |
|
endif |
| 1206 |
|
|
| 1207 |
|
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1208 |
|
|
| 1209 |
|
xgood(ip) = 0. |
| 1210 |
|
ygood(ip) = 1. |
| 1211 |
|
resx(ip) = 1000. |
| 1212 |
|
resy(ip) = resyPAM |
| 1213 |
|
|
| 1214 |
|
xm(ip) = -100. |
| 1215 |
|
ym(ip) = -100. |
| 1216 |
|
zm(ip) = (zPAM_A+zPAM_B)/2. |
| 1217 |
|
xm_A(ip) = xPAM_A |
| 1218 |
|
ym_A(ip) = yPAM_A |
| 1219 |
|
xm_B(ip) = xPAM_B |
| 1220 |
|
ym_B(ip) = yPAM_B |
| 1221 |
|
|
| 1222 |
|
c zv(ip) = (zPAM_A+zPAM_B)/2. |
| 1223 |
|
|
| 1224 |
|
elseif(icx.ne.0.and.icy.eq.0)then |
| 1225 |
|
|
| 1226 |
|
ipx=npl(VIEW(icx)) |
| 1227 |
|
c$$$ if((nplanes-ipx+1).ne.ip) |
| 1228 |
|
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1229 |
|
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
| 1230 |
|
|
| 1231 |
|
if( (nplanes-ipx+1).ne.ip )then |
| 1232 |
|
print*,'xyzpam: ***WARNING*** cluster ',icx |
| 1233 |
|
$ ,' does not belong to plane: ',ip |
| 1234 |
|
icx = -1*icx |
| 1235 |
|
return |
| 1236 |
|
endif |
| 1237 |
|
|
| 1238 |
|
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1239 |
|
|
| 1240 |
|
xgood(ip) = 1. |
| 1241 |
|
ygood(ip) = 0. |
| 1242 |
|
resx(ip) = resxPAM |
| 1243 |
|
resy(ip) = 1000. |
| 1244 |
|
|
| 1245 |
|
xm(ip) = -100. |
| 1246 |
|
ym(ip) = -100. |
| 1247 |
|
zm(ip) = (zPAM_A+zPAM_B)/2. |
| 1248 |
|
xm_A(ip) = xPAM_A |
| 1249 |
|
ym_A(ip) = yPAM_A |
| 1250 |
|
xm_B(ip) = xPAM_B |
| 1251 |
|
ym_B(ip) = yPAM_B |
| 1252 |
|
|
| 1253 |
|
c zv(ip) = (zPAM_A+zPAM_B)/2. |
| 1254 |
|
|
| 1255 |
|
else |
| 1256 |
|
|
| 1257 |
|
il = 2 |
| 1258 |
|
if(lad.ne.0)il=lad |
| 1259 |
|
is = 1 |
| 1260 |
|
if(sensor.ne.0)is=sensor |
| 1261 |
|
c print*,nplanes-ip+1,il,is |
| 1262 |
|
|
| 1263 |
|
xgood(ip) = 0. |
| 1264 |
|
ygood(ip) = 0. |
| 1265 |
|
resx(ip) = 1000. |
| 1266 |
|
resy(ip) = 1000. |
| 1267 |
|
|
| 1268 |
|
xm(ip) = -100. |
| 1269 |
|
ym(ip) = -100. |
| 1270 |
|
zm(ip) = z_mech_sensor(nplanes-ip+1,il,is)*1000./1.d4 |
| 1271 |
|
xm_A(ip) = 0. |
| 1272 |
|
ym_A(ip) = 0. |
| 1273 |
|
xm_B(ip) = 0. |
| 1274 |
|
ym_B(ip) = 0. |
| 1275 |
|
|
| 1276 |
|
c zv(ip) = z_mech_sensor(nplanes-ip+1,il,is)*1000./1.d4 |
| 1277 |
|
|
| 1278 |
|
endif |
| 1279 |
|
|
| 1280 |
|
if(DEBUG)then |
| 1281 |
|
c print*,'----------------------------- track coord' |
| 1282 |
|
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
| 1283 |
|
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
| 1284 |
|
$ ,xm_A(ip),ym_A(ip),xm_B(ip),ym_B(ip) |
| 1285 |
|
$ ,xgood(ip),ygood(ip),resx(ip),resy(ip) |
| 1286 |
|
c$$$ print*,'-----------------------------' |
| 1287 |
|
endif |
| 1288 |
|
end |
| 1289 |
|
|
| 1290 |
******************************************************************************** |
******************************************************************************** |
| 1291 |
******************************************************************************** |
******************************************************************************** |
| 1361 |
endif |
endif |
| 1362 |
|
|
| 1363 |
distance= |
distance= |
| 1364 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)!QUIQUI |
| 1365 |
|
cc $ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
| 1366 |
distance=dsqrt(distance) |
distance=dsqrt(distance) |
| 1367 |
|
|
| 1368 |
c$$$ print*,xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b |
c$$$ print*,xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b |
| 1387 |
* ---------------------- |
* ---------------------- |
| 1388 |
|
|
| 1389 |
distance= |
distance= |
| 1390 |
$ ((xPAM-XPP)/resxPAM)**2 |
$ ((xPAM-XPP))**2 !QUIQUI |
| 1391 |
$ + |
$ + |
| 1392 |
$ ((yPAM-YPP)/resyPAM)**2 |
$ ((yPAM-YPP))**2 |
| 1393 |
|
c$$$ $ ((xPAM-XPP)/resxPAM)**2 |
| 1394 |
|
c$$$ $ + |
| 1395 |
|
c$$$ $ ((yPAM-YPP)/resyPAM)**2 |
| 1396 |
distance=dsqrt(distance) |
distance=dsqrt(distance) |
| 1397 |
|
|
| 1398 |
c$$$ print*,xPAM,yPAM,zPAM |
c$$$ print*,xPAM,yPAM,zPAM |
| 1401 |
|
|
| 1402 |
else |
else |
| 1403 |
|
|
| 1404 |
print* |
c print* |
| 1405 |
$ ,' function distance_to ---> wrong usage!!!' |
c $ ,' function distance_to ---> wrong usage!!!' |
| 1406 |
print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
c print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
| 1407 |
print*,' xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b ' |
c print*,' xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b ' |
| 1408 |
$ ,xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b |
c $ ,xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b |
| 1409 |
endif |
endif |
| 1410 |
|
|
| 1411 |
distance_to = sngl(distance) |
distance_to = sngl(distance) |
| 1473 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 1474 |
$ .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... |
| 1475 |
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... |
| 1476 |
print*,'whichsensor: ', |
c print*,'whichsensor: ', |
| 1477 |
$ ' WARNING: false X strip: strip ',stripx |
c $ ' WARNING: false X strip: strip ',stripx |
| 1478 |
endif |
endif |
| 1479 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
| 1480 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
| 1629 |
is_cp=0 |
is_cp=0 |
| 1630 |
if(id.lt.0)is_cp=1 |
if(id.lt.0)is_cp=1 |
| 1631 |
if(id.gt.0)is_cp=2 |
if(id.gt.0)is_cp=2 |
| 1632 |
if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
c if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
| 1633 |
|
|
| 1634 |
return |
return |
| 1635 |
end |
end |
| 1758 |
* mask views with too many clusters |
* mask views with too many clusters |
| 1759 |
do iv=1,nviews |
do iv=1,nviews |
| 1760 |
if( ncl_view(iv).gt. nclusterlimit)then |
if( ncl_view(iv).gt. nclusterlimit)then |
| 1761 |
mask_view(iv) = 1 |
c mask_view(iv) = 1 |
| 1762 |
|
mask_view(iv) = mask_view(iv) + 2**0 |
| 1763 |
if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' |
if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' |
| 1764 |
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
| 1765 |
endif |
endif |
| 1904 |
$ 'couples on plane ',nplx, |
$ 'couples on plane ',nplx, |
| 1905 |
$ 'exceeds vector dimention ' |
$ 'exceeds vector dimention ' |
| 1906 |
$ ,'( ',ncouplemax,' ) --> masked!' |
$ ,'( ',ncouplemax,' ) --> masked!' |
| 1907 |
mask_view(nviewx(nplx)) = 2 |
c mask_view(nviewx(nplx)) = 2 |
| 1908 |
mask_view(nviewy(nply)) = 2 |
c mask_view(nviewy(nply)) = 2 |
| 1909 |
|
mask_view(nviewx(nplx))= mask_view(nviewx(nplx))+ 2**1 |
| 1910 |
|
mask_view(nviewy(nply))= mask_view(nviewy(nply))+ 2**1 |
| 1911 |
goto 10 |
goto 10 |
| 1912 |
endif |
endif |
| 1913 |
|
|
| 2008 |
* -------------------------------------------- |
* -------------------------------------------- |
| 2009 |
do ip=1,nplanes |
do ip=1,nplanes |
| 2010 |
if(ncp_plane(ip).gt.ncouplelimit)then |
if(ncp_plane(ip).gt.ncouplelimit)then |
| 2011 |
mask_view(nviewx(ip)) = 8 |
c mask_view(nviewx(ip)) = 8 |
| 2012 |
mask_view(nviewy(ip)) = 8 |
c mask_view(nviewy(ip)) = 8 |
| 2013 |
|
mask_view(nviewx(ip)) = mask_view(nviewx(ip)) + 2**7 |
| 2014 |
|
mask_view(nviewy(ip)) = mask_view(nviewy(ip)) + 2**7 |
| 2015 |
endif |
endif |
| 2016 |
enddo |
enddo |
| 2017 |
|
|
| 2064 |
c good2=.false. |
c good2=.false. |
| 2065 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
| 2066 |
do iv=1,12 |
do iv=1,12 |
| 2067 |
mask_view(iv) = 3 |
c mask_view(iv) = 3 |
| 2068 |
|
mask_view(iv) = mask_view(iv)+ 2**2 |
| 2069 |
enddo |
enddo |
| 2070 |
iflag=1 |
iflag=1 |
| 2071 |
return |
return |
| 2144 |
c good2=.false. |
c good2=.false. |
| 2145 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
| 2146 |
do iv=1,nviews |
do iv=1,nviews |
| 2147 |
mask_view(iv) = 4 |
c mask_view(iv) = 4 |
| 2148 |
|
mask_view(iv)=mask_view(iv)+ 2**3 |
| 2149 |
enddo |
enddo |
| 2150 |
iflag=1 |
iflag=1 |
| 2151 |
return |
return |
| 2379 |
c good2=.false. |
c good2=.false. |
| 2380 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
| 2381 |
do iv=1,nviews |
do iv=1,nviews |
| 2382 |
mask_view(iv) = 5 |
c mask_view(iv) = 5 |
| 2383 |
|
mask_view(iv) = mask_view(iv) + 2**4 |
| 2384 |
enddo |
enddo |
| 2385 |
iflag=1 |
iflag=1 |
| 2386 |
return |
return |
| 2590 |
enddo |
enddo |
| 2591 |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
| 2592 |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
| 2593 |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
if(nplused.lt.nplxz_min)goto 22288 !next triplet |
| 2594 |
|
|
| 2595 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
| 2596 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
| 2602 |
c good2=.false. |
c good2=.false. |
| 2603 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
| 2604 |
do iv=1,nviews |
do iv=1,nviews |
| 2605 |
mask_view(iv) = 6 |
c mask_view(iv) = 6 |
| 2606 |
|
mask_view(iv) = mask_view(iv) + 2**5 |
| 2607 |
enddo |
enddo |
| 2608 |
iflag=1 |
iflag=1 |
| 2609 |
return |
return |
| 2668 |
************************************************** |
************************************************** |
| 2669 |
|
|
| 2670 |
subroutine clouds_to_ctrack(iflag) |
subroutine clouds_to_ctrack(iflag) |
|
c***************************************************** |
|
|
c 02/02/2006 modified by Elena Vannuccini --> (1) |
|
|
c***************************************************** |
|
| 2671 |
|
|
| 2672 |
include 'commontracker.f' |
include 'commontracker.f' |
| 2673 |
include 'level1.f' |
include 'level1.f' |
| 2675 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
| 2676 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
| 2677 |
include 'common_mech.f' |
include 'common_mech.f' |
| 2678 |
c include 'momanhough_init.f' |
|
| 2679 |
|
|
| 2680 |
|
|
| 2681 |
* output flag |
* output flag |
| 2936 |
c good2=.false. |
c good2=.false. |
| 2937 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
| 2938 |
do iv=1,nviews |
do iv=1,nviews |
| 2939 |
mask_view(iv) = 7 |
c mask_view(iv) = 7 |
| 2940 |
|
mask_view(iv) = mask_view(iv) + 2**6 |
| 2941 |
enddo |
enddo |
| 2942 |
iflag=1 |
iflag=1 |
| 2943 |
return |
return |
| 2945 |
|
|
| 2946 |
ntracks = ntracks + 1 |
ntracks = ntracks + 1 |
| 2947 |
|
|
|
c$$$ ndof=0 |
|
| 2948 |
do ip=1,nplanes |
do ip=1,nplanes |
| 2949 |
c$$$ ndof=ndof |
|
|
c$$$ $ +int(xgood(ip)) |
|
|
c$$$ $ +int(ygood(ip)) |
|
| 2950 |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
| 2951 |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
| 2952 |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
| 2965 |
if(hit_plane(ip).ne.0)then |
if(hit_plane(ip).ne.0)then |
| 2966 |
CP_STORE(nplanes-ip+1,ntracks)= |
CP_STORE(nplanes-ip+1,ntracks)= |
| 2967 |
$ cp_match(ip,hit_plane(ip)) |
$ cp_match(ip,hit_plane(ip)) |
| 2968 |
|
SENSOR_STORE(nplanes-ip+1,ntracks) |
| 2969 |
|
$ = is_cp(cp_match(ip,hit_plane(ip))) |
| 2970 |
|
LADDER_STORE(nplanes-ip+1,ntracks) |
| 2971 |
|
$ = LADDER( |
| 2972 |
|
$ clx(ip,icp_cp( |
| 2973 |
|
$ cp_match(ip,hit_plane(ip) |
| 2974 |
|
$ )))); |
| 2975 |
else |
else |
| 2976 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
| 2977 |
|
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
| 2978 |
|
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
| 2979 |
endif |
endif |
| 2980 |
|
BX_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
| 2981 |
|
BY_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
| 2982 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
| 2983 |
do i=1,5 |
do i=1,5 |
| 2984 |
AL_STORE(i,ntracks)=sngl(AL(i)) |
AL_STORE(i,ntracks)=sngl(AL(i)) |
| 2985 |
enddo |
enddo |
| 2986 |
enddo |
enddo |
| 2987 |
|
|
|
c$$$ * Number of Degree Of Freedom |
|
|
c$$$ ndof=ndof-5 |
|
|
c$$$ * reduced chi^2 |
|
|
c$$$ rchi2=chi2/dble(ndof) |
|
| 2988 |
RCHI2_STORE(ntracks)=chi2 |
RCHI2_STORE(ntracks)=chi2 |
| 2989 |
|
|
| 2990 |
* -------------------------------- |
* -------------------------------- |
| 3008 |
return |
return |
| 3009 |
endif |
endif |
| 3010 |
|
|
| 3011 |
|
c$$$ if(DEBUG)then |
| 3012 |
|
c$$$ print*,'****** TRACK CANDIDATES ***********' |
| 3013 |
|
c$$$ print*,'# R. chi2 RIG' |
| 3014 |
|
c$$$ do i=1,ntracks |
| 3015 |
|
c$$$ print*,i,' --- ',rchi2_store(i),' --- ' |
| 3016 |
|
c$$$ $ ,1./abs(AL_STORE(5,i)) |
| 3017 |
|
c$$$ enddo |
| 3018 |
|
c$$$ print*,'***********************************' |
| 3019 |
|
c$$$ endif |
| 3020 |
if(DEBUG)then |
if(DEBUG)then |
| 3021 |
print*,'****** TRACK CANDIDATES ***********' |
print*,'****** TRACK CANDIDATES *****************' |
| 3022 |
print*,'# R. chi2 RIG' |
print*,'# R. chi2 RIG ndof' |
| 3023 |
do i=1,ntracks |
do i=1,ntracks |
| 3024 |
print*,i,' --- ',rchi2_store(i),' --- ' |
ndof=0 !(1) |
| 3025 |
$ ,1./abs(AL_STORE(5,i)) |
do ii=1,nplanes !(1) |
| 3026 |
enddo |
ndof=ndof !(1) |
| 3027 |
print*,'***********************************' |
$ +int(xgood_store(ii,i)) !(1) |
| 3028 |
|
$ +int(ygood_store(ii,i)) !(1) |
| 3029 |
|
enddo !(1) |
| 3030 |
|
print*,i,' --- ',rchi2_store(i),' --- ' |
| 3031 |
|
$ ,1./abs(AL_STORE(5,i)),' --- ',ndof |
| 3032 |
|
enddo |
| 3033 |
|
print*,'*****************************************' |
| 3034 |
endif |
endif |
| 3035 |
|
|
| 3036 |
|
|
| 3049 |
|
|
| 3050 |
subroutine refine_track(ibest) |
subroutine refine_track(ibest) |
| 3051 |
|
|
|
c****************************************************** |
|
|
cccccc 06/10/2005 modified by elena vannuccini ---> (1) |
|
|
cccccc 31/01/2006 modified by elena vannuccini ---> (2) |
|
|
cccccc 12/08/2006 modified by elena vannucicni ---> (3) |
|
|
c****************************************************** |
|
| 3052 |
|
|
| 3053 |
include 'commontracker.f' |
include 'commontracker.f' |
| 3054 |
include 'level1.f' |
include 'level1.f' |
| 3056 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
| 3057 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
| 3058 |
include 'common_mech.f' |
include 'common_mech.f' |
|
c include 'momanhough_init.f' |
|
|
c include 'level1.f' |
|
| 3059 |
include 'calib.f' |
include 'calib.f' |
| 3060 |
|
|
| 3061 |
* flag to chose PFA |
* flag to chose PFA |
| 3062 |
character*10 PFA |
character*10 PFA |
| 3063 |
common/FINALPFA/PFA |
common/FINALPFA/PFA |
| 3064 |
|
|
| 3065 |
|
real k(6) |
| 3066 |
|
DATA k/1.099730,0.418900,0.220939,0.220907,0.418771,1.100674/ |
| 3067 |
|
|
| 3068 |
real xp,yp,zp |
real xp,yp,zp |
| 3069 |
real xyzp(3),bxyz(3) |
real xyzp(3),bxyz(3) |
| 3070 |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
| 3081 |
yP=YV_STORE(nplanes-ip+1,ibest) |
yP=YV_STORE(nplanes-ip+1,ibest) |
| 3082 |
zP=ZV_STORE(nplanes-ip+1,ibest) |
zP=ZV_STORE(nplanes-ip+1,ibest) |
| 3083 |
call gufld(xyzp,bxyz) |
call gufld(xyzp,bxyz) |
| 3084 |
c$$$ bxyz(1)=0 |
BX_STORE(nplanes-ip+1,ibest)=bxyz(1) |
| 3085 |
|
BY_STORE(nplanes-ip+1,ibest)=bxyz(2) |
| 3086 |
|
c$$$ bxyz(1)=0 |
| 3087 |
c$$$ bxyz(2)=0 |
c$$$ bxyz(2)=0 |
| 3088 |
c$$$ bxyz(3)=0 |
c$$$ bxyz(3)=0 |
| 3089 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
| 3117 |
$ bxyz(1), |
$ bxyz(1), |
| 3118 |
$ bxyz(2) |
$ bxyz(2) |
| 3119 |
$ ) |
$ ) |
| 3120 |
c$$$ call xyz_PAM(icx,icy,is, |
|
|
c$$$ $ 'COG2','COG2', |
|
|
c$$$ $ 0., |
|
|
c$$$ $ 0.) |
|
| 3121 |
xm(nplanes-ip+1) = xPAM |
xm(nplanes-ip+1) = xPAM |
| 3122 |
ym(nplanes-ip+1) = yPAM |
ym(nplanes-ip+1) = yPAM |
| 3123 |
zm(nplanes-ip+1) = zPAM |
zm(nplanes-ip+1) = zPAM |
| 3126 |
resx(nplanes-ip+1) = resxPAM |
resx(nplanes-ip+1) = resxPAM |
| 3127 |
resy(nplanes-ip+1) = resyPAM |
resy(nplanes-ip+1) = resyPAM |
| 3128 |
|
|
| 3129 |
c dedxtrk(nplanes-ip+1) = (sgnl(icx)+sgnl(icy))/2. !(1) |
dedxtrk_x(nplanes-ip+1)=sgnl(icx)/mip(VIEW(icx),LADDER(icx)) |
| 3130 |
dedxtrk_x(nplanes-ip+1)=sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
dedxtrk_y(nplanes-ip+1)=sgnl(icy)/mip(VIEW(icy),LADDER(icy)) |
|
dedxtrk_y(nplanes-ip+1)=sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
|
| 3131 |
|
|
| 3132 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
| 3133 |
* ------------------------------------------------- |
* ------------------------------------------------- |
| 3142 |
|
|
| 3143 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
| 3144 |
* determine which ladder and sensor are intersected by the track |
* determine which ladder and sensor are intersected by the track |
|
c$$$ xP=XV_STORE(nplanes-ip+1,ibest) |
|
|
c$$$ yP=YV_STORE(nplanes-ip+1,ibest) |
|
|
c$$$ zP=ZV_STORE(nplanes-ip+1,ibest) |
|
| 3145 |
call whichsensor(ip,xP,yP,nldt,ist) |
call whichsensor(ip,xP,yP,nldt,ist) |
| 3146 |
* if the track hit the plane in a dead area, go to the next plane |
* if the track hit the plane in a dead area, go to the next plane |
| 3147 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
| 3148 |
|
|
| 3149 |
|
SENSOR_STORE(nplanes-ip+1,IBEST)=ist |
| 3150 |
|
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
| 3151 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
| 3152 |
|
|
| 3153 |
if(DEBUG)then |
if(DEBUG)then |
| 3182 |
$ cl_used(icy).ne.0.or. !or the Y cluster is already used !(3) |
$ cl_used(icy).ne.0.or. !or the Y cluster is already used !(3) |
| 3183 |
$ .false.)goto 1188 !then jump to next couple. |
$ .false.)goto 1188 !then jump to next couple. |
| 3184 |
* |
* |
|
c call xyz_PAM(icx,icy,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ AXV_STORE(nplanes-ip+1,ibest), |
|
|
c $ AYV_STORE(nplanes-ip+1,ibest)) |
|
| 3185 |
call xyz_PAM(icx,icy,ist, |
call xyz_PAM(icx,icy,ist, |
| 3186 |
$ PFA,PFA, |
$ PFA,PFA, |
| 3187 |
$ AXV_STORE(nplanes-ip+1,ibest), |
$ AXV_STORE(nplanes-ip+1,ibest), |
| 3191 |
$ ) |
$ ) |
| 3192 |
|
|
| 3193 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3194 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3195 |
id=id_cp(ip,icp,ist) |
id=id_cp(ip,icp,ist) |
| 3196 |
if(DEBUG)print*,'( couple ',id |
if(DEBUG)print*,'( couple ',id |
| 3197 |
$ ,' ) normalized distance ',distance |
$ ,' ) distance ',distance |
| 3198 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3199 |
xmm = xPAM |
xmm = xPAM |
| 3200 |
ymm = yPAM |
ymm = yPAM |
| 3203 |
rymm = resyPAM |
rymm = resyPAM |
| 3204 |
distmin = distance |
distmin = distance |
| 3205 |
idm = id |
idm = id |
|
c dedxmm = (sgnl(icx)+sgnl(icy))/2. !(1) |
|
| 3206 |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
| 3207 |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
| 3208 |
|
c QUIQUI --> non devo moltiplicare per clinc?!?!?! |
| 3209 |
|
clincnewc=10*sqrt(rymm**2+rxmm**2 !QUIQUI |
| 3210 |
|
$ +RCHI2_STORE(ibest)*k(ip)*(cov(1,1)+cov(2,2))) !QUIQUI |
| 3211 |
endif |
endif |
| 3212 |
1188 continue |
1188 continue |
| 3213 |
enddo !end loop on couples on plane icp |
enddo !end loop on couples on plane icp |
| 3214 |
if(distmin.le.clinc)then |
c if(distmin.le.clinc)then !QUIQUI |
| 3215 |
|
if(distmin.le.clincnewc)then !QUIQUI |
| 3216 |
* ----------------------------------- |
* ----------------------------------- |
| 3217 |
xm(nplanes-ip+1) = xmm !<<< |
xm(nplanes-ip+1) = xmm !<<< |
| 3218 |
ym(nplanes-ip+1) = ymm !<<< |
ym(nplanes-ip+1) = ymm !<<< |
| 3219 |
zm(nplanes-ip+1) = zmm !<<< |
zm(nplanes-ip+1) = zmm !<<< |
| 3220 |
xgood(nplanes-ip+1) = 1 !<<< |
xgood(nplanes-ip+1) = 1 !<<< |
| 3221 |
ygood(nplanes-ip+1) = 1 !<<< |
ygood(nplanes-ip+1) = 1 !<<< |
| 3222 |
resx(nplanes-ip+1)=rxmm !<<< |
resx(nplanes-ip+1)=rxmm !<<< |
| 3223 |
resy(nplanes-ip+1)=rymm !<<< |
resy(nplanes-ip+1)=rymm !<<< |
| 3224 |
c dedxtrk(nplanes-ip+1) = dedxmm !<<< !(1) |
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
| 3225 |
dedxtrk_x(nplanes-ip+1) = dedxmmx !(1) |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !(1) |
|
| 3226 |
* ----------------------------------- |
* ----------------------------------- |
| 3227 |
CP_STORE(nplanes-ip+1,ibest)=idm |
CP_STORE(nplanes-ip+1,ibest)=idm |
| 3228 |
if(DEBUG)print*,'%%%% included couple ',idm |
if(DEBUG)print*,'%%%% included couple ',idm |
| 3229 |
$ ,' (norm.dist.= ',distmin,', cut ',clinc,' )' |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
| 3230 |
goto 133 !next plane |
goto 133 !next plane |
| 3231 |
endif |
endif |
| 3232 |
* ================================================ |
* ================================================ |
| 3269 |
$ bxyz(2) |
$ bxyz(2) |
| 3270 |
$ ) |
$ ) |
| 3271 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3272 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3273 |
if(DEBUG)print*,'( cl-X ',icx |
if(DEBUG)print*,'( cl-X ',icx |
| 3274 |
$ ,' in cp ',id,' ) normalized 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 |
| 3277 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
| 3302 |
$ bxyz(2) |
$ bxyz(2) |
| 3303 |
$ ) |
$ ) |
| 3304 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3305 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3306 |
if(DEBUG)print*,'( cl-Y ',icy |
if(DEBUG)print*,'( cl-Y ',icy |
| 3307 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
| 3308 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3309 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
| 3310 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
| 3326 |
c print*,'## ncls(',ip,') ',ncls(ip) |
c print*,'## ncls(',ip,') ',ncls(ip) |
| 3327 |
do ic=1,ncls(ip) !loop on single clusters |
do ic=1,ncls(ip) !loop on single clusters |
| 3328 |
icl=cls(ip,ic) |
icl=cls(ip,ic) |
|
c print*,'## ic ',ic,' ist ',ist |
|
| 3329 |
c if(cl_used(icl).eq.1.or. !if the cluster is already used |
c if(cl_used(icl).eq.1.or. !if the cluster is already used |
| 3330 |
if(cl_used(icl).ne.0.or. !if the cluster is already used !(3) |
if(cl_used(icl).ne.0.or. !if the cluster is already used !(3) |
| 3331 |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
| 3332 |
$ .false.)goto 18882 !jump to the next singlet |
$ .false.)goto 18882 !jump to the next singlet |
| 3333 |
if(mod(VIEW(icl),2).eq.0)then!<---- X view |
if(mod(VIEW(icl),2).eq.0)then!<---- X view |
|
c call xyz_PAM(icl,0,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ AXV_STORE(nplanes-ip+1,ibest),0.) |
|
| 3334 |
call xyz_PAM(icl,0,ist, |
call xyz_PAM(icl,0,ist, |
| 3335 |
$ PFA,PFA, |
$ PFA,PFA, |
| 3336 |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
| 3338 |
$ bxyz(2) |
$ bxyz(2) |
| 3339 |
$ ) |
$ ) |
| 3340 |
else !<---- Y view |
else !<---- Y view |
|
c call xyz_PAM(0,icl,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
|
| 3341 |
call xyz_PAM(0,icl,ist, |
call xyz_PAM(0,icl,ist, |
| 3342 |
$ PFA,PFA, |
$ PFA,PFA, |
| 3343 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
| 3347 |
endif |
endif |
| 3348 |
|
|
| 3349 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
| 3350 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3351 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG)print*,'( cl-s ',icl |
| 3352 |
$ ,' ) normalized distance ',distance,'<',distmin,' ?' |
$ ,' ) distance ',distance,'<',distmin,' ?' |
| 3353 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
| 3354 |
if(DEBUG)print*,'YES' |
if(DEBUG)print*,'YES' |
| 3355 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
| 3362 |
rymm = resyPAM |
rymm = resyPAM |
| 3363 |
distmin = distance |
distmin = distance |
| 3364 |
iclm = icl |
iclm = icl |
|
c dedxmm = sgnl(icl) !(1) |
|
| 3365 |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
| 3366 |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) !(1)(2) |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 3367 |
dedxmmy = 0. !(1) |
dedxmmy = 0. |
| 3368 |
else !<---- Y view |
else !<---- Y view |
| 3369 |
dedxmmx = 0. !(1) |
dedxmmx = 0. |
| 3370 |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) !(1)(2) |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 3371 |
endif |
endif |
| 3372 |
endif |
endif |
| 3373 |
18882 continue |
18882 continue |
| 3374 |
enddo !end loop on single clusters |
enddo !end loop on single clusters |
| 3375 |
c print*,'## distmin ', distmin,' clinc ',clinc |
c print*,'## distmin ', distmin,' clinc ',clinc |
| 3376 |
if(distmin.le.clinc)then |
|
| 3377 |
|
c QUIQUI------------ |
| 3378 |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
c anche qui: non ci vuole clinc??? |
| 3379 |
* ---------------------------- |
if(iclm.ne.0)then |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
|
| 3380 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
| 3381 |
XGOOD(nplanes-ip+1)=1. |
clincnew= |
| 3382 |
resx(nplanes-ip+1)=rxmm |
$ 20* |
| 3383 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
$ sqrt(rxmm**2+RCHI2_STORE(ibest)*k(ip)*cov(1,1)) |
| 3384 |
c if(.true.)print*,'%%%% included X-cl ',iclm |
else if(mod(VIEW(iclm),2).ne.0)then |
| 3385 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
clincnew= |
| 3386 |
$ ,', norm.dist.= ',distmin |
$ 10* |
| 3387 |
$ ,', cut ',clinc,' )' |
$ sqrt(rymm**2+RCHI2_STORE(ibest)*k(ip)*cov(2,2)) |
| 3388 |
else |
endif |
| 3389 |
YGOOD(nplanes-ip+1)=1. |
c QUIQUI------------ |
| 3390 |
resy(nplanes-ip+1)=rymm |
|
| 3391 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(distmin.le.clincnew)then !QUIQUI |
| 3392 |
c if(.true.)print*,'%%%% included Y-cl ',iclm |
c if(distmin.le.clinc)then !QUIQUI |
| 3393 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
|
| 3394 |
$ ,', norm.dist.= ', distmin |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
| 3395 |
$ ,', cut ',clinc,' )' |
* ---------------------------- |
| 3396 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 3397 |
|
if(mod(VIEW(iclm),2).eq.0)then |
| 3398 |
|
XGOOD(nplanes-ip+1)=1. |
| 3399 |
|
resx(nplanes-ip+1)=rxmm |
| 3400 |
|
if(DEBUG)print*,'%%%% included X-cl ',iclm |
| 3401 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
| 3402 |
|
$ ,', dist.= ',distmin |
| 3403 |
|
$ ,', cut ',clinc,' )' |
| 3404 |
|
else |
| 3405 |
|
YGOOD(nplanes-ip+1)=1. |
| 3406 |
|
resy(nplanes-ip+1)=rymm |
| 3407 |
|
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
| 3408 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
| 3409 |
|
$ ,', dist.= ', distmin |
| 3410 |
|
$ ,', cut ',clinc,' )' |
| 3411 |
|
endif |
| 3412 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 3413 |
|
* ---------------------------- |
| 3414 |
|
xm_A(nplanes-ip+1) = xmm_A |
| 3415 |
|
ym_A(nplanes-ip+1) = ymm_A |
| 3416 |
|
xm_B(nplanes-ip+1) = xmm_B |
| 3417 |
|
ym_B(nplanes-ip+1) = ymm_B |
| 3418 |
|
zm(nplanes-ip+1) = (zmm_A+zmm_B)/2. |
| 3419 |
|
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
| 3420 |
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
| 3421 |
|
* ---------------------------- |
| 3422 |
endif |
endif |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
|
|
* ---------------------------- |
|
|
xm_A(nplanes-ip+1) = xmm_A |
|
|
ym_A(nplanes-ip+1) = ymm_A |
|
|
xm_B(nplanes-ip+1) = xmm_B |
|
|
ym_B(nplanes-ip+1) = ymm_B |
|
|
zm(nplanes-ip+1) = (zmm_A+zmm_B)/2. |
|
|
c dedxtrk(nplanes-ip+1) = dedxmm !<<< !(1) |
|
|
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< !(1) |
|
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< !(1) |
|
|
* ---------------------------- |
|
| 3423 |
endif |
endif |
| 3424 |
endif |
endif |
| 3425 |
133 continue |
133 continue |
| 3438 |
* * |
* * |
| 3439 |
* * |
* * |
| 3440 |
************************************************** |
************************************************** |
|
cccccc 12/08/2006 modified by elena ---> (1) |
|
| 3441 |
* |
* |
| 3442 |
subroutine clean_XYclouds(ibest,iflag) |
subroutine clean_XYclouds(ibest,iflag) |
| 3443 |
|
|
| 3444 |
include 'commontracker.f' |
include 'commontracker.f' |
| 3445 |
include 'level1.f' |
include 'level1.f' |
| 3446 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
| 3447 |
c include 'momanhough_init.f' |
include 'level2.f' |
|
include 'level2.f' !(1) |
|
|
c include 'calib.f' |
|
|
c include 'level1.f' |
|
|
|
|
|
|
|
| 3448 |
|
|
| 3449 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
| 3450 |
|
|
| 3454 |
if(id.ne.0)then |
if(id.ne.0)then |
| 3455 |
iclx=clx(ip,icp_cp(id)) |
iclx=clx(ip,icp_cp(id)) |
| 3456 |
icly=cly(ip,icp_cp(id)) |
icly=cly(ip,icp_cp(id)) |
| 3457 |
c cl_used(iclx)=1 !tag used clusters |
cl_used(iclx)=ntrk !tag used clusters |
| 3458 |
c cl_used(icly)=1 !tag used clusters |
cl_used(icly)=ntrk !tag used clusters |
|
cl_used(iclx)=ntrk !tag used clusters !(1) |
|
|
cl_used(icly)=ntrk !tag used clusters !(1) |
|
| 3459 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
| 3460 |
c cl_used(icl)=1 !tag used clusters |
cl_used(icl)=ntrk !tag used clusters |
|
cl_used(icl)=ntrk !tag used clusters !1) |
|
| 3461 |
endif |
endif |
| 3462 |
|
|
|
c if(DEBUG)then |
|
|
c print*,ip,' <<< ',id |
|
|
c endif |
|
| 3463 |
* ----------------------------- |
* ----------------------------- |
| 3464 |
* remove the couple from clouds |
* remove the couple from clouds |
| 3465 |
* remove also vitual couples containing the |
* remove also vitual couples containing the |
| 3520 |
include 'level1.f' |
include 'level1.f' |
| 3521 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
| 3522 |
include 'level2.f' |
include 'level2.f' |
|
c include 'level1.f' |
|
| 3523 |
|
|
| 3524 |
|
* --------------------------------- |
| 3525 |
|
* variables initialized from level1 |
| 3526 |
|
* --------------------------------- |
| 3527 |
do i=1,nviews |
do i=1,nviews |
| 3528 |
good2(i)=good1(i) |
good2(i)=good1(i) |
| 3529 |
|
do j=1,nva1_view |
| 3530 |
|
vkflag(i,j)=1 |
| 3531 |
|
if(cnnev(i,j).le.0)then |
| 3532 |
|
vkflag(i,j)=cnnev(i,j) |
| 3533 |
|
endif |
| 3534 |
|
enddo |
| 3535 |
enddo |
enddo |
| 3536 |
|
* ---------------- |
| 3537 |
|
* level2 variables |
| 3538 |
|
* ---------------- |
| 3539 |
NTRK = 0 |
NTRK = 0 |
| 3540 |
do it=1,NTRKMAX |
do it=1,NTRKMAX |
| 3541 |
IMAGE(IT)=0 |
IMAGE(IT)=0 |
| 3546 |
ZM_nt(IP,IT) = 0 |
ZM_nt(IP,IT) = 0 |
| 3547 |
RESX_nt(IP,IT) = 0 |
RESX_nt(IP,IT) = 0 |
| 3548 |
RESY_nt(IP,IT) = 0 |
RESY_nt(IP,IT) = 0 |
| 3549 |
|
TAILX_nt(IP,IT) = 0 |
| 3550 |
|
TAILY_nt(IP,IT) = 0 |
| 3551 |
|
XBAD(IP,IT) = 0 |
| 3552 |
|
YBAD(IP,IT) = 0 |
| 3553 |
XGOOD_nt(IP,IT) = 0 |
XGOOD_nt(IP,IT) = 0 |
| 3554 |
YGOOD_nt(IP,IT) = 0 |
YGOOD_nt(IP,IT) = 0 |
| 3555 |
|
LS(IP,IT) = 0 |
| 3556 |
DEDX_X(IP,IT) = 0 |
DEDX_X(IP,IT) = 0 |
| 3557 |
DEDX_Y(IP,IT) = 0 |
DEDX_Y(IP,IT) = 0 |
| 3558 |
CLTRX(IP,IT) = 0 |
CLTRX(IP,IT) = 0 |
| 3685 |
|
|
| 3686 |
|
|
| 3687 |
include 'commontracker.f' |
include 'commontracker.f' |
|
c include 'level1.f' |
|
| 3688 |
include 'level1.f' |
include 'level1.f' |
| 3689 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
| 3690 |
include 'level2.f' |
include 'level2.f' |
| 3691 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
| 3692 |
real sinth,phi,pig |
include 'calib.f' |
| 3693 |
|
|
| 3694 |
|
character*10 PFA |
| 3695 |
|
common/FINALPFA/PFA |
| 3696 |
|
|
| 3697 |
|
real sinth,phi,pig |
| 3698 |
|
integer ssensor,sladder |
| 3699 |
pig=acos(-1.) |
pig=acos(-1.) |
| 3700 |
|
|
| 3701 |
|
* ------------------------------------- |
| 3702 |
chi2_nt(ntr) = sngl(chi2) |
chi2_nt(ntr) = sngl(chi2) |
| 3703 |
nstep_nt(ntr) = nstep |
nstep_nt(ntr) = nstep |
| 3704 |
|
* ------------------------------------- |
| 3705 |
phi = al(4) |
phi = al(4) |
| 3706 |
sinth = al(3) |
sinth = al(3) |
| 3707 |
if(sinth.lt.0)then |
if(sinth.lt.0)then |
| 3714 |
$ phi = phi + 2*pig |
$ phi = phi + 2*pig |
| 3715 |
al(4) = phi |
al(4) = phi |
| 3716 |
al(3) = sinth |
al(3) = sinth |
|
|
|
| 3717 |
do i=1,5 |
do i=1,5 |
| 3718 |
al_nt(i,ntr) = sngl(al(i)) |
al_nt(i,ntr) = sngl(al(i)) |
| 3719 |
do j=1,5 |
do j=1,5 |
| 3720 |
coval(i,j,ntr) = sngl(cov(i,j)) |
coval(i,j,ntr) = sngl(cov(i,j)) |
| 3721 |
enddo |
enddo |
| 3722 |
enddo |
enddo |
| 3723 |
|
* ------------------------------------- |
| 3724 |
do ip=1,nplanes ! loop on planes |
do ip=1,nplanes ! loop on planes |
| 3725 |
xgood_nt(ip,ntr) = int(xgood(ip)) |
xgood_nt(ip,ntr) = int(xgood(ip)) |
| 3726 |
ygood_nt(ip,ntr) = int(ygood(ip)) |
ygood_nt(ip,ntr) = int(ygood(ip)) |
| 3729 |
zm_nt(ip,ntr) = sngl(zm(ip)) |
zm_nt(ip,ntr) = sngl(zm(ip)) |
| 3730 |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
| 3731 |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
| 3732 |
|
TAILX_nt(IP,ntr) = 0. |
| 3733 |
|
TAILY_nt(IP,ntr) = 0. |
| 3734 |
xv_nt(ip,ntr) = sngl(xv(ip)) |
xv_nt(ip,ntr) = sngl(xv(ip)) |
| 3735 |
yv_nt(ip,ntr) = sngl(yv(ip)) |
yv_nt(ip,ntr) = sngl(yv(ip)) |
| 3736 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
zv_nt(ip,ntr) = sngl(zv(ip)) |
| 3738 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
| 3739 |
c l'avevo dimenticato!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
c l'avevo dimenticato!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 3740 |
factor = sqrt( |
factor = sqrt( |
| 3741 |
$ sin( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
| 3742 |
$ sin( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
| 3743 |
$ 1. ) |
$ 1. ) |
| 3744 |
c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 3745 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
| 3746 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
| 3747 |
|
|
| 3748 |
id = CP_STORE(ip,IDCAND) |
ax = axv_nt(ip,ntr) |
| 3749 |
|
ay = ayv_nt(ip,ntr) |
| 3750 |
|
bfx = BX_STORE(ip,IDCAND) |
| 3751 |
|
bfy = BY_STORE(ip,IDCAND) |
| 3752 |
|
if(ip.eq.6) ax = -1. * axv_nt(ip,ntr) |
| 3753 |
|
if(ip.eq.6) bfy = -1. * BY_STORE(ip,IDCAND) |
| 3754 |
|
tgtemp = tan(ax*acos(-1.)/180.) + pmuH_h*bfy*0.00001 |
| 3755 |
|
angx = 180.*atan(tgtemp)/acos(-1.) |
| 3756 |
|
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
| 3757 |
|
angy = 180.*atan(tgtemp)/acos(-1.) |
| 3758 |
|
|
| 3759 |
|
c print*,'* ',ip,bfx,bfy,angx,angy |
| 3760 |
|
|
| 3761 |
|
id = CP_STORE(ip,IDCAND) ! couple id |
| 3762 |
icl = CLS_STORE(ip,IDCAND) |
icl = CLS_STORE(ip,IDCAND) |
| 3763 |
|
ssensor = -1 |
| 3764 |
|
sladder = -1 |
| 3765 |
|
ssensor = SENSOR_STORE(ip,IDCAND) |
| 3766 |
|
sladder = LADDER_STORE(ip,IDCAND) |
| 3767 |
|
if(ip.eq.6.and.ssensor.ne.0)ssensor = 3 - ssensor !notazione paolo x align |
| 3768 |
|
LS(IP,ntr) = ssensor+10*sladder |
| 3769 |
|
|
| 3770 |
if(id.ne.0)then |
if(id.ne.0)then |
| 3771 |
|
c >>> is a couple |
| 3772 |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
| 3773 |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
| 3774 |
c print*,ip,' ',cltrx(ip,ntr),cltry(ip,ntr) |
|
| 3775 |
|
c$$$ nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
| 3776 |
|
c$$$ nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
| 3777 |
|
c$$$ xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) |
| 3778 |
|
c$$$ ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) |
| 3779 |
|
xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) |
| 3780 |
|
ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) |
| 3781 |
|
|
| 3782 |
|
|
| 3783 |
|
if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) |
| 3784 |
|
$ dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
| 3785 |
|
if(nsatstrips(cly(nplanes-ip+1,icp_cp(id))).gt.0) |
| 3786 |
|
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
| 3787 |
|
|
| 3788 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
| 3789 |
if(mod(VIEW(icl),2).eq.0)cltrx(ip,ntr)=icl |
|
| 3790 |
if(mod(VIEW(icl),2).eq.1)cltry(ip,ntr)=icl |
if(mod(VIEW(icl),2).eq.0)then |
| 3791 |
c print*,ip,' ',cltrx(ip,ntr),cltry(ip,ntr) |
cltrx(ip,ntr)=icl |
| 3792 |
|
c$$$ nnnnn = npfastrips(icl,PFA,angx) |
| 3793 |
|
c$$$ xbad(ip,ntr) = nbadstrips(nnnnn,icl) |
| 3794 |
|
xbad(ip,ntr) = nbadstrips(4,icl) |
| 3795 |
|
|
| 3796 |
|
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
| 3797 |
|
elseif(mod(VIEW(icl),2).eq.1)then |
| 3798 |
|
cltry(ip,ntr)=icl |
| 3799 |
|
c$$$ nnnnn = npfastrips(icl,PFA,angy) |
| 3800 |
|
c$$$ ybad(ip,ntr) = nbadstrips(nnnnn,icl) |
| 3801 |
|
ybad(ip,ntr) = nbadstrips(4,icl) |
| 3802 |
|
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
| 3803 |
|
endif |
| 3804 |
|
|
| 3805 |
endif |
endif |
| 3806 |
|
|
| 3807 |
enddo |
enddo |
| 3808 |
|
|
| 3809 |
|
|
| 3810 |
|
c$$$ print*,(xgood(i),i=1,6) |
| 3811 |
|
c$$$ print*,(ygood(i),i=1,6) |
| 3812 |
|
c$$$ print*,(ls(i,ntr),i=1,6) |
| 3813 |
|
c$$$ print*,(dedx_x(i,ntr),i=1,6) |
| 3814 |
|
c$$$ print*,(dedx_y(i,ntr),i=1,6) |
| 3815 |
|
c$$$ print*,'-----------------------' |
| 3816 |
|
|
| 3817 |
end |
end |
| 3818 |
|
|
| 3819 |
subroutine fill_level2_siglets |
subroutine fill_level2_siglets |
| 3825 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
| 3826 |
|
|
| 3827 |
include 'commontracker.f' |
include 'commontracker.f' |
|
c include 'level1.f' |
|
| 3828 |
include 'calib.f' |
include 'calib.f' |
| 3829 |
include 'level1.f' |
include 'level1.f' |
| 3830 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
| 3832 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
| 3833 |
|
|
| 3834 |
* count #cluster per plane not associated to any track |
* count #cluster per plane not associated to any track |
|
c good2=1!.true. |
|
| 3835 |
nclsx = 0 |
nclsx = 0 |
| 3836 |
nclsy = 0 |
nclsy = 0 |
| 3837 |
|
|
| 3838 |
do iv = 1,nviews |
do iv = 1,nviews |
| 3839 |
if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) |
c if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) |
| 3840 |
|
good2(iv) = good2(iv) + mask_view(iv)*2**8 |
| 3841 |
enddo |
enddo |
| 3842 |
|
|
| 3843 |
do icl=1,nclstr1 |
do icl=1,nclstr1 |
| 3846 |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
| 3847 |
nclsx = nclsx + 1 |
nclsx = nclsx + 1 |
| 3848 |
planex(nclsx) = ip |
planex(nclsx) = ip |
| 3849 |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl))!(2) |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 3850 |
|
if(nsatstrips(icl).gt.0)sgnlxs(nclsx)=-sgnlxs(nclsx) |
| 3851 |
clsx(nclsx) = icl |
clsx(nclsx) = icl |
| 3852 |
do is=1,2 |
do is=1,2 |
| 3853 |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
| 3863 |
else !=== Y views |
else !=== Y views |
| 3864 |
nclsy = nclsy + 1 |
nclsy = nclsy + 1 |
| 3865 |
planey(nclsy) = ip |
planey(nclsy) = ip |
| 3866 |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl))!(2) |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 3867 |
|
if(nsatstrips(icl).gt.0)sgnlys(nclsy)=-sgnlys(nclsy) |
| 3868 |
clsy(nclsy) = icl |
clsy(nclsy) = icl |
| 3869 |
do is=1,2 |
do is=1,2 |
| 3870 |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
| 3879 |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
| 3880 |
endif |
endif |
| 3881 |
endif |
endif |
|
c print*,icl,cl_used(icl),cl_good(icl),ip,VIEW(icl)!nclsx(ip),nclsy(ip) |
|
| 3882 |
|
|
| 3883 |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
| 3884 |
whichtrack(icl) = cl_used(icl) |
whichtrack(icl) = cl_used(icl) |