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 |
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 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
273 |
* 2nd) increasing chi**2 |
* 2nd) increasing chi**2 |
274 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
275 |
rchi2best=1000000000. |
rchi2best=1000000000. |
276 |
ndofbest=0 !(1) |
ndofbest=0 |
277 |
do i=1,ntracks |
do i=1,ntracks |
278 |
ndof=0 !(1) |
ndof=0 |
279 |
do ii=1,nplanes !(1) |
do ii=1,nplanes |
280 |
ndof=ndof !(1) |
ndof=ndof |
281 |
$ +int(xgood_store(ii,i)) !(1) |
$ +int(xgood_store(ii,i)) |
282 |
$ +int(ygood_store(ii,i)) !(1) |
$ +int(ygood_store(ii,i)) |
283 |
enddo !(1) |
enddo |
284 |
if(ndof.gt.ndofbest)then !(1) |
if(ndof.gt.ndofbest)then |
285 |
ibest=i |
ibest=i |
286 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
287 |
ndofbest=ndof !(1) |
ndofbest=ndof |
288 |
elseif(ndof.eq.ndofbest)then !(1) |
elseif(ndof.eq.ndofbest)then |
289 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
if(RCHI2_STORE(i).lt.rchi2best.and. |
290 |
$ RCHI2_STORE(i).gt.0)then |
$ RCHI2_STORE(i).gt.0)then |
291 |
ibest=i |
ibest=i |
292 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
293 |
ndofbest=ndof !(1) |
ndofbest=ndof |
294 |
endif !(1) |
endif |
295 |
endif |
endif |
296 |
enddo |
enddo |
297 |
|
|
332 |
iimage=0 |
iimage=0 |
333 |
endif |
endif |
334 |
if(icand.eq.0)then |
if(icand.eq.0)then |
335 |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
if(VERBOSE.EQ.1)then |
336 |
$ ,ibest,iimage |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
337 |
|
$ ,ibest,iimage |
338 |
|
endif |
339 |
return |
return |
340 |
endif |
endif |
341 |
|
|
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 |
674 |
include 'commontracker.f' |
include 'commontracker.f' |
675 |
include 'level1.f' |
include 'level1.f' |
676 |
include 'calib.f' |
include 'calib.f' |
|
c include 'level1.f' |
|
677 |
include 'common_align.f' |
include 'common_align.f' |
678 |
include 'common_mech.f' |
include 'common_mech.f' |
679 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
|
c include 'common_resxy.f' |
|
|
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
680 |
|
|
681 |
integer icx,icy !X-Y cluster ID |
integer icx,icy !X-Y cluster ID |
682 |
integer sensor |
integer sensor |
691 |
double precision xrt,yrt,zrt |
double precision xrt,yrt,zrt |
692 |
double precision xrt_A,yrt_A,zrt_A |
double precision xrt_A,yrt_A,zrt_A |
693 |
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 |
|
694 |
|
|
695 |
|
|
696 |
parameter (ndivx=30) |
parameter (ndivx=30) |
697 |
|
|
698 |
|
|
699 |
|
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
700 |
|
|
701 |
resxPAM = 0 |
resxPAM = 0 |
702 |
resyPAM = 0 |
resyPAM = 0 |
711 |
yPAM_B = 0. |
yPAM_B = 0. |
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) |
728 |
nldx = nld(MAXS(icx),VIEW(icx)) |
nldx = nld(MAXS(icx),VIEW(icx)) |
729 |
nplx = npl(VIEW(icx)) |
nplx = npl(VIEW(icx)) |
730 |
resxPAM = RESXAV |
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 |
* -------------------------- |
* -------------------------- |
|
c$$$ print*,nplx,ax,bfy/10. |
|
750 |
angtemp = ax |
angtemp = ax |
751 |
bfytemp = bfy |
bfytemp = bfy |
752 |
if(nplx.eq.6) angtemp = -1. * ax |
* ///////////////////////////////// |
753 |
if(nplx.eq.6) bfytemp = -1. * bfy |
* AAAAHHHHHHHH!!!!!!!!!!!!!!!!!!!!! |
754 |
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
* *grvzkkjsdgjhhhgngbn###>:( |
755 |
angx = 180.*atan(tgtemp)/acos(-1.) |
* ///////////////////////////////// |
756 |
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
c if(nplx.eq.6) angtemp = -1. * ax |
757 |
|
c if(nplx.eq.6) bfytemp = -1. * bfy |
758 |
|
if(viewx.eq.12) angtemp = -1. * ax |
759 |
|
if(viewx.eq.12) bfytemp = -1. * bfy |
760 |
|
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
761 |
|
angx = 180.*atan(tgtemp)/acos(-1.) |
762 |
|
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
763 |
|
c$$$ print*,nplx,ax,bfy/10. |
764 |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
765 |
c$$$ print*,'========================' |
c$$$ print*,'========================' |
766 |
|
c$$$ if(bfy.ne.0.)print*,viewx,'-x- ' |
767 |
|
c$$$ $ ,bfy,-1*0.5*pmuH_h*bfytemp*0.00001*SiDimZ |
768 |
* -------------------------- |
* -------------------------- |
769 |
|
|
770 |
|
c$$$ print*,'--- x-cl ---' |
771 |
|
c$$$ istart = INDSTART(ICX) |
772 |
|
c$$$ istop = TOTCLLENGTH |
773 |
|
c$$$ if(icx.lt.NCLSTR1)istop=INDSTART(ICX+1)-1 |
774 |
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
775 |
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
776 |
|
c$$$ print*,INDMAX(icx) |
777 |
|
c$$$ print*,cog(4,icx) |
778 |
|
c$$$ print*,fbad_cog(4,icx) |
779 |
|
|
780 |
|
|
781 |
if(PFAx.eq.'COG1')then |
if(PFAx.eq.'COG1')then |
782 |
stripx = stripx |
|
783 |
resxPAM = resxPAM |
stripx = stripx |
784 |
|
resxPAM = 1e-4*pitchX/sqrt(12.)!!resxPAM |
785 |
|
|
786 |
elseif(PFAx.eq.'COG2')then |
elseif(PFAx.eq.'COG2')then |
787 |
stripx = stripx + cog(2,icx) |
|
788 |
|
stripx = stripx + cog(2,icx) |
789 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
790 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
791 |
|
|
792 |
elseif(PFAx.eq.'COG3')then |
elseif(PFAx.eq.'COG3')then |
793 |
stripx = stripx + cog(3,icx) |
|
794 |
|
stripx = stripx + cog(3,icx) |
795 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
796 |
resxPAM = resxPAM*fbad_cog(3,icx) |
resxPAM = resxPAM*fbad_cog(3,icx) |
797 |
|
|
798 |
elseif(PFAx.eq.'COG4')then |
elseif(PFAx.eq.'COG4')then |
799 |
c print*,'COG4' |
|
800 |
stripx = stripx + cog(4,icx) |
stripx = stripx + cog(4,icx) |
801 |
|
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
802 |
resxPAM = resxPAM*fbad_cog(4,icx) |
resxPAM = resxPAM*fbad_cog(4,icx) |
803 |
|
|
804 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
805 |
stripx = stripx + pfaeta2(icx,angx) |
|
806 |
resxPAM = risx_eta2(abs(angx)) |
stripx = stripx + pfaeta2(icx,angx) |
807 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
resxPAM = risxeta2(abs(angx)) |
|
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
|
808 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
809 |
|
c$$$ if(DEBUG.EQ.1.and.fbad_cog(2,icx).ne.1) |
810 |
|
c$$$ $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
811 |
|
|
812 |
elseif(PFAx.eq.'ETA3')then |
elseif(PFAx.eq.'ETA3')then |
813 |
stripx = stripx + pfaeta3(icx,angx) |
|
814 |
resxPAM = risx_eta3(abs(angx)) |
stripx = stripx + pfaeta3(icx,angx) |
815 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) |
resxPAM = risxeta3(abs(angx)) |
|
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
|
816 |
resxPAM = resxPAM*fbad_cog(3,icx) |
resxPAM = resxPAM*fbad_cog(3,icx) |
817 |
|
c if(DEBUG.and.fbad_cog(3,icx).ne.1) |
818 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
819 |
|
|
820 |
elseif(PFAx.eq.'ETA4')then |
elseif(PFAx.eq.'ETA4')then |
821 |
stripx = stripx + pfaeta4(icx,angx) |
|
822 |
resxPAM = risx_eta4(abs(angx)) |
stripx = stripx + pfaeta4(icx,angx) |
823 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) |
resxPAM = risxeta4(abs(angx)) |
|
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
|
824 |
resxPAM = resxPAM*fbad_cog(4,icx) |
resxPAM = resxPAM*fbad_cog(4,icx) |
825 |
|
c if(DEBUG.and.fbad_cog(4,icx).ne.1) |
826 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
827 |
|
|
828 |
elseif(PFAx.eq.'ETA')then |
elseif(PFAx.eq.'ETA')then |
829 |
c print*,'ETA' |
|
830 |
stripx = stripx + pfaeta(icx,angx) |
stripx = stripx + pfaeta(icx,angx) |
831 |
resxPAM = ris_eta(icx,angx) |
c resxPAM = riseta(icx,angx) |
832 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
resxPAM = riseta(viewx,angx) |
833 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
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 |
|
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
843 |
|
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
844 |
|
|
845 |
elseif(PFAx.eq.'COG')then |
elseif(PFAx.eq.'COG')then |
846 |
stripx = stripx + cog(0,icx) |
|
847 |
|
stripx = stripx + cog(0,icx) |
848 |
resxPAM = risx_cog(abs(angx)) |
resxPAM = risx_cog(abs(angx)) |
849 |
resxPAM = resxPAM*fbad_cog(0,icx) |
resxPAM = resxPAM*fbad_cog(0,icx) |
850 |
|
|
851 |
else |
else |
852 |
print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
853 |
endif |
endif |
854 |
|
|
|
c print*,'%%%%%%%%%%%%' |
|
855 |
|
|
856 |
endif |
* ====================================== |
857 |
|
* temporary patch for saturated clusters |
858 |
|
* ====================================== |
859 |
|
if( nsatstrips(icx).gt.0 )then |
860 |
|
stripx = stripx + cog(4,icx) |
861 |
|
resxPAM = pitchX*1e-4/sqrt(12.) |
862 |
|
cc cc=cog(4,icx) |
863 |
|
c$$$ print*,icx,' *** ',cc |
864 |
|
c$$$ print*,icx,' *** ',resxPAM |
865 |
|
endif |
866 |
|
|
867 |
|
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 |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
if(DEBUG.EQ.1) then |
898 |
$ ,icx,icy |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
899 |
|
$ ,icx,icy |
900 |
|
endif |
901 |
goto 100 |
goto 100 |
902 |
endif |
endif |
903 |
* -------------------------- |
* -------------------------- |
906 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
907 |
angy = 180.*atan(tgtemp)/acos(-1.) |
angy = 180.*atan(tgtemp)/acos(-1.) |
908 |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
909 |
|
c$$$ if(bfx.ne.0.)print*,viewy,'-y- ' |
910 |
|
c$$$ $ ,bfx,0.5*pmuH_e*bfx*0.00001*SiDimZ |
911 |
* -------------------------- |
* -------------------------- |
912 |
|
|
913 |
if(PFAy.eq.'COG1')then !(1) |
c$$$ print*,'--- y-cl ---' |
914 |
stripy = stripy !(1) |
c$$$ istart = INDSTART(ICY) |
915 |
resyPAM = resyPAM !(1) |
c$$$ istop = TOTCLLENGTH |
916 |
|
c$$$ if(icy.lt.NCLSTR1)istop=INDSTART(ICY+1)-1 |
917 |
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
918 |
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
919 |
|
c$$$ print*,INDMAX(icy) |
920 |
|
c$$$ print*,cog(4,icy) |
921 |
|
c$$$ print*,fbad_cog(4,icy) |
922 |
|
|
923 |
|
if(PFAy.eq.'COG1')then |
924 |
|
|
925 |
|
stripy = stripy |
926 |
|
resyPAM = 1e-4*pitchY/sqrt(12.)!resyPAM |
927 |
|
|
928 |
elseif(PFAy.eq.'COG2')then |
elseif(PFAy.eq.'COG2')then |
929 |
stripy = stripy + cog(2,icy) |
|
930 |
|
stripy = stripy + cog(2,icy) |
931 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
932 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
933 |
|
|
934 |
elseif(PFAy.eq.'COG3')then |
elseif(PFAy.eq.'COG3')then |
935 |
stripy = stripy + cog(3,icy) |
|
936 |
|
stripy = stripy + cog(3,icy) |
937 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
938 |
resyPAM = resyPAM*fbad_cog(3,icy) |
resyPAM = resyPAM*fbad_cog(3,icy) |
939 |
|
|
940 |
elseif(PFAy.eq.'COG4')then |
elseif(PFAy.eq.'COG4')then |
941 |
stripy = stripy + cog(4,icy) |
|
942 |
|
stripy = stripy + cog(4,icy) |
943 |
|
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
944 |
resyPAM = resyPAM*fbad_cog(4,icy) |
resyPAM = resyPAM*fbad_cog(4,icy) |
945 |
|
|
946 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
947 |
c cog2 = cog(2,icy) |
|
948 |
c etacorr = pfaeta2(cog2,viewy,nldy,angy) |
stripy = stripy + pfaeta2(icy,angy) |
949 |
c stripy = stripy + etacorr |
resyPAM = risyeta2(abs(angy)) |
|
stripy = stripy + pfaeta2(icy,angy) !(3) |
|
|
resyPAM = risy_eta2(abs(angy)) ! (4) |
|
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 |
elseif(PFAy.eq.'ETA3')then !(3) |
|
954 |
stripy = stripy + pfaeta3(icy,angy) !(3) |
elseif(PFAy.eq.'ETA3')then |
955 |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
|
956 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
stripy = stripy + pfaeta3(icy,angy) |
957 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
resyPAM = resyPAM*fbad_cog(3,icy) |
958 |
elseif(PFAy.eq.'ETA4')then !(3) |
c if(DEBUG.and.fbad_cog(3,icy).ne.1) |
959 |
stripy = stripy + pfaeta4(icy,angy) !(3) |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
960 |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
|
961 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
elseif(PFAy.eq.'ETA4')then |
962 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
|
963 |
elseif(PFAy.eq.'ETA')then !(3) |
stripy = stripy + pfaeta4(icy,angy) |
964 |
stripy = stripy + pfaeta(icy,angy) !(3) |
resyPAM = resyPAM*fbad_cog(4,icy) |
965 |
resyPAM = ris_eta(icy,angy) ! (4) |
c if(DEBUG.and.fbad_cog(4,icy).ne.1) |
966 |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
967 |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
|
968 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) !(3) |
elseif(PFAy.eq.'ETA')then |
969 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy)!(3) |
|
970 |
|
stripy = stripy + pfaeta(icy,angy) |
971 |
|
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) |
982 |
|
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
983 |
|
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
984 |
|
|
985 |
elseif(PFAy.eq.'COG')then |
elseif(PFAy.eq.'COG')then |
986 |
stripy = stripy + cog(0,icy) |
|
987 |
resyPAM = risy_cog(abs(angy)) ! (4) |
stripy = stripy + cog(0,icy) |
988 |
c resyPAM = ris_eta(icy,angy) ! (4) |
resyPAM = risy_cog(abs(angy)) |
989 |
resyPAM = resyPAM*fbad_cog(0,icy) |
resyPAM = resyPAM*fbad_cog(0,icy) |
990 |
|
|
991 |
else |
else |
992 |
print*,'*** Non valid p.f.a. (x) --> ',PFAx |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
993 |
|
endif |
994 |
|
|
995 |
|
|
996 |
|
* ====================================== |
997 |
|
* temporary patch for saturated clusters |
998 |
|
* ====================================== |
999 |
|
if( nsatstrips(icy).gt.0 )then |
1000 |
|
stripy = stripy + cog(4,icy) |
1001 |
|
resyPAM = pitchY*1e-4/sqrt(12.) |
1002 |
|
cc cc=cog(4,icy) |
1003 |
|
c$$$ print*,icy,' *** ',cc |
1004 |
|
c$$$ print*,icy,' *** ',resyPAM |
1005 |
endif |
endif |
1006 |
|
|
|
endif |
|
1007 |
|
|
1008 |
c print*,'## stripx,stripy ',stripx,stripy |
20 endif |
1009 |
|
|
1010 |
|
c$$$ print*,'## stripx,stripy ',stripx,stripy |
1011 |
|
|
1012 |
c=========================================================== |
c=========================================================== |
1013 |
C COUPLE |
C COUPLE |
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 |
print*,'xyz_PAM (couple):', |
if(DEBUG.EQ.1) then |
1023 |
$ ' WARNING: false X strip: strip ',stripx |
print*,'xyz_PAM (couple):', |
1024 |
|
$ ' WARNING: false X strip: strip ',stripx |
1025 |
|
endif |
1026 |
endif |
endif |
1027 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
1028 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
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 |
print*,'xyz_PAM (X-singlet):', |
if(DEBUG.EQ.1) then |
1118 |
$ ' WARNING: false X strip: strip ',stripx |
print*,'xyz_PAM (X-singlet):', |
1119 |
|
$ ' WARNING: false X strip: strip ',stripx |
1120 |
|
endif |
1121 |
endif |
endif |
1122 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
1123 |
|
|
1139 |
c print*,yi_A,' <--> ',yi_B |
c print*,yi_A,' <--> ',yi_B |
1140 |
|
|
1141 |
else |
else |
1142 |
|
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 |
1146 |
|
endif |
1147 |
goto 100 |
goto 100 |
1148 |
|
|
1149 |
endif |
endif |
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.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 |
1215 |
|
endif |
1216 |
endif |
endif |
1217 |
|
|
1218 |
|
|
1223 |
100 continue |
100 continue |
1224 |
end |
end |
1225 |
|
|
1226 |
|
************************************************************************ |
1227 |
|
* Call xyz_PAM subroutine with default PFA and fill the mini2 common. |
1228 |
|
* (done to be called from c/c++) |
1229 |
|
************************************************************************ |
1230 |
|
|
1231 |
|
subroutine xyzpam(ip,icx,icy,lad,sensor,ax,ay,bfx,bfy) |
1232 |
|
|
1233 |
|
include 'commontracker.f' |
1234 |
|
include 'level1.f' |
1235 |
|
include 'common_mini_2.f' |
1236 |
|
include 'common_xyzPAM.f' |
1237 |
|
include 'common_mech.f' |
1238 |
|
include 'calib.f' |
1239 |
|
|
1240 |
|
* flag to chose PFA |
1241 |
|
c$$$ character*10 PFA |
1242 |
|
c$$$ common/FINALPFA/PFA |
1243 |
|
|
1244 |
|
integer icx,icy !X-Y cluster ID |
1245 |
|
integer sensor |
1246 |
|
character*4 PFAx,PFAy !PFA to be used |
1247 |
|
real ax,ay !X-Y geometric angle |
1248 |
|
real bfx,bfy !X-Y b-field components |
1249 |
|
|
1250 |
|
ipx=0 |
1251 |
|
ipy=0 |
1252 |
|
|
1253 |
|
c$$$ PFAx = 'COG4'!PFA |
1254 |
|
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) |
1267 |
|
call idtoc(pfaid,PFAy) |
1268 |
|
|
1269 |
|
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 |
1274 |
|
|
1275 |
|
if(icx.ne.0.and.icy.ne.0)then |
1276 |
|
|
1277 |
|
ipx=npl(VIEW(icx)) |
1278 |
|
ipy=npl(VIEW(icy)) |
1279 |
|
c$$$ if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) |
1280 |
|
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1281 |
|
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. |
1299 |
|
ygood(ip) = 1. |
1300 |
|
resx(ip) = resxPAM |
1301 |
|
resy(ip) = resyPAM |
1302 |
|
|
1303 |
|
xm(ip) = xPAM |
1304 |
|
ym(ip) = yPAM |
1305 |
|
zm(ip) = zPAM |
1306 |
|
xm_A(ip) = 0. |
1307 |
|
ym_A(ip) = 0. |
1308 |
|
xm_B(ip) = 0. |
1309 |
|
ym_B(ip) = 0. |
1310 |
|
|
1311 |
|
c zv(ip) = zPAM |
1312 |
|
|
1313 |
|
elseif(icx.eq.0.and.icy.ne.0)then |
1314 |
|
|
1315 |
|
ipy=npl(VIEW(icy)) |
1316 |
|
c$$$ if((nplanes-ipy+1).ne.ip) |
1317 |
|
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1318 |
|
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. |
1329 |
|
ygood(ip) = 1. |
1330 |
|
resx(ip) = 1000. |
1331 |
|
resy(ip) = resyPAM |
1332 |
|
|
1333 |
|
xm(ip) = -100. |
1334 |
|
ym(ip) = -100. |
1335 |
|
zm(ip) = (zPAM_A+zPAM_B)/2. |
1336 |
|
xm_A(ip) = xPAM_A |
1337 |
|
ym_A(ip) = yPAM_A |
1338 |
|
xm_B(ip) = xPAM_B |
1339 |
|
ym_B(ip) = yPAM_B |
1340 |
|
|
1341 |
|
c zv(ip) = (zPAM_A+zPAM_B)/2. |
1342 |
|
|
1343 |
|
elseif(icx.ne.0.and.icy.eq.0)then |
1344 |
|
|
1345 |
|
ipx=npl(VIEW(icx)) |
1346 |
|
c$$$ if((nplanes-ipx+1).ne.ip) |
1347 |
|
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
1348 |
|
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. |
1360 |
|
ygood(ip) = 0. |
1361 |
|
resx(ip) = resxPAM |
1362 |
|
resy(ip) = 1000. |
1363 |
|
|
1364 |
|
xm(ip) = -100. |
1365 |
|
ym(ip) = -100. |
1366 |
|
zm(ip) = (zPAM_A+zPAM_B)/2. |
1367 |
|
xm_A(ip) = xPAM_A |
1368 |
|
ym_A(ip) = yPAM_A |
1369 |
|
xm_B(ip) = xPAM_B |
1370 |
|
ym_B(ip) = yPAM_B |
1371 |
|
|
1372 |
|
c zv(ip) = (zPAM_A+zPAM_B)/2. |
1373 |
|
|
1374 |
|
else |
1375 |
|
|
1376 |
|
il = 2 |
1377 |
|
if(lad.ne.0)il=lad |
1378 |
|
is = 1 |
1379 |
|
if(sensor.ne.0)is=sensor |
1380 |
|
c print*,nplanes-ip+1,il,is |
1381 |
|
|
1382 |
|
xgood(ip) = 0. |
1383 |
|
ygood(ip) = 0. |
1384 |
|
resx(ip) = 1000. |
1385 |
|
resy(ip) = 1000. |
1386 |
|
|
1387 |
|
xm(ip) = -100. |
1388 |
|
ym(ip) = -100. |
1389 |
|
zm(ip) = z_mech_sensor(nplanes-ip+1,il,is)*1000./1.d4 |
1390 |
|
xm_A(ip) = 0. |
1391 |
|
ym_A(ip) = 0. |
1392 |
|
xm_B(ip) = 0. |
1393 |
|
ym_B(ip) = 0. |
1394 |
|
|
1395 |
|
c zv(ip) = z_mech_sensor(nplanes-ip+1,il,is)*1000./1.d4 |
1396 |
|
|
1397 |
|
endif |
1398 |
|
|
1399 |
|
if(DEBUG.EQ.1)then |
1400 |
|
c print*,'----------------------------- track coord' |
1401 |
|
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
1402 |
|
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
1403 |
|
$ ,xm_A(ip),ym_A(ip),xm_B(ip),ym_B(ip) |
1404 |
|
$ ,xgood(ip),ygood(ip),resx(ip),resy(ip) |
1405 |
|
c$$$ print*,'-----------------------------' |
1406 |
|
endif |
1407 |
|
end |
1408 |
|
|
1409 |
******************************************************************************** |
******************************************************************************** |
1410 |
******************************************************************************** |
******************************************************************************** |
1480 |
endif |
endif |
1481 |
|
|
1482 |
distance= |
distance= |
1483 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)!QUIQUI |
1484 |
|
cc $ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
1485 |
distance=dsqrt(distance) |
distance=dsqrt(distance) |
1486 |
|
|
1487 |
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 |
1506 |
* ---------------------- |
* ---------------------- |
1507 |
|
|
1508 |
distance= |
distance= |
1509 |
$ ((xPAM-XPP)/resxPAM)**2 |
$ ((xPAM-XPP))**2 !QUIQUI |
1510 |
$ + |
$ + |
1511 |
$ ((yPAM-YPP)/resyPAM)**2 |
$ ((yPAM-YPP))**2 |
1512 |
|
c$$$ $ ((xPAM-XPP)/resxPAM)**2 |
1513 |
|
c$$$ $ + |
1514 |
|
c$$$ $ ((yPAM-YPP)/resyPAM)**2 |
1515 |
distance=dsqrt(distance) |
distance=dsqrt(distance) |
1516 |
|
|
1517 |
c$$$ print*,xPAM,yPAM,zPAM |
c$$$ print*,xPAM,yPAM,zPAM |
1520 |
|
|
1521 |
else |
else |
1522 |
|
|
1523 |
print* |
c print* |
1524 |
$ ,' function distance_to ---> wrong usage!!!' |
c $ ,' function distance_to ---> wrong usage!!!' |
1525 |
print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
c print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
1526 |
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 ' |
1527 |
$ ,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 |
1528 |
endif |
endif |
1529 |
|
|
1530 |
distance_to = sngl(distance) |
distance_to = sngl(distance) |
1592 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
1593 |
$ .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... |
1594 |
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... |
1595 |
print*,'whichsensor: ', |
c print*,'whichsensor: ', |
1596 |
$ ' WARNING: false X strip: strip ',stripx |
c $ ' WARNING: false X strip: strip ',stripx |
1597 |
endif |
endif |
1598 |
xi = acoordsi(stripx,viewx) |
xi = acoordsi(stripx,viewx) |
1599 |
yi = acoordsi(stripy,viewy) |
yi = acoordsi(stripy,viewy) |
1748 |
is_cp=0 |
is_cp=0 |
1749 |
if(id.lt.0)is_cp=1 |
if(id.lt.0)is_cp=1 |
1750 |
if(id.gt.0)is_cp=2 |
if(id.gt.0)is_cp=2 |
1751 |
if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
c if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
1752 |
|
|
1753 |
return |
return |
1754 |
end |
end |
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 |
2731 |
enddo |
enddo |
2732 |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
2733 |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
2734 |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
if(nplused.lt.nplxz_min)goto 22288 !next triplet |
2735 |
|
|
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*,' ' |
2811 |
************************************************** |
************************************************** |
2812 |
|
|
2813 |
subroutine clouds_to_ctrack(iflag) |
subroutine clouds_to_ctrack(iflag) |
|
c***************************************************** |
|
|
c 02/02/2006 modified by Elena Vannuccini --> (1) |
|
|
c***************************************************** |
|
2814 |
|
|
2815 |
include 'commontracker.f' |
include 'commontracker.f' |
2816 |
include 'level1.f' |
include 'level1.f' |
2818 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2819 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2820 |
include 'common_mech.f' |
include 'common_mech.f' |
2821 |
c include 'momanhough_init.f' |
|
2822 |
|
|
2823 |
|
|
2824 |
* output flag |
* output flag |
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 |
c$$$ ndof=0 |
do ip=1,nplanes !top to bottom |
3120 |
do ip=1,nplanes |
|
|
c$$$ ndof=ndof |
|
|
c$$$ $ +int(xgood(ip)) |
|
|
c$$$ $ +int(ygood(ip)) |
|
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)) |
3123 |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
ZV_STORE(ip,ntracks)=sngl(zv(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)) |
3140 |
|
SENSOR_STORE(nplanes-ip+1,ntracks) |
3141 |
|
$ = is_cp(cp_match(ip,hit_plane(ip))) |
3142 |
|
LADDER_STORE(nplanes-ip+1,ntracks) |
3143 |
|
$ = LADDER( |
3144 |
|
$ clx(ip,icp_cp( |
3145 |
|
$ cp_match(ip,hit_plane(ip) |
3146 |
|
$ )))); |
3147 |
else |
else |
3148 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
3149 |
|
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
3150 |
|
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
3151 |
endif |
endif |
3152 |
CLS_STORE(nplanes-ip+1,ntracks)=0 |
BX_STORE(ip,ntracks)=0!I dont need it now |
3153 |
|
BY_STORE(ip,ntracks)=0!I dont need it now |
3154 |
|
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 |
3158 |
enddo |
enddo |
3159 |
|
|
|
c$$$ * Number of Degree Of Freedom |
|
|
c$$$ ndof=ndof-5 |
|
|
c$$$ * reduced chi^2 |
|
|
c$$$ rchi2=chi2/dble(ndof) |
|
3160 |
RCHI2_STORE(ntracks)=chi2 |
RCHI2_STORE(ntracks)=chi2 |
3161 |
|
|
3162 |
* -------------------------------- |
* -------------------------------- |
3180 |
return |
return |
3181 |
endif |
endif |
3182 |
|
|
3183 |
if(DEBUG)then |
c$$$ if(DEBUG.EQ.1)then |
3184 |
print*,'****** TRACK CANDIDATES ***********' |
c$$$ print*,'****** TRACK CANDIDATES ***********' |
3185 |
print*,'# R. chi2 RIG' |
c$$$ print*,'# R. chi2 RIG' |
3186 |
do i=1,ntracks |
c$$$ do i=1,ntracks |
3187 |
print*,i,' --- ',rchi2_store(i),' --- ' |
c$$$ print*,i,' --- ',rchi2_store(i),' --- ' |
3188 |
$ ,1./abs(AL_STORE(5,i)) |
c$$$ $ ,1./abs(AL_STORE(5,i)) |
3189 |
enddo |
c$$$ enddo |
3190 |
print*,'***********************************' |
c$$$ print*,'***********************************' |
3191 |
|
c$$$ endif |
3192 |
|
if(DEBUG.EQ.1)then |
3193 |
|
print*,'****** TRACK CANDIDATES *****************' |
3194 |
|
print*,'# R. chi2 RIG ndof' |
3195 |
|
do i=1,ntracks |
3196 |
|
ndof=0 !(1) |
3197 |
|
do ii=1,nplanes !(1) |
3198 |
|
ndof=ndof !(1) |
3199 |
|
$ +int(xgood_store(ii,i)) !(1) |
3200 |
|
$ +int(ygood_store(ii,i)) !(1) |
3201 |
|
enddo !(1) |
3202 |
|
print*,i,' --- ',rchi2_store(i),' --- ' |
3203 |
|
$ ,1./abs(AL_STORE(5,i)),' --- ',ndof |
3204 |
|
enddo |
3205 |
|
print*,'*****************************************' |
3206 |
endif |
endif |
3207 |
|
|
3208 |
|
|
3221 |
|
|
3222 |
subroutine refine_track(ibest) |
subroutine refine_track(ibest) |
3223 |
|
|
|
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****************************************************** |
|
3224 |
|
|
3225 |
include 'commontracker.f' |
include 'commontracker.f' |
3226 |
include 'level1.f' |
include 'level1.f' |
3228 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
3229 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
3230 |
include 'common_mech.f' |
include 'common_mech.f' |
|
c include 'momanhough_init.f' |
|
|
c include 'level1.f' |
|
3231 |
include 'calib.f' |
include 'calib.f' |
3232 |
|
|
3233 |
* flag to chose PFA |
* flag to chose PFA |
3234 |
character*10 PFA |
character*10 PFA |
3235 |
common/FINALPFA/PFA |
common/FINALPFA/PFA |
3236 |
|
|
3237 |
|
real k(6) |
3238 |
|
DATA k/1.099730,0.418900,0.220939,0.220907,0.418771,1.100674/ |
3239 |
|
|
3240 |
real xp,yp,zp |
real xp,yp,zp |
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 |
3254 |
yP=YV_STORE(nplanes-ip+1,ibest) |
yP=YV_STORE(nplanes-ip+1,ibest) |
3255 |
zP=ZV_STORE(nplanes-ip+1,ibest) |
zP=ZV_STORE(nplanes-ip+1,ibest) |
3256 |
call gufld(xyzp,bxyz) |
call gufld(xyzp,bxyz) |
3257 |
c$$$ bxyz(1)=0 |
BX_STORE(nplanes-ip+1,ibest)=bxyz(1) |
3258 |
|
BY_STORE(nplanes-ip+1,ibest)=bxyz(2) |
3259 |
|
c$$$ bxyz(1)=0 |
3260 |
c$$$ bxyz(2)=0 |
c$$$ bxyz(2)=0 |
3261 |
c$$$ bxyz(3)=0 |
c$$$ bxyz(3)=0 |
3262 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
3290 |
$ bxyz(1), |
$ bxyz(1), |
3291 |
$ bxyz(2) |
$ bxyz(2) |
3292 |
$ ) |
$ ) |
3293 |
c$$$ call xyz_PAM(icx,icy,is, |
|
|
c$$$ $ 'COG2','COG2', |
|
|
c$$$ $ 0., |
|
|
c$$$ $ 0.) |
|
3294 |
xm(nplanes-ip+1) = xPAM |
xm(nplanes-ip+1) = xPAM |
3295 |
ym(nplanes-ip+1) = yPAM |
ym(nplanes-ip+1) = yPAM |
3296 |
zm(nplanes-ip+1) = zPAM |
zm(nplanes-ip+1) = zPAM |
3299 |
resx(nplanes-ip+1) = resxPAM |
resx(nplanes-ip+1) = resxPAM |
3300 |
resy(nplanes-ip+1) = resyPAM |
resy(nplanes-ip+1) = resyPAM |
3301 |
|
|
3302 |
c dedxtrk(nplanes-ip+1) = (sgnl(icx)+sgnl(icy))/2. !(1) |
dedxtrk_x(nplanes-ip+1)=sgnl(icx)/mip(VIEW(icx),LADDER(icx)) |
3303 |
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) |
|
3304 |
|
|
3305 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
3306 |
* ------------------------------------------------- |
* ------------------------------------------------- |
3315 |
|
|
3316 |
* -------------------------------------------------------------- |
* -------------------------------------------------------------- |
3317 |
* 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) |
|
3318 |
call whichsensor(ip,xP,yP,nldt,ist) |
call whichsensor(ip,xP,yP,nldt,ist) |
3319 |
* 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 |
3320 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
3321 |
|
|
3322 |
|
SENSOR_STORE(nplanes-ip+1,IBEST)=ist |
3323 |
|
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. |
3355 |
$ 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) |
3356 |
$ .false.)goto 1188 !then jump to next couple. |
$ .false.)goto 1188 !then jump to next couple. |
3357 |
* |
* |
|
c call xyz_PAM(icx,icy,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ AXV_STORE(nplanes-ip+1,ibest), |
|
|
c $ AYV_STORE(nplanes-ip+1,ibest)) |
|
3358 |
call xyz_PAM(icx,icy,ist, |
call xyz_PAM(icx,icy,ist, |
3359 |
$ PFA,PFA, |
$ PFA,PFA, |
3360 |
$ AXV_STORE(nplanes-ip+1,ibest), |
$ AXV_STORE(nplanes-ip+1,ibest), |
3364 |
$ ) |
$ ) |
3365 |
|
|
3366 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3367 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
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 |
$ ,' ) normalized distance ',distance |
$ ,' ) distance ',distance |
3371 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3372 |
xmm = xPAM |
xmm = xPAM |
3373 |
ymm = yPAM |
ymm = yPAM |
3376 |
rymm = resyPAM |
rymm = resyPAM |
3377 |
distmin = distance |
distmin = distance |
3378 |
idm = id |
idm = id |
|
c dedxmm = (sgnl(icx)+sgnl(icy))/2. !(1) |
|
3379 |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
3380 |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
3381 |
|
c QUIQUI --> non devo moltiplicare per clinc?!?!?! |
3382 |
|
clincnewc=10*sqrt(rymm**2+rxmm**2 !QUIQUI |
3383 |
|
$ +RCHI2_STORE(ibest)*k(ip)*(cov(1,1)+cov(2,2))) !QUIQUI |
3384 |
endif |
endif |
3385 |
1188 continue |
1188 continue |
3386 |
enddo !end loop on couples on plane icp |
enddo !end loop on couples on plane icp |
3387 |
if(distmin.le.clinc)then |
c if(distmin.le.clinc)then !QUIQUI |
3388 |
|
if(distmin.le.clincnewc)then !QUIQUI |
3389 |
* ----------------------------------- |
* ----------------------------------- |
3390 |
xm(nplanes-ip+1) = xmm !<<< |
xm(nplanes-ip+1) = xmm !<<< |
3391 |
ym(nplanes-ip+1) = ymm !<<< |
ym(nplanes-ip+1) = ymm !<<< |
3392 |
zm(nplanes-ip+1) = zmm !<<< |
zm(nplanes-ip+1) = zmm !<<< |
3393 |
xgood(nplanes-ip+1) = 1 !<<< |
xgood(nplanes-ip+1) = 1 !<<< |
3394 |
ygood(nplanes-ip+1) = 1 !<<< |
ygood(nplanes-ip+1) = 1 !<<< |
3395 |
resx(nplanes-ip+1)=rxmm !<<< |
resx(nplanes-ip+1)=rxmm !<<< |
3396 |
resy(nplanes-ip+1)=rymm !<<< |
resy(nplanes-ip+1)=rymm !<<< |
3397 |
c dedxtrk(nplanes-ip+1) = dedxmm !<<< !(1) |
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
3398 |
dedxtrk_x(nplanes-ip+1) = dedxmmx !(1) |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !(1) |
|
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 |
$ ,' (norm.dist.= ',distmin,', cut ',clinc,' )' |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
3403 |
goto 133 !next plane |
goto 133 !next plane |
3404 |
endif |
endif |
3405 |
* ================================================ |
* ================================================ |
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 |
3442 |
$ bxyz(2) |
$ bxyz(2) |
3443 |
$ ) |
$ ) |
3444 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3445 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
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,' ) normalized 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 |
3450 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
3475 |
$ bxyz(2) |
$ bxyz(2) |
3476 |
$ ) |
$ ) |
3477 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3478 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
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,' ) normalized 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 |
3483 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
3499 |
c print*,'## ncls(',ip,') ',ncls(ip) |
c print*,'## ncls(',ip,') ',ncls(ip) |
3500 |
do ic=1,ncls(ip) !loop on single clusters |
do ic=1,ncls(ip) !loop on single clusters |
3501 |
icl=cls(ip,ic) |
icl=cls(ip,ic) |
|
c print*,'## ic ',ic,' ist ',ist |
|
3502 |
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 |
3503 |
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) |
3504 |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
3505 |
$ .false.)goto 18882 !jump to the next singlet |
$ .false.)goto 18882 !jump to the next singlet |
3506 |
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.) |
|
3507 |
call xyz_PAM(icl,0,ist, |
call xyz_PAM(icl,0,ist, |
3508 |
$ PFA,PFA, |
$ PFA,PFA, |
3509 |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
3511 |
$ bxyz(2) |
$ bxyz(2) |
3512 |
$ ) |
$ ) |
3513 |
else !<---- Y view |
else !<---- Y view |
|
c call xyz_PAM(0,icl,ist, |
|
|
c $ PFA,PFA, |
|
|
c $ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
|
3514 |
call xyz_PAM(0,icl,ist, |
call xyz_PAM(0,icl,ist, |
3515 |
$ PFA,PFA, |
$ PFA,PFA, |
3516 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
3520 |
endif |
endif |
3521 |
|
|
3522 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3523 |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
3524 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG.EQ.1)print*,'( cl-s ',icl |
3525 |
$ ,' ) normalized 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 |
3535 |
rymm = resyPAM |
rymm = resyPAM |
3536 |
distmin = distance |
distmin = distance |
3537 |
iclm = icl |
iclm = icl |
|
c dedxmm = sgnl(icl) !(1) |
|
3538 |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
3539 |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) !(1)(2) |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
3540 |
dedxmmy = 0. !(1) |
dedxmmy = 0. |
3541 |
else !<---- Y view |
else !<---- Y view |
3542 |
dedxmmx = 0. !(1) |
dedxmmx = 0. |
3543 |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) !(1)(2) |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
3544 |
endif |
endif |
3545 |
endif |
endif |
3546 |
18882 continue |
18882 continue |
3547 |
enddo !end loop on single clusters |
enddo !end loop on single clusters |
3548 |
c print*,'## distmin ', distmin,' clinc ',clinc |
c print*,'## distmin ', distmin,' clinc ',clinc |
3549 |
if(distmin.le.clinc)then |
|
3550 |
|
c QUIQUI------------ |
3551 |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
c anche qui: non ci vuole clinc??? |
3552 |
* ---------------------------- |
if(iclm.ne.0)then |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
|
3553 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
3554 |
XGOOD(nplanes-ip+1)=1. |
clincnew= |
3555 |
resx(nplanes-ip+1)=rxmm |
$ 20* |
3556 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
$ sqrt(rxmm**2+RCHI2_STORE(ibest)*k(ip)*cov(1,1)) |
3557 |
c if(.true.)print*,'%%%% included X-cl ',iclm |
else if(mod(VIEW(iclm),2).ne.0)then |
3558 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
clincnew= |
3559 |
$ ,', norm.dist.= ',distmin |
$ 10* |
3560 |
$ ,', cut ',clinc,' )' |
$ sqrt(rymm**2+RCHI2_STORE(ibest)*k(ip)*cov(2,2)) |
3561 |
else |
endif |
3562 |
YGOOD(nplanes-ip+1)=1. |
c QUIQUI------------ |
3563 |
resy(nplanes-ip+1)=rymm |
|
3564 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(distmin.le.clincnew)then !QUIQUI |
3565 |
c if(.true.)print*,'%%%% included Y-cl ',iclm |
c if(distmin.le.clinc)then !QUIQUI |
3566 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
|
3567 |
$ ,', norm.dist.= ', distmin |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
3568 |
$ ,', cut ',clinc,' )' |
* ---------------------------- |
3569 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
3570 |
|
if(mod(VIEW(iclm),2).eq.0)then |
3571 |
|
XGOOD(nplanes-ip+1)=1. |
3572 |
|
resx(nplanes-ip+1)=rxmm |
3573 |
|
if(DEBUG.EQ.1)print*,'%%%% included X-cl ',iclm |
3574 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3575 |
|
$ ,', dist.= ',distmin |
3576 |
|
$ ,', cut ',clinc,' )' |
3577 |
|
else |
3578 |
|
YGOOD(nplanes-ip+1)=1. |
3579 |
|
resy(nplanes-ip+1)=rymm |
3580 |
|
if(DEBUG.EQ.1)print*,'%%%% included Y-cl ',iclm |
3581 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3582 |
|
$ ,', dist.= ', distmin |
3583 |
|
$ ,', cut ',clinc,' )' |
3584 |
|
endif |
3585 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
3586 |
|
* ---------------------------- |
3587 |
|
xm_A(nplanes-ip+1) = xmm_A |
3588 |
|
ym_A(nplanes-ip+1) = ymm_A |
3589 |
|
xm_B(nplanes-ip+1) = xmm_B |
3590 |
|
ym_B(nplanes-ip+1) = ymm_B |
3591 |
|
zm(nplanes-ip+1) = (zmm_A+zmm_B)/2. |
3592 |
|
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
3593 |
|
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
3594 |
|
* ---------------------------- |
3595 |
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) |
|
|
* ---------------------------- |
|
3596 |
endif |
endif |
3597 |
endif |
endif |
3598 |
133 continue |
133 continue |
3611 |
* * |
* * |
3612 |
* * |
* * |
3613 |
************************************************** |
************************************************** |
|
cccccc 12/08/2006 modified by elena ---> (1) |
|
3614 |
* |
* |
3615 |
subroutine clean_XYclouds(ibest,iflag) |
subroutine clean_XYclouds(ibest,iflag) |
3616 |
|
|
3617 |
include 'commontracker.f' |
include 'commontracker.f' |
3618 |
include 'level1.f' |
include 'level1.f' |
3619 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3620 |
c include 'momanhough_init.f' |
include 'level2.f' |
|
include 'level2.f' !(1) |
|
|
c include 'calib.f' |
|
|
c include 'level1.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 |
|
|
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 |
c cl_used(iclx)=1 !tag used clusters |
c$$$ cl_used(iclx)=ntrk !tag used clusters |
3633 |
c cl_used(icly)=1 !tag used clusters |
c$$$ cl_used(icly)=ntrk !tag used clusters |
|
cl_used(iclx)=ntrk !tag used clusters !(1) |
|
|
cl_used(icly)=ntrk !tag used clusters !(1) |
|
3634 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
3635 |
c cl_used(icl)=1 !tag used clusters |
c$$$ cl_used(icl)=ntrk !tag used clusters |
|
cl_used(icl)=ntrk !tag used clusters !1) |
|
3636 |
endif |
endif |
3637 |
|
|
|
c if(DEBUG)then |
|
|
c print*,ip,' <<< ',id |
|
|
c endif |
|
3638 |
* ----------------------------- |
* ----------------------------- |
3639 |
* remove the couple from clouds |
* remove the couple from clouds |
3640 |
* remove also vitual couples containing the |
* remove also vitual couples containing the |
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) |
3695 |
include 'level1.f' |
include 'level1.f' |
3696 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3697 |
include 'level2.f' |
include 'level2.f' |
|
c include 'level1.f' |
|
3698 |
|
|
3699 |
|
* --------------------------------- |
3700 |
|
* variables initialized from level1 |
3701 |
|
* --------------------------------- |
3702 |
do i=1,nviews |
do i=1,nviews |
3703 |
good2(i)=good1(i) |
good2(i)=good1(i) |
3704 |
|
do j=1,nva1_view |
3705 |
|
vkflag(i,j)=1 |
3706 |
|
if(cnnev(i,j).le.0)then |
3707 |
|
vkflag(i,j)=cnnev(i,j) |
3708 |
|
endif |
3709 |
|
enddo |
3710 |
enddo |
enddo |
3711 |
|
* ---------------- |
3712 |
|
* level2 variables |
3713 |
|
* ---------------- |
3714 |
NTRK = 0 |
NTRK = 0 |
3715 |
do it=1,NTRKMAX |
do it=1,NTRKMAX |
3716 |
IMAGE(IT)=0 |
IMAGE(IT)=0 |
3721 |
ZM_nt(IP,IT) = 0 |
ZM_nt(IP,IT) = 0 |
3722 |
RESX_nt(IP,IT) = 0 |
RESX_nt(IP,IT) = 0 |
3723 |
RESY_nt(IP,IT) = 0 |
RESY_nt(IP,IT) = 0 |
3724 |
|
TAILX_nt(IP,IT) = 0 |
3725 |
|
TAILY_nt(IP,IT) = 0 |
3726 |
|
XBAD(IP,IT) = 0 |
3727 |
|
YBAD(IP,IT) = 0 |
3728 |
XGOOD_nt(IP,IT) = 0 |
XGOOD_nt(IP,IT) = 0 |
3729 |
YGOOD_nt(IP,IT) = 0 |
YGOOD_nt(IP,IT) = 0 |
3730 |
|
LS(IP,IT) = 0 |
3731 |
DEDX_X(IP,IT) = 0 |
DEDX_X(IP,IT) = 0 |
3732 |
DEDX_Y(IP,IT) = 0 |
DEDX_Y(IP,IT) = 0 |
3733 |
CLTRX(IP,IT) = 0 |
CLTRX(IP,IT) = 0 |
3860 |
|
|
3861 |
|
|
3862 |
include 'commontracker.f' |
include 'commontracker.f' |
|
c include 'level1.f' |
|
3863 |
include 'level1.f' |
include 'level1.f' |
3864 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3865 |
include 'level2.f' |
include 'level2.f' |
3866 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
3867 |
real sinth,phi,pig |
include 'calib.f' |
3868 |
|
|
3869 |
|
character*10 PFA |
3870 |
|
common/FINALPFA/PFA |
3871 |
|
|
3872 |
|
real sinth,phi,pig |
3873 |
|
integer ssensor,sladder |
3874 |
pig=acos(-1.) |
pig=acos(-1.) |
3875 |
|
|
3876 |
|
* ------------------------------------- |
3877 |
chi2_nt(ntr) = sngl(chi2) |
chi2_nt(ntr) = sngl(chi2) |
3878 |
nstep_nt(ntr) = nstep |
nstep_nt(ntr) = nstep |
3879 |
|
* ------------------------------------- |
3880 |
phi = al(4) |
phi = al(4) |
3881 |
sinth = al(3) |
sinth = al(3) |
3882 |
if(sinth.lt.0)then |
if(sinth.lt.0)then |
3889 |
$ phi = phi + 2*pig |
$ phi = phi + 2*pig |
3890 |
al(4) = phi |
al(4) = phi |
3891 |
al(3) = sinth |
al(3) = sinth |
|
|
|
3892 |
do i=1,5 |
do i=1,5 |
3893 |
al_nt(i,ntr) = sngl(al(i)) |
al_nt(i,ntr) = sngl(al(i)) |
3894 |
do j=1,5 |
do j=1,5 |
3895 |
coval(i,j,ntr) = sngl(cov(i,j)) |
coval(i,j,ntr) = sngl(cov(i,j)) |
3896 |
enddo |
enddo |
3897 |
enddo |
enddo |
3898 |
|
* ------------------------------------- |
3899 |
do ip=1,nplanes ! loop on planes |
do ip=1,nplanes ! loop on planes |
3900 |
xgood_nt(ip,ntr) = int(xgood(ip)) |
xgood_nt(ip,ntr) = int(xgood(ip)) |
3901 |
ygood_nt(ip,ntr) = int(ygood(ip)) |
ygood_nt(ip,ntr) = int(ygood(ip)) |
3904 |
zm_nt(ip,ntr) = sngl(zm(ip)) |
zm_nt(ip,ntr) = sngl(zm(ip)) |
3905 |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
3906 |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
3907 |
|
TAILX_nt(IP,ntr) = 0. |
3908 |
|
TAILY_nt(IP,ntr) = 0. |
3909 |
xv_nt(ip,ntr) = sngl(xv(ip)) |
xv_nt(ip,ntr) = sngl(xv(ip)) |
3910 |
yv_nt(ip,ntr) = sngl(yv(ip)) |
yv_nt(ip,ntr) = sngl(yv(ip)) |
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 |
$ sin( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
3917 |
$ sin( 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 |
|
|
3923 |
id = CP_STORE(ip,IDCAND) |
ax = axv_nt(ip,ntr) |
3924 |
|
ay = ayv_nt(ip,ntr) |
3925 |
|
bfx = BX_STORE(ip,IDCAND) |
3926 |
|
bfy = BY_STORE(ip,IDCAND) |
3927 |
|
if(ip.eq.6) ax = -1. * axv_nt(ip,ntr) |
3928 |
|
if(ip.eq.6) bfy = -1. * BY_STORE(ip,IDCAND) |
3929 |
|
tgtemp = tan(ax*acos(-1.)/180.) + pmuH_h*bfy*0.00001 |
3930 |
|
angx = 180.*atan(tgtemp)/acos(-1.) |
3931 |
|
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
3932 |
|
angy = 180.*atan(tgtemp)/acos(-1.) |
3933 |
|
|
3934 |
|
c print*,'* ',ip,bfx,bfy,angx,angy |
3935 |
|
|
3936 |
|
id = CP_STORE(ip,IDCAND) ! couple id |
3937 |
icl = CLS_STORE(ip,IDCAND) |
icl = CLS_STORE(ip,IDCAND) |
3938 |
|
ssensor = -1 |
3939 |
|
sladder = -1 |
3940 |
|
ssensor = SENSOR_STORE(ip,IDCAND) |
3941 |
|
sladder = LADDER_STORE(ip,IDCAND) |
3942 |
|
if(ip.eq.6.and.ssensor.ne.0)ssensor = 3 - ssensor !notazione paolo x align |
3943 |
|
LS(IP,ntr) = ssensor+10*sladder |
3944 |
|
|
3945 |
if(id.ne.0)then |
if(id.ne.0)then |
3946 |
|
c >>> is a couple |
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 |
c print*,ip,' ',cltrx(ip,ntr),cltry(ip,ntr) |
|
3950 |
|
cl_used(cltrx(ip,ntr)) = 1 !tag used clusters |
3951 |
|
cl_used(cltry(ip,ntr)) = 1 !tag used clusters |
3952 |
|
|
3953 |
|
c$$$ nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
3954 |
|
c$$$ nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
3955 |
|
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 |
|
xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) |
3958 |
|
ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) |
3959 |
|
|
3960 |
|
|
3961 |
|
if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) |
3962 |
|
$ dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
3963 |
|
if(nsatstrips(cly(nplanes-ip+1,icp_cp(id))).gt.0) |
3964 |
|
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
3965 |
|
|
3966 |
elseif(icl.ne.0)then |
elseif(icl.ne.0)then |
3967 |
if(mod(VIEW(icl),2).eq.0)cltrx(ip,ntr)=icl |
|
3968 |
if(mod(VIEW(icl),2).eq.1)cltry(ip,ntr)=icl |
cl_used(icl) = 1 !tag used clusters |
3969 |
c print*,ip,' ',cltrx(ip,ntr),cltry(ip,ntr) |
|
3970 |
|
if(mod(VIEW(icl),2).eq.0)then |
3971 |
|
cltrx(ip,ntr)=icl |
3972 |
|
c$$$ nnnnn = npfastrips(icl,PFA,angx) |
3973 |
|
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) |
3977 |
|
elseif(mod(VIEW(icl),2).eq.1)then |
3978 |
|
cltry(ip,ntr)=icl |
3979 |
|
c$$$ nnnnn = npfastrips(icl,PFA,angy) |
3980 |
|
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) |
3983 |
|
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) |
3998 |
|
c$$$ print*,(ygood(i),i=1,6) |
3999 |
|
c$$$ print*,(ls(i,ntr),i=1,6) |
4000 |
|
c$$$ print*,(dedx_x(i,ntr),i=1,6) |
4001 |
|
c$$$ print*,(dedx_y(i,ntr),i=1,6) |
4002 |
|
c$$$ print*,'-----------------------' |
4003 |
|
|
4004 |
end |
end |
4005 |
|
|
4012 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
4013 |
|
|
4014 |
include 'commontracker.f' |
include 'commontracker.f' |
|
c include 'level1.f' |
|
4015 |
include 'calib.f' |
include 'calib.f' |
4016 |
include 'level1.f' |
include 'level1.f' |
4017 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
4019 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
4020 |
|
|
4021 |
* count #cluster per plane not associated to any track |
* count #cluster per plane not associated to any track |
|
c good2=1!.true. |
|
4022 |
nclsx = 0 |
nclsx = 0 |
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 |
4042 |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl))!(2) |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
4043 |
|
if(nsatstrips(icl).gt.0)sgnlxs(nclsx)=-sgnlxs(nclsx) |
4044 |
clsx(nclsx) = icl |
clsx(nclsx) = icl |
4045 |
do is=1,2 |
do is=1,2 |
4046 |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
4056 |
else !=== Y views |
else !=== Y views |
4057 |
nclsy = nclsy + 1 |
nclsy = nclsy + 1 |
4058 |
planey(nclsy) = ip |
planey(nclsy) = ip |
4059 |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl))!(2) |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
4060 |
|
if(nsatstrips(icl).gt.0)sgnlys(nclsy)=-sgnlys(nclsy) |
4061 |
clsy(nclsy) = icl |
clsy(nclsy) = icl |
4062 |
do is=1,2 |
do is=1,2 |
4063 |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
4072 |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
4073 |
endif |
endif |
4074 |
endif |
endif |
|
c print*,icl,cl_used(icl),cl_good(icl),ip,VIEW(icl)!nclsx(ip),nclsy(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 |