215 |
c include 'momanhough_init.f' |
c include 'momanhough_init.f' |
216 |
|
|
217 |
logical FIMAGE ! |
logical FIMAGE ! |
218 |
|
real trackimage(NTRACKSMAX) |
219 |
real*8 AL_GUESS(5) |
real*8 AL_GUESS(5) |
220 |
|
|
221 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
332 |
iimage=0 |
iimage=0 |
333 |
endif |
endif |
334 |
if(icand.eq.0)then |
if(icand.eq.0)then |
335 |
if(VERBOSE)then |
if(VERBOSE.EQ.1)then |
336 |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
337 |
$ ,ibest,iimage |
$ ,ibest,iimage |
338 |
endif |
endif |
361 |
jstep=0 !# minimization steps |
jstep=0 !# minimization steps |
362 |
|
|
363 |
iprint=0 |
iprint=0 |
364 |
c if(DEBUG)iprint=1 |
c if(DEBUG.EQ.1)iprint=1 |
365 |
if(VERBOSE)iprint=1 |
if(VERBOSE.EQ.1)iprint=1 |
366 |
if(DEBUG)iprint=2 |
if(DEBUG.EQ.1)iprint=2 |
367 |
call mini2(jstep,ifail,iprint) |
call mini2(jstep,ifail,iprint) |
368 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
369 |
if(VERBOSE)then |
if(VERBOSE.EQ.1)then |
370 |
print *, |
print *, |
371 |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
372 |
$ ,iev |
$ ,iev |
381 |
c chi2=-chi2 |
c chi2=-chi2 |
382 |
endif |
endif |
383 |
|
|
384 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
385 |
print*,'----------------------------- improved track coord' |
print*,'----------------------------- improved track coord' |
386 |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
387 |
do ip=1,6 |
do ip=1,6 |
392 |
endif |
endif |
393 |
|
|
394 |
c rchi2=chi2/dble(ndof) |
c rchi2=chi2/dble(ndof) |
395 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
396 |
print*,' ' |
print*,' ' |
397 |
print*,'****** SELECTED TRACK *************' |
print*,'****** SELECTED TRACK *************' |
398 |
print*,'# R. chi2 RIG' |
print*,'# R. chi2 RIG' |
408 |
* ------------- search if the track has an IMAGE ------------- |
* ------------- search if the track has an IMAGE ------------- |
409 |
* ------------- (also this is stored ) ------------- |
* ------------- (also this is stored ) ------------- |
410 |
if(FIMAGE)goto 122 !>>> jump! (this is already an image) |
if(FIMAGE)goto 122 !>>> jump! (this is already an image) |
411 |
* now search for track-image, by comparing couples IDs |
|
412 |
|
* ----------------------------------------------------- |
413 |
|
* first check if the track is ambiguous |
414 |
|
* ----------------------------------------------------- |
415 |
|
* (modified on august 2007 by ElenaV) |
416 |
|
is1=0 |
417 |
|
do ip=1,NPLANES |
418 |
|
if(SENSOR_STORE(ip,icand).ne.0)then |
419 |
|
is1=SENSOR_STORE(ip,icand) |
420 |
|
if(ip.eq.6)is1=3-is1 !last plane inverted |
421 |
|
endif |
422 |
|
enddo |
423 |
|
if(is1.eq.0)then |
424 |
|
if(WARNING.EQ.1)print*,'** WARNING ** sensor=0' |
425 |
|
goto 122 !jump |
426 |
|
endif |
427 |
|
c print*,'is1 ',is1 |
428 |
|
do ip=1,NPLANES |
429 |
|
is2 = SENSOR_STORE(ip,icand) !sensor |
430 |
|
c print*,'is2 ',is2,' ip ',ip |
431 |
|
if(ip.eq.6.and.is2.ne.0)is2=3-is2 !last plane inverted |
432 |
|
if( |
433 |
|
$ (is1.ne.is2.and.is2.ne.0) |
434 |
|
$ )goto 122 !jump (this track cannot have an image) |
435 |
|
enddo |
436 |
|
if(DEBUG.eq.1)print*,' >>> ambiguous track! ' |
437 |
|
* now search for track-image among track candidates |
438 |
|
c$$$ do i=1,ntracks |
439 |
|
c$$$ iimage=i |
440 |
|
c$$$ do ip=1,nplanes |
441 |
|
c$$$ if( CP_STORE(nplanes-ip+1,icand).ne. |
442 |
|
c$$$ $ -1*CP_STORE(nplanes-ip+1,i).and. |
443 |
|
c$$$ $ CP_STORE(nplanes-ip+1,i).ne.0.and. |
444 |
|
c$$$ $ CP_STORE(nplanes-ip+1,icand).ne.0 )iimage=0 |
445 |
|
c$$$ print*,' track ',i,' CP ',CP_STORE(nplanes-ip+1,i) |
446 |
|
c$$$ $ ,CP_STORE(nplanes-ip+1,icand),iimage |
447 |
|
c$$$ enddo |
448 |
|
c$$$ if( iimage.ne.0.and. |
449 |
|
c$$$c $ RCHI2_STORE(i).le.CHI2MAX.and. |
450 |
|
c$$$c $ RCHI2_STORE(i).gt.0.and. |
451 |
|
c$$$ $ .true.)then |
452 |
|
c$$$ if(DEBUG.EQ.1)print*,'Track candidate ',iimage |
453 |
|
c$$$ $ ,' >>> TRACK IMAGE >>> of' |
454 |
|
c$$$ $ ,ibest |
455 |
|
c$$$ goto 122 !image track found |
456 |
|
c$$$ endif |
457 |
|
c$$$ enddo |
458 |
|
* --------------------------------------------------------------- |
459 |
|
* take the candidate with the greatest number of matching couples |
460 |
|
* if more than one satisfies the requirement, |
461 |
|
* choose the one with more points and lower chi2 |
462 |
|
* --------------------------------------------------------------- |
463 |
|
* count the number of matching couples |
464 |
|
ncpmax = 0 |
465 |
|
iimage = 0 !id of candidate with better matching |
466 |
do i=1,ntracks |
do i=1,ntracks |
467 |
iimage=i |
ncp=0 |
468 |
do ip=1,nplanes |
do ip=1,nplanes |
469 |
if( CP_STORE(nplanes-ip+1,icand).ne. |
if(CP_STORE(nplanes-ip+1,icand).ne.0)then |
470 |
$ -1*CP_STORE(nplanes-ip+1,i) )iimage=0 |
if( |
471 |
|
$ CP_STORE(nplanes-ip+1,i).ne.0 |
472 |
|
$ .and. |
473 |
|
$ CP_STORE(nplanes-ip+1,icand).eq. |
474 |
|
$ -1*CP_STORE(nplanes-ip+1,i) |
475 |
|
$ )then |
476 |
|
ncp=ncp+1 !ok |
477 |
|
elseif( |
478 |
|
$ CP_STORE(nplanes-ip+1,i).ne.0 |
479 |
|
$ .and. |
480 |
|
$ CP_STORE(nplanes-ip+1,icand).ne. |
481 |
|
$ -1*CP_STORE(nplanes-ip+1,i) |
482 |
|
$ )then |
483 |
|
ncp = 0 |
484 |
|
goto 117 !it is not an image candidate |
485 |
|
else |
486 |
|
|
487 |
|
endif |
488 |
|
endif |
489 |
|
c$$$ print*,' track ',i,' CP ',CP_STORE(nplanes-ip+1,i) |
490 |
|
c$$$ $ ,CP_STORE(nplanes-ip+1,icand),ncp |
491 |
enddo |
enddo |
492 |
if( iimage.ne.0.and. |
117 continue |
493 |
c $ RCHI2_STORE(i).le.CHI2MAX.and. |
trackimage(i)=ncp !number of matching couples |
494 |
c $ RCHI2_STORE(i).gt.0.and. |
if(ncp>ncpmax)then |
495 |
$ .true.)then |
ncpmax=ncp |
496 |
if(DEBUG)print*,'Track candidate ',iimage |
iimage=i |
|
$ ,' >>> TRACK IMAGE >>> of' |
|
|
$ ,ibest |
|
|
goto 122 !image track found |
|
497 |
endif |
endif |
498 |
enddo |
enddo |
499 |
|
* check if there are more than one image candidates |
500 |
|
ngood=0 |
501 |
|
do i=1,ntracks |
502 |
|
if( ncpmax.ne.0.and.trackimage(i).eq.ncpmax )ngood=ngood+1 |
503 |
|
enddo |
504 |
|
* if there are, choose the best one |
505 |
|
if(ngood.gt.1)then |
506 |
|
* ------------------------------------------------------- |
507 |
|
* order track-candidates according to: |
508 |
|
* 1st) decreasing n.points |
509 |
|
* 2nd) increasing chi**2 |
510 |
|
* ------------------------------------------------------- |
511 |
|
rchi2best=1000000000. |
512 |
|
ndofbest=0 |
513 |
|
do i=1,ntracks |
514 |
|
if( trackimage(i).eq.ncpmax )then |
515 |
|
ndof=0 |
516 |
|
do ii=1,nplanes |
517 |
|
ndof=ndof |
518 |
|
$ +int(xgood_store(ii,i)) |
519 |
|
$ +int(ygood_store(ii,i)) |
520 |
|
enddo |
521 |
|
if(ndof.gt.ndofbest)then |
522 |
|
iimage=i |
523 |
|
rchi2best=RCHI2_STORE(i) |
524 |
|
ndofbest=ndof |
525 |
|
elseif(ndof.eq.ndofbest)then |
526 |
|
if(RCHI2_STORE(i).lt.rchi2best.and. |
527 |
|
$ RCHI2_STORE(i).gt.0)then |
528 |
|
iimage=i |
529 |
|
rchi2best=RCHI2_STORE(i) |
530 |
|
ndofbest=ndof |
531 |
|
endif |
532 |
|
endif |
533 |
|
endif |
534 |
|
enddo |
535 |
|
|
536 |
|
endif |
537 |
|
|
538 |
|
if(DEBUG.EQ.1)print*,'Track candidate ',iimage |
539 |
|
$ ,' >>> TRACK IMAGE >>> of' |
540 |
|
$ ,ibest |
541 |
|
|
542 |
122 continue |
122 continue |
543 |
|
|
544 |
|
|
545 |
* --- and store the results -------------------------------- |
* --- and store the results -------------------------------- |
546 |
ntrk = ntrk + 1 !counter of found tracks |
ntrk = ntrk + 1 !counter of found tracks |
547 |
if(.not.FIMAGE |
if(.not.FIMAGE |
554 |
c $ ,iimage,fimage,ntrk,image(ntrk) |
c $ ,iimage,fimage,ntrk,image(ntrk) |
555 |
|
|
556 |
if(ntrk.eq.NTRKMAX)then |
if(ntrk.eq.NTRKMAX)then |
557 |
if(verbose) |
if(verbose.eq.1) |
558 |
$ print*, |
$ print*, |
559 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
560 |
$ 'tracks exceeds vector dimension ' |
$ 'tracks exceeds vector dimension ' |
590 |
$ rchi2best.le.CHI2MAX.and. |
$ rchi2best.le.CHI2MAX.and. |
591 |
c $ rchi2best.lt.15..and. |
c $ rchi2best.lt.15..and. |
592 |
$ .true.)then |
$ .true.)then |
593 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
594 |
print*,'***** NEW SEARCH ****' |
print*,'***** NEW SEARCH ****' |
595 |
endif |
endif |
596 |
goto 11111 !try new search |
goto 11111 !try new search |
712 |
zPAM_B = 0. |
zPAM_B = 0. |
713 |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
714 |
|
|
715 |
|
if(sensor.lt.1.or.sensor.gt.2)then |
716 |
|
print*,'xyz_PAM ***ERROR*** wrong input ' |
717 |
|
print*,'sensor ',sensor |
718 |
|
icx=0 |
719 |
|
icy=0 |
720 |
|
endif |
721 |
|
|
722 |
* ----------------- |
* ----------------- |
723 |
* CLUSTER X |
* CLUSTER X |
724 |
* ----------------- |
* ----------------- |
|
|
|
725 |
if(icx.ne.0)then |
if(icx.ne.0)then |
726 |
|
|
727 |
viewx = VIEW(icx) |
viewx = VIEW(icx) |
729 |
nplx = npl(VIEW(icx)) |
nplx = npl(VIEW(icx)) |
730 |
resxPAM = RESXAV |
resxPAM = RESXAV |
731 |
stripx = float(MAXS(icx)) |
stripx = float(MAXS(icx)) |
732 |
|
|
733 |
|
if( |
734 |
|
$ viewx.lt.1.or. |
735 |
|
$ viewx.gt.12.or. |
736 |
|
$ nldx.lt.1.or. |
737 |
|
$ nldx.gt.3.or. |
738 |
|
$ stripx.lt.1.or. |
739 |
|
$ stripx.gt.3072.or. |
740 |
|
$ .false.)then |
741 |
|
print*,'xyz_PAM ***ERROR*** wrong input ' |
742 |
|
print*,'icx ',icx,'view ',viewx,'nld ',nldx,'strip ',stripx |
743 |
|
icx = 0 |
744 |
|
goto 10 |
745 |
|
endif |
746 |
|
|
747 |
* -------------------------- |
* -------------------------- |
748 |
* magnetic-field corrections |
* magnetic-field corrections |
749 |
* -------------------------- |
* -------------------------- |
804 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
805 |
|
|
806 |
stripx = stripx + pfaeta2(icx,angx) |
stripx = stripx + pfaeta2(icx,angx) |
807 |
resxPAM = risx_eta2(abs(angx)) |
resxPAM = risxeta2(abs(angx)) |
808 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
809 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
c$$$ if(DEBUG.EQ.1.and.fbad_cog(2,icx).ne.1) |
810 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
c$$$ $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
811 |
|
|
812 |
elseif(PFAx.eq.'ETA3')then |
elseif(PFAx.eq.'ETA3')then |
813 |
|
|
814 |
stripx = stripx + pfaeta3(icx,angx) |
stripx = stripx + pfaeta3(icx,angx) |
815 |
resxPAM = risx_eta3(abs(angx)) |
resxPAM = risxeta3(abs(angx)) |
816 |
resxPAM = resxPAM*fbad_cog(3,icx) |
resxPAM = resxPAM*fbad_cog(3,icx) |
817 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) |
c if(DEBUG.and.fbad_cog(3,icx).ne.1) |
818 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
819 |
|
|
820 |
elseif(PFAx.eq.'ETA4')then |
elseif(PFAx.eq.'ETA4')then |
821 |
|
|
822 |
stripx = stripx + pfaeta4(icx,angx) |
stripx = stripx + pfaeta4(icx,angx) |
823 |
resxPAM = risx_eta4(abs(angx)) |
resxPAM = risxeta4(abs(angx)) |
824 |
resxPAM = resxPAM*fbad_cog(4,icx) |
resxPAM = resxPAM*fbad_cog(4,icx) |
825 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) |
c if(DEBUG.and.fbad_cog(4,icx).ne.1) |
826 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
827 |
|
|
828 |
elseif(PFAx.eq.'ETA')then |
elseif(PFAx.eq.'ETA')then |
829 |
|
|
830 |
stripx = stripx + pfaeta(icx,angx) |
stripx = stripx + pfaeta(icx,angx) |
831 |
resxPAM = ris_eta(icx,angx) |
c resxPAM = riseta(icx,angx) |
832 |
|
resxPAM = riseta(viewx,angx) |
833 |
|
resxPAM = resxPAM*fbad_eta(icx,angx) |
834 |
|
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
835 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
836 |
|
|
837 |
|
elseif(PFAx.eq.'ETAL')then |
838 |
|
|
839 |
|
stripx = stripx + pfaetal(icx,angx) |
840 |
|
resxPAM = riseta(viewx,angx) |
841 |
resxPAM = resxPAM*fbad_eta(icx,angx) |
resxPAM = resxPAM*fbad_eta(icx,angx) |
842 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
843 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
844 |
|
|
845 |
elseif(PFAx.eq.'COG')then |
elseif(PFAx.eq.'COG')then |
846 |
|
|
849 |
resxPAM = resxPAM*fbad_cog(0,icx) |
resxPAM = resxPAM*fbad_cog(0,icx) |
850 |
|
|
851 |
else |
else |
852 |
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
853 |
endif |
endif |
854 |
|
|
855 |
|
|
859 |
if( nsatstrips(icx).gt.0 )then |
if( nsatstrips(icx).gt.0 )then |
860 |
stripx = stripx + cog(4,icx) |
stripx = stripx + cog(4,icx) |
861 |
resxPAM = pitchX*1e-4/sqrt(12.) |
resxPAM = pitchX*1e-4/sqrt(12.) |
862 |
cc=cog(4,icx) |
cc cc=cog(4,icx) |
863 |
c$$$ print*,icx,' *** ',cc |
c$$$ print*,icx,' *** ',cc |
864 |
c$$$ print*,icx,' *** ',resxPAM |
c$$$ print*,icx,' *** ',resxPAM |
865 |
endif |
endif |
866 |
|
|
867 |
endif |
10 endif |
868 |
|
|
869 |
|
|
870 |
* ----------------- |
* ----------------- |
871 |
* CLUSTER Y |
* CLUSTER Y |
872 |
* ----------------- |
* ----------------- |
879 |
resyPAM = RESYAV |
resyPAM = RESYAV |
880 |
stripy = float(MAXS(icy)) |
stripy = float(MAXS(icy)) |
881 |
|
|
882 |
|
if( |
883 |
|
$ viewy.lt.1.or. |
884 |
|
$ viewy.gt.12.or. |
885 |
|
$ nldy.lt.1.or. |
886 |
|
$ nldy.gt.3.or. |
887 |
|
$ stripy.lt.1.or. |
888 |
|
$ stripy.gt.3072.or. |
889 |
|
$ .false.)then |
890 |
|
print*,'xyz_PAM ***ERROR*** wrong input ' |
891 |
|
print*,'icy ',icy,'view ',viewy,'nld ',nldy,'strip ',stripy |
892 |
|
icy = 0 |
893 |
|
goto 20 |
894 |
|
endif |
895 |
|
|
896 |
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 |
897 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
898 |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
899 |
$ ,icx,icy |
$ ,icx,icy |
900 |
endif |
endif |
946 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
947 |
|
|
948 |
stripy = stripy + pfaeta2(icy,angy) |
stripy = stripy + pfaeta2(icy,angy) |
949 |
resyPAM = risy_eta2(abs(angy)) |
resyPAM = risyeta2(abs(angy)) |
950 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
951 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
952 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
953 |
|
|
954 |
elseif(PFAy.eq.'ETA3')then |
elseif(PFAy.eq.'ETA3')then |
955 |
|
|
956 |
stripy = stripy + pfaeta3(icy,angy) |
stripy = stripy + pfaeta3(icy,angy) |
957 |
resyPAM = resyPAM*fbad_cog(3,icy) |
resyPAM = resyPAM*fbad_cog(3,icy) |
958 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) |
c if(DEBUG.and.fbad_cog(3,icy).ne.1) |
959 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
960 |
|
|
961 |
elseif(PFAy.eq.'ETA4')then |
elseif(PFAy.eq.'ETA4')then |
962 |
|
|
963 |
stripy = stripy + pfaeta4(icy,angy) |
stripy = stripy + pfaeta4(icy,angy) |
964 |
resyPAM = resyPAM*fbad_cog(4,icy) |
resyPAM = resyPAM*fbad_cog(4,icy) |
965 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) |
c if(DEBUG.and.fbad_cog(4,icy).ne.1) |
966 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
967 |
|
|
968 |
elseif(PFAy.eq.'ETA')then |
elseif(PFAy.eq.'ETA')then |
969 |
|
|
970 |
stripy = stripy + pfaeta(icy,angy) |
stripy = stripy + pfaeta(icy,angy) |
971 |
resyPAM = ris_eta(icy,angy) |
c resyPAM = riseta(icy,angy) |
972 |
|
resyPAM = riseta(viewy,angy) |
973 |
|
resyPAM = resyPAM*fbad_eta(icy,angy) |
974 |
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
975 |
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
976 |
|
|
977 |
|
elseif(PFAy.eq.'ETAL')then |
978 |
|
|
979 |
|
stripy = stripy + pfaetal(icy,angy) |
980 |
|
resyPAM = riseta(viewy,angy) |
981 |
resyPAM = resyPAM*fbad_eta(icy,angy) |
resyPAM = resyPAM*fbad_eta(icy,angy) |
982 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
983 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
984 |
|
|
985 |
elseif(PFAy.eq.'COG')then |
elseif(PFAy.eq.'COG')then |
986 |
|
|
989 |
resyPAM = resyPAM*fbad_cog(0,icy) |
resyPAM = resyPAM*fbad_cog(0,icy) |
990 |
|
|
991 |
else |
else |
992 |
if(DEBUG) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
993 |
endif |
endif |
994 |
|
|
995 |
|
|
999 |
if( nsatstrips(icy).gt.0 )then |
if( nsatstrips(icy).gt.0 )then |
1000 |
stripy = stripy + cog(4,icy) |
stripy = stripy + cog(4,icy) |
1001 |
resyPAM = pitchY*1e-4/sqrt(12.) |
resyPAM = pitchY*1e-4/sqrt(12.) |
1002 |
cc=cog(4,icy) |
cc cc=cog(4,icy) |
1003 |
c$$$ print*,icy,' *** ',cc |
c$$$ print*,icy,' *** ',cc |
1004 |
c$$$ print*,icy,' *** ',resyPAM |
c$$$ print*,icy,' *** ',resyPAM |
1005 |
endif |
endif |
1006 |
|
|
1007 |
|
|
1008 |
endif |
20 endif |
1009 |
|
|
1010 |
c$$$ print*,'## stripx,stripy ',stripx,stripy |
c$$$ print*,'## stripx,stripy ',stripx,stripy |
1011 |
|
|
1019 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
1020 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
1021 |
$ .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... |
1022 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
1023 |
print*,'xyz_PAM (couple):', |
print*,'xyz_PAM (couple):', |
1024 |
$ ' WARNING: false X strip: strip ',stripx |
$ ' WARNING: false X strip: strip ',stripx |
1025 |
endif |
endif |
1114 |
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... |
1115 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
1116 |
$ .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... |
1117 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
1118 |
print*,'xyz_PAM (X-singlet):', |
print*,'xyz_PAM (X-singlet):', |
1119 |
$ ' WARNING: false X strip: strip ',stripx |
$ ' WARNING: false X strip: strip ',stripx |
1120 |
endif |
endif |
1139 |
c print*,yi_A,' <--> ',yi_B |
c print*,yi_A,' <--> ',yi_B |
1140 |
|
|
1141 |
else |
else |
1142 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
1143 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
1144 |
print *,'icx = ',icx |
print *,'icx = ',icx |
1145 |
print *,'icy = ',icy |
print *,'icy = ',icy |
1208 |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
1209 |
|
|
1210 |
else |
else |
1211 |
if(DEBUG) then |
if(DEBUG.EQ.1) then |
1212 |
print *,'routine xyz_PAM ---> not properly used !!!' |
print *,'routine xyz_PAM ---> not properly used !!!' |
1213 |
print *,'icx = ',icx |
print *,'icx = ',icx |
1214 |
print *,'icy = ',icy |
print *,'icy = ',icy |
1252 |
|
|
1253 |
c$$$ PFAx = 'COG4'!PFA |
c$$$ PFAx = 'COG4'!PFA |
1254 |
c$$$ PFAy = 'COG4'!PFA |
c$$$ PFAy = 'COG4'!PFA |
1255 |
|
|
1256 |
|
|
1257 |
|
if(icx.gt.nclstr1.or.icy.gt.nclstr1)then |
1258 |
|
print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1259 |
|
$ ,' does not exists (nclstr1=',nclstr1,')' |
1260 |
|
icx = -1*icx |
1261 |
|
icy = -1*icy |
1262 |
|
return |
1263 |
|
|
1264 |
|
endif |
1265 |
|
|
1266 |
call idtoc(pfaid,PFAx) |
call idtoc(pfaid,PFAx) |
1267 |
call idtoc(pfaid,PFAy) |
call idtoc(pfaid,PFAy) |
1268 |
|
|
1269 |
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
cc print*,PFAx,PFAy |
1270 |
|
|
1271 |
|
c$$$ call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
1272 |
|
|
1273 |
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
1274 |
|
|
1276 |
|
|
1277 |
ipx=npl(VIEW(icx)) |
ipx=npl(VIEW(icx)) |
1278 |
ipy=npl(VIEW(icy)) |
ipy=npl(VIEW(icy)) |
1279 |
if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) |
c$$$ if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) |
1280 |
$ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1281 |
$ ,' does not belong to the correct plane: ',ip,ipx,ipy |
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
1282 |
|
|
1283 |
|
if( (nplanes-ipx+1).ne.ip )then |
1284 |
|
print*,'xyzpam: ***WARNING*** cluster ',icx |
1285 |
|
$ ,' does not belong to plane: ',ip |
1286 |
|
icx = -1*icx |
1287 |
|
return |
1288 |
|
endif |
1289 |
|
if( (nplanes-ipy+1).ne.ip )then |
1290 |
|
print*,'xyzpam: ***WARNING*** cluster ',icy |
1291 |
|
$ ,' does not belong to plane: ',ip |
1292 |
|
icy = -1*icy |
1293 |
|
return |
1294 |
|
endif |
1295 |
|
|
1296 |
|
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
1297 |
|
|
1298 |
xgood(ip) = 1. |
xgood(ip) = 1. |
1299 |
ygood(ip) = 1. |
ygood(ip) = 1. |
1313 |
elseif(icx.eq.0.and.icy.ne.0)then |
elseif(icx.eq.0.and.icy.ne.0)then |
1314 |
|
|
1315 |
ipy=npl(VIEW(icy)) |
ipy=npl(VIEW(icy)) |
1316 |
if((nplanes-ipy+1).ne.ip) |
c$$$ if((nplanes-ipy+1).ne.ip) |
1317 |
$ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1318 |
$ ,' does not belong to the correct plane: ',ip,ipx,ipy |
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
1319 |
|
if( (nplanes-ipy+1).ne.ip )then |
1320 |
|
print*,'xyzpam: ***WARNING*** cluster ',icy |
1321 |
|
$ ,' does not belong to plane: ',ip |
1322 |
|
icy = -1*icy |
1323 |
|
return |
1324 |
|
endif |
1325 |
|
|
1326 |
|
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
1327 |
|
|
1328 |
xgood(ip) = 0. |
xgood(ip) = 0. |
1329 |
ygood(ip) = 1. |
ygood(ip) = 1. |
1330 |
resx(ip) = 1000. |
resx(ip) = 1000. |
1343 |
elseif(icx.ne.0.and.icy.eq.0)then |
elseif(icx.ne.0.and.icy.eq.0)then |
1344 |
|
|
1345 |
ipx=npl(VIEW(icx)) |
ipx=npl(VIEW(icx)) |
1346 |
if((nplanes-ipx+1).ne.ip) |
c$$$ if((nplanes-ipx+1).ne.ip) |
1347 |
$ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1348 |
$ ,' does not belong to the correct plane: ',ip,ipx,ipy |
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
1349 |
|
|
1350 |
|
if( (nplanes-ipx+1).ne.ip )then |
1351 |
|
print*,'xyzpam: ***WARNING*** cluster ',icx |
1352 |
|
$ ,' does not belong to plane: ',ip |
1353 |
|
icx = -1*icx |
1354 |
|
return |
1355 |
|
endif |
1356 |
|
|
1357 |
|
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
1358 |
|
|
1359 |
xgood(ip) = 1. |
xgood(ip) = 1. |
1360 |
ygood(ip) = 0. |
ygood(ip) = 0. |
1361 |
resx(ip) = resxPAM |
resx(ip) = resxPAM |
1396 |
|
|
1397 |
endif |
endif |
1398 |
|
|
1399 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
1400 |
c print*,'----------------------------- track coord' |
c print*,'----------------------------- track coord' |
1401 |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
1402 |
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
1847 |
integer iflag |
integer iflag |
1848 |
|
|
1849 |
integer badseed,badclx,badcly |
integer badseed,badclx,badcly |
1850 |
|
|
1851 |
|
if(DEBUG.EQ.1)print*,'cl_to_couples:' |
1852 |
|
|
1853 |
* init variables |
* init variables |
1854 |
ncp_tot=0 |
ncp_tot=0 |
1879 |
* mask views with too many clusters |
* mask views with too many clusters |
1880 |
do iv=1,nviews |
do iv=1,nviews |
1881 |
if( ncl_view(iv).gt. nclusterlimit)then |
if( ncl_view(iv).gt. nclusterlimit)then |
1882 |
mask_view(iv) = 1 |
c mask_view(iv) = 1 |
1883 |
if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' |
mask_view(iv) = mask_view(iv) + 2**0 |
1884 |
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
if(DEBUG.EQ.1) |
1885 |
|
$ print*,' * WARNING * cl_to_couple: n.clusters > ' |
1886 |
|
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
1887 |
endif |
endif |
1888 |
enddo |
enddo |
1889 |
|
|
2021 |
endif |
endif |
2022 |
|
|
2023 |
if(ncp_plane(nplx).gt.ncouplemax)then |
if(ncp_plane(nplx).gt.ncouplemax)then |
2024 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
2025 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
2026 |
$ 'couples on plane ',nplx, |
$ 'couples on plane ',nplx, |
2027 |
$ 'exceeds vector dimention ' |
$ 'exceeds vector dimention ' |
2028 |
$ ,'( ',ncouplemax,' ) --> masked!' |
$ ,'( ',ncouplemax,' ) --> masked!' |
2029 |
mask_view(nviewx(nplx)) = 2 |
c mask_view(nviewx(nplx)) = 2 |
2030 |
mask_view(nviewy(nply)) = 2 |
c mask_view(nviewy(nply)) = 2 |
2031 |
|
mask_view(nviewx(nplx))= mask_view(nviewx(nplx))+ 2**1 |
2032 |
|
mask_view(nviewy(nply))= mask_view(nviewy(nply))+ 2**1 |
2033 |
goto 10 |
goto 10 |
2034 |
endif |
endif |
2035 |
|
|
2059 |
enddo |
enddo |
2060 |
|
|
2061 |
|
|
2062 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2063 |
print*,'clusters ',nclstr1 |
print*,'clusters ',nclstr1 |
2064 |
print*,'good ',(cl_good(i),i=1,nclstr1) |
print*,'good ',(cl_good(i),i=1,nclstr1) |
2065 |
print*,'singles ',(cl_single(i),i=1,nclstr1) |
print*,'singlets',(cl_single(i),i=1,nclstr1) |
2066 |
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
2067 |
endif |
endif |
2068 |
|
|
2122 |
real xc,zc,radius |
real xc,zc,radius |
2123 |
* ----------------------------- |
* ----------------------------- |
2124 |
|
|
2125 |
|
if(DEBUG.EQ.1)print*,'cp_to_doubtrip:' |
2126 |
|
|
2127 |
* -------------------------------------------- |
* -------------------------------------------- |
2128 |
* put a limit to the maximum number of couples |
* put a limit to the maximum number of couples |
2131 |
* -------------------------------------------- |
* -------------------------------------------- |
2132 |
do ip=1,nplanes |
do ip=1,nplanes |
2133 |
if(ncp_plane(ip).gt.ncouplelimit)then |
if(ncp_plane(ip).gt.ncouplelimit)then |
2134 |
mask_view(nviewx(ip)) = 8 |
c mask_view(nviewx(ip)) = 8 |
2135 |
mask_view(nviewy(ip)) = 8 |
c mask_view(nviewy(ip)) = 8 |
2136 |
|
mask_view(nviewx(ip)) = mask_view(nviewx(ip)) + 2**7 |
2137 |
|
mask_view(nviewy(ip)) = mask_view(nviewy(ip)) + 2**7 |
2138 |
endif |
endif |
2139 |
enddo |
enddo |
2140 |
|
|
2160 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
2161 |
if( mask_view(nviewx(ip2)).ne.0 .or. |
if( mask_view(nviewx(ip2)).ne.0 .or. |
2162 |
$ mask_view(nviewy(ip2)).ne.0 )goto 20 !skip plane |
$ mask_view(nviewy(ip2)).ne.0 )goto 20 !skip plane |
2163 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
|
|
|
2164 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
2165 |
icx2=clx(ip2,icp2) |
icx2=clx(ip2,icp2) |
2166 |
icy2=cly(ip2,icp2) |
icy2=cly(ip2,icp2) |
2179 |
* (2 couples needed) |
* (2 couples needed) |
2180 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
2181 |
if(ndblt.eq.ndblt_max)then |
if(ndblt.eq.ndblt_max)then |
2182 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
2183 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
2184 |
$ 'doublets exceeds vector dimention ' |
$ 'doublets exceeds vector dimention ' |
2185 |
$ ,'( ',ndblt_max,' )' |
$ ,'( ',ndblt_max,' )' |
2186 |
c good2=.false. |
c good2=.false. |
2187 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2188 |
do iv=1,12 |
do iv=1,12 |
2189 |
mask_view(iv) = 3 |
c mask_view(iv) = 3 |
2190 |
|
mask_view(iv) = mask_view(iv)+ 2**2 |
2191 |
enddo |
enddo |
2192 |
iflag=1 |
iflag=1 |
2193 |
return |
return |
2243 |
ym3=yPAM |
ym3=yPAM |
2244 |
zm3=zPAM |
zm3=zPAM |
2245 |
* find the circle passing through the three points |
* find the circle passing through the three points |
2246 |
|
c$$$ call tricircle(3,xp,zp,angp,resp,chi |
2247 |
|
c$$$ $ ,xc,zc,radius,iflag) |
2248 |
|
iflag = DEBUG |
2249 |
call tricircle(3,xp,zp,angp,resp,chi |
call tricircle(3,xp,zp,angp,resp,chi |
2250 |
$ ,xc,zc,radius,iflag) |
$ ,xc,zc,radius,iflag) |
2251 |
c print*,xc,zc,radius |
c print*,xc,zc,radius |
2262 |
* (3 couples needed) |
* (3 couples needed) |
2263 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
2264 |
if(ntrpt.eq.ntrpt_max)then |
if(ntrpt.eq.ntrpt_max)then |
2265 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
2266 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
2267 |
$ 'triplets exceeds vector dimention ' |
$ 'triplets exceeds vector dimention ' |
2268 |
$ ,'( ',ntrpt_max,' )' |
$ ,'( ',ntrpt_max,' )' |
2269 |
c good2=.false. |
c good2=.false. |
2270 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2271 |
do iv=1,nviews |
do iv=1,nviews |
2272 |
mask_view(iv) = 4 |
c mask_view(iv) = 4 |
2273 |
|
mask_view(iv)=mask_view(iv)+ 2**3 |
2274 |
enddo |
enddo |
2275 |
iflag=1 |
iflag=1 |
2276 |
return |
return |
2324 |
10 continue |
10 continue |
2325 |
enddo !end loop on planes - COPPIA 1 |
enddo !end loop on planes - COPPIA 1 |
2326 |
|
|
2327 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2328 |
print*,'--- doublets ',ndblt |
print*,'--- doublets ',ndblt |
2329 |
print*,'--- triplets ',ntrpt |
print*,'--- triplets ',ntrpt |
2330 |
endif |
endif |
2371 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
2372 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
2373 |
|
|
2374 |
|
if(DEBUG.EQ.1)print*,'doub_to_YZcloud:' |
2375 |
|
|
2376 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
2377 |
* classification of DOUBLETS |
* classification of DOUBLETS |
2498 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
2499 |
|
|
2500 |
if(nclouds_yz.ge.ncloyz_max)then |
if(nclouds_yz.ge.ncloyz_max)then |
2501 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
2502 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
2503 |
$ 'YZ clouds exceeds vector dimention ' |
$ 'YZ clouds exceeds vector dimention ' |
2504 |
$ ,'( ',ncloyz_max,' )' |
$ ,'( ',ncloyz_max,' )' |
2505 |
c good2=.false. |
c good2=.false. |
2506 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2507 |
do iv=1,nviews |
do iv=1,nviews |
2508 |
mask_view(iv) = 5 |
c mask_view(iv) = 5 |
2509 |
|
mask_view(iv) = mask_view(iv) + 2**4 |
2510 |
enddo |
enddo |
2511 |
iflag=1 |
iflag=1 |
2512 |
return |
return |
2526 |
c print*,'>> ',ipt,db_all(ipt) |
c print*,'>> ',ipt,db_all(ipt) |
2527 |
enddo |
enddo |
2528 |
npt_tot=npt_tot+npt |
npt_tot=npt_tot+npt |
2529 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2530 |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
2531 |
print*,'>>>> cloud ',nclouds_yz,' --- ',npt,' points' |
print*,'>>>> cloud ',nclouds_yz,' --- ',npt,' points' |
2532 |
print*,'- alfayz1 ',alfayz1_av(nclouds_yz) |
print*,'- alfayz1 ',alfayz1_av(nclouds_yz) |
2533 |
print*,'- alfayz2 ',alfayz2_av(nclouds_yz) |
print*,'- alfayz2 ',alfayz2_av(nclouds_yz) |
2534 |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
2535 |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
2536 |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
print*,'cpcloud_yz ' |
2537 |
|
$ ,(cpcloud_yz(nclouds_yz,icp),icp=1,ncp_tot) |
2538 |
|
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
2539 |
c$$$ print*,'nt-uple: ptcloud_yz(',nclouds_yz,') = ' |
c$$$ print*,'nt-uple: ptcloud_yz(',nclouds_yz,') = ' |
2540 |
c$$$ $ ,ptcloud_yz(nclouds_yz) |
c$$$ $ ,ptcloud_yz(nclouds_yz) |
2541 |
c$$$ print*,'nt-uple: db_cloud(...) = ' |
c$$$ print*,'nt-uple: db_cloud(...) = ' |
2553 |
goto 90 |
goto 90 |
2554 |
endif |
endif |
2555 |
|
|
2556 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2557 |
print*,'---------------------- ' |
print*,'---------------------- ' |
2558 |
print*,'Y-Z total clouds ',nclouds_yz |
print*,'Y-Z total clouds ',nclouds_yz |
2559 |
print*,' ' |
print*,' ' |
2602 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
2603 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
2604 |
|
|
2605 |
|
if(DEBUG.EQ.1)print*,'trip_to_XZcloud:' |
2606 |
|
|
2607 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
2608 |
* classification of TRIPLETS |
* classification of TRIPLETS |
2609 |
* according to distance in parameter space |
* according to distance in parameter space |
2661 |
$ +((alfaxz2(itrref)-alfaxz2(itr2))/Dalfaxz2)**2 |
$ +((alfaxz2(itrref)-alfaxz2(itr2))/Dalfaxz2)**2 |
2662 |
distance = sqrt(distance) |
distance = sqrt(distance) |
2663 |
|
|
2664 |
if(distance.lt.cutdistxz)then |
* ------------------------------------------------------------------------ |
2665 |
|
* FORCE INCLUSION OF TRIPLETS COMPOSED BY SAME COUPLES, IGNORING THE IMAGE |
2666 |
|
* ------------------------------------------------------------------------ |
2667 |
|
* (added in august 2007) |
2668 |
|
istrimage=0 |
2669 |
|
if( |
2670 |
|
$ abs(cpxz1(itrref)).eq.abs(cpxz1(itr2)).and. |
2671 |
|
$ abs(cpxz2(itrref)).eq.abs(cpxz2(itr2)).and. |
2672 |
|
$ abs(cpxz3(itrref)).eq.abs(cpxz3(itr2)).and. |
2673 |
|
$ .true.)istrimage=1 |
2674 |
|
|
2675 |
|
if(distance.lt.cutdistxz.or.istrimage.eq.1)then |
2676 |
c print*,idb1,idb2,distance,' cloud ',nclouds_yz |
c print*,idb1,idb2,distance,' cloud ',nclouds_yz |
2677 |
if(cpxz1(itr2).gt.0)cp_useds2(cpxz1(itr2))=1 |
if(cpxz1(itr2).gt.0)cp_useds2(cpxz1(itr2))=1 |
2678 |
if(cpxz1(itr2).lt.0)cp_useds1(-cpxz1(itr2))=1 |
if(cpxz1(itr2).lt.0)cp_useds1(-cpxz1(itr2))=1 |
2736 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
2737 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
2738 |
if(nclouds_xz.ge.ncloxz_max)then |
if(nclouds_xz.ge.ncloxz_max)then |
2739 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
2740 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
2741 |
$ 'XZ clouds exceeds vector dimention ' |
$ 'XZ clouds exceeds vector dimention ' |
2742 |
$ ,'( ',ncloxz_max,' )' |
$ ,'( ',ncloxz_max,' )' |
2743 |
c good2=.false. |
c good2=.false. |
2744 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2745 |
do iv=1,nviews |
do iv=1,nviews |
2746 |
mask_view(iv) = 6 |
c mask_view(iv) = 6 |
2747 |
|
mask_view(iv) = mask_view(iv) + 2**5 |
2748 |
enddo |
enddo |
2749 |
iflag=1 |
iflag=1 |
2750 |
return |
return |
2763 |
enddo |
enddo |
2764 |
npt_tot=npt_tot+npt |
npt_tot=npt_tot+npt |
2765 |
|
|
2766 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2767 |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
2768 |
print*,'>>>> cloud ',nclouds_xz,' --- ',npt,' points' |
print*,'>>>> cloud ',nclouds_xz,' --- ',npt,' points' |
2769 |
print*,'- alfaxz1 ',alfaxz1_av(nclouds_xz) |
print*,'- alfaxz1 ',alfaxz1_av(nclouds_xz) |
2770 |
print*,'- alfaxz2 ',alfaxz2_av(nclouds_xz) |
print*,'- alfaxz2 ',alfaxz2_av(nclouds_xz) |
2771 |
print*,'- alfaxz3 ',alfaxz3_av(nclouds_xz) |
print*,'- alfaxz3 ',alfaxz3_av(nclouds_xz) |
2772 |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
2773 |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
2774 |
|
print*,'cpcloud_xz ' |
2775 |
|
$ ,(cpcloud_xz(nclouds_xz,icp),icp=1,ncp_tot) |
2776 |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
2777 |
c$$$ print*,'nt-uple: ptcloud_xz(',nclouds_xz,') = ' |
c$$$ print*,'nt-uple: ptcloud_xz(',nclouds_xz,') = ' |
2778 |
c$$$ $ ,ptcloud_xz(nclouds_xz) |
c$$$ $ ,ptcloud_xz(nclouds_xz) |
2790 |
goto 91 |
goto 91 |
2791 |
endif |
endif |
2792 |
|
|
2793 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2794 |
print*,'---------------------- ' |
print*,'---------------------- ' |
2795 |
print*,'X-Z total clouds ',nclouds_xz |
print*,'X-Z total clouds ',nclouds_xz |
2796 |
print*,' ' |
print*,' ' |
2842 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2843 |
* variables for track fitting |
* variables for track fitting |
2844 |
double precision AL_INI(5) |
double precision AL_INI(5) |
|
c double precision tath |
|
2845 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
|
c real fitz(nplanes) !z coordinates of the planes in cm |
|
2846 |
|
|
2847 |
|
if(DEBUG.EQ.1)print*,'clouds_to_ctrack:' |
2848 |
|
|
2849 |
|
|
2850 |
ntracks=0 !counter of track candidates |
ntracks=0 !counter of track candidates |
2866 |
enddo |
enddo |
2867 |
enddo |
enddo |
2868 |
ncp_ok=0 |
ncp_ok=0 |
2869 |
do icp=1,ncp_tot !loop on couples |
do icp=1,ncp_tot !loop over couples |
2870 |
* get info on |
* get info on |
2871 |
cpintersec(icp)=min( |
cpintersec(icp)=min( |
2872 |
$ cpcloud_yz(iyz,icp), |
$ cpcloud_yz(iyz,icp), |
2875 |
$ (cpcloud_yz(iyz,icp).eq.1.and.cpcloud_xz(ixz,icp).eq.2).or. |
$ (cpcloud_yz(iyz,icp).eq.1.and.cpcloud_xz(ixz,icp).eq.2).or. |
2876 |
$ (cpcloud_yz(iyz,icp).eq.2.and.cpcloud_xz(ixz,icp).eq.1).or. |
$ (cpcloud_yz(iyz,icp).eq.2.and.cpcloud_xz(ixz,icp).eq.1).or. |
2877 |
$ .false.)cpintersec(icp)=0 |
$ .false.)cpintersec(icp)=0 |
2878 |
|
* cpintersec is >0 if yz and xz clouds contain the same image of couple icp |
2879 |
if(cpintersec(icp).ne.0)then |
if(cpintersec(icp).ne.0)then |
2880 |
ncp_ok=ncp_ok+1 |
ncp_ok=ncp_ok+1 |
2881 |
|
|
2908 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
2909 |
enddo |
enddo |
2910 |
|
|
|
c if(nplused.lt.nplxz_min)goto 888 !next doublet |
|
|
if(nplused.lt.nplyz_min)goto 888 !next doublet |
|
|
if(ncp_ok.lt.ncpok)goto 888 !next cloud |
|
2911 |
|
|
2912 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2913 |
print*,'Combination ',iyz,ixz |
print*,'Combination ',iyz,ixz |
2914 |
$ ,' db ',ptcloud_yz(iyz) |
$ ,' db ',ptcloud_yz(iyz) |
2915 |
$ ,' tr ',ptcloud_xz(ixz) |
$ ,' tr ',ptcloud_xz(ixz) |
2916 |
$ ,' -----> # matching couples ',ncp_ok |
$ ,' -----> # matching couples ',ncp_ok |
2917 |
endif |
endif |
2918 |
|
|
2919 |
|
c if(nplused.lt.nplxz_min)goto 888 !next combination |
2920 |
|
if(nplused.lt.nplyz_min)goto 888 !next combination |
2921 |
|
if(ncp_ok.lt.ncpok)goto 888 !next combination |
2922 |
|
|
2923 |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
2924 |
c$$$ print*,'Configurazione cluster XZ' |
c$$$ print*,'Configurazione cluster XZ' |
2925 |
c$$$ print*,'1 -- ',(clx(1,i),i=1,ncp_plane(1)) |
c$$$ print*,'1 -- ',(clx(1,i),i=1,ncp_plane(1)) |
2965 |
c$$$ |
c$$$ |
2966 |
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
2967 |
|
|
2968 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
2969 |
|
print*,'track candidate', ntracks+1 |
2970 |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
2971 |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
2972 |
print*,'3 >>> ',(cp_match(4,i),i=1,ncp_match(4)) |
print*,'3 >>> ',(cp_match(4,i),i=1,ncp_match(4)) |
2999 |
hit_plane(6)=icp6 |
hit_plane(6)=icp6 |
3000 |
if(ncp_match(6).eq.0)hit_plane(6)=0 !-icp6 |
if(ncp_match(6).eq.0)hit_plane(6)=0 !-icp6 |
3001 |
|
|
3002 |
|
* --------------------------------------- |
3003 |
|
* check if this group of couples has been |
3004 |
|
* already fitted |
3005 |
|
* --------------------------------------- |
3006 |
|
do ica=1,ntracks |
3007 |
|
isthesame=1 |
3008 |
|
do ip=1,NPLANES |
3009 |
|
if(hit_plane(ip).ne.0)then |
3010 |
|
if( CP_STORE(nplanes-ip+1,ica) |
3011 |
|
$ .ne. |
3012 |
|
$ cp_match(ip,hit_plane(ip)) ) |
3013 |
|
$ isthesame=0 |
3014 |
|
else |
3015 |
|
if( CP_STORE(nplanes-ip+1,ica) |
3016 |
|
$ .ne. |
3017 |
|
$ 0 ) |
3018 |
|
$ isthesame=0 |
3019 |
|
endif |
3020 |
|
enddo |
3021 |
|
if(isthesame.eq.1)then |
3022 |
|
if(DEBUG.eq.1) |
3023 |
|
$ print*,'(already fitted)' |
3024 |
|
goto 666 !jump to next combination |
3025 |
|
endif |
3026 |
|
enddo |
3027 |
|
|
3028 |
call track_init !init TRACK common |
call track_init !init TRACK common |
3029 |
|
|
3030 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes (bottom to top) |
3031 |
if(hit_plane(ip).ne.0)then |
if(hit_plane(ip).ne.0)then |
3032 |
id=cp_match(ip,hit_plane(ip)) |
id=cp_match(ip,hit_plane(ip)) |
3033 |
is=is_cp(id) |
is=is_cp(id) |
3071 |
ifail=0 !error flag in chi^2 computation |
ifail=0 !error flag in chi^2 computation |
3072 |
jstep=0 !number of minimization steps |
jstep=0 !number of minimization steps |
3073 |
iprint=0 |
iprint=0 |
3074 |
c if(DEBUG)iprint=1 |
c if(DEBUG.EQ.1)iprint=1 |
3075 |
if(DEBUG)iprint=2 |
if(DEBUG.EQ.1)iprint=2 |
3076 |
call mini2(jstep,ifail,iprint) |
call mini2(jstep,ifail,iprint) |
3077 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
3078 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
3079 |
print *, |
print *, |
3080 |
$ '*** MINIMIZATION FAILURE *** ' |
$ '*** MINIMIZATION FAILURE *** ' |
3081 |
$ //'(clouds_to_ctrack)' |
$ //'(clouds_to_ctrack)' |
3100 |
* -------------------------- |
* -------------------------- |
3101 |
if(ntracks.eq.NTRACKSMAX)then |
if(ntracks.eq.NTRACKSMAX)then |
3102 |
|
|
3103 |
if(verbose)print*, |
if(verbose.eq.1)print*, |
3104 |
$ '** warning ** number of candidate tracks '// |
$ '** warning ** number of candidate tracks '// |
3105 |
$ ' exceeds vector dimension ' |
$ ' exceeds vector dimension ' |
3106 |
$ ,'( ',NTRACKSMAX,' )' |
$ ,'( ',NTRACKSMAX,' )' |
3107 |
c good2=.false. |
c good2=.false. |
3108 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
3109 |
do iv=1,nviews |
do iv=1,nviews |
3110 |
mask_view(iv) = 7 |
c mask_view(iv) = 7 |
3111 |
|
mask_view(iv) = mask_view(iv) + 2**6 |
3112 |
enddo |
enddo |
3113 |
iflag=1 |
iflag=1 |
3114 |
return |
return |
3116 |
|
|
3117 |
ntracks = ntracks + 1 |
ntracks = ntracks + 1 |
3118 |
|
|
3119 |
do ip=1,nplanes |
do ip=1,nplanes !top to bottom |
3120 |
|
|
3121 |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
3122 |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
3133 |
AYV_STORE(ip,ntracks)=sngl(ayv(ip)) |
AYV_STORE(ip,ntracks)=sngl(ayv(ip)) |
3134 |
XGOOD_STORE(ip,ntracks)=sngl(xgood(ip)) |
XGOOD_STORE(ip,ntracks)=sngl(xgood(ip)) |
3135 |
YGOOD_STORE(ip,ntracks)=sngl(ygood(ip)) |
YGOOD_STORE(ip,ntracks)=sngl(ygood(ip)) |
3136 |
|
* NB! hit_plane is defined from bottom to top |
3137 |
if(hit_plane(ip).ne.0)then |
if(hit_plane(ip).ne.0)then |
3138 |
CP_STORE(nplanes-ip+1,ntracks)= |
CP_STORE(nplanes-ip+1,ntracks)= |
3139 |
$ cp_match(ip,hit_plane(ip)) |
$ cp_match(ip,hit_plane(ip)) |
3149 |
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
3150 |
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
3151 |
endif |
endif |
3152 |
BX_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
BX_STORE(ip,ntracks)=0!I dont need it now |
3153 |
BY_STORE(nplanes-ip+1,ntracks)=0!I dont need it now |
BY_STORE(ip,ntracks)=0!I dont need it now |
3154 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
CLS_STORE(ip,ntracks)=0 |
3155 |
do i=1,5 |
do i=1,5 |
3156 |
AL_STORE(i,ntracks)=sngl(AL(i)) |
AL_STORE(i,ntracks)=sngl(AL(i)) |
3157 |
enddo |
enddo |
3180 |
return |
return |
3181 |
endif |
endif |
3182 |
|
|
3183 |
c$$$ if(DEBUG)then |
c$$$ if(DEBUG.EQ.1)then |
3184 |
c$$$ print*,'****** TRACK CANDIDATES ***********' |
c$$$ print*,'****** TRACK CANDIDATES ***********' |
3185 |
c$$$ print*,'# R. chi2 RIG' |
c$$$ print*,'# R. chi2 RIG' |
3186 |
c$$$ do i=1,ntracks |
c$$$ do i=1,ntracks |
3189 |
c$$$ enddo |
c$$$ enddo |
3190 |
c$$$ print*,'***********************************' |
c$$$ print*,'***********************************' |
3191 |
c$$$ endif |
c$$$ endif |
3192 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
3193 |
print*,'****** TRACK CANDIDATES *****************' |
print*,'****** TRACK CANDIDATES *****************' |
3194 |
print*,'# R. chi2 RIG ndof' |
print*,'# R. chi2 RIG ndof' |
3195 |
do i=1,ntracks |
do i=1,ntracks |
3241 |
real xyzp(3),bxyz(3) |
real xyzp(3),bxyz(3) |
3242 |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
3243 |
|
|
3244 |
|
if(DEBUG.EQ.1)print*,'refine_track:' |
3245 |
* ================================================= |
* ================================================= |
3246 |
* new estimate of positions using ETA algorithm |
* new estimate of positions using ETA algorithm |
3247 |
* and |
* and |
3323 |
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
3324 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
3325 |
|
|
3326 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
3327 |
print*, |
print*, |
3328 |
$ '------ Plane ',ip,' intersected on LADDER ',nldt |
$ '------ Plane ',ip,' intersected on LADDER ',nldt |
3329 |
$ ,' SENSOR ',ist |
$ ,' SENSOR ',ist |
3334 |
* =========================================== |
* =========================================== |
3335 |
* STEP 1 >>>>>>> try to include a new couple |
* STEP 1 >>>>>>> try to include a new couple |
3336 |
* =========================================== |
* =========================================== |
3337 |
c if(DEBUG)print*,'>>>> try to include a new couple' |
c if(DEBUG.EQ.1)print*,'>>>> try to include a new couple' |
3338 |
distmin=1000000. |
distmin=1000000. |
3339 |
xmm = 0. |
xmm = 0. |
3340 |
ymm = 0. |
ymm = 0. |
3366 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3367 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3368 |
id=id_cp(ip,icp,ist) |
id=id_cp(ip,icp,ist) |
3369 |
if(DEBUG)print*,'( couple ',id |
if(DEBUG.EQ.1)print*,'( couple ',id |
3370 |
$ ,' ) distance ',distance |
$ ,' ) distance ',distance |
3371 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3372 |
xmm = xPAM |
xmm = xPAM |
3398 |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
3399 |
* ----------------------------------- |
* ----------------------------------- |
3400 |
CP_STORE(nplanes-ip+1,ibest)=idm |
CP_STORE(nplanes-ip+1,ibest)=idm |
3401 |
if(DEBUG)print*,'%%%% included couple ',idm |
if(DEBUG.EQ.1)print*,'%%%% included couple ',idm |
3402 |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
3403 |
goto 133 !next plane |
goto 133 !next plane |
3404 |
endif |
endif |
3406 |
* STEP 2 >>>>>>> try to include a single cluster |
* STEP 2 >>>>>>> try to include a single cluster |
3407 |
* either from a couple or single |
* either from a couple or single |
3408 |
* ================================================ |
* ================================================ |
3409 |
c if(DEBUG)print*,'>>>> try to include a new cluster' |
c if(DEBUG.EQ.1)print*,'>>>> try to include a new cluster' |
3410 |
distmin=1000000. |
distmin=1000000. |
3411 |
xmm_A = 0. !--------------------------- |
xmm_A = 0. !--------------------------- |
3412 |
ymm_A = 0. ! init variables that |
ymm_A = 0. ! init variables that |
3443 |
$ ) |
$ ) |
3444 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3445 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3446 |
if(DEBUG)print*,'( cl-X ',icx |
if(DEBUG.EQ.1)print*,'( cl-X ',icx |
3447 |
$ ,' in cp ',id,' ) distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
3448 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3449 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
3476 |
$ ) |
$ ) |
3477 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3478 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3479 |
if(DEBUG)print*,'( cl-Y ',icy |
if(DEBUG.EQ.1)print*,'( cl-Y ',icy |
3480 |
$ ,' in cp ',id,' ) distance ',distance |
$ ,' in cp ',id,' ) distance ',distance |
3481 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3482 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
3521 |
|
|
3522 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3523 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3524 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG.EQ.1)print*,'( cl-s ',icl |
3525 |
$ ,' ) distance ',distance,'<',distmin,' ?' |
$ ,' ) distance ',distance |
3526 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3527 |
if(DEBUG)print*,'YES' |
c if(DEBUG.EQ.1)print*,'YES' |
3528 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
3529 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
3530 |
zmm_A = zPAM_A |
zmm_A = zPAM_A |
3570 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
3571 |
XGOOD(nplanes-ip+1)=1. |
XGOOD(nplanes-ip+1)=1. |
3572 |
resx(nplanes-ip+1)=rxmm |
resx(nplanes-ip+1)=rxmm |
3573 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
if(DEBUG.EQ.1)print*,'%%%% included X-cl ',iclm |
3574 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3575 |
$ ,', dist.= ',distmin |
$ ,', dist.= ',distmin |
3576 |
$ ,', cut ',clinc,' )' |
$ ,', cut ',clinc,' )' |
3577 |
else |
else |
3578 |
YGOOD(nplanes-ip+1)=1. |
YGOOD(nplanes-ip+1)=1. |
3579 |
resy(nplanes-ip+1)=rymm |
resy(nplanes-ip+1)=rymm |
3580 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(DEBUG.EQ.1)print*,'%%%% included Y-cl ',iclm |
3581 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3582 |
$ ,', dist.= ', distmin |
$ ,', dist.= ', distmin |
3583 |
$ ,', cut ',clinc,' )' |
$ ,', cut ',clinc,' )' |
3619 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3620 |
include 'level2.f' |
include 'level2.f' |
3621 |
|
|
3622 |
|
if(DEBUG.EQ.1)print*,'clean_XYclouds:' |
3623 |
|
|
3624 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
3625 |
|
|
3626 |
id=CP_STORE(nplanes-ip+1,ibest) |
id=CP_STORE(nplanes-ip+1,ibest) |
3629 |
if(id.ne.0)then |
if(id.ne.0)then |
3630 |
iclx=clx(ip,icp_cp(id)) |
iclx=clx(ip,icp_cp(id)) |
3631 |
icly=cly(ip,icp_cp(id)) |
icly=cly(ip,icp_cp(id)) |
3632 |
cl_used(iclx)=ntrk !tag used clusters |
c$$$ cl_used(iclx)=ntrk !tag used clusters |
3633 |
cl_used(icly)=ntrk !tag used clusters |
c$$$ cl_used(icly)=ntrk !tag used clusters |
3634 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
3635 |
cl_used(icl)=ntrk !tag used clusters |
c$$$ cl_used(icl)=ntrk !tag used clusters |
3636 |
endif |
endif |
3637 |
|
|
3638 |
* ----------------------------- |
* ----------------------------- |
3651 |
$ cly(ip,icp).eq.icl |
$ cly(ip,icp).eq.icl |
3652 |
$ )then |
$ )then |
3653 |
id=id_cp(ip,icp,1) |
id=id_cp(ip,icp,1) |
3654 |
if(DEBUG)then |
if(DEBUG.EQ.1)then |
3655 |
print*,ip,' <<< cp ',id |
print*,ip,' <<< cp ',id |
3656 |
$ ,' ( cl-x ' |
$ ,' ( cl-x ' |
3657 |
$ ,clx(ip,icp) |
$ ,clx(ip,icp) |
3911 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
zv_nt(ip,ntr) = sngl(zv(ip)) |
3912 |
axv_nt(ip,ntr) = sngl(axv(ip)) |
axv_nt(ip,ntr) = sngl(axv(ip)) |
3913 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
3914 |
c l'avevo dimenticato!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
3915 |
factor = sqrt( |
factor = sqrt( |
3916 |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
3917 |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
3918 |
$ 1. ) |
$ 1. ) |
3919 |
c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
3920 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
3921 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
3922 |
|
|
3947 |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
3948 |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
3949 |
|
|
3950 |
c$$$ if(is_cp(id).ne.ssensor) |
cl_used(cltrx(ip,ntr)) = 1 !tag used clusters |
3951 |
c$$$ $ print*,'ERROR is sensor assignment (couple)' |
cl_used(cltry(ip,ntr)) = 1 !tag used clusters |
3952 |
c$$$ $ ,is_cp(id),ssensor |
|
3953 |
c$$$ if(LADDER(clx(nplanes-ip+1,icp_cp(id))).ne.sladder) |
c$$$ nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
3954 |
c$$$ $ print*,'ERROR is ladder assignment (couple)' |
c$$$ nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
3955 |
c$$$ $ ,LADDER(clx(nplanes-ip+1,icp_cp(id))),sladder |
c$$$ xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) |
3956 |
|
c$$$ ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) |
3957 |
nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) |
3958 |
nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) |
3959 |
xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) |
|
|
ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) |
|
3960 |
|
|
3961 |
if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) |
if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) |
3962 |
$ dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
$ dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
3964 |
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
3965 |
|
|
3966 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
3967 |
c >>> is a singlet |
|
3968 |
c$$$ if(LADDER(icl).ne.sladder) |
cl_used(icl) = 1 !tag used clusters |
3969 |
c$$$ $ print*,'ERROR is ladder assignment (single)' |
|
|
c$$$ $ ,LADDER(icl),sladder |
|
3970 |
if(mod(VIEW(icl),2).eq.0)then |
if(mod(VIEW(icl),2).eq.0)then |
3971 |
cltrx(ip,ntr)=icl |
cltrx(ip,ntr)=icl |
3972 |
nnnnn = npfastrips(icl,PFA,angx) |
c$$$ nnnnn = npfastrips(icl,PFA,angx) |
3973 |
xbad(ip,ntr) = nbadstrips(nnnnn,icl) |
c$$$ xbad(ip,ntr) = nbadstrips(nnnnn,icl) |
3974 |
|
xbad(ip,ntr) = nbadstrips(4,icl) |
3975 |
|
|
3976 |
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
3977 |
elseif(mod(VIEW(icl),2).eq.1)then |
elseif(mod(VIEW(icl),2).eq.1)then |
3978 |
cltry(ip,ntr)=icl |
cltry(ip,ntr)=icl |
3979 |
nnnnn = npfastrips(icl,PFA,angy) |
c$$$ nnnnn = npfastrips(icl,PFA,angy) |
3980 |
ybad(ip,ntr) = nbadstrips(nnnnn,icl) |
c$$$ ybad(ip,ntr) = nbadstrips(nnnnn,icl) |
3981 |
|
ybad(ip,ntr) = nbadstrips(4,icl) |
3982 |
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
3983 |
endif |
endif |
3984 |
|
|
3985 |
endif |
endif |
3986 |
|
|
3987 |
enddo |
enddo |
3988 |
|
|
3989 |
|
if(DEBUG.eq.1)then |
3990 |
|
print*,'> STORING TRACK ',ntr |
3991 |
|
print*,'clusters: ' |
3992 |
|
do ip=1,6 |
3993 |
|
print*,'> ',ip,' -- ',cltrx(ip,ntr),cltry(ip,ntr) |
3994 |
|
enddo |
3995 |
|
endif |
3996 |
|
|
3997 |
c$$$ print*,(xgood(i),i=1,6) |
c$$$ print*,(xgood(i),i=1,6) |
3998 |
c$$$ print*,(ygood(i),i=1,6) |
c$$$ print*,(ygood(i),i=1,6) |
4023 |
nclsy = 0 |
nclsy = 0 |
4024 |
|
|
4025 |
do iv = 1,nviews |
do iv = 1,nviews |
4026 |
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) |
4027 |
|
good2(iv) = good2(iv) + mask_view(iv)*2**8 |
4028 |
enddo |
enddo |
4029 |
|
|
4030 |
|
if(DEBUG.eq.1)then |
4031 |
|
print*,'> STORING SINGLETS ' |
4032 |
|
endif |
4033 |
|
|
4034 |
do icl=1,nclstr1 |
do icl=1,nclstr1 |
4035 |
|
|
4036 |
|
ip=nplanes-npl(VIEW(icl))+1 |
4037 |
|
|
4038 |
if(cl_used(icl).eq.0)then !cluster not included in any track |
if(cl_used(icl).eq.0)then !cluster not included in any track |
|
ip=nplanes-npl(VIEW(icl))+1 |
|
4039 |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
4040 |
nclsx = nclsx + 1 |
nclsx = nclsx + 1 |
4041 |
planex(nclsx) = ip |
planex(nclsx) = ip |
4075 |
|
|
4076 |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
4077 |
whichtrack(icl) = cl_used(icl) |
whichtrack(icl) = cl_used(icl) |
4078 |
|
* -------------------------------------------------- |
4079 |
|
* per non perdere la testa... |
4080 |
|
* whichtrack(icl) e` una variabile del common level1 |
4081 |
|
* che serve solo per sapere quali cluster sono stati |
4082 |
|
* associati ad una traccia, e permettere di salvare |
4083 |
|
* solo questi nell'albero di uscita |
4084 |
|
* -------------------------------------------------- |
4085 |
|
|
4086 |
|
|
4087 |
|
c$$$ print*,' cl ',icl,' --> ',cl_used(icl) |
4088 |
|
c$$$ |
4089 |
|
c$$$ if( cl_used(icl).ne.0 )then |
4090 |
|
c$$$ if( |
4091 |
|
c$$$ $ mod(VIEW(icl),2).eq.0.and. |
4092 |
|
c$$$ $ cltrx(ip,whichtrack(icl)).ne.icl ) |
4093 |
|
c$$$ $ print*,'**WARNING** cltrx(',ip,',',whichtrack(icl) |
4094 |
|
c$$$ $ ,')=',cltrx(ip,whichtrack(icl)),'.ne.',icl |
4095 |
|
c$$$ if( |
4096 |
|
c$$$ $ mod(VIEW(icl),2).eq.1.and. |
4097 |
|
c$$$ $ cltry(ip,whichtrack(icl)).ne.icl ) |
4098 |
|
c$$$ $ print*,'**WARNING** cltry(',ip,',',whichtrack(icl) |
4099 |
|
c$$$ $ ,')=',cltry(ip,whichtrack(icl)),'.ne.',icl |
4100 |
|
c$$$ endif |
4101 |
|
|
4102 |
|
|
4103 |
enddo |
enddo |
4104 |
end |
end |