1 |
***************************************************************************** |
2 |
INTEGER FUNCTION CALOL2CM() |
3 |
c |
4 |
IMPLICIT NONE |
5 |
C |
6 |
INCLUDE 'INTEST.TXT' |
7 |
C |
8 |
REAL PIANO(NPLAV), VARFIT(2) |
9 |
REAL SHIFT |
10 |
REAL TG(2), BAR(2,NPLAV) |
11 |
REAL DISTX, DISTY, Y(NPLAV), YY(NPLAV) |
12 |
REAL RIG, RMASS |
13 |
REAL CHECK, ENER, CX, CY |
14 |
REAL EINF, ESUP,ENPLANEX,ENPLANEY,TENPLAX,TENPLAY |
15 |
REAL hmemor(9000000) |
16 |
c |
17 |
INTEGER gtr |
18 |
INTEGER j, m, nn, i |
19 |
INTEGER IBAR(2,NPLAV), NPFIT(2) |
20 |
INTEGER Iquest(100), IWPL(2),CHTRACK |
21 |
c |
22 |
COMMON / TAGLIOEN / EINF, ESUP, ENER(2) |
23 |
SAVE / TAGLIOEN / |
24 |
C |
25 |
COMMON / SHIFT / SHIFT |
26 |
SAVE / SHIFT / |
27 |
C |
28 |
COMMON / ANGOLO / BAR, IBAR |
29 |
SAVE / ANGOLO / |
30 |
C |
31 |
COMMON / WHERE / CX, CY, PIANO |
32 |
SAVE / WHERE / |
33 |
C |
34 |
COMMON / GENERAL / RIG, RMASS |
35 |
SAVE / GENERAL / |
36 |
C |
37 |
COMMON / CH / CHECK |
38 |
SAVE / CH / |
39 |
C |
40 |
COMMON / CALOFIT / VARFIT, NPFIT, IWPL,CHTRACK |
41 |
SAVE / CALOFIT / |
42 |
C |
43 |
COMMON / pawcd / hmemor |
44 |
save / pawcd / |
45 |
C |
46 |
Common / QUESTd / Iquest |
47 |
save / questd / |
48 |
C |
49 |
C Begin ! |
50 |
C |
51 |
CALOL2CM = 0; |
52 |
RMASS = 0.938 |
53 |
C |
54 |
C Z position of Y planes, Y1 = 0., Y2 = -8.09, Y3 = -18.18, ... |
55 |
C |
56 |
c print *,'NPLA IS ',NPLA |
57 |
PIANO(1) = 0. |
58 |
DO I = 2, NPLA |
59 |
IF ( MOD(I,2).EQ.0 ) THEN |
60 |
PIANO(I) = PIANO(I-1) - 8.09 |
61 |
ELSE |
62 |
PIANO(I) = PIANO(I-1) - 10.09 |
63 |
ENDIF |
64 |
ENDDO |
65 |
C |
66 |
CALL VZERO(DEXY,2*LENSEV) |
67 |
CALL VZERO(BAR,2*NPLAV) |
68 |
CALL VZERO(IBAR,2*NPLAV) |
69 |
CALL VZERO(CBAR,2*NPLAV) |
70 |
CALL VZERO(CIBAR,2*NPLAV) |
71 |
CALL VZERO(QQ,4) |
72 |
CALL VZERO(Y,NPLAV) |
73 |
CALL VZERO(YY,NPLAV) |
74 |
VARFIT(1) = 0. |
75 |
VARFIT(2) = 0. |
76 |
NPFIT(1) = 0. |
77 |
NPFIT(2) = 0. |
78 |
VARCFIT(1) = 0. |
79 |
VARCFIT(2) = 0. |
80 |
NPCFIT(1) = 0. |
81 |
NPCFIT(2) = 0. |
82 |
ELEN = 0. |
83 |
SELEN = 0. |
84 |
NSTRIP = 0. |
85 |
QTOT = 0. |
86 |
NX22 = 0. |
87 |
QX22 = 0. |
88 |
QMAX = 0. |
89 |
GTR = 0 |
90 |
CHTRACK = 0 |
91 |
C |
92 |
DISTX = 0. |
93 |
DISTY = 0. |
94 |
C |
95 |
PLANEMAX(1) = 0 |
96 |
PLANEMAX(2) = 0 |
97 |
TENPLAX = 0. |
98 |
TENPLAY = 0. |
99 |
C |
100 |
IF (GOOD2.EQ.0.AND.TRIGTY.LT.2) goto 9696 |
101 |
C |
102 |
C CALCULATE QTOT, NSTRIP, QQ, NX22, QX22, QMAX AND PLANEMAX |
103 |
C |
104 |
DO I = 1,NPLA |
105 |
ENPLANEY = 0. |
106 |
ENPLANEX = 0. |
107 |
DO J = 1,96 |
108 |
c if ( ESTRIP(1,I,J).gt.0) |
109 |
c & print *,' I ',I,' J ',J,' ES1 ',ESTRIP(1,I,J) |
110 |
c if ( ESTRIP(2,I,J).gt.0) |
111 |
c & print *,' I ',I,' J ',J,' ES2 ',ESTRIP(2,I,J) |
112 |
IF ( MOD(I,2).NE.0 ) THEN |
113 |
IF ( ESTRIP(2,I,J).GT.EMIN ) THEN |
114 |
DEXY(2,I,J) = ESTRIP(2,I,J) |
115 |
ENPLANEY = ENPLANEY + DEXY(2,I,J) |
116 |
NSTRIP = NSTRIP + 1. |
117 |
QTOT = QTOT + DEXY(2,I,J) |
118 |
IF (I.LT.11) QQ(1) = QQ(1) + DEXY(2,I,J) |
119 |
ENDIF |
120 |
IF ( ESTRIP(1,I,J).GT.EMIN ) THEN |
121 |
C IF ( ESTRIP(1,I+1,J).GT.EMIN ) THEN |
122 |
C |
123 |
c print *,' i ',i,' i + 1 ',I+1 |
124 |
C DEXY(1,I,J) = ESTRIP(1,I+1,J) |
125 |
DEXY(1,I,J) = ESTRIP(1,I,J) |
126 |
C |
127 |
ENPLANEX = ENPLANEX + DEXY(1,I,J) |
128 |
NSTRIP = NSTRIP + 1. |
129 |
QTOT = QTOT + DEXY(1,I,J) |
130 |
if (i.lt.11) QQ(2) = QQ(2) + DEXY(1,I,J) |
131 |
c IF (I.EQ.21) THEN |
132 |
c NX22 = NX22 + 1. |
133 |
c QX22 = QX22 + DEXY(1,I,J) |
134 |
c ENDIF |
135 |
ENDIF |
136 |
ENDIF |
137 |
IF ( MOD(I,2).EQ.0 ) THEN |
138 |
IF (ESTRIP(2,I,J).GT.EMIN) THEN |
139 |
DEXY(2,I,J) = ESTRIP(2,I,J) |
140 |
ENPLANEY = ENPLANEY + DEXY(2,I,J) |
141 |
NSTRIP = NSTRIP + 1. |
142 |
QTOT = QTOT + DEXY(2,I,J) |
143 |
if (i.lt.11) QQ(3) = QQ(3) + DEXY(2,I,J) |
144 |
ENDIF |
145 |
IF (ESTRIP(1,I,J).GT.EMIN) THEN |
146 |
C IF (ESTRIP(1,I-1,J).GT.EMIN) THEN |
147 |
C |
148 |
c print *,' i ',i,' i - 1 ',I-1 |
149 |
C DEXY(1,I,J) = ESTRIP(1,I-1,J) |
150 |
DEXY(1,I,J) = ESTRIP(1,I,J) |
151 |
C |
152 |
ENPLANEX = ENPLANEX + DEXY(1,I,J) |
153 |
NSTRIP = NSTRIP + 1. |
154 |
QTOT = QTOT + DEXY(1,I,J) |
155 |
IF (I.EQ.NPLA) THEN |
156 |
NX22 = NX22 + 1. |
157 |
QX22 = QX22 + DEXY(1,I,J) |
158 |
ENDIF |
159 |
IF (I.LT.11) QQ(4) = QQ(4) + DEXY(1,I,J) |
160 |
ENDIF |
161 |
ENDIF |
162 |
C |
163 |
IF (DEXY(1,I,J).GT.QMAX) QMAX = DEXY(1,I,J) |
164 |
IF (DEXY(2,I,J).GT.QMAX) QMAX = DEXY(2,I,J) |
165 |
C |
166 |
ENDDO |
167 |
IF (ENPLANEX.GT.TENPLAX) THEN |
168 |
PLANEMAX(1) = I |
169 |
TENPLAX = ENPLANEX |
170 |
ENDIF |
171 |
IF (ENPLANEY.GT.TENPLAY) THEN |
172 |
PLANEMAX(2) = I |
173 |
TENPLAY = ENPLANEY |
174 |
ENDIF |
175 |
ENDDO |
176 |
C |
177 |
C FIT THE TRACK INSIDE THE CALORIMETER |
178 |
C |
179 |
if (GOOD2.EQ.1.OR.TRIGTY.GE.2) then |
180 |
c print *,' CALL CLUSTER ' |
181 |
CALL CLUSTER |
182 |
c print *,' CALL DIRECTION ' |
183 |
CALL DIRECTION(TG) |
184 |
NPCFIT(1) = NPFIT(1) |
185 |
NPCFIT(2) = NPFIT(2) |
186 |
C |
187 |
DO M = 1,2 |
188 |
C |
189 |
IF (NPCFIT(M).GE.2) THEN |
190 |
VARCFIT(M) = VARFIT(M) |
191 |
IF (M.EQ.1) THEN |
192 |
IMPX = (CX - XALIG)/10. |
193 |
TANX = TG(1) |
194 |
ELSE |
195 |
IMPY =( CY - YALIG)/10. |
196 |
TANY = TG(2) |
197 |
ENDIF |
198 |
C |
199 |
DO I = 1,NPLA |
200 |
C NN = 1 |
201 |
NN = 0 |
202 |
C IF (M.EQ.2) NN = 1 |
203 |
IF (MOD(I,2).EQ.NN) THEN |
204 |
IF (REVERSE.EQ.0) THEN |
205 |
SHIFT = +0.5 |
206 |
ELSE |
207 |
SHIFT = -0.5 |
208 |
ENDIF |
209 |
ELSE |
210 |
IF (REVERSE.EQ.0) THEN |
211 |
SHIFT = -0.5 |
212 |
ELSE |
213 |
SHIFT = +0.5 |
214 |
ENDIF |
215 |
ENDIF |
216 |
C |
217 |
IF (M.EQ.1) THEN |
218 |
DISTX = PIANO(I) - 5.81 |
219 |
c print *,'C X PLANE I= ',I,' Z = ',DISTX+ZALIG |
220 |
Y(I) = DISTX * TG(1) + CX |
221 |
BAR(M,I) = Y(I) |
222 |
CBAR(M,I) = (Y(I) - XALIG)/10. |
223 |
C |
224 |
ELSE |
225 |
DISTY = PIANO(I) |
226 |
c print *,'C Y PLANE I= ',I,' Z = ',DISTY+ZALIG |
227 |
YY(I) = DISTY * TG(2) + CY |
228 |
BAR(M,I) = YY(I) |
229 |
CBAR(M,I) = (-YALIG + YY(I))/10. |
230 |
C |
231 |
ENDIF |
232 |
CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) |
233 |
CIBAR(M,I) = IBAR(M,I) |
234 |
IF (ibar(m,i).EQ.-1) THEN |
235 |
CHTRACK = CHTRACK + 1 |
236 |
ELSE |
237 |
IWPL(M) = IWPL(M) + 1 |
238 |
ENDIF |
239 |
ENDDO |
240 |
ENDIF |
241 |
C |
242 |
ENDDO |
243 |
ELSE |
244 |
GOTO 9696 |
245 |
ENDIF |
246 |
C |
247 |
C CALCULATE ELEN AND SELEN |
248 |
C |
249 |
c ELEN = 40.82 * QTOT * 1.06 * 1E-4 |
250 |
ELEN = 260. * QTOT |
251 |
IF (ELEN.GT.0.) THEN |
252 |
SELEN = ELEN * (0.01183 + 0.121 / SQRT(ELEN)) |
253 |
ELSE |
254 |
SELEN = 0. |
255 |
ENDIF |
256 |
C |
257 |
9696 CONTINUE |
258 |
C |
259 |
45 continue |
260 |
|
261 |
50 continue |
262 |
|
263 |
return |
264 |
END |
265 |
|
266 |
|