/[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.4 - (show annotations) (download)
Thu Aug 10 06:32:02 2006 UTC (18 years, 3 months ago) by mocchiut
Branch: MAIN
CVS Tags: v2r01, v2r00BETA
Changes since 1.3: +1 -1 lines
ToF bug fixed + new calo/tracker alignement

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)
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
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 C
90 DISTX = 0.
91 DISTY = 0.
92 C
93 PLANEMAX(1) = 0
94 PLANEMAX(2) = 0
95 TENPLAX = 0.
96 TENPLAY = 0.
97 C
98 IF (GOOD2.EQ.0.AND.TRIGTY.LT.2) goto 9696
99 C
100 C CALCULATE QTOT, NSTRIP, QQ, NX22, QX22, QMAX AND PLANEMAX
101 C
102 DO I = 1,22
103 ENPLANEY = 0.
104 ENPLANEX = 0.
105 DO J = 1,96
106 IF ( MOD(I,2).NE.0 ) THEN
107 IF ( ESTRIP(2,I,J).GT.EMIN ) THEN
108 ENPLANEY = ENPLANEY + ESTRIP(2,I,J)
109 DEXY(2,I,J) = ESTRIP(2,I,J)
110 NSTRIP = NSTRIP + 1.
111 QTOT = QTOT + ESTRIP(2,I,J)
112 IF (I.LT.11) QQ(1) = QQ(1) + ESTRIP(2,I,J)
113 ENDIF
114 IF ( ESTRIP(1,I,J).GT.EMIN ) THEN
115 ENPLANEX = ENPLANEX + ESTRIP(1,I,J)
116 DEXY(1,I,J) = ESTRIP(1,I,J)
117 NSTRIP = NSTRIP + 1.
118 QTOT = QTOT + ESTRIP(1,I,J)
119 if (i.lt.11) QQ(2) = QQ(2) + ESTRIP(1,I,J)
120 ENDIF
121 ENDIF
122 IF ( MOD(I,2).EQ.0 ) THEN
123 IF (ESTRIP(2,I,J).GT.EMIN) THEN
124 ENPLANEY = ENPLANEY + ESTRIP(2,I,J)
125 DEXY(2,I,J) = ESTRIP(2,I,J)
126 NSTRIP = NSTRIP + 1.
127 QTOT = QTOT + ESTRIP(2,I,J)
128 if (i.lt.11) QQ(3) = QQ(3) + ESTRIP(2,I,J)
129 ENDIF
130 IF (ESTRIP(1,I,J).GT.EMIN) THEN
131 ENPLANEX = ENPLANEX + ESTRIP(1,I,J)
132 DEXY(1,I,J) = ESTRIP(1,I,J)
133 NSTRIP = NSTRIP + 1.
134 QTOT = QTOT + ESTRIP(1,I,J)
135 IF (I.EQ.22) THEN
136 NX22 = NX22 + 1.
137 QX22 = QX22 + ESTRIP(1,I,J)
138 ENDIF
139 IF (I.LT.11) QQ(4) = QQ(4) + ESTRIP(1,I,J)
140 ENDIF
141 ENDIF
142 C
143 IF (DEXY(1,I,J).GT.QMAX) QMAX = DEXY(1,I,J)
144 IF (DEXY(2,I,J).GT.QMAX) QMAX = DEXY(2,I,J)
145 C
146 ENDDO
147 IF (ENPLANEX.GT.TENPLAX) THEN
148 PLANEMAX(1) = I
149 TENPLAX = ENPLANEX
150 ENDIF
151 IF (ENPLANEY.GT.TENPLAY) THEN
152 PLANEMAX(2) = I
153 TENPLAY = ENPLANEY
154 ENDIF
155 ENDDO
156 C
157 C FIT THE TRACK INSIDE THE CALORIMETER
158 C
159 if (GOOD2.EQ.1.OR.TRIGTY.GE.2) then
160 CALL CLUSTER
161 CALL DIRECTION(TG)
162 NPCFIT(1) = NPFIT(1)
163 NPCFIT(2) = NPFIT(2)
164 C
165 DO M = 1,2
166 C
167 IF (NPCFIT(M).GE.2) THEN
168 VARCFIT(M) = VARFIT(M)
169 IF (M.EQ.1) THEN
170 IMPX = (CX - XALIG)/10.
171 TANX = TG(1)
172 ELSE
173 IMPY =( CY - YALIG)/10.
174 TANY = TG(2)
175 ENDIF
176 C
177 DO I = 1,NPLA
178 NN = 0
179 C???? IF (M.EQ.2) NN = 1
180 IF (MOD(I,2).EQ.NN) THEN
181 SHIFT = +0.5
182 ELSE
183 SHIFT = -0.5
184 ENDIF
185 C
186 IF (M.EQ.1) THEN
187 DISTX = PIANO(I) - 5.81
188 Y(I) = DISTX * TG(1) + CX
189 BAR(M,I) = Y(I)
190 CBAR(M,I) = (Y(I) - XALIG)/10.
191 C
192 ELSE
193 DISTY = PIANO(I)
194 YY(I) = DISTY * TG(2) + CY
195 BAR(M,I) = YY(I)
196 CBAR(M,I) = (-YALIG + YY(I))/10.
197 C
198 ENDIF
199 CALL LASTRISCIA(BAR(M,I),IBAR(M,I))
200 CIBAR(M,I) = IBAR(M,I)
201 ENDDO
202 ENDIF
203 C
204 ENDDO
205 ELSE
206 GOTO 9696
207 ENDIF
208 C
209 C CALCULATE ELEN AND SELEN
210 C
211 ELEN = 40.82 * QTOT * 1.06 * 1E-4
212 IF (ELEN.GT.0.) THEN
213 SELEN = ELEN * (0.01183 + 0.121 / SQRT(ELEN))
214 ELSE
215 SELEN = 0.
216 ENDIF
217 C
218 9696 CONTINUE
219 C
220 45 continue
221
222 50 continue
223
224 return
225 END
226
227

  ViewVC Help
Powered by ViewVC 1.1.23