/[PAMELA software]/DarthVader/CalorimeterLevel2/src/calol2cm.for
ViewVC logotype

Contents of /DarthVader/CalorimeterLevel2/src/calol2cm.for

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Mon Mar 26 14:02:07 2007 UTC (17 years, 8 months ago) by mocchiut
Branch: MAIN
Changes since 1.5: +1 -1 lines
Bug in CaloStrip/Level0 fixed + new alignement parameters added

1 *****************************************************************************
2 INTEGER FUNCTION CALOL2CM()
3 c
4 IMPLICIT NONE
5 C
6 INCLUDE 'INTEST.TXT'
7 C
8 REAL PIANO(22), VARFIT(2)
9 REAL SHIFT
10 REAL TG(2), BAR(2,NPLA)
11 REAL DISTX, DISTY, Y(NPLA), YY(NPLA)
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,NPLA), 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 PIANO(1) = 0.
57 DO I = 2, 22
58 IF ( MOD(I,2).EQ.0 ) THEN
59 PIANO(I) = PIANO(I-1) - 8.09
60 ELSE
61 PIANO(I) = PIANO(I-1) - 10.09
62 ENDIF
63 ENDDO
64 C
65 CALL VZERO(DEXY,2*LENSEV)
66 CALL VZERO(BAR,2*NPLA)
67 CALL VZERO(IBAR,2*NPLA)
68 CALL VZERO(CBAR,2*NPLA)
69 CALL VZERO(CIBAR,2*NPLA)
70 CALL VZERO(QQ,4)
71 CALL VZERO(Y,NPLA)
72 CALL VZERO(YY,NPLA)
73 VARFIT(1) = 0.
74 VARFIT(2) = 0.
75 NPFIT(1) = 0.
76 NPFIT(2) = 0.
77 VARCFIT(1) = 0.
78 VARCFIT(2) = 0.
79 NPCFIT(1) = 0.
80 NPCFIT(2) = 0.
81 ELEN = 0.
82 SELEN = 0.
83 NSTRIP = 0.
84 QTOT = 0.
85 NX22 = 0.
86 QX22 = 0.
87 QMAX = 0.
88 GTR = 0
89 CHTRACK = 0
90 C
91 DISTX = 0.
92 DISTY = 0.
93 C
94 PLANEMAX(1) = 0
95 PLANEMAX(2) = 0
96 TENPLAX = 0.
97 TENPLAY = 0.
98 C
99 IF (GOOD2.EQ.0.AND.TRIGTY.LT.2) goto 9696
100 C
101 C CALCULATE QTOT, NSTRIP, QQ, NX22, QX22, QMAX AND PLANEMAX
102 C
103 DO I = 1,22
104 ENPLANEY = 0.
105 ENPLANEX = 0.
106 DO J = 1,96
107 IF ( MOD(I,2).NE.0 ) THEN
108 IF ( ESTRIP(2,I,J).GT.EMIN ) THEN
109 ENPLANEY = ENPLANEY + ESTRIP(2,I,J)
110 DEXY(2,I,J) = ESTRIP(2,I,J)
111 NSTRIP = NSTRIP + 1.
112 QTOT = QTOT + ESTRIP(2,I,J)
113 IF (I.LT.11) QQ(1) = QQ(1) + ESTRIP(2,I,J)
114 ENDIF
115 IF ( ESTRIP(1,I,J).GT.EMIN ) THEN
116 ENPLANEX = ENPLANEX + ESTRIP(1,I,J)
117 DEXY(1,I,J) = ESTRIP(1,I,J)
118 NSTRIP = NSTRIP + 1.
119 QTOT = QTOT + ESTRIP(1,I,J)
120 if (i.lt.11) QQ(2) = QQ(2) + ESTRIP(1,I,J)
121 ENDIF
122 ENDIF
123 IF ( MOD(I,2).EQ.0 ) THEN
124 IF (ESTRIP(2,I,J).GT.EMIN) THEN
125 ENPLANEY = ENPLANEY + ESTRIP(2,I,J)
126 DEXY(2,I,J) = ESTRIP(2,I,J)
127 NSTRIP = NSTRIP + 1.
128 QTOT = QTOT + ESTRIP(2,I,J)
129 if (i.lt.11) QQ(3) = QQ(3) + ESTRIP(2,I,J)
130 ENDIF
131 IF (ESTRIP(1,I,J).GT.EMIN) THEN
132 ENPLANEX = ENPLANEX + ESTRIP(1,I,J)
133 DEXY(1,I,J) = ESTRIP(1,I,J)
134 NSTRIP = NSTRIP + 1.
135 QTOT = QTOT + ESTRIP(1,I,J)
136 IF (I.EQ.22) THEN
137 NX22 = NX22 + 1.
138 QX22 = QX22 + ESTRIP(1,I,J)
139 ENDIF
140 IF (I.LT.11) QQ(4) = QQ(4) + ESTRIP(1,I,J)
141 ENDIF
142 ENDIF
143 C
144 IF (DEXY(1,I,J).GT.QMAX) QMAX = DEXY(1,I,J)
145 IF (DEXY(2,I,J).GT.QMAX) QMAX = DEXY(2,I,J)
146 C
147 ENDDO
148 IF (ENPLANEX.GT.TENPLAX) THEN
149 PLANEMAX(1) = I
150 TENPLAX = ENPLANEX
151 ENDIF
152 IF (ENPLANEY.GT.TENPLAY) THEN
153 PLANEMAX(2) = I
154 TENPLAY = ENPLANEY
155 ENDIF
156 ENDDO
157 C
158 C FIT THE TRACK INSIDE THE CALORIMETER
159 C
160 if (GOOD2.EQ.1.OR.TRIGTY.GE.2) then
161 CALL CLUSTER
162 CALL DIRECTION(TG)
163 NPCFIT(1) = NPFIT(1)
164 NPCFIT(2) = NPFIT(2)
165 C
166 DO M = 1,2
167 C
168 IF (NPCFIT(M).GE.2) THEN
169 VARCFIT(M) = VARFIT(M)
170 IF (M.EQ.1) THEN
171 IMPX = (CX - XALIG)/10.
172 TANX = TG(1)
173 ELSE
174 IMPY =( CY - YALIG)/10.
175 TANY = TG(2)
176 ENDIF
177 C
178 DO I = 1,NPLA
179 NN = 0
180 IF (M.EQ.2) NN = 1
181 IF (MOD(I,2).EQ.NN) THEN
182 SHIFT = +0.5
183 ELSE
184 SHIFT = -0.5
185 ENDIF
186 C
187 IF (M.EQ.1) THEN
188 DISTX = PIANO(I) - 5.81
189 Y(I) = DISTX * TG(1) + CX
190 BAR(M,I) = Y(I)
191 CBAR(M,I) = (Y(I) - XALIG)/10.
192 C
193 ELSE
194 DISTY = PIANO(I)
195 YY(I) = DISTY * TG(2) + CY
196 BAR(M,I) = YY(I)
197 CBAR(M,I) = (-YALIG + YY(I))/10.
198 C
199 ENDIF
200 CALL LASTRISCIA(BAR(M,I),IBAR(M,I))
201 CIBAR(M,I) = IBAR(M,I)
202 IF (ibar(m,i).EQ.-1) THEN
203 CHTRACK = CHTRACK + 1
204 ELSE
205 IWPL(M) = IWPL(M) + 1
206 ENDIF
207 ENDDO
208 ENDIF
209 C
210 ENDDO
211 ELSE
212 GOTO 9696
213 ENDIF
214 C
215 C CALCULATE ELEN AND SELEN
216 C
217 ELEN = 40.82 * QTOT * 1.06 * 1E-4
218 IF (ELEN.GT.0.) THEN
219 SELEN = ELEN * (0.01183 + 0.121 / SQRT(ELEN))
220 ELSE
221 SELEN = 0.
222 ENDIF
223 C
224 9696 CONTINUE
225 C
226 45 continue
227
228 50 continue
229
230 return
231 END
232
233

  ViewVC Help
Powered by ViewVC 1.1.23