21 |
REAL ax,bx,eax,ebx,chi2x |
REAL ax,bx,eax,ebx,chi2x |
22 |
REAL ay,by,eay,eby,chi2y |
REAL ay,by,eay,eby,chi2y |
23 |
REAL parzen3, TMISD |
REAL parzen3, TMISD |
24 |
INTEGER Nfitx,Nfity |
INTEGER Nfitx,Nfity, MNPLA |
25 |
C |
C |
26 |
INTEGER INDEX, NTOT(2), NPIANI, GTR |
INTEGER INDEX, NTOT(2), NPIANI, GTR |
27 |
INTEGER j, m, i, IWPL(2), timpx, timpy, T, nn |
c INTEGER j, m, i, IWPL(2), timpx, timpy, T, nn |
28 |
|
INTEGER j, m, i, IWPL(2), T, nn |
29 |
INTEGER IPLANE, NNX, NNY, INFX, INFY, ISUPX, ISUPY |
INTEGER IPLANE, NNX, NNY, INFX, INFY, ISUPX, ISUPY |
30 |
INTEGER IBAR(2,NPLAV), NPFIT(2), CHTRACK,IWPLU |
INTEGER IBAR(2,NPLAV), NPFIT(2), CHTRACK,IWPLU |
31 |
INTEGER Iquest(100), ICONTROL5, nin, IFAIL |
INTEGER Iquest(100), ICONTROL5, nin, IFAIL |
93 |
QMEAN = 0. |
QMEAN = 0. |
94 |
C SELFTRIGGER = 0 |
C SELFTRIGGER = 0 |
95 |
C |
C |
96 |
C BEGIN WITH THE FISRT TRACK IF WE HAVE A TRACK FROM TRACKER |
C BEGIN WITH THE FIRST TRACK IF WE HAVE A TRACK FROM TRACKER |
97 |
C |
C |
98 |
T = 1 |
T = 1 |
99 |
C |
C |
100 |
10 CONTINUE |
c 10 CONTINUE |
101 |
|
CONTINUE |
102 |
C |
C |
103 |
IF (GOOD2.EQ.1) THEN |
IF (GOOD2.EQ.1) THEN |
104 |
C |
C |
118 |
c print *,' al_p(',m,') = ',al_p(m) |
c print *,' al_p(',m,') = ',al_p(m) |
119 |
enddo |
enddo |
120 |
if (al_p(5).eq.0.) THEN |
if (al_p(5).eq.0.) THEN |
121 |
PRINT *,' CALORIMETER - WARNING F77: track with R = 0, discarded' |
c PRINT *,' CALORIMETER - WARNING F77: track with R = 0, discarded' |
122 |
GOOD2 = 0 |
GOOD2 = 0 |
123 |
GOTO 969 |
GOTO 969 |
124 |
ENDIF |
ENDIF |
145 |
c print *,' CALORIMETER - WARNING F77: tracking failed ' |
c print *,' CALORIMETER - WARNING F77: tracking failed ' |
146 |
goto 969 |
goto 969 |
147 |
endif |
endif |
148 |
TX = TAN(ASIN(AL_P(3))) * COS(AL_P(4)) |
TX = REAL(DTAN(DASIN(AL_P(3))) * DCOS(AL_P(4))) |
149 |
TY = TAN(ASIN(AL_P(3))) * SIN(AL_P(4)) |
TY = REAL(DTAN(DASIN(AL_P(3))) * DSIN(AL_P(4))) |
150 |
DO I = 1, NPLA |
DO I = 1, NPLA |
151 |
NN = 0 |
NN = 0 |
152 |
IF (M.EQ.2) NN = 1 |
c IF (M.EQ.2) NN = 1 |
153 |
IF (MOD(I,2).EQ.NN) THEN |
IF (MOD(I,2).EQ.NN) THEN |
154 |
IF (REVERSE.EQ.0) THEN |
IF (REVERSE.EQ.0) THEN |
|
SHIFT = +0.5 |
|
|
ELSE |
|
155 |
SHIFT = -0.5 |
SHIFT = -0.5 |
156 |
|
ELSE |
157 |
|
SHIFT = +0.5 |
158 |
ENDIF |
ENDIF |
159 |
ELSE |
ELSE |
160 |
IF (REVERSE.EQ.0) THEN |
IF (REVERSE.EQ.0) THEN |
|
SHIFT = -0.5 |
|
|
ELSE |
|
161 |
SHIFT = +0.5 |
SHIFT = +0.5 |
162 |
|
ELSE |
163 |
|
SHIFT = -0.5 |
164 |
ENDIF |
ENDIF |
165 |
ENDIF |
ENDIF |
166 |
C |
C |
173 |
GOTO 969 |
GOTO 969 |
174 |
ENDIF |
ENDIF |
175 |
C |
C |
176 |
CX = XOUT(I)*10. + XALIG |
CX = REAL(XOUT(I))*10. + XALIG |
177 |
CY = YOUT(I)*10. + YALIG |
CY = REAL(YOUT(I))*10. + YALIG |
178 |
C |
C |
179 |
IF (I.EQ.1) THEN |
c IF (I.EQ.1) THEN !EM GCC4.7 TIMPX/Y are not used in che code... |
180 |
TIMPX = CX |
c TIMPX = NINT(CX) |
181 |
TIMPY = CY |
c TIMPY = NINT(CY) |
182 |
ENDIF |
c ENDIF |
183 |
IF (M.EQ.1) THEN |
IF (M.EQ.1) THEN |
184 |
Y(I) = CX |
Y(I) = CX |
185 |
BAR(M,I) = Y(I) |
BAR(M,I) = Y(I) |
186 |
TBAR(M,I) = (Y(I) - XALIG)/10. |
TBAR(M,I) = (Y(I) - XALIG)/10. |
187 |
IF (I.EQ.NPLA) MX=ABS(Y(1)-Y(NPLA))/ |
IF (I.EQ.NPLA) MX=ABS(Y(1)-Y(NPLA))/ |
188 |
& ABS(ZIN(1)-ZIN(NPLA)) |
& ABS(REAL(ZIN(1)-ZIN(NPLA))) |
189 |
ELSE |
ELSE |
190 |
YY(I) = CY |
YY(I) = CY |
191 |
BAR(M,I) = YY(I) |
BAR(M,I) = YY(I) |
192 |
TBAR(M,I) = (-YALIG + YY(I))/10. |
TBAR(M,I) = (-YALIG + YY(I))/10. |
193 |
IF (I.EQ.NPLA) MY=ABS(Y(1)-Y(NPLA))/ |
IF (I.EQ.NPLA) MY=ABS(Y(1)-Y(NPLA))/ |
194 |
& ABS(ZIN(1)-ZIN(NPLA)) |
& ABS(REAL(ZIN(1)-ZIN(NPLA))) |
195 |
ENDIF |
ENDIF |
196 |
CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) |
CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) |
197 |
tibar(M,I) = ibar(m,i) |
tibar(M,I) = ibar(m,i) |
275 |
IF (NPCFIT(M).GE.2) THEN |
IF (NPCFIT(M).GE.2) THEN |
276 |
IF (M.EQ.1) THEN |
IF (M.EQ.1) THEN |
277 |
VARCFIT(1) = CHI2X |
VARCFIT(1) = CHI2X |
278 |
IMPX = AX ! PAMELA REF |
IMPX = AX + BX * (ZALIG/10.) ! PAMELA REF |
279 |
TANX = BX |
TANX = BX |
280 |
ELSE |
ELSE |
281 |
VARCFIT(2) = CHI2Y |
VARCFIT(2) = CHI2Y |
282 |
IMPY = AY ! PAMELA REF |
IMPY = AY + BY * (ZALIG/10.) ! PAMELA REF |
283 |
TANY = BY |
TANY = BY |
284 |
ENDIF |
ENDIF |
285 |
C |
C |
286 |
DO I = 1,NPLA |
DO I = 1,NPLA |
287 |
NN = 0 |
NN = 0 |
288 |
IF (M.EQ.2) NN = 1 |
c IF (M.EQ.2) NN = 1 |
289 |
IF (MOD(I,2).EQ.NN) THEN |
IF (MOD(I,2).EQ.NN) THEN |
290 |
IF (REVERSE.EQ.0) THEN |
IF (REVERSE.EQ.0) THEN |
|
SHIFT = +0.5 |
|
|
ELSE |
|
291 |
SHIFT = -0.5 |
SHIFT = -0.5 |
292 |
|
ELSE |
293 |
|
SHIFT = +0.5 |
294 |
ENDIF |
ENDIF |
295 |
ELSE |
ELSE |
296 |
IF (REVERSE.EQ.0) THEN |
IF (REVERSE.EQ.0) THEN |
|
SHIFT = -0.5 |
|
|
ELSE |
|
297 |
SHIFT = +0.5 |
SHIFT = +0.5 |
298 |
|
ELSE |
299 |
|
SHIFT = -0.5 |
300 |
ENDIF |
ENDIF |
301 |
ENDIF |
ENDIF |
302 |
C |
C |
303 |
IF (M.EQ.1) THEN |
IF (M.EQ.1) THEN |
304 |
DISTX = PIANO(I) - 5.81 |
DISTX = PIANO(I) - 5.81 |
305 |
Y(I) = (DISTX * TANX) + AX - XALIG |
Y(I) = (DISTX * TANX) + IMPX*10. !- XALIG |
306 |
c CBAR(M,I) = Y(I) |
c CBAR(M,I) = Y(I) |
307 |
BAR(M,I) = Y(I) |
BAR(M,I) = Y(I) + XALIG |
308 |
CBAR(M,I) = (Y(I) + XALIG)/10. |
CBAR(M,I) = Y(I) / 10. |
309 |
IF (I.EQ.NPLA) MX=ABS(Y(1)-Y(NPLA))/ |
IF (I.EQ.NPLA) MX=ABS(Y(1)-Y(NPLA))/ |
310 |
& ABS(ZIN(1)-ZIN(NPLA)) |
& ABS(REAL(ZIN(1)-ZIN(NPLA))) |
311 |
C |
C |
312 |
ELSE |
ELSE |
313 |
DISTY = PIANO(I) |
DISTY = PIANO(I) |
314 |
YY(I) = (DISTY * TANY) + AY - YALIG |
YY(I) = (DISTY * TANY) + IMPY*10. !- YALIG |
315 |
|
c print *,' I ',i,' YY ',YY(I) |
316 |
c CBAR(M,I) = YY(I) |
c CBAR(M,I) = YY(I) |
317 |
BAR(M,I) = YY(I) |
BAR(M,I) = YY(I) + YALIG |
318 |
CBAR(M,I) = (YY(I) + YALIG)/10. |
CBAR(M,I) = YY(I) / 10. |
319 |
IF (I.EQ.NPLA) MY=ABS(Y(1)-Y(NPLA))/ |
IF (I.EQ.NPLA) MY=ABS(Y(1)-Y(NPLA))/ |
320 |
& ABS(ZIN(1)-ZIN(NPLA)) |
& ABS(REAL(ZIN(1)-ZIN(NPLA))) |
321 |
C |
C |
322 |
ENDIF |
ENDIF |
323 |
CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) |
CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) |
377 |
GTR = 1 |
GTR = 1 |
378 |
IF (TRKCHI2.LT.0) GTR = 2 |
IF (TRKCHI2.LT.0) GTR = 2 |
379 |
IF ( AL_PP(GTR,5).NE.0. ) THEN |
IF ( AL_PP(GTR,5).NE.0. ) THEN |
380 |
RIG = 1./(AL_PP(GTR,5)) |
RIG = REAL(1./(AL_PP(GTR,5))) |
381 |
ELSE |
ELSE |
382 |
GOOD2 = 0 |
GOOD2 = 0 |
383 |
PRINT *,' CALORIMETER - WARNING F77: track with R = 0' |
c PRINT *,' CALORIMETER - WARNING F77: track with R = 0' |
384 |
GOTO 50 |
GOTO 50 |
385 |
ENDIF |
ENDIF |
386 |
ENDIF |
ENDIF |
388 |
RIG = ELEN ! SELFTRIGGER RIGIDITY |
RIG = ELEN ! SELFTRIGGER RIGIDITY |
389 |
IF ( RIG.EQ.0. ) THEN |
IF ( RIG.EQ.0. ) THEN |
390 |
GOOD2 = 1 |
GOOD2 = 1 |
391 |
PRINT *,' CALORIMETER - WARNING F77: ST track with R = 0' |
c PRINT *,' CALORIMETER - WARNING F77: ST track with R = 0' |
392 |
GOTO 50 |
GOTO 50 |
393 |
ENDIF |
ENDIF |
394 |
ENDIF |
ENDIF |
482 |
INFX = NNX - 8 |
INFX = NNX - 8 |
483 |
ISUPX = NNX + 8 |
ISUPX = NNX + 8 |
484 |
DO I = INFX,ISUPX |
DO I = INFX,ISUPX |
485 |
IF (DEXY(1,J,I).LT.EMIN) GO TO 710 |
IF (DEXY(1,J,I).GE.EMIN) THEN |
486 |
NCYL = NCYL + 1 |
NCYL = NCYL + 1 |
487 |
QCYL = QCYL + DEXY(1,J,I) |
QCYL = QCYL + DEXY(1,J,I) |
488 |
710 ENDDO |
ENDIF |
489 |
|
ENDDO |
490 |
ENDIF |
ENDIF |
491 |
NNY = IBAR(2,J) |
NNY = IBAR(2,J) |
492 |
IF (NNY.NE.-1) THEN |
IF (NNY.NE.-1) THEN |
495 |
INFY = NNY - 8 |
INFY = NNY - 8 |
496 |
ISUPY = NNY + 8 |
ISUPY = NNY + 8 |
497 |
DO I=INFY,ISUPY |
DO I=INFY,ISUPY |
498 |
IF (DEXY(2,J,I).LT.EMIN) GO TO 810 |
IF (DEXY(2,J,I).GE.EMIN) THEN |
499 |
NCYL = NCYL + 1 |
NCYL = NCYL + 1 |
500 |
QCYL = QCYL + DEXY(2,J,I) |
QCYL = QCYL + DEXY(2,J,I) |
501 |
810 ENDDO |
ENDIF |
502 |
|
ENDDO |
503 |
ENDIF |
ENDIF |
504 |
C |
C |
505 |
C QTR = DETECTED ENERGY AND NTR = NUMBER OF HIT STRIPS IN A CYLINDER oF |
C QTR = DETECTED ENERGY AND NTR = NUMBER OF HIT STRIPS IN A CYLINDER oF |
611 |
C |
C |
612 |
C CALCULATE NLAST AND QLAST |
C CALCULATE NLAST AND QLAST |
613 |
C |
C |
614 |
DO J = NPLA-4,NPLA |
MNPLA = NPLA -4 |
615 |
|
IF ( MNPLA .LT. 1 ) MNPLA = 1 |
616 |
|
DO J = MNPLA,NPLA |
617 |
NNX = IBAR(1,J) |
NNX = IBAR(1,J) |
618 |
IF (NNX.NE.-1) THEN |
IF (NNX.NE.-1) THEN |
619 |
IF (NNX.LT.5) NNX = 5 |
IF (NNX.LT.5) NNX = 5 |