27 |
c PARAMETER (FLIMIT=500) |
c PARAMETER (FLIMIT=500) |
28 |
PARAMETER (FLIMIT=2000) |
PARAMETER (FLIMIT=2000) |
29 |
PARAMETER (FLIMIT2=500) |
PARAMETER (FLIMIT2=500) |
30 |
REAL X(NPLA),Y(NPLA),W(NPLA) |
REAL X(NPLAV),Y(NPLAV),W(NPLAV) |
31 |
REAL DEVIA(2),TG(2) |
REAL DEVIA(2),TG(2) |
32 |
REAL BAR(2,NPLA) |
REAL BAR(2,NPLAV) |
33 |
REAL A, B, VAR |
REAL A, B, VAR |
34 |
REAL SA, SB, SVAR |
REAL SA, SB, SVAR |
35 |
REAL SSA, SSB, SSVAR |
REAL SSA, SSB, SSVAR |
36 |
REAL PIANO(22) |
REAL PIANO(NPLAV) |
37 |
REAL VARFIT(2) |
REAL VARFIT(2) |
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,NPLA) |
INTEGER IBAR(2,NPLAV) |
44 |
COMMON/ANGOLO/BAR,IBAR |
COMMON/ANGOLO/BAR,IBAR |
45 |
SAVE /ANGOLO/ |
SAVE /ANGOLO/ |
46 |
|
|
62 |
VARFIT(1) = 0. |
VARFIT(1) = 0. |
63 |
VARFIT(2) = 0. |
VARFIT(2) = 0. |
64 |
C |
C |
65 |
|
FORCEMODE = -1 |
66 |
|
IF (FMODE(1).GT.100.AND.FMODE(2).GT.100) 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 . |
78 |
FMODE(M) = 0 |
FMODE(M) = 0 |
79 |
10 CONTINUE |
10 CONTINUE |
80 |
ICONT = 0 |
ICONT = 0 |
81 |
CALL VZERO(X,NPLA) |
CALL VZERO(X,NPLAV) |
82 |
CALL VZERO(Y,NPLA) |
CALL VZERO(Y,NPLAV) |
83 |
CALL VZERO(W,NPLA) |
CALL VZERO(W,NPLAV) |
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.).AND.FMODE(M).EQ.0) THEN |
159 |
SA = A |
SVAR = VAR |
160 |
SNPFIT = NPFIT(M) |
SB = B |
161 |
NPFIT(M) = NPLA |
SA = A |
162 |
FMODE(M) = 1 |
SNPFIT = NPFIT(M) |
163 |
GOTO 10 |
NPFIT(M) = NPLA |
|
ENDIF |
|
|
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 |
|
164 |
FMODE(M) = 1 |
FMODE(M) = 1 |
165 |
VAR=SSVAR |
GOTO 10 |
|
B = SSB |
|
|
A = SSA |
|
|
NPFIT(M) = SSNPFIT |
|
166 |
ENDIF |
ENDIF |
167 |
ENDIF |
C |
168 |
C |
C TRY AGAIN IF STILL BAD AND WE HAVE AT LEAST 10 POINT TO MAKE THE FIT |
169 |
C IF THE SECOND TRY AND THE FIT IS WORST THAN THE FIRST TRY TAKE THE FIRST TRY |
C |
170 |
C |
IF ((ABS(VAR).GT.FLIMIT2.OR.VAR.EQ.0.).AND.FMODE(M).EQ.1 |
171 |
IF (FMODE(M).EQ.1) THEN |
& .AND.SNPFIT.GT.5) THEN |
172 |
IF (ABS(VAR).GT.ABS(SVAR).OR.ABS(VAR).EQ.0.) THEN |
SSVAR = VAR |
173 |
FMODE(M) = 0 |
SSB = B |
174 |
VAR=SVAR |
SSA = A |
175 |
B = SB |
SSNPFIT = NPFIT(M) |
176 |
A = SA |
NPFIT(M) = NPLA |
177 |
NPFIT(M) = SNPFIT |
FMODE(M) = 2 |
178 |
|
GOTO 10 |
179 |
|
ENDIF |
180 |
|
C |
181 |
|
C IF WE ARE AT THE THIRD TRY AND THE FIT IS WORST THAN THE SECOND TRY TAKE THE FIRST TRY |
182 |
|
C |
183 |
|
IF (FMODE(M).EQ.2) THEN |
184 |
|
IF (ABS(VAR).GT.ABS(SSVAR).OR.ABS(VAR).EQ.0. |
185 |
|
& .OR.NPFIT(M).LE.4) THEN |
186 |
|
FMODE(M) = 1 |
187 |
|
VAR=SSVAR |
188 |
|
B = SSB |
189 |
|
A = SSA |
190 |
|
NPFIT(M) = SSNPFIT |
191 |
|
ENDIF |
192 |
|
ENDIF |
193 |
|
C |
194 |
|
C IF THE SECOND TRY AND THE FIT IS WORST THAN THE FIRST TRY TAKE THE FIRST TRY |
195 |
|
C |
196 |
|
IF (FMODE(M).EQ.1) THEN |
197 |
|
IF (ABS(VAR).GT.ABS(SVAR).OR.ABS(VAR).EQ.0.) THEN |
198 |
|
FMODE(M) = 0 |
199 |
|
VAR=SVAR |
200 |
|
B = SB |
201 |
|
A = SA |
202 |
|
NPFIT(M) = SNPFIT |
203 |
|
ENDIF |
204 |
ENDIF |
ENDIF |
205 |
ENDIF |
ENDIF |
206 |
C |
C |