PROGRAM COMBINED IMPLICIT NONE INTEGER*4 LUNOUT PARAMETER (LUNOUT = 20) CHARACTER*3 DET(2) REAL*4 B, EPSILON(2), N_RL(2), N_RL_FRONT(2), LAMBDA, L(2), X N_M_EFF(2), N_M_EFF_POLAR(2), M, P, R_M(2), STEREO REAL*4 DK_MS, DK_RES, DK REAL*4 DPHI_MS, DPHI_RES, DPHI_K, DPHI REAL*4 DTHETA_MS, DTHETA_RES, DTHETA REAL*4 DK_INV2TOT, DPHI_INV2TOT, DTHETA_INV2TOT REAL*4 DK_TOT, DPHI_TOT, DTHETA_TOT REAL*4 PT, K, DP_OVER_P, N_M(2), N_M_POLAR(2), Z_LENGTH_CDC REAL*4 LAMBDA_CDC, LAMBDA_FDC_FRONT, LAMBDA_FDC_BACK REAL*4 PIOVER2, L_EFF(2), Z_MIN_FDC, Z_MAX_FDC REAL*4 R_MIN_CDC, R_MAX_CDC, R_MAX_FDC, N_RL_EFF(2) INTEGER*4 I DATA PIOVER2 /1.5707963/ DATA B /1.74/ DATA EPSILON /0.00015, 0.00020/ STEREO = 6.0*3.14159/180.0 DATA N_RL /0.03437, 0.028258/ DATA N_RL_FRONT /0.01437, 0.0000/ LAMBDA = 70*3.14159/180.0 DATA R_M /.377475, 0.293/ DATA N_M /23, 24/ DATA N_M_POLAR /10, 24/ DATA DET /'CDC', 'FDC'/ DATA R_MIN_CDC /0.10960/, R_MAX_CDC /0.56534/ R_MAX_FDC = R_MAX_CDC Z_MIN_FDC = 1.90 - 0.65 Z_MAX_FDC = 3.57 - 0.65 Z_LENGTH_CDC = 1.67 - 0.65 L(1) = R_MAX_CDC - R_MIN_CDC L(2) = Z_MAX_FDC - Z_MIN_FDC LAMBDA_CDC = ATAN(Z_LENGTH_CDC/R_MAX_CDC) LAMBDA_FDC_FRONT = ATAN(Z_MIN_FDC/R_MAX_FDC) LAMBDA_FDC_BACK = ATAN(Z_MAX_FDC/R_MAX_FDC) IF (LAMBDA .GE. LAMBDA_CDC) THEN L_EFF(1) = Z_LENGTH_CDC*TAN(PIOVER2 - LAMBDA) - R_MIN_CDC N_M_EFF(1) = N_M(1)*L_EFF(1)/L(1) N_M_EFF_POLAR(1) = N_M_POLAR(1)*L_EFF(1)/L(1) N_RL_EFF(1) = N_RL(1)*L_EFF(1)/L(1) ELSE N_M_EFF(1) = N_M(1) N_M_EFF_POLAR(1) = N_M_POLAR(1) L_EFF(1) = L(1) N_RL_EFF(1) = N_RL(1); END IF IF (LAMBDA .LT. LAMBDA_FDC_FRONT) THEN N_M_EFF(2) = 0.0 N_M_EFF_POLAR(2) = 0.0 ELSE IF (LAMBDA .LT. LAMBDA_FDC_BACK) THEN L_EFF(2) = R_MAX_FDC*TAN(LAMBDA) - Z_MIN_FDC N_M_EFF(2) = N_M(2)*L_EFF(2)/L(2) N_M_EFF_POLAR(2) = N_M_POLAR(2)*L_EFF(2)/L(2) N_RL_EFF(2) = N_RL(2)*L_EFF(2)/L(2) ELSE L_EFF(2) = L(2) N_M_EFF(2) = N_M(2) N_M_EFF_POLAR(2) = N_M_POLAR(2) N_RL_EFF(2) = N_RL(2) END IF M = 0.139 OPEN (UNIT=LUNOUT, FILE='combined.txt', STATUS='UNKNOWN') c P = 0.01 c DO WHILE (P < 6.0) P = 1.0 DO WHILE (P < 1.0001) WRITE (6, *) '----------------------------------' WRITE (6, *) 'p = ', P DK_INV2TOT = 0.0 DPHI_INV2TOT = 0.0 DTHETA_INV2TOT = 0.0 DO I = 1, 2 WRITE (6, *) DET(I) CALL REZEST_CURVE(DET(I), LAMBDA, L_EFF(I), EPSILON(I), X N_M_EFF(I), P, M, N_RL_EFF(I), B, DK_MS, DK_RES, DK) WRITE (6, *) 'curve', DK_MS, DK_RES, DK DK_INV2TOT = DK_INV2TOT + 1.0/(DK*DK) CALL REZEST_AZIMUTH(DET(I), LAMBDA, L_EFF(I), EPSILON(I), X N_M_EFF(I), P, M, N_RL_EFF(I), N_RL_FRONT(I), B, X R_M(I), DK, DPHI_MS, DPHI_RES, DPHI_K, DPHI) WRITE (6, *) 'azimu', DPHI_MS, DPHI_RES, DPHI_K, DPHI DPHI_INV2TOT = DPHI_INV2TOT + 1.0/(DPHI*DPHI) CALL REZEST_POLAR(DET(I), LAMBDA, L_EFF(I), EPSILON(I), X STEREO, N_M_EFF_POLAR(I), P, M, N_RL_EFF(I), X N_RL_FRONT(I), DTHETA_MS, DTHETA_RES, DTHETA) WRITE (6, *) 'polar', DTHETA_MS, DTHETA_RES, DTHETA DTHETA_INV2TOT = DTHETA_INV2TOT + 1.0/(DTHETA*DTHETA) PT = P*COS(LAMBDA) END DO DK_TOT = 1.0/SQRT(DK_INV2TOT) DPHI_TOT = 1.0/SQRT(DPHI_INV2TOT) DTHETA_TOT = 1.0/SQRT(DTHETA_INV2TOT) PT = P*COS(LAMBDA) K = 0.3*B/PT DP_OVER_P = DK_TOT/K WRITE (6, *) 'B = ', B, 'PT = ', PT, ' K = ', K WRITE (6,*) 'to file: ', P, DP_OVER_P, DPHI_TOT, DTHETA_TOT WRITE (LUNOUT,*) P, DP_OVER_P, DPHI_TOT, DTHETA_TOT P = P*1.02 END DO CLOSE(LUNOUT) STOP END