22 |
REAL FLIMIT, FLIMIT2 |
REAL FLIMIT, FLIMIT2 |
23 |
INTEGER NVAR,NPAR |
INTEGER NVAR,NPAR |
24 |
PARAMETER (NVAR=1,NPAR=2) |
PARAMETER (NVAR=1,NPAR=2) |
25 |
PARAMETER (FLIMIT=10000) |
c PARAMETER (FLIMIT=10000) |
26 |
PARAMETER (FLIMIT2=2000) |
c PARAMETER (FLIMIT2=2000) |
27 |
REAL X(NPLA),Y(NPLA),W(NPLA) |
c PARAMETER (FLIMIT=500) |
28 |
|
PARAMETER (FLIMIT=2000) |
29 |
|
PARAMETER (FLIMIT2=500) |
30 |
|
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).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 . |
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) |
108 |
ENDIF |
ENDIF |
109 |
ENDIF |
ENDIF |
110 |
C |
C |
111 |
C More importance to 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) |
118 |
W(I) = ((CLUS(M,I,1+NCHA/2)**0.29))**2. |
W(I) = ((CLUS(M,I,1+NCHA/2)**0.29))**2. |
119 |
|
c W(I) = 1. |
120 |
ENDIF |
ENDIF |
121 |
IF (W(I).GT.2000.) THEN |
c IF (W(I).GT.2000.) THEN |
122 |
W(I) = 2000. |
cx W(I) = 2000. |
123 |
c Y(I) = 0. |
cc Y(I) = 0. |
124 |
c ICONT = ICONT -1 |
cc ICONT = ICONT -1 |
125 |
ENDIF |
c ENDIF |
126 |
ENDIF |
ENDIF |
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) |
135 |
W(I) = ((CLUS(M,I,1+NCHA/2)**0.79))**2. |
W(I) = ((CLUS(M,I,1+NCHA/2)**0.79))**2. |
136 |
|
c W(I) = 1. |
137 |
ENDIF |
ENDIF |
138 |
ENDIF |
ENDIF |
139 |
c if (Y(I).eq.0.or.W(I).eq.2000.) NPFIT(M) = NPFIT(M) - 1 |
c if (Y(I).eq.0.or.W(I).eq.2000.) NPFIT(M) = NPFIT(M) - 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 15 POINT TO MAKE THE FIT |
|
|
C |
|
|
IF ((ABS(VAR).GT.FLIMIT2.OR.VAR.EQ.0.).AND.FMODE(M).EQ.1 |
|
|
& .AND.NPFIT(M).GT.14) 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 |