36 |
c DATA XGOOD,YGOOD/nplanes*1.,nplanes*1./ !planes to be used in the tracking |
c DATA XGOOD,YGOOD/nplanes*1.,nplanes*1./ !planes to be used in the tracking |
37 |
|
|
38 |
DATA STEPAL/5*1.d-7/ !alpha vector step |
DATA STEPAL/5*1.d-7/ !alpha vector step |
39 |
DATA ISTEPMAX/120/ !maximum number of steps in the chi^2 minimization |
DATA ISTEPMAX/100/ !maximum number of steps in the chi^2 minimization |
40 |
DATA TOLL/1.d-8/ !tolerance in reaching the next plane during |
DATA TOLL/1.d-8/ !tolerance in reaching the next plane during |
41 |
* !the tracking procedure |
* !the tracking procedure |
42 |
DATA STEPMAX/100./ !maximum number of steps in the trackin gprocess |
DATA STEPMAX/100./ !maximum number of steps in the trackin gprocess |
43 |
|
|
44 |
DATA ALMAX/dinf,dinf,1.,dinf,dinf/ !limits on alpha vector components |
c DATA ALMAX/dinf,dinf,1.,dinf,dinf/ !limits on alpha vector components |
45 |
DATA ALMIN/-dinf,-dinf,-1.,-dinf,-dinf/ !" |
c DATA ALMIN/-dinf,-dinf,-1.,-dinf,-dinf/ !" |
46 |
|
DATA ALMAX/dinf,dinf,dinf,dinf,dinf/ !limits on alpha vector components |
47 |
|
DATA ALMIN/-dinf,-dinf,-dinf,-dinf,-dinf/ !" |
48 |
|
|
49 |
DIMENSION DAL(5) !increment of vector alfa |
DIMENSION DAL(5) !increment of vector alfa |
50 |
DIMENSION CHI2DD_R(4,4),CHI2D_R(4) !hessiano e gradiente di chi2 |
DIMENSION CHI2DD_R(4,4),CHI2D_R(4) !hessiano e gradiente di chi2 |
122 |
ISTEP=0 !num. steps to minimize chi^2 |
ISTEP=0 !num. steps to minimize chi^2 |
123 |
JFAIL=0 !error flag |
JFAIL=0 !error flag |
124 |
|
|
125 |
c elena-------- |
if(TRKDEBUG) print*,'guess: ',al |
|
CHI2 = 0 |
|
|
c elena-------- |
|
126 |
if(TRKDEBUG) print*,'mini2: step ',istep,chi2,1./AL(5) |
if(TRKDEBUG) print*,'mini2: step ',istep,chi2,1./AL(5) |
127 |
|
|
128 |
* |
* |
247 |
* check number of steps: |
* check number of steps: |
248 |
*------------------------------------------------------------* |
*------------------------------------------------------------* |
249 |
IF(ISTEP.ge.ISTEPMAX) then |
IF(ISTEP.ge.ISTEPMAX) then |
250 |
IFAIL=1 |
c$$$ IFAIL=1 |
251 |
if(TRKVERBOSE) |
c$$$ if(TRKVERBOSE) |
252 |
$ PRINT *,'*** WARNING in mini *** ISTEP.GT.ISTEPMAX=', |
c$$$ $ PRINT *,'*** WARNING in mini *** ISTEP.GT.ISTEPMAX=', |
253 |
$ ISTEPMAX |
c$$$ $ ISTEPMAX |
254 |
goto 11 |
goto 11 |
255 |
endif |
endif |
256 |
*------------------------------------------------------------* |
*------------------------------------------------------------* |
467 |
+ +((XV(I)-XM(I))**2+(YV(I)-YM(I))**2)/RESY(i)**2 |
+ +((XV(I)-XM(I))**2+(YV(I)-YM(I))**2)/RESY(i)**2 |
468 |
+ *( (1-XGOOD(I))*YGOOD(I) ) |
+ *( (1-XGOOD(I))*YGOOD(I) ) |
469 |
ENDDO |
ENDDO |
470 |
|
c print*,'CHISQ ',chi2 |
471 |
* ------------------------------------------------ |
* ------------------------------------------------ |
472 |
* |
* |
473 |
* calculation of derivatives (dX/dAL_fa and dY/dAL_fa) |
* calculation of derivatives (dX/dAL_fa and dY/dAL_fa) |
642 |
VOUT(6)=-1.*DSQRT(1.-AL_P(3)**2) |
VOUT(6)=-1.*DSQRT(1.-AL_P(3)**2) |
643 |
IF(AL_P(5).NE.0.) VOUT(7)=DABS(1./AL_P(5)) |
IF(AL_P(5).NE.0.) VOUT(7)=DABS(1./AL_P(5)) |
644 |
IF(AL_P(5).EQ.0.) VOUT(7)=1.E8 |
IF(AL_P(5).EQ.0.) VOUT(7)=1.E8 |
645 |
|
|
646 |
|
c$$$ print*,'POSXY ',vout |
647 |
|
|
648 |
DO I=1,nplanes |
DO I=1,nplanes |
649 |
step=vout(3)-zv(i) |
step=vout(3)-zv(i) |
650 |
10 DO J=1,7 |
10 DO J=1,7 |
799 |
ZP(NP)=ZM(I) |
ZP(NP)=ZM(I) |
800 |
ENDIF |
ENDIF |
801 |
ENDDO |
ENDDO |
802 |
|
IFLAG=0 !no debug mode |
803 |
CALL TRICIRCLE(NP,XP,ZP,AP,RP,CHI,XC,ZC,RADIUS,IFLAG) |
CALL TRICIRCLE(NP,XP,ZP,AP,RP,CHI,XC,ZC,RADIUS,IFLAG) |
804 |
c print*,' circle: ',XC,ZC,RADIUS,' --- ',CHI |
c print*,' circle: ',XC,ZC,RADIUS,' --- ',CHI,IFLAG |
805 |
IF(IFLAG.NE.0)GOTO 10 !straigth fit |
IF(IFLAG.NE.0)GOTO 10 !straigth fit |
806 |
|
if(CHI.gt.100)GOTO 10 !straigth fit |
807 |
ARG = RADIUS**2-(ZINI-ZC)**2 |
ARG = RADIUS**2-(ZINI-ZC)**2 |
808 |
IF(ARG.LT.0)GOTO 10 !straigth fit |
IF(ARG.LT.0)GOTO 10 !straigth fit |
809 |
DC = SQRT(ARG) |
DC = SQRT(ARG) |
812 |
AX = -(ZINI-ZC)/DC |
AX = -(ZINI-ZC)/DC |
813 |
DEF=100./(RADIUS*0.3*0.43) |
DEF=100./(RADIUS*0.3*0.43) |
814 |
IF(XC.GT.0)DEF=-DEF |
IF(XC.GT.0)DEF=-DEF |
815 |
|
|
816 |
|
IF(ABS(X0).GT.30)THEN |
817 |
|
PRINT*,'STRANGE GUESS: XC,ZC,R ',XC,ZC,RADIUS |
818 |
|
$ ,' - CHI ',CHI,' - X0,AX,DEF ',X0,AX,DEF |
819 |
|
GOTO 10 !straigth fit |
820 |
|
ENDIF |
821 |
GOTO 20 !guess is ok |
GOTO 20 !guess is ok |
822 |
|
|
823 |
* ---------------------------------------- |
* ---------------------------------------- |