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) |
592 |
yPAM_B = 0. |
yPAM_B = 0. |
593 |
zPAM_B = 0. |
zPAM_B = 0. |
594 |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
595 |
|
|
596 |
* ----------------- |
* ----------------- |
597 |
* CLUSTER X |
* CLUSTER X |
598 |
* ----------------- |
* ----------------- |
599 |
|
|
600 |
if(icx.ne.0)then |
if(icx.ne.0)then |
601 |
|
|
602 |
viewx = VIEW(icx) |
viewx = VIEW(icx) |
603 |
nldx = nld(MAXS(icx),VIEW(icx)) |
nldx = nld(MAXS(icx),VIEW(icx)) |
604 |
nplx = npl(VIEW(icx)) |
nplx = npl(VIEW(icx)) |
605 |
resxPAM = RESXAV |
resxPAM = RESXAV |
606 |
stripx = float(MAXS(icx)) |
stripx = float(MAXS(icx)) |
607 |
* -------------------------- |
* -------------------------- |
608 |
* magnetic-field corrections |
* magnetic-field corrections |
609 |
* -------------------------- |
* -------------------------- |
|
c$$$ print*,nplx,ax,bfy/10. |
|
610 |
angtemp = ax |
angtemp = ax |
611 |
bfytemp = bfy |
bfytemp = bfy |
612 |
if(nplx.eq.6) angtemp = -1. * ax |
if(nplx.eq.6) angtemp = -1. * ax |
613 |
if(nplx.eq.6) bfytemp = -1. * bfy |
if(nplx.eq.6) bfytemp = -1. * bfy |
614 |
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
615 |
angx = 180.*atan(tgtemp)/acos(-1.) |
angx = 180.*atan(tgtemp)/acos(-1.) |
616 |
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
617 |
|
c$$$ print*,nplx,ax,bfy/10. |
618 |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
619 |
c$$$ print*,'========================' |
c$$$ print*,'========================' |
620 |
* -------------------------- |
* -------------------------- |
621 |
|
|
622 |
|
c$$$ print*,'--- x-cl ---' |
623 |
|
c$$$ istart = INDSTART(ICX) |
624 |
|
c$$$ istop = TOTCLLENGTH |
625 |
|
c$$$ if(icx.lt.NCLSTR1)istop=INDSTART(ICX+1)-1 |
626 |
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
627 |
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
628 |
|
c$$$ print*,INDMAX(icx) |
629 |
|
c$$$ print*,cog(4,icx) |
630 |
|
c$$$ print*,fbad_cog(4,icx) |
631 |
|
|
632 |
|
|
633 |
if(PFAx.eq.'COG1')then |
if(PFAx.eq.'COG1')then |
634 |
stripx = stripx |
|
635 |
resxPAM = resxPAM |
stripx = stripx |
636 |
|
resxPAM = 1e-4*pitchX/sqrt(12.)!!resxPAM |
637 |
|
|
638 |
elseif(PFAx.eq.'COG2')then |
elseif(PFAx.eq.'COG2')then |
639 |
stripx = stripx + cog(2,icx) |
|
640 |
|
stripx = stripx + cog(2,icx) |
641 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
642 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
643 |
|
|
644 |
elseif(PFAx.eq.'COG3')then |
elseif(PFAx.eq.'COG3')then |
645 |
stripx = stripx + cog(3,icx) |
|
646 |
|
stripx = stripx + cog(3,icx) |
647 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
648 |
resxPAM = resxPAM*fbad_cog(3,icx) |
resxPAM = resxPAM*fbad_cog(3,icx) |
649 |
|
|
650 |
elseif(PFAx.eq.'COG4')then |
elseif(PFAx.eq.'COG4')then |
651 |
c print*,'COG4' |
|
652 |
stripx = stripx + cog(4,icx) |
stripx = stripx + cog(4,icx) |
653 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
654 |
resxPAM = resxPAM*fbad_cog(4,icx) |
resxPAM = resxPAM*fbad_cog(4,icx) |
655 |
|
|
656 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
657 |
stripx = stripx + pfaeta2(icx,angx) |
|
658 |
resxPAM = risx_eta2(abs(angx)) |
stripx = stripx + pfaeta2(icx,angx) |
659 |
|
resxPAM = risx_eta2(abs(angx)) |
660 |
|
resxPAM = resxPAM*fbad_cog(2,icx) |
661 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
662 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
663 |
resxPAM = resxPAM*fbad_cog(2,icx) |
|
664 |
elseif(PFAx.eq.'ETA3')then |
elseif(PFAx.eq.'ETA3')then |
665 |
stripx = stripx + pfaeta3(icx,angx) |
|
666 |
|
stripx = stripx + pfaeta3(icx,angx) |
667 |
resxPAM = risx_eta3(abs(angx)) |
resxPAM = risx_eta3(abs(angx)) |
668 |
|
resxPAM = resxPAM*fbad_cog(3,icx) |
669 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) |
if(DEBUG.and.fbad_cog(3,icx).ne.1) |
670 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
671 |
resxPAM = resxPAM*fbad_cog(3,icx) |
|
672 |
elseif(PFAx.eq.'ETA4')then |
elseif(PFAx.eq.'ETA4')then |
673 |
stripx = stripx + pfaeta4(icx,angx) |
|
674 |
|
stripx = stripx + pfaeta4(icx,angx) |
675 |
resxPAM = risx_eta4(abs(angx)) |
resxPAM = risx_eta4(abs(angx)) |
676 |
|
resxPAM = resxPAM*fbad_cog(4,icx) |
677 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) |
if(DEBUG.and.fbad_cog(4,icx).ne.1) |
678 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
679 |
resxPAM = resxPAM*fbad_cog(4,icx) |
|
680 |
elseif(PFAx.eq.'ETA')then |
elseif(PFAx.eq.'ETA')then |
681 |
c print*,'ETA' |
|
682 |
stripx = stripx + pfaeta(icx,angx) |
stripx = stripx + pfaeta(icx,angx) |
683 |
resxPAM = ris_eta(icx,angx) |
resxPAM = ris_eta(icx,angx) |
684 |
|
resxPAM = resxPAM*fbad_eta(icx,angx) |
685 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
686 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
687 |
resxPAM = resxPAM*fbad_eta(icx,angx) |
|
688 |
elseif(PFAx.eq.'COG')then |
elseif(PFAx.eq.'COG')then |
689 |
stripx = stripx + cog(0,icx) |
|
690 |
|
stripx = stripx + cog(0,icx) |
691 |
resxPAM = risx_cog(abs(angx)) |
resxPAM = risx_cog(abs(angx)) |
692 |
resxPAM = resxPAM*fbad_cog(0,icx) |
resxPAM = resxPAM*fbad_cog(0,icx) |
693 |
|
|
694 |
else |
else |
695 |
print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
696 |
endif |
endif |
697 |
|
|
698 |
c print*,'%%%%%%%%%%%%' |
|
699 |
|
* ====================================== |
700 |
|
* temporary patch for saturated clusters |
701 |
|
* ====================================== |
702 |
|
if( nsatstrips(icx).gt.0 )then |
703 |
|
stripx = stripx + cog(4,icx) |
704 |
|
resxPAM = pitchX*1e-4/sqrt(12.) |
705 |
|
cc=cog(4,icx) |
706 |
|
c$$$ print*,icx,' *** ',cc |
707 |
|
c$$$ print*,icx,' *** ',resxPAM |
708 |
|
endif |
709 |
|
|
710 |
endif |
endif |
711 |
|
|
722 |
stripy = float(MAXS(icy)) |
stripy = float(MAXS(icy)) |
723 |
|
|
724 |
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 |
725 |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
if(DEBUG) then |
726 |
$ ,icx,icy |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
727 |
|
$ ,icx,icy |
728 |
|
endif |
729 |
goto 100 |
goto 100 |
730 |
endif |
endif |
731 |
* -------------------------- |
* -------------------------- |
736 |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
737 |
* -------------------------- |
* -------------------------- |
738 |
|
|
739 |
if(PFAy.eq.'COG1')then !(1) |
c$$$ print*,'--- y-cl ---' |
740 |
stripy = stripy !(1) |
c$$$ istart = INDSTART(ICY) |
741 |
resyPAM = resyPAM !(1) |
c$$$ istop = TOTCLLENGTH |
742 |
|
c$$$ if(icy.lt.NCLSTR1)istop=INDSTART(ICY+1)-1 |
743 |
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
744 |
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
745 |
|
c$$$ print*,INDMAX(icy) |
746 |
|
c$$$ print*,cog(4,icy) |
747 |
|
c$$$ print*,fbad_cog(4,icy) |
748 |
|
|
749 |
|
if(PFAy.eq.'COG1')then |
750 |
|
|
751 |
|
stripy = stripy |
752 |
|
resyPAM = 1e-4*pitchY/sqrt(12.)!resyPAM |
753 |
|
|
754 |
elseif(PFAy.eq.'COG2')then |
elseif(PFAy.eq.'COG2')then |
755 |
stripy = stripy + cog(2,icy) |
|
756 |
|
stripy = stripy + cog(2,icy) |
757 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
758 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
759 |
|
|
760 |
elseif(PFAy.eq.'COG3')then |
elseif(PFAy.eq.'COG3')then |
761 |
stripy = stripy + cog(3,icy) |
|
762 |
|
stripy = stripy + cog(3,icy) |
763 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
764 |
resyPAM = resyPAM*fbad_cog(3,icy) |
resyPAM = resyPAM*fbad_cog(3,icy) |
765 |
|
|
766 |
elseif(PFAy.eq.'COG4')then |
elseif(PFAy.eq.'COG4')then |
767 |
stripy = stripy + cog(4,icy) |
|
768 |
|
stripy = stripy + cog(4,icy) |
769 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
770 |
resyPAM = resyPAM*fbad_cog(4,icy) |
resyPAM = resyPAM*fbad_cog(4,icy) |
771 |
|
|
772 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
773 |
c cog2 = cog(2,icy) |
|
774 |
c etacorr = pfaeta2(cog2,viewy,nldy,angy) |
stripy = stripy + pfaeta2(icy,angy) |
775 |
c stripy = stripy + etacorr |
resyPAM = risy_eta2(abs(angy)) |
|
stripy = stripy + pfaeta2(icy,angy) !(3) |
|
|
resyPAM = risy_eta2(abs(angy)) ! (4) |
|
776 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
777 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
778 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
779 |
elseif(PFAy.eq.'ETA3')then !(3) |
|
780 |
stripy = stripy + pfaeta3(icy,angy) !(3) |
elseif(PFAy.eq.'ETA3')then |
781 |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
|
782 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
stripy = stripy + pfaeta3(icy,angy) |
783 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
resyPAM = resyPAM*fbad_cog(3,icy) |
784 |
elseif(PFAy.eq.'ETA4')then !(3) |
if(DEBUG.and.fbad_cog(3,icy).ne.1) |
785 |
stripy = stripy + pfaeta4(icy,angy) !(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
786 |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
|
787 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
elseif(PFAy.eq.'ETA4')then |
788 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
|
789 |
elseif(PFAy.eq.'ETA')then !(3) |
stripy = stripy + pfaeta4(icy,angy) |
790 |
stripy = stripy + pfaeta(icy,angy) !(3) |
resyPAM = resyPAM*fbad_cog(4,icy) |
791 |
resyPAM = ris_eta(icy,angy) ! (4) |
if(DEBUG.and.fbad_cog(4,icy).ne.1) |
792 |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
793 |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
|
794 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) !(3) |
elseif(PFAy.eq.'ETA')then |
795 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy)!(3) |
|
796 |
|
stripy = stripy + pfaeta(icy,angy) |
797 |
|
resyPAM = ris_eta(icy,angy) |
798 |
|
resyPAM = resyPAM*fbad_eta(icy,angy) |
799 |
|
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
800 |
|
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
801 |
|
|
802 |
elseif(PFAy.eq.'COG')then |
elseif(PFAy.eq.'COG')then |
803 |
stripy = stripy + cog(0,icy) |
|
804 |
resyPAM = risy_cog(abs(angy)) ! (4) |
stripy = stripy + cog(0,icy) |
805 |
c resyPAM = ris_eta(icy,angy) ! (4) |
resyPAM = risy_cog(abs(angy)) |
806 |
resyPAM = resyPAM*fbad_cog(0,icy) |
resyPAM = resyPAM*fbad_cog(0,icy) |
807 |
|
|
808 |
else |
else |
809 |
print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
810 |
|
endif |
811 |
|
|
812 |
|
|
813 |
|
* ====================================== |
814 |
|
* temporary patch for saturated clusters |
815 |
|
* ====================================== |
816 |
|
if( nsatstrips(icy).gt.0 )then |
817 |
|
stripy = stripy + cog(4,icy) |
818 |
|
resyPAM = pitchY*1e-4/sqrt(12.) |
819 |
|
cc=cog(4,icy) |
820 |
|
c$$$ print*,icy,' *** ',cc |
821 |
|
c$$$ print*,icy,' *** ',resyPAM |
822 |
endif |
endif |
823 |
|
|
824 |
|
|
825 |
endif |
endif |
826 |
|
|
827 |
c print*,'## stripx,stripy ',stripx,stripy |
c print*,'## stripx,stripy ',stripx,stripy |
836 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
837 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
838 |
$ .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... |
839 |
print*,'xyz_PAM (couple):', |
if(DEBUG) then |
840 |
$ ' WARNING: false X strip: strip ',stripx |
print*,'xyz_PAM (couple):', |
841 |
|
$ ' WARNING: false X strip: strip ',stripx |
842 |
|
endif |
843 |
endif |
endif |
844 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
845 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
931 |
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... |
932 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
933 |
$ .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... |
934 |
print*,'xyz_PAM (X-singlet):', |
if(DEBUG) then |
935 |
$ ' WARNING: false X strip: strip ',stripx |
print*,'xyz_PAM (X-singlet):', |
936 |
|
$ ' WARNING: false X strip: strip ',stripx |
937 |
|
endif |
938 |
endif |
endif |
939 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
940 |
|
|
956 |
c print*,yi_A,' <--> ',yi_B |
c print*,yi_A,' <--> ',yi_B |
957 |
|
|
958 |
else |
else |
959 |
|
if(DEBUG) then |
960 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
961 |
print *,'icx = ',icx |
print *,'icx = ',icx |
962 |
print *,'icy = ',icy |
print *,'icy = ',icy |
963 |
|
endif |
964 |
goto 100 |
goto 100 |
965 |
|
|
966 |
endif |
endif |
1025 |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
1026 |
|
|
1027 |
else |
else |
1028 |
|
if(DEBUG) then |
1029 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
1030 |
print *,'icx = ',icx |
print *,'icx = ',icx |
1031 |
print *,'icy = ',icy |
print *,'icy = ',icy |
1032 |
|
endif |
1033 |
endif |
endif |
1034 |
|
|
1035 |
|
|
1115 |
endif |
endif |
1116 |
|
|
1117 |
distance= |
distance= |
1118 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)!QUIQUI |
1119 |
|
cc $ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
1120 |
distance=dsqrt(distance) |
distance=dsqrt(distance) |
1121 |
|
|
1122 |
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 |
1141 |
* ---------------------- |
* ---------------------- |
1142 |
|
|
1143 |
distance= |
distance= |
1144 |
$ ((xPAM-XPP)/resxPAM)**2 |
$ ((xPAM-XPP))**2 !QUIQUI |
1145 |
$ + |
$ + |
1146 |
$ ((yPAM-YPP)/resyPAM)**2 |
$ ((yPAM-YPP))**2 |
1147 |
|
c$$$ $ ((xPAM-XPP)/resxPAM)**2 |
1148 |
|
c$$$ $ + |
1149 |
|
c$$$ $ ((yPAM-YPP)/resyPAM)**2 |
1150 |
distance=dsqrt(distance) |
distance=dsqrt(distance) |
1151 |
|
|
1152 |
c$$$ print*,xPAM,yPAM,zPAM |
c$$$ print*,xPAM,yPAM,zPAM |
1155 |
|
|
1156 |
else |
else |
1157 |
|
|
1158 |
print* |
c print* |
1159 |
$ ,' function distance_to ---> wrong usage!!!' |
c $ ,' function distance_to ---> wrong usage!!!' |
1160 |
print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
c print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
1161 |
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 ' |
1162 |
$ ,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 |
1163 |
endif |
endif |
1164 |
|
|
1165 |
distance_to = sngl(distance) |
distance_to = sngl(distance) |
1227 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
1228 |
$ .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... |
1229 |
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... |
1230 |
print*,'whichsensor: ', |
c print*,'whichsensor: ', |
1231 |
$ ' WARNING: false X strip: strip ',stripx |
c $ ' WARNING: false X strip: strip ',stripx |
1232 |
endif |
endif |
1233 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
1234 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
1383 |
is_cp=0 |
is_cp=0 |
1384 |
if(id.lt.0)is_cp=1 |
if(id.lt.0)is_cp=1 |
1385 |
if(id.gt.0)is_cp=2 |
if(id.gt.0)is_cp=2 |
1386 |
if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
c if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
1387 |
|
|
1388 |
return |
return |
1389 |
end |
end |
2336 |
enddo |
enddo |
2337 |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
2338 |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
2339 |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
if(nplused.lt.nplxz_min)goto 22288 !next triplet |
2340 |
|
|
2341 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
2342 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
2413 |
************************************************** |
************************************************** |
2414 |
|
|
2415 |
subroutine clouds_to_ctrack(iflag) |
subroutine clouds_to_ctrack(iflag) |
|
c***************************************************** |
|
|
c 02/02/2006 modified by Elena Vannuccini --> (1) |
|
|
c***************************************************** |
|
2416 |
|
|
2417 |
include 'commontracker.f' |
include 'commontracker.f' |
2418 |
include 'level1.f' |
include 'level1.f' |
2420 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2421 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2422 |
include 'common_mech.f' |
include 'common_mech.f' |
2423 |
c include 'momanhough_init.f' |
|
2424 |
|
|
2425 |
|
|
2426 |
* output flag |
* output flag |
2689 |
|
|
2690 |
ntracks = ntracks + 1 |
ntracks = ntracks + 1 |
2691 |
|
|
|
c$$$ ndof=0 |
|
2692 |
do ip=1,nplanes |
do ip=1,nplanes |
2693 |
c$$$ ndof=ndof |
|
|
c$$$ $ +int(xgood(ip)) |
|
|
c$$$ $ +int(ygood(ip)) |
|
2694 |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
2695 |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
2696 |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
2709 |
if(hit_plane(ip).ne.0)then |
if(hit_plane(ip).ne.0)then |
2710 |
CP_STORE(nplanes-ip+1,ntracks)= |
CP_STORE(nplanes-ip+1,ntracks)= |
2711 |
$ cp_match(ip,hit_plane(ip)) |
$ cp_match(ip,hit_plane(ip)) |
2712 |
|
SENSOR_STORE(nplanes-ip+1,ntracks) |
2713 |
|
$ = is_cp(cp_match(ip,hit_plane(ip))) |
2714 |
|
LADDER_STORE(nplanes-ip+1,ntracks) |
2715 |
|
$ = LADDER( |
2716 |
|
$ clx(ip,icp_cp( |
2717 |
|
$ cp_match(ip,hit_plane(ip) |
2718 |
|
$ )))); |
2719 |
else |
else |
2720 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
2721 |
|
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
2722 |
|
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
2723 |
endif |
endif |
2724 |
|
BX_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
2725 |
|
BY_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
2726 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
2727 |
do i=1,5 |
do i=1,5 |
2728 |
AL_STORE(i,ntracks)=sngl(AL(i)) |
AL_STORE(i,ntracks)=sngl(AL(i)) |
2729 |
enddo |
enddo |
2730 |
enddo |
enddo |
2731 |
|
|
|
c$$$ * Number of Degree Of Freedom |
|
|
c$$$ ndof=ndof-5 |
|
|
c$$$ * reduced chi^2 |
|
|
c$$$ rchi2=chi2/dble(ndof) |
|
2732 |
RCHI2_STORE(ntracks)=chi2 |
RCHI2_STORE(ntracks)=chi2 |
2733 |
|
|
2734 |
* -------------------------------- |
* -------------------------------- |
2752 |
return |
return |
2753 |
endif |
endif |
2754 |
|
|
2755 |
|
c$$$ if(DEBUG)then |
2756 |
|
c$$$ print*,'****** TRACK CANDIDATES ***********' |
2757 |
|
c$$$ print*,'# R. chi2 RIG' |
2758 |
|
c$$$ do i=1,ntracks |
2759 |
|
c$$$ print*,i,' --- ',rchi2_store(i),' --- ' |
2760 |
|
c$$$ $ ,1./abs(AL_STORE(5,i)) |
2761 |
|
c$$$ enddo |
2762 |
|
c$$$ print*,'***********************************' |
2763 |
|
c$$$ endif |
2764 |
if(DEBUG)then |
if(DEBUG)then |
2765 |
print*,'****** TRACK CANDIDATES ***********' |
print*,'****** TRACK CANDIDATES *****************' |
2766 |
print*,'# R. chi2 RIG' |
print*,'# R. chi2 RIG ndof' |
2767 |
do i=1,ntracks |
do i=1,ntracks |
2768 |
print*,i,' --- ',rchi2_store(i),' --- ' |
ndof=0 !(1) |
2769 |
$ ,1./abs(AL_STORE(5,i)) |
do ii=1,nplanes !(1) |
2770 |
enddo |
ndof=ndof !(1) |
2771 |
print*,'***********************************' |
$ +int(xgood_store(ii,i)) !(1) |
2772 |
|
$ +int(ygood_store(ii,i)) !(1) |
2773 |
|
enddo !(1) |
2774 |
|
print*,i,' --- ',rchi2_store(i),' --- ' |
2775 |
|
$ ,1./abs(AL_STORE(5,i)),' --- ',ndof |
2776 |
|
enddo |
2777 |
|
print*,'*****************************************' |
2778 |
endif |
endif |
2779 |
|
|
2780 |
|
|
2793 |
|
|
2794 |
subroutine refine_track(ibest) |
subroutine refine_track(ibest) |
2795 |
|
|
|
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****************************************************** |
|
2796 |
|
|
2797 |
include 'commontracker.f' |
include 'commontracker.f' |
2798 |
include 'level1.f' |
include 'level1.f' |
2800 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2801 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2802 |
include 'common_mech.f' |
include 'common_mech.f' |
|
c include 'momanhough_init.f' |
|
|
c include 'level1.f' |
|
2803 |
include 'calib.f' |
include 'calib.f' |
2804 |
|
|
2805 |
* flag to chose PFA |
* flag to chose PFA |
2806 |
character*10 PFA |
character*10 PFA |
2807 |
common/FINALPFA/PFA |
common/FINALPFA/PFA |
2808 |
|
|
2809 |
|
real k(6) |
2810 |
|
DATA k/1.099730,0.418900,0.220939,0.220907,0.418771,1.100674/ |
2811 |
|
|
2812 |
real xp,yp,zp |
real xp,yp,zp |
2813 |
real xyzp(3),bxyz(3) |
real xyzp(3),bxyz(3) |
2814 |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
2825 |
yP=YV_STORE(nplanes-ip+1,ibest) |
yP=YV_STORE(nplanes-ip+1,ibest) |
2826 |
zP=ZV_STORE(nplanes-ip+1,ibest) |
zP=ZV_STORE(nplanes-ip+1,ibest) |
2827 |
call gufld(xyzp,bxyz) |
call gufld(xyzp,bxyz) |
2828 |
c$$$ bxyz(1)=0 |
BX_STORE(nplanes-ip+1,ibest)=bxyz(1) |
2829 |
|
BY_STORE(nplanes-ip+1,ibest)=bxyz(2) |
2830 |
|
c$$$ bxyz(1)=0 |
2831 |
c$$$ bxyz(2)=0 |
c$$$ bxyz(2)=0 |
2832 |
c$$$ bxyz(3)=0 |
c$$$ bxyz(3)=0 |
2833 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
2861 |
$ bxyz(1), |
$ bxyz(1), |
2862 |
$ bxyz(2) |
$ bxyz(2) |
2863 |
$ ) |
$ ) |
2864 |
c$$$ call xyz_PAM(icx,icy,is, |
|
|
c$$$ $ 'COG2','COG2', |
|
|
c$$$ $ 0., |
|
|
c$$$ $ 0.) |
|
2865 |
xm(nplanes-ip+1) = xPAM |
xm(nplanes-ip+1) = xPAM |
2866 |
ym(nplanes-ip+1) = yPAM |
ym(nplanes-ip+1) = yPAM |
2867 |
zm(nplanes-ip+1) = zPAM |
zm(nplanes-ip+1) = zPAM |
2870 |
resx(nplanes-ip+1) = resxPAM |
resx(nplanes-ip+1) = resxPAM |
2871 |
resy(nplanes-ip+1) = resyPAM |
resy(nplanes-ip+1) = resyPAM |
2872 |
|
|
2873 |
c dedxtrk(nplanes-ip+1) = (sgnl(icx)+sgnl(icy))/2. !(1) |
dedxtrk_x(nplanes-ip+1)=sgnl(icx)/mip(VIEW(icx),LADDER(icx)) |
2874 |
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) |
|
2875 |
|
|
2876 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
2877 |
* ------------------------------------------------- |
* ------------------------------------------------- |
2886 |
|
|
2887 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
2888 |
* 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) |
|
2889 |
call whichsensor(ip,xP,yP,nldt,ist) |
call whichsensor(ip,xP,yP,nldt,ist) |
2890 |
* 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 |
2891 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
2892 |
|
|
2893 |
|
SENSOR_STORE(nplanes-ip+1,IBEST)=ist |
2894 |
|
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
2895 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
2896 |
|
|
2897 |
if(DEBUG)then |
if(DEBUG)then |
2926 |
$ 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) |
2927 |
$ .false.)goto 1188 !then jump to next couple. |
$ .false.)goto 1188 !then jump to next couple. |
2928 |
* |
* |
|
c call xyz_PAM(icx,icy,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ AXV_STORE(nplanes-ip+1,ibest), |
|
|
c $ AYV_STORE(nplanes-ip+1,ibest)) |
|
2929 |
call xyz_PAM(icx,icy,ist, |
call xyz_PAM(icx,icy,ist, |
2930 |
$ PFA,PFA, |
$ PFA,PFA, |
2931 |
$ AXV_STORE(nplanes-ip+1,ibest), |
$ AXV_STORE(nplanes-ip+1,ibest), |
2935 |
$ ) |
$ ) |
2936 |
|
|
2937 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
2938 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
2939 |
id=id_cp(ip,icp,ist) |
id=id_cp(ip,icp,ist) |
2940 |
if(DEBUG)print*,'( couple ',id |
if(DEBUG)print*,'( couple ',id |
2941 |
$ ,' ) normalized distance ',distance |
$ ,' ) distance ',distance |
2942 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
2943 |
xmm = xPAM |
xmm = xPAM |
2944 |
ymm = yPAM |
ymm = yPAM |
2947 |
rymm = resyPAM |
rymm = resyPAM |
2948 |
distmin = distance |
distmin = distance |
2949 |
idm = id |
idm = id |
|
c dedxmm = (sgnl(icx)+sgnl(icy))/2. !(1) |
|
2950 |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
2951 |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
2952 |
|
c QUIQUI --> non devo moltiplicare per clinc?!?!?! |
2953 |
|
clincnewc=10*sqrt(rymm**2+rxmm**2 !QUIQUI |
2954 |
|
$ +RCHI2_STORE(ibest)*k(ip)*(cov(1,1)+cov(2,2))) !QUIQUI |
2955 |
endif |
endif |
2956 |
1188 continue |
1188 continue |
2957 |
enddo !end loop on couples on plane icp |
enddo !end loop on couples on plane icp |
2958 |
if(distmin.le.clinc)then |
c if(distmin.le.clinc)then !QUIQUI |
2959 |
|
if(distmin.le.clincnewc)then !QUIQUI |
2960 |
* ----------------------------------- |
* ----------------------------------- |
2961 |
xm(nplanes-ip+1) = xmm !<<< |
xm(nplanes-ip+1) = xmm !<<< |
2962 |
ym(nplanes-ip+1) = ymm !<<< |
ym(nplanes-ip+1) = ymm !<<< |
2963 |
zm(nplanes-ip+1) = zmm !<<< |
zm(nplanes-ip+1) = zmm !<<< |
2964 |
xgood(nplanes-ip+1) = 1 !<<< |
xgood(nplanes-ip+1) = 1 !<<< |
2965 |
ygood(nplanes-ip+1) = 1 !<<< |
ygood(nplanes-ip+1) = 1 !<<< |
2966 |
resx(nplanes-ip+1)=rxmm !<<< |
resx(nplanes-ip+1)=rxmm !<<< |
2967 |
resy(nplanes-ip+1)=rymm !<<< |
resy(nplanes-ip+1)=rymm !<<< |
2968 |
c dedxtrk(nplanes-ip+1) = dedxmm !<<< !(1) |
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
2969 |
dedxtrk_x(nplanes-ip+1) = dedxmmx !(1) |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !(1) |
|
2970 |
* ----------------------------------- |
* ----------------------------------- |
2971 |
CP_STORE(nplanes-ip+1,ibest)=idm |
CP_STORE(nplanes-ip+1,ibest)=idm |
2972 |
if(DEBUG)print*,'%%%% included couple ',idm |
if(DEBUG)print*,'%%%% included couple ',idm |
2973 |
$ ,' (norm.dist.= ',distmin,', cut ',clinc,' )' |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
2974 |
goto 133 !next plane |
goto 133 !next plane |
2975 |
endif |
endif |
2976 |
* ================================================ |
* ================================================ |
3013 |
$ bxyz(2) |
$ bxyz(2) |
3014 |
$ ) |
$ ) |
3015 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3016 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3017 |
if(DEBUG)print*,'( cl-X ',icx |
if(DEBUG)print*,'( cl-X ',icx |
3018 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
3019 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3020 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
3021 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
3046 |
$ bxyz(2) |
$ bxyz(2) |
3047 |
$ ) |
$ ) |
3048 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3049 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3050 |
if(DEBUG)print*,'( cl-Y ',icy |
if(DEBUG)print*,'( cl-Y ',icy |
3051 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
3052 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3053 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
3054 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
3070 |
c print*,'## ncls(',ip,') ',ncls(ip) |
c print*,'## ncls(',ip,') ',ncls(ip) |
3071 |
do ic=1,ncls(ip) !loop on single clusters |
do ic=1,ncls(ip) !loop on single clusters |
3072 |
icl=cls(ip,ic) |
icl=cls(ip,ic) |
|
c print*,'## ic ',ic,' ist ',ist |
|
3073 |
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 |
3074 |
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) |
3075 |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
3076 |
$ .false.)goto 18882 !jump to the next singlet |
$ .false.)goto 18882 !jump to the next singlet |
3077 |
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.) |
|
3078 |
call xyz_PAM(icl,0,ist, |
call xyz_PAM(icl,0,ist, |
3079 |
$ PFA,PFA, |
$ PFA,PFA, |
3080 |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
3082 |
$ bxyz(2) |
$ bxyz(2) |
3083 |
$ ) |
$ ) |
3084 |
else !<---- Y view |
else !<---- Y view |
|
c call xyz_PAM(0,icl,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
|
3085 |
call xyz_PAM(0,icl,ist, |
call xyz_PAM(0,icl,ist, |
3086 |
$ PFA,PFA, |
$ PFA,PFA, |
3087 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
3091 |
endif |
endif |
3092 |
|
|
3093 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3094 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3095 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG)print*,'( cl-s ',icl |
3096 |
$ ,' ) normalized distance ',distance,'<',distmin,' ?' |
$ ,' ) distance ',distance,'<',distmin,' ?' |
3097 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3098 |
if(DEBUG)print*,'YES' |
if(DEBUG)print*,'YES' |
3099 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
3106 |
rymm = resyPAM |
rymm = resyPAM |
3107 |
distmin = distance |
distmin = distance |
3108 |
iclm = icl |
iclm = icl |
|
c dedxmm = sgnl(icl) !(1) |
|
3109 |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
3110 |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) !(1)(2) |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
3111 |
dedxmmy = 0. !(1) |
dedxmmy = 0. |
3112 |
else !<---- Y view |
else !<---- Y view |
3113 |
dedxmmx = 0. !(1) |
dedxmmx = 0. |
3114 |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) !(1)(2) |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
3115 |
endif |
endif |
3116 |
endif |
endif |
3117 |
18882 continue |
18882 continue |
3118 |
enddo !end loop on single clusters |
enddo !end loop on single clusters |
3119 |
c print*,'## distmin ', distmin,' clinc ',clinc |
c print*,'## distmin ', distmin,' clinc ',clinc |
3120 |
if(distmin.le.clinc)then |
|
3121 |
|
c QUIQUI------------ |
3122 |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
c anche qui: non ci vuole clinc??? |
3123 |
* ---------------------------- |
if(iclm.ne.0)then |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
|
3124 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
3125 |
XGOOD(nplanes-ip+1)=1. |
clincnew= |
3126 |
resx(nplanes-ip+1)=rxmm |
$ 20* |
3127 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
$ sqrt(rxmm**2+RCHI2_STORE(ibest)*k(ip)*cov(1,1)) |
3128 |
c if(.true.)print*,'%%%% included X-cl ',iclm |
else if(mod(VIEW(iclm),2).ne.0)then |
3129 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
clincnew= |
3130 |
$ ,', norm.dist.= ',distmin |
$ 10* |
3131 |
$ ,', cut ',clinc,' )' |
$ sqrt(rymm**2+RCHI2_STORE(ibest)*k(ip)*cov(2,2)) |
3132 |
else |
endif |
3133 |
YGOOD(nplanes-ip+1)=1. |
c QUIQUI------------ |
3134 |
resy(nplanes-ip+1)=rymm |
|
3135 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(distmin.le.clincnew)then !QUIQUI |
3136 |
c if(.true.)print*,'%%%% included Y-cl ',iclm |
c if(distmin.le.clinc)then !QUIQUI |
3137 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
|
3138 |
$ ,', norm.dist.= ', distmin |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
3139 |
$ ,', cut ',clinc,' )' |
* ---------------------------- |
3140 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
3141 |
|
if(mod(VIEW(iclm),2).eq.0)then |
3142 |
|
XGOOD(nplanes-ip+1)=1. |
3143 |
|
resx(nplanes-ip+1)=rxmm |
3144 |
|
if(DEBUG)print*,'%%%% included X-cl ',iclm |
3145 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3146 |
|
$ ,', dist.= ',distmin |
3147 |
|
$ ,', cut ',clinc,' )' |
3148 |
|
else |
3149 |
|
YGOOD(nplanes-ip+1)=1. |
3150 |
|
resy(nplanes-ip+1)=rymm |
3151 |
|
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
3152 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3153 |
|
$ ,', dist.= ', distmin |
3154 |
|
$ ,', cut ',clinc,' )' |
3155 |
|
endif |
3156 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
3157 |
|
* ---------------------------- |
3158 |
|
xm_A(nplanes-ip+1) = xmm_A |
3159 |
|
ym_A(nplanes-ip+1) = ymm_A |
3160 |
|
xm_B(nplanes-ip+1) = xmm_B |
3161 |
|
ym_B(nplanes-ip+1) = ymm_B |
3162 |
|
zm(nplanes-ip+1) = (zmm_A+zmm_B)/2. |
3163 |
|
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
3164 |
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
3165 |
|
* ---------------------------- |
3166 |
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) |
|
|
* ---------------------------- |
|
3167 |
endif |
endif |
3168 |
endif |
endif |
3169 |
133 continue |
133 continue |
3182 |
* * |
* * |
3183 |
* * |
* * |
3184 |
************************************************** |
************************************************** |
|
cccccc 12/08/2006 modified by elena ---> (1) |
|
3185 |
* |
* |
3186 |
subroutine clean_XYclouds(ibest,iflag) |
subroutine clean_XYclouds(ibest,iflag) |
3187 |
|
|
3188 |
include 'commontracker.f' |
include 'commontracker.f' |
3189 |
include 'level1.f' |
include 'level1.f' |
3190 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3191 |
c include 'momanhough_init.f' |
include 'level2.f' |
|
include 'level2.f' !(1) |
|
|
c include 'calib.f' |
|
|
c include 'level1.f' |
|
|
|
|
|
|
|
3192 |
|
|
3193 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
3194 |
|
|
3198 |
if(id.ne.0)then |
if(id.ne.0)then |
3199 |
iclx=clx(ip,icp_cp(id)) |
iclx=clx(ip,icp_cp(id)) |
3200 |
icly=cly(ip,icp_cp(id)) |
icly=cly(ip,icp_cp(id)) |
3201 |
c cl_used(iclx)=1 !tag used clusters |
cl_used(iclx)=ntrk !tag used clusters |
3202 |
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) |
|
3203 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
3204 |
c cl_used(icl)=1 !tag used clusters |
cl_used(icl)=ntrk !tag used clusters |
|
cl_used(icl)=ntrk !tag used clusters !1) |
|
3205 |
endif |
endif |
3206 |
|
|
|
c if(DEBUG)then |
|
|
c print*,ip,' <<< ',id |
|
|
c endif |
|
3207 |
* ----------------------------- |
* ----------------------------- |
3208 |
* remove the couple from clouds |
* remove the couple from clouds |
3209 |
* remove also vitual couples containing the |
* remove also vitual couples containing the |
3264 |
include 'level1.f' |
include 'level1.f' |
3265 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3266 |
include 'level2.f' |
include 'level2.f' |
|
c include 'level1.f' |
|
3267 |
|
|
3268 |
|
* --------------------------------- |
3269 |
|
* variables initialized from level1 |
3270 |
|
* --------------------------------- |
3271 |
do i=1,nviews |
do i=1,nviews |
3272 |
good2(i)=good1(i) |
good2(i)=good1(i) |
3273 |
|
do j=1,nva1_view |
3274 |
|
vkflag(i,j)=1 |
3275 |
|
if(cnnev(i,j).le.0)then |
3276 |
|
vkflag(i,j)=cnnev(i,j) |
3277 |
|
endif |
3278 |
|
enddo |
3279 |
enddo |
enddo |
3280 |
|
* ---------------- |
3281 |
|
* level2 variables |
3282 |
|
* ---------------- |
3283 |
NTRK = 0 |
NTRK = 0 |
3284 |
do it=1,NTRKMAX |
do it=1,NTRKMAX |
3285 |
IMAGE(IT)=0 |
IMAGE(IT)=0 |
3290 |
ZM_nt(IP,IT) = 0 |
ZM_nt(IP,IT) = 0 |
3291 |
RESX_nt(IP,IT) = 0 |
RESX_nt(IP,IT) = 0 |
3292 |
RESY_nt(IP,IT) = 0 |
RESY_nt(IP,IT) = 0 |
3293 |
|
TAILX_nt(IP,IT) = 0 |
3294 |
|
TAILY_nt(IP,IT) = 0 |
3295 |
|
XBAD(IP,IT) = 0 |
3296 |
|
YBAD(IP,IT) = 0 |
3297 |
XGOOD_nt(IP,IT) = 0 |
XGOOD_nt(IP,IT) = 0 |
3298 |
YGOOD_nt(IP,IT) = 0 |
YGOOD_nt(IP,IT) = 0 |
3299 |
|
LS(IP,IT) = 0 |
3300 |
DEDX_X(IP,IT) = 0 |
DEDX_X(IP,IT) = 0 |
3301 |
DEDX_Y(IP,IT) = 0 |
DEDX_Y(IP,IT) = 0 |
3302 |
CLTRX(IP,IT) = 0 |
CLTRX(IP,IT) = 0 |
3429 |
|
|
3430 |
|
|
3431 |
include 'commontracker.f' |
include 'commontracker.f' |
|
c include 'level1.f' |
|
3432 |
include 'level1.f' |
include 'level1.f' |
3433 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3434 |
include 'level2.f' |
include 'level2.f' |
3435 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
3436 |
real sinth,phi,pig |
include 'calib.f' |
3437 |
|
|
3438 |
|
character*10 PFA |
3439 |
|
common/FINALPFA/PFA |
3440 |
|
|
3441 |
|
real sinth,phi,pig |
3442 |
|
integer ssensor,sladder |
3443 |
pig=acos(-1.) |
pig=acos(-1.) |
3444 |
|
|
3445 |
|
* ------------------------------------- |
3446 |
chi2_nt(ntr) = sngl(chi2) |
chi2_nt(ntr) = sngl(chi2) |
3447 |
nstep_nt(ntr) = nstep |
nstep_nt(ntr) = nstep |
3448 |
|
* ------------------------------------- |
3449 |
phi = al(4) |
phi = al(4) |
3450 |
sinth = al(3) |
sinth = al(3) |
3451 |
if(sinth.lt.0)then |
if(sinth.lt.0)then |
3458 |
$ phi = phi + 2*pig |
$ phi = phi + 2*pig |
3459 |
al(4) = phi |
al(4) = phi |
3460 |
al(3) = sinth |
al(3) = sinth |
|
|
|
3461 |
do i=1,5 |
do i=1,5 |
3462 |
al_nt(i,ntr) = sngl(al(i)) |
al_nt(i,ntr) = sngl(al(i)) |
3463 |
do j=1,5 |
do j=1,5 |
3464 |
coval(i,j,ntr) = sngl(cov(i,j)) |
coval(i,j,ntr) = sngl(cov(i,j)) |
3465 |
enddo |
enddo |
3466 |
enddo |
enddo |
3467 |
|
* ------------------------------------- |
3468 |
do ip=1,nplanes ! loop on planes |
do ip=1,nplanes ! loop on planes |
3469 |
xgood_nt(ip,ntr) = int(xgood(ip)) |
xgood_nt(ip,ntr) = int(xgood(ip)) |
3470 |
ygood_nt(ip,ntr) = int(ygood(ip)) |
ygood_nt(ip,ntr) = int(ygood(ip)) |
3473 |
zm_nt(ip,ntr) = sngl(zm(ip)) |
zm_nt(ip,ntr) = sngl(zm(ip)) |
3474 |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
3475 |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
3476 |
|
TAILX_nt(IP,ntr) = 0. |
3477 |
|
TAILY_nt(IP,ntr) = 0. |
3478 |
xv_nt(ip,ntr) = sngl(xv(ip)) |
xv_nt(ip,ntr) = sngl(xv(ip)) |
3479 |
yv_nt(ip,ntr) = sngl(yv(ip)) |
yv_nt(ip,ntr) = sngl(yv(ip)) |
3480 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
zv_nt(ip,ntr) = sngl(zv(ip)) |
3482 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
3483 |
c l'avevo dimenticato!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
c l'avevo dimenticato!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
3484 |
factor = sqrt( |
factor = sqrt( |
3485 |
$ sin( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
3486 |
$ sin( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
3487 |
$ 1. ) |
$ 1. ) |
3488 |
c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
3489 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
3490 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
3491 |
|
|
3492 |
id = CP_STORE(ip,IDCAND) |
ax = axv_nt(ip,ntr) |
3493 |
|
ay = ayv_nt(ip,ntr) |
3494 |
|
bfx = BX_STORE(ip,IDCAND) |
3495 |
|
bfy = BY_STORE(ip,IDCAND) |
3496 |
|
if(ip.eq.6) ax = -1. * axv_nt(ip,ntr) |
3497 |
|
if(ip.eq.6) bfy = -1. * BY_STORE(ip,IDCAND) |
3498 |
|
tgtemp = tan(ax*acos(-1.)/180.) + pmuH_h*bfy*0.00001 |
3499 |
|
angx = 180.*atan(tgtemp)/acos(-1.) |
3500 |
|
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
3501 |
|
angy = 180.*atan(tgtemp)/acos(-1.) |
3502 |
|
|
3503 |
|
c print*,'* ',ip,bfx,bfy,angx,angy |
3504 |
|
|
3505 |
|
id = CP_STORE(ip,IDCAND) ! couple id |
3506 |
icl = CLS_STORE(ip,IDCAND) |
icl = CLS_STORE(ip,IDCAND) |
3507 |
|
ssensor = -1 |
3508 |
|
sladder = -1 |
3509 |
|
ssensor = SENSOR_STORE(ip,IDCAND) |
3510 |
|
sladder = LADDER_STORE(ip,IDCAND) |
3511 |
|
if(ip.eq.6.and.ssensor.ne.0)ssensor = 3 - ssensor !notazione paolo x align |
3512 |
|
LS(IP,ntr) = ssensor+10*sladder |
3513 |
|
|
3514 |
if(id.ne.0)then |
if(id.ne.0)then |
3515 |
|
c >>> is a couple |
3516 |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
3517 |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
3518 |
c print*,ip,' ',cltrx(ip,ntr),cltry(ip,ntr) |
|
3519 |
|
c$$$ if(is_cp(id).ne.ssensor) |
3520 |
|
c$$$ $ print*,'ERROR is sensor assignment (couple)' |
3521 |
|
c$$$ $ ,is_cp(id),ssensor |
3522 |
|
c$$$ if(LADDER(clx(nplanes-ip+1,icp_cp(id))).ne.sladder) |
3523 |
|
c$$$ $ print*,'ERROR is ladder assignment (couple)' |
3524 |
|
c$$$ $ ,LADDER(clx(nplanes-ip+1,icp_cp(id))),sladder |
3525 |
|
|
3526 |
|
nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
3527 |
|
nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
3528 |
|
xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) |
3529 |
|
ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) |
3530 |
|
|
3531 |
|
if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) |
3532 |
|
$ dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
3533 |
|
if(nsatstrips(cly(nplanes-ip+1,icp_cp(id))).gt.0) |
3534 |
|
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
3535 |
|
|
3536 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
3537 |
if(mod(VIEW(icl),2).eq.0)cltrx(ip,ntr)=icl |
c >>> is a singlet |
3538 |
if(mod(VIEW(icl),2).eq.1)cltry(ip,ntr)=icl |
c$$$ if(LADDER(icl).ne.sladder) |
3539 |
c print*,ip,' ',cltrx(ip,ntr),cltry(ip,ntr) |
c$$$ $ print*,'ERROR is ladder assignment (single)' |
3540 |
|
c$$$ $ ,LADDER(icl),sladder |
3541 |
|
if(mod(VIEW(icl),2).eq.0)then |
3542 |
|
cltrx(ip,ntr)=icl |
3543 |
|
nnnnn = npfastrips(icl,PFA,angx) |
3544 |
|
xbad(ip,ntr) = nbadstrips(nnnnn,icl) |
3545 |
|
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
3546 |
|
elseif(mod(VIEW(icl),2).eq.1)then |
3547 |
|
cltry(ip,ntr)=icl |
3548 |
|
nnnnn = npfastrips(icl,PFA,angy) |
3549 |
|
ybad(ip,ntr) = nbadstrips(nnnnn,icl) |
3550 |
|
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
3551 |
|
endif |
3552 |
endif |
endif |
3553 |
|
|
3554 |
enddo |
enddo |
3555 |
|
|
3556 |
|
|
3557 |
|
c$$$ print*,(xgood(i),i=1,6) |
3558 |
|
c$$$ print*,(ygood(i),i=1,6) |
3559 |
|
c$$$ print*,(ls(i,ntr),i=1,6) |
3560 |
|
c$$$ print*,(dedx_x(i,ntr),i=1,6) |
3561 |
|
c$$$ print*,(dedx_y(i,ntr),i=1,6) |
3562 |
|
c$$$ print*,'-----------------------' |
3563 |
|
|
3564 |
end |
end |
3565 |
|
|
3566 |
subroutine fill_level2_siglets |
subroutine fill_level2_siglets |
3572 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
3573 |
|
|
3574 |
include 'commontracker.f' |
include 'commontracker.f' |
|
c include 'level1.f' |
|
3575 |
include 'calib.f' |
include 'calib.f' |
3576 |
include 'level1.f' |
include 'level1.f' |
3577 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3579 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
3580 |
|
|
3581 |
* count #cluster per plane not associated to any track |
* count #cluster per plane not associated to any track |
|
c good2=1!.true. |
|
3582 |
nclsx = 0 |
nclsx = 0 |
3583 |
nclsy = 0 |
nclsy = 0 |
3584 |
|
|
3592 |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
3593 |
nclsx = nclsx + 1 |
nclsx = nclsx + 1 |
3594 |
planex(nclsx) = ip |
planex(nclsx) = ip |
3595 |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl))!(2) |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
3596 |
|
if(nsatstrips(icl).gt.0)sgnlxs(nclsx)=-sgnlxs(nclsx) |
3597 |
clsx(nclsx) = icl |
clsx(nclsx) = icl |
3598 |
do is=1,2 |
do is=1,2 |
3599 |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
3609 |
else !=== Y views |
else !=== Y views |
3610 |
nclsy = nclsy + 1 |
nclsy = nclsy + 1 |
3611 |
planey(nclsy) = ip |
planey(nclsy) = ip |
3612 |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl))!(2) |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
3613 |
|
if(nsatstrips(icl).gt.0)sgnlys(nclsy)=-sgnlys(nclsy) |
3614 |
clsy(nclsy) = icl |
clsy(nclsy) = icl |
3615 |
do is=1,2 |
do is=1,2 |
3616 |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
3625 |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
3626 |
endif |
endif |
3627 |
endif |
endif |
|
c print*,icl,cl_used(icl),cl_good(icl),ip,VIEW(icl)!nclsx(ip),nclsy(ip) |
|
3628 |
|
|
3629 |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
3630 |
whichtrack(icl) = cl_used(icl) |
whichtrack(icl) = cl_used(icl) |