38 |
|
|
39 |
INTEGER ICONT, M, I, SNPFIT,SSNPFIT |
INTEGER ICONT, M, I, SNPFIT,SSNPFIT |
40 |
INTEGER NPFIT(2), CHTRACK,IWPL(2) |
INTEGER NPFIT(2), CHTRACK,IWPL(2) |
41 |
|
INTEGER FORCEMODE |
42 |
|
|
43 |
INTEGER IBAR(2,NPLAV) |
INTEGER IBAR(2,NPLAV) |
44 |
COMMON/ANGOLO/BAR,IBAR |
COMMON/ANGOLO/BAR,IBAR |
62 |
VARFIT(1) = 0. |
VARFIT(1) = 0. |
63 |
VARFIT(2) = 0. |
VARFIT(2) = 0. |
64 |
C |
C |
65 |
|
FORCEMODE = -1 |
66 |
|
IF (FMODE(1).GE.1000.AND.FMODE(2).GE.1000) THEN |
67 |
|
FORCEMODE = FMODE(1)-1000 |
68 |
|
ENDIF |
69 |
|
C |
70 |
C THE FIT IS PERFORMED WHEN THERE ARE AT LEAST TWO |
C THE FIT IS PERFORMED WHEN THERE ARE AT LEAST TWO |
71 |
C LAYERS WITH SIGNAL . FOR THE FIT THE CLUSTER WITH THE |
C LAYERS WITH SIGNAL . FOR THE FIT THE CLUSTER WITH THE |
72 |
C HIGHEST DETECTED ENERGY IS USED . |
C HIGHEST DETECTED ENERGY IS USED . |
84 |
DO I = 1,NPLA |
DO I = 1,NPLA |
85 |
C |
C |
86 |
IF (MOD(M,2).EQ.0) THEN |
IF (MOD(M,2).EQ.0) THEN |
87 |
X(I) = PIANO(I) - 5.81 |
X(I) = PIANO(I) |
88 |
|
C X(I) = PIANO(I) - 5.81 |
89 |
ELSE |
ELSE |
90 |
X(I) = PIANO(I) |
X(I) = PIANO(I) - 5.81 |
91 |
|
C X(I) = PIANO(I) |
92 |
ENDIF |
ENDIF |
93 |
Y(I) = 0. |
Y(I) = 0. |
94 |
C |
C |
95 |
C |
C |
96 |
C |
C |
97 |
IF (FMODE(M).EQ.0) THEN |
IF ((FMODE(M).EQ.0.AND.FORCEMODE.EQ.-1) |
98 |
|
+ .OR.FORCEMODE.EQ.0) THEN |
99 |
IF (NCL(M,I).GE.1) THEN |
IF (NCL(M,I).GE.1) THEN |
100 |
ICONT = ICONT + 1 |
ICONT = ICONT + 1 |
101 |
Y(I) = CLUS(M,I,1) |
Y(I) = CLUS(M,I,1) |
110 |
C |
C |
111 |
C No weigth and less cluster per plane |
C No weigth and less cluster per plane |
112 |
C |
C |
113 |
IF(FMODE(M).EQ.1) THEN |
IF((FMODE(M).EQ.1.AND.FORCEMODE.EQ.-1).OR. |
114 |
|
+ FORCEMODE.EQ.1) THEN |
115 |
IF (NCL(M,I).GE.1.AND.NCL(M,I).LE.2) THEN |
IF (NCL(M,I).GE.1.AND.NCL(M,I).LE.2) THEN |
116 |
ICONT = ICONT + 1 |
ICONT = ICONT + 1 |
117 |
Y(I) = CLUS(M,I,1) |
Y(I) = CLUS(M,I,1) |
127 |
c |
c |
128 |
c One cluster per plane |
c One cluster per plane |
129 |
c |
c |
130 |
IF(FMODE(M).EQ.2) THEN |
IF((FMODE(M).EQ.2.AND.FORCEMODE.EQ.-1).OR. |
131 |
|
+ FORCEMODE.EQ.2) THEN |
132 |
IF (NCL(M,I).EQ.1) THEN |
IF (NCL(M,I).EQ.1) THEN |
133 |
ICONT = ICONT + 1 |
ICONT = ICONT + 1 |
134 |
Y(I) = CLUS(M,I,1) |
Y(I) = CLUS(M,I,1) |
151 |
NPFIT(M) = 0 |
NPFIT(M) = 0 |
152 |
ENDIF |
ENDIF |
153 |
C |
C |
154 |
C TRY A BETTER FIT IF VAR IS BIG ON THE FIRST TRY |
IF (FORCEMODE.EQ.-1) THEN |
155 |
C |
C |
156 |
IF ((ABS(VAR).GT.FLIMIT.OR.VAR.EQ.0.).AND.FMODE(M).EQ.0) THEN |
C TRY A BETTER FIT IF VAR IS BIG ON THE FIRST TRY |
157 |
SVAR = VAR |
C |
158 |
SB = B |
IF ((ABS(VAR).GT.FLIMIT.OR.VAR.EQ.0.) |
159 |
SA = A |
& .AND.FMODE(M).EQ.0) THEN |
160 |
SNPFIT = NPFIT(M) |
SVAR = VAR |
161 |
NPFIT(M) = NPLA |
SB = B |
162 |
FMODE(M) = 1 |
SA = A |
163 |
GOTO 10 |
SNPFIT = NPFIT(M) |
164 |
ENDIF |
NPFIT(M) = NPLA |
|
C |
|
|
C TRY AGAIN IF STILL BAD AND WE HAVE AT LEAST 10 POINT TO MAKE THE FIT |
|
|
C |
|
|
IF ((ABS(VAR).GT.FLIMIT2.OR.VAR.EQ.0.).AND.FMODE(M).EQ.1 |
|
|
& .AND.SNPFIT.GT.5) THEN |
|
|
SSVAR = VAR |
|
|
SSB = B |
|
|
SSA = A |
|
|
SSNPFIT = NPFIT(M) |
|
|
NPFIT(M) = NPLA |
|
|
FMODE(M) = 2 |
|
|
GOTO 10 |
|
|
ENDIF |
|
|
C |
|
|
C IF WE ARE AT THE THIRD TRY AND THE FIT IS WORST THAN THE SECOND TRY TAKE THE FIRST TRY |
|
|
C |
|
|
IF (FMODE(M).EQ.2) THEN |
|
|
IF (ABS(VAR).GT.ABS(SSVAR).OR.ABS(VAR).EQ.0. |
|
|
& .OR.NPFIT(M).LE.4) THEN |
|
165 |
FMODE(M) = 1 |
FMODE(M) = 1 |
166 |
VAR=SSVAR |
GOTO 10 |
|
B = SSB |
|
|
A = SSA |
|
|
NPFIT(M) = SSNPFIT |
|
167 |
ENDIF |
ENDIF |
168 |
ENDIF |
C |
169 |
C |
C TRY AGAIN IF STILL BAD AND WE HAVE AT LEAST 10 POINT TO MAKE THE FIT |
170 |
C IF THE SECOND TRY AND THE FIT IS WORST THAN THE FIRST TRY TAKE THE FIRST TRY |
C |
171 |
C |
IF ((ABS(VAR).GT.FLIMIT2.OR.VAR.EQ.0.).AND.FMODE(M).EQ.1 |
172 |
IF (FMODE(M).EQ.1) THEN |
& .AND.SNPFIT.GT.5) THEN |
173 |
IF (ABS(VAR).GT.ABS(SVAR).OR.ABS(VAR).EQ.0.) THEN |
SSVAR = VAR |
174 |
FMODE(M) = 0 |
SSB = B |
175 |
VAR=SVAR |
SSA = A |
176 |
B = SB |
SSNPFIT = NPFIT(M) |
177 |
A = SA |
NPFIT(M) = NPLA |
178 |
NPFIT(M) = SNPFIT |
FMODE(M) = 2 |
179 |
|
GOTO 10 |
180 |
|
ENDIF |
181 |
|
C |
182 |
|
C IF WE ARE AT THE THIRD TRY AND THE FIT IS WORST THAN THE SECOND TRY TAKE THE FIRST TRY |
183 |
|
C |
184 |
|
IF (FMODE(M).EQ.2) THEN |
185 |
|
IF (ABS(VAR).GT.ABS(SSVAR).OR.ABS(VAR).EQ.0. |
186 |
|
& .OR.NPFIT(M).LE.4) THEN |
187 |
|
FMODE(M) = 1 |
188 |
|
VAR=SSVAR |
189 |
|
B = SSB |
190 |
|
A = SSA |
191 |
|
NPFIT(M) = SSNPFIT |
192 |
|
ENDIF |
193 |
|
ENDIF |
194 |
|
C |
195 |
|
C IF THE SECOND TRY AND THE FIT IS WORST THAN THE FIRST TRY TAKE THE FIRST TRY |
196 |
|
C |
197 |
|
IF (FMODE(M).EQ.1) THEN |
198 |
|
IF (ABS(VAR).GT.ABS(SVAR).OR.ABS(VAR).EQ.0.) THEN |
199 |
|
FMODE(M) = 0 |
200 |
|
VAR=SVAR |
201 |
|
B = SB |
202 |
|
A = SA |
203 |
|
NPFIT(M) = SNPFIT |
204 |
|
ENDIF |
205 |
ENDIF |
ENDIF |
206 |
ENDIF |
ENDIF |
207 |
C |
C |