1 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
2 |
|
* this file contains all subroutines and functions |
3 |
|
* that are needed for position finding algorithms: |
4 |
|
* |
5 |
|
* subroutine idtoc(ipfa,cpfa) |
6 |
|
* |
7 |
|
* subroutine applypfa(PFAtt,ic,ang,corr,res) |
8 |
|
* |
9 |
|
* integer function npfastrips(ic,angle) |
10 |
|
* |
11 |
|
* ----------------------------------------------------------------- |
12 |
|
* p.f.a. |
13 |
|
* ----------------------------------------------------------------- |
14 |
|
* real function pfaeta(ic,angle) |
15 |
|
* real function pfaetal(ic,angle) |
16 |
|
* real function pfaeta2(ic,angle) |
17 |
|
* real function pfaeta3(ic,angle) |
18 |
|
* real function pfaeta4(ic,angle) |
19 |
|
* real function cog(ncog,ic) |
20 |
|
* |
21 |
|
* ----------------------------------------------------------------- |
22 |
|
* risoluzione spaziale media, stimata dalla simulazione (samuele) |
23 |
|
* ----------------------------------------------------------------- |
24 |
|
* FUNCTION risxeta2(angle) |
25 |
|
* FUNCTION risxeta3(angle) |
26 |
|
* FUNCTION risxeta4(angle) |
27 |
|
* FUNCTION risyeta2(angle) |
28 |
|
* FUNCTION risy_cog(angle) |
29 |
|
* FUNCTION risx_cog(angle) |
30 |
|
* real function riseta(iview,angle) |
31 |
|
* ----------------------------------------------------------------- |
32 |
|
* fattore moltiplicativo per tenere conto della dipendenza della |
33 |
|
* risoluzione dal rumore delle strip |
34 |
|
* ----------------------------------------------------------------- |
35 |
|
* real function fbad_cog(ncog,ic) |
36 |
|
* real function fbad_eta(ic,angle) |
37 |
|
* |
38 |
|
* ----------------------------------------------------------------- |
39 |
|
* NUOVO APPROCCIO PER LA STIMA DELLA RISOLUZIONE |
40 |
|
* ----------------------------------------------------------------- |
41 |
|
* real function riscogtheor(ncog,ic) |
42 |
|
* real function risetatheor(ncog,ic,angle) |
43 |
|
* |
44 |
|
* ----------------------------------------------------------------- |
45 |
|
* correzione landi |
46 |
|
* ----------------------------------------------------------------- |
47 |
|
* real function pfacorr(ic,angle) |
48 |
|
* |
49 |
|
* real function effectiveangle(ang,iview,bbb) |
50 |
|
* real function fieldcorr(iview,bbb) |
51 |
|
* |
52 |
|
* NB - The angle is the "effective angle", which is relative |
53 |
|
* to the sensor and it takes into account the magnetic field |
54 |
|
* |
55 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
56 |
|
|
57 |
subroutine idtoc(ipfa,cpfa) |
subroutine idtoc(ipfa,cpfa) |
58 |
|
|
59 |
integer ipfa |
integer ipfa |
60 |
character*4 cpfa |
character*10 cpfa |
61 |
|
|
62 |
CPFA='COG4' |
CPFA='COG4' |
63 |
if(ipfa.eq.0)CPFA='ETA' |
if(ipfa.eq.0)CPFA='ETA' |
72 |
if(ipfa.eq.14)CPFA='COG4' |
if(ipfa.eq.14)CPFA='COG4' |
73 |
|
|
74 |
end |
end |
75 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
76 |
|
real function effectiveangle(ang,iview,bbb) |
77 |
|
|
78 |
|
include 'commontracker.f' |
79 |
|
|
80 |
|
effectiveangle = 0. |
81 |
|
|
82 |
|
if(mod(iview,2).eq.0)then |
83 |
|
c ================================================= |
84 |
|
c X view |
85 |
|
c ================================================= |
86 |
|
c here bbb is the y component of the m.field |
87 |
|
angx = ang |
88 |
|
by = bbb |
89 |
|
if(iview.eq.12) angx = -1. * ang |
90 |
|
if(iview.eq.12) by = -1. * bbb |
91 |
|
cc tgtemp = tan(ang*acos(-1.)/180.) + pmuH_h*by*0.00001 !ORRORE!! |
92 |
|
tgtemp = tan(angx*acos(-1.)/180.) + pmuH_h*by*0.00001 |
93 |
|
|
94 |
|
elseif(mod(iview,2).eq.1)then |
95 |
|
c ================================================= |
96 |
|
c Y view |
97 |
|
c ================================================= |
98 |
|
c here bbb is the x component of the m.filed |
99 |
|
angy = ang |
100 |
|
bx = bbb |
101 |
|
tgtemp = tan(angy*acos(-1.)/180.)+pmuH_e*bx*0.00001 |
102 |
|
|
103 |
|
endif |
104 |
|
effectiveangle = 180.*atan(tgtemp)/acos(-1.) |
105 |
|
|
106 |
|
return |
107 |
|
end |
108 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
109 |
* this file contains all subroutines and functions |
real function fieldcorr(iview,bbb) |
110 |
* that are needed for position finding algorithms |
|
111 |
* |
include 'commontracker.f' |
112 |
* |
|
113 |
|
fieldcorr = 0. |
114 |
|
|
115 |
|
if(mod(iview,2).eq.0)then |
116 |
|
|
117 |
|
c ================================================= |
118 |
|
c X view |
119 |
|
c ================================================= |
120 |
|
c here bbb is the y component of the m.field |
121 |
|
by = bbb |
122 |
|
if(iview.eq.12) by = -1. * bbb |
123 |
|
fieldcorr = -1. * 0.5*pmuH_h*by*0.00001*SiDimZ/pitchX |
124 |
|
|
125 |
|
elseif(mod(iview,2).eq.1)then |
126 |
|
c ================================================= |
127 |
|
c Y view |
128 |
|
c ================================================= |
129 |
|
c here bbb is the x component of the m.filed |
130 |
|
bx = bbb |
131 |
|
fieldcorr = 0.5*pmuH_e*bx*0.00001*SiDimZ/pitchY |
132 |
|
|
133 |
|
endif |
134 |
|
|
135 |
|
return |
136 |
|
end |
137 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
138 |
|
|
139 |
|
subroutine applypfa(PFAtt,ic,ang,corr,res) |
140 |
|
*--------------------------------------------------------------- |
141 |
|
* this subroutine calculate the coordinate of cluster ic (in |
142 |
|
* strip units), relative to the strip with the maximum signal, |
143 |
|
* and its spatial resolution (in cm), applying PFAtt. |
144 |
|
* ang is the effective angle, relative to the sensor |
145 |
|
*--------------------------------------------------------------- |
146 |
|
|
147 |
|
character*4 PFAtt |
148 |
|
include 'commontracker.f' |
149 |
|
include 'level1.f' |
150 |
|
|
151 |
|
corr = 0 |
152 |
|
res = 0 |
153 |
|
|
154 |
|
if(ic.le.0)return |
155 |
|
|
156 |
|
iview = VIEW(ic) |
157 |
|
|
158 |
|
if(mod(iview,2).eq.0)then |
159 |
|
c ================================================= |
160 |
|
c X view |
161 |
|
c ================================================= |
162 |
|
|
163 |
|
res = RESXAV |
164 |
|
|
165 |
|
if(PFAtt.eq.'COG1')then |
166 |
|
|
167 |
|
corr = 0 |
168 |
|
res = 1e-4*pitchX/sqrt(12.)!!res |
169 |
|
|
170 |
|
elseif(PFAtt.eq.'COG2')then |
171 |
|
|
172 |
|
corr = cog(2,ic) |
173 |
|
res = risx_cog(abs(ang))!TEMPORANEO |
174 |
|
res = res*fbad_cog(2,ic) |
175 |
|
|
176 |
|
elseif(PFAtt.eq.'COG3')then |
177 |
|
|
178 |
|
corr = cog(3,ic) |
179 |
|
res = risx_cog(abs(ang))!TEMPORANEO |
180 |
|
res = res*fbad_cog(3,ic) |
181 |
|
|
182 |
|
elseif(PFAtt.eq.'COG4')then |
183 |
|
|
184 |
integer function npfastrips(ic,PFA,angle) |
corr = cog(4,ic) |
185 |
|
res = risx_cog(abs(ang))!TEMPORANEO |
186 |
|
res = res*fbad_cog(4,ic) |
187 |
|
|
188 |
|
elseif(PFAtt.eq.'ETA2')then |
189 |
|
|
190 |
|
corr = pfaeta2(ic,ang) |
191 |
|
res = risxeta2(abs(ang)) |
192 |
|
res = res*fbad_cog(2,ic) |
193 |
|
|
194 |
|
elseif(PFAtt.eq.'ETA3')then |
195 |
|
|
196 |
|
corr = pfaeta3(ic,ang) |
197 |
|
res = risxeta3(abs(ang)) |
198 |
|
res = res*fbad_cog(3,ic) |
199 |
|
|
200 |
|
elseif(PFAtt.eq.'ETA4')then |
201 |
|
|
202 |
|
corr = pfaeta4(ic,ang) |
203 |
|
res = risxeta4(abs(ang)) |
204 |
|
res = res*fbad_cog(4,ic) |
205 |
|
|
206 |
|
elseif(PFAtt.eq.'ETA')then |
207 |
|
|
208 |
|
corr = pfaeta(ic,ang) |
209 |
|
c res = riseta(ic,ang) |
210 |
|
res = riseta(iview,ang) |
211 |
|
res = res*fbad_eta(ic,ang) |
212 |
|
|
213 |
|
elseif(PFAtt.eq.'ETAL')then |
214 |
|
|
215 |
|
corr = pfaetal(ic,ang) |
216 |
|
res = riseta(iview,ang) |
217 |
|
res = res*fbad_eta(ic,ang) |
218 |
|
|
219 |
|
elseif(PFAtt.eq.'COG')then |
220 |
|
|
221 |
|
corr = cog(0,ic) |
222 |
|
res = risx_cog(abs(ang)) |
223 |
|
res = res*fbad_cog(0,ic) |
224 |
|
|
225 |
|
else |
226 |
|
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAtt |
227 |
|
endif |
228 |
|
|
229 |
|
|
230 |
|
* ====================================== |
231 |
|
* temporary patch for saturated clusters |
232 |
|
* ====================================== |
233 |
|
if( nsatstrips(ic).gt.0 )then |
234 |
|
corr = cog(4,ic) |
235 |
|
res = pitchX*1e-4/sqrt(12.) |
236 |
|
cc cc=cog(4,ic) |
237 |
|
c$$$ print*,ic,' *** ',cc |
238 |
|
c$$$ print*,ic,' *** ',res |
239 |
|
endif |
240 |
|
|
241 |
|
|
242 |
|
elseif(mod(iview,2).eq.1)then |
243 |
|
c ================================================= |
244 |
|
c Y view |
245 |
|
c ================================================= |
246 |
|
|
247 |
|
res = RESYAV |
248 |
|
|
249 |
|
if(PFAtt.eq.'COG1')then |
250 |
|
|
251 |
|
corr = 0 |
252 |
|
res = 1e-4*pitchY/sqrt(12.)!res |
253 |
|
|
254 |
|
elseif(PFAtt.eq.'COG2')then |
255 |
|
|
256 |
|
corr = cog(2,ic) |
257 |
|
res = risy_cog(abs(ang))!TEMPORANEO |
258 |
|
res = res*fbad_cog(2,ic) |
259 |
|
|
260 |
|
elseif(PFAtt.eq.'COG3')then |
261 |
|
|
262 |
|
corr = cog(3,ic) |
263 |
|
res = risy_cog(abs(ang))!TEMPORANEO |
264 |
|
res = res*fbad_cog(3,ic) |
265 |
|
|
266 |
|
elseif(PFAtt.eq.'COG4')then |
267 |
|
|
268 |
|
corr = cog(4,ic) |
269 |
|
res = risy_cog(abs(ang))!TEMPORANEO |
270 |
|
res = res*fbad_cog(4,ic) |
271 |
|
|
272 |
|
elseif(PFAtt.eq.'ETA2')then |
273 |
|
|
274 |
|
corr = pfaeta2(ic,ang) |
275 |
|
res = risyeta2(abs(ang)) |
276 |
|
res = res*fbad_cog(2,ic) |
277 |
|
|
278 |
|
elseif(PFAtt.eq.'ETA3')then |
279 |
|
|
280 |
|
corr = pfaeta3(ic,ang) |
281 |
|
res = res*fbad_cog(3,ic) |
282 |
|
|
283 |
|
elseif(PFAtt.eq.'ETA4')then |
284 |
|
|
285 |
|
corr = pfaeta4(ic,ang) |
286 |
|
res = res*fbad_cog(4,ic) |
287 |
|
|
288 |
|
elseif(PFAtt.eq.'ETA')then |
289 |
|
|
290 |
|
corr = pfaeta(ic,ang) |
291 |
|
c res = riseta(ic,ang) |
292 |
|
res = riseta(iview,ang) |
293 |
|
res = res*fbad_eta(ic,ang) |
294 |
|
|
295 |
|
elseif(PFAtt.eq.'ETAL')then |
296 |
|
|
297 |
|
corr = pfaetal(ic,ang) |
298 |
|
res = riseta(iview,ang) |
299 |
|
res = res*fbad_eta(ic,ang) |
300 |
|
|
301 |
|
elseif(PFAtt.eq.'COG')then |
302 |
|
|
303 |
|
corr = cog(0,ic) |
304 |
|
res = risy_cog(abs(ang)) |
305 |
|
res = res*fbad_cog(0,ic) |
306 |
|
|
307 |
|
else |
308 |
|
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (y) --> ',PFAtt |
309 |
|
endif |
310 |
|
|
311 |
|
|
312 |
|
* ====================================== |
313 |
|
* temporary patch for saturated clusters |
314 |
|
* ====================================== |
315 |
|
if( nsatstrips(ic).gt.0 )then |
316 |
|
corr = cog(4,ic) |
317 |
|
res = pitchY*1e-4/sqrt(12.) |
318 |
|
cc cc=cog(4,ic) |
319 |
|
c$$$ print*,ic,' *** ',cc |
320 |
|
c$$$ print*,ic,' *** ',res |
321 |
|
endif |
322 |
|
|
323 |
|
endif |
324 |
|
end |
325 |
|
|
326 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
327 |
|
integer function npfastrips(ic,angle) |
328 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
329 |
* thid function returns the number of strips used |
* thid function returns the number of strips used |
330 |
* to evaluate the position of a cluster, according to the p.f.a. |
* to evaluate the position of a cluster, according to the p.f.a. |
333 |
include 'level1.f' |
include 'level1.f' |
334 |
include 'calib.f' |
include 'calib.f' |
335 |
|
|
336 |
character*4 usedPFA,PFA |
character*4 usedPFA |
337 |
|
|
338 |
|
|
339 |
|
|
340 |
usedPFA=PFA |
call idtoc(pfaid,usedPFA) |
341 |
|
|
342 |
npfastrips=0 |
npfastrips=-1 |
343 |
|
|
344 |
if(usedPFA.eq.'COG1')npfastrips=1 |
if(usedPFA.eq.'COG1')npfastrips=1 |
345 |
if(usedPFA.eq.'COG2')npfastrips=2 |
if(usedPFA.eq.'COG2')npfastrips=2 |
349 |
if(usedPFA.eq.'ETA3')npfastrips=3 |
if(usedPFA.eq.'ETA3')npfastrips=3 |
350 |
if(usedPFA.eq.'ETA4')npfastrips=4 |
if(usedPFA.eq.'ETA4')npfastrips=4 |
351 |
* ---------------------------------------------------------------- |
* ---------------------------------------------------------------- |
352 |
if(usedPFA.eq.'ETA')then |
if(usedPFA.eq.'ETA'.or.usedPFA.eq.'ETAL')then |
353 |
c print*,VIEW(ic),angle |
c print*,VIEW(ic),angle |
354 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
355 |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
359 |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
360 |
npfastrips=4 |
npfastrips=4 |
361 |
else |
else |
362 |
npfastrips=4 |
npfastrips=4 !COG4 |
|
c usedPFA='COG' |
|
363 |
endif |
endif |
364 |
else !X-view |
else !X-view |
365 |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
369 |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
370 |
npfastrips=4 |
npfastrips=4 |
371 |
else |
else |
372 |
npfastrips=4 |
npfastrips=4 !COG4 |
|
c usedPFA='COG' |
|
373 |
endif |
endif |
374 |
endif |
endif |
375 |
endif |
endif |
376 |
* ---------------------------------------------------------------- |
* ---------------------------------------------------------------- |
377 |
if(usedPFA.eq.'COG')then |
if(usedPFA.eq.'COG')then |
378 |
|
|
379 |
iv=VIEW(ic) |
npfastrips=0 |
380 |
if(mod(iv,2).eq.1)incut=incuty |
|
381 |
if(mod(iv,2).eq.0)incut=incutx |
c$$$ iv=VIEW(ic) |
382 |
istart = INDSTART(IC) |
c$$$ if(mod(iv,2).eq.1)incut=incuty |
383 |
istop = TOTCLLENGTH |
c$$$ if(mod(iv,2).eq.0)incut=incutx |
384 |
if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
c$$$ istart = INDSTART(IC) |
385 |
mu = 0 |
c$$$ istop = TOTCLLENGTH |
386 |
do i = INDMAX(IC),istart,-1 |
c$$$ if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
387 |
ipos = i-INDMAX(ic) |
c$$$ mu = 0 |
388 |
cut = incut*CLSIGMA(i) |
c$$$ do i = INDMAX(IC),istart,-1 |
389 |
if(CLSIGNAL(i).ge.cut)then |
c$$$ ipos = i-INDMAX(ic) |
390 |
mu = mu + 1 |
c$$$ cut = incut*CLSIGMA(i) |
391 |
print*,i,mu |
c$$$ if(CLSIGNAL(i).ge.cut)then |
392 |
else |
c$$$ mu = mu + 1 |
393 |
goto 10 |
c$$$ print*,i,mu |
394 |
endif |
c$$$ else |
395 |
enddo |
c$$$ goto 10 |
396 |
10 continue |
c$$$ endif |
397 |
do i = INDMAX(IC)+1,istop |
c$$$ enddo |
398 |
ipos = i-INDMAX(ic) |
c$$$ 10 continue |
399 |
cut = incut*CLSIGMA(i) |
c$$$ do i = INDMAX(IC)+1,istop |
400 |
if(CLSIGNAL(i).ge.cut)then |
c$$$ ipos = i-INDMAX(ic) |
401 |
mu = mu + 1 |
c$$$ cut = incut*CLSIGMA(i) |
402 |
print*,i,mu |
c$$$ if(CLSIGNAL(i).ge.cut)then |
403 |
else |
c$$$ mu = mu + 1 |
404 |
goto 20 |
c$$$ print*,i,mu |
405 |
endif |
c$$$ else |
406 |
enddo |
c$$$ goto 20 |
407 |
20 continue |
c$$$ endif |
408 |
npfastrips=mu |
c$$$ enddo |
409 |
|
c$$$ 20 continue |
410 |
|
c$$$ npfastrips=mu |
411 |
|
|
412 |
endif |
endif |
413 |
* ---------------------------------------------------------------- |
* ---------------------------------------------------------------- |
414 |
|
|
415 |
c print*,pfastrips |
c print*,pfaid,usedPFA,angle,npfastrips |
416 |
|
|
417 |
return |
return |
418 |
end |
end |
435 |
|
|
436 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
437 |
|
|
438 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
439 |
pfaeta = pfaeta2(ic,angle) |
pfaeta = pfaeta2(ic,angle) |
440 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
cc print*,pfaeta2(ic,angle) |
441 |
|
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
442 |
pfaeta = pfaeta3(ic,angle) |
pfaeta = pfaeta3(ic,angle) |
443 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
444 |
pfaeta = pfaeta4(ic,angle) |
pfaeta = pfaeta4(ic,angle) |
445 |
else |
else |
446 |
pfaeta = cog(4,ic) |
pfaeta = cog(4,ic) |
448 |
|
|
449 |
else !X-view |
else !X-view |
450 |
|
|
451 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
452 |
pfaeta = pfaeta2(ic,angle) |
pfaeta = pfaeta2(ic,angle) |
453 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
454 |
pfaeta = pfaeta3(ic,angle) |
pfaeta = pfaeta3(ic,angle) |
455 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
456 |
pfaeta = pfaeta4(ic,angle) |
pfaeta = pfaeta4(ic,angle) |
457 |
else |
else |
458 |
pfaeta = cog(4,ic) |
pfaeta = cog(4,ic) |
477 |
include 'level1.f' |
include 'level1.f' |
478 |
include 'calib.f' |
include 'calib.f' |
479 |
|
|
480 |
pfaeta = 0 |
pfaetal = 0 |
481 |
|
|
482 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
483 |
|
|
484 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
485 |
pfaeta = pfaeta2(ic,angle)+pfacorr(ic,angle) |
pfaetal = pfaeta2(ic,angle)+pfacorr(ic,angle) |
486 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
cc print*,VIEW(ic),angle,pfaeta2(ic,angle),pfacorr(ic,angle) |
487 |
pfaeta = pfaeta3(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
488 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
pfaetal = pfaeta3(ic,angle)+pfacorr(ic,angle) |
489 |
pfaeta = pfaeta4(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
490 |
|
pfaetal = pfaeta4(ic,angle)+pfacorr(ic,angle) |
491 |
else |
else |
492 |
pfaeta = cog(4,ic) |
pfaetal = cog(4,ic) |
493 |
endif |
endif |
494 |
|
|
495 |
else !X-view |
else !X-view |
496 |
|
|
497 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
498 |
pfaeta = pfaeta2(ic,angle)+pfacorr(ic,angle) |
pfaetal = pfaeta2(ic,angle)+pfacorr(ic,angle) |
499 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
cc print*,VIEW(ic),angle,pfaeta2(ic,angle),pfacorr(ic,angle) |
500 |
pfaeta = pfaeta3(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
501 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
pfaetal = pfaeta3(ic,angle)+pfacorr(ic,angle) |
502 |
pfaeta = pfaeta4(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
503 |
|
pfaetal = pfaeta4(ic,angle)+pfacorr(ic,angle) |
504 |
else |
else |
505 |
pfaeta = cog(4,ic) |
pfaetal = cog(4,ic) |
506 |
endif |
endif |
507 |
|
|
508 |
endif |
endif |
570 |
* resolution. |
* resolution. |
571 |
* It calls the function FBAD_COG(NCOG,IC), |
* It calls the function FBAD_COG(NCOG,IC), |
572 |
* accordingto the angle |
* accordingto the angle |
573 |
|
* |
574 |
|
* >>> cosi` non e` corretto!! |
575 |
|
* >>> l'errore sulla coordinata eta si ottiene moltiplicando |
576 |
|
* >>> l'errore sulla coordinata cog per la derivata della |
577 |
|
* >>> distribuzione eta... pur sapendolo l'ho sempre ignorato... |
578 |
|
* >>> deve essere modificato!!!! |
579 |
|
* |
580 |
*------------------------------------------------------- |
*------------------------------------------------------- |
581 |
|
|
582 |
include 'commontracker.f' |
include 'commontracker.f' |
614 |
end |
end |
615 |
|
|
616 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
617 |
real function pfaeta2(ic,angle) !(1) |
real function pfaeta2(ic,angle) |
618 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
619 |
* this function returns |
* this function returns |
620 |
* |
* |
633 |
real cog2,angle |
real cog2,angle |
634 |
integer iview,lad |
integer iview,lad |
635 |
|
|
636 |
iview = VIEW(ic) |
iview = VIEW(ic) |
637 |
lad = nld(MAXS(ic),VIEW(ic)) |
lad = nld(MAXS(ic),VIEW(ic)) |
638 |
cog2 = cog(2,ic) |
cog2 = cog(2,ic) |
639 |
pfaeta2=cog2 |
pfaeta2 = cog2 |
640 |
|
|
641 |
|
* ---------------- |
642 |
* find angular bin |
* find angular bin |
643 |
|
* ---------------- |
644 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
645 |
do iang=1,nangbin |
do iang=1,nangbin |
646 |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
648 |
goto 98 |
goto 98 |
649 |
endif |
endif |
650 |
enddo |
enddo |
651 |
if(DEBUG) |
if(DEBUG.EQ.1) |
652 |
$ print*,'pfaeta2 *** warning *** angle out of range: ',angle |
$ print*,'pfaeta2 *** warning *** angle out of range: ',angle |
653 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
654 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
655 |
98 continue !jump here if ok |
98 continue !jump here if ok |
656 |
|
|
657 |
|
* ------------- |
658 |
|
* within +/-0.5 |
659 |
|
* ------------- |
660 |
|
|
661 |
c$$$* find extremes of interpolation |
iaddmax=10 |
|
c$$$ iflag=0 |
|
|
c$$$* -------------------------------- |
|
|
c$$$ if(cog2.lt.eta2(1,iang).or.cog2.gt.eta2(netaval,iang))then |
|
|
c$$$c print*,'pfaeta2 *** warning *** argument out of range: ',cog2 |
|
|
c$$$* goto 100 |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* non salto piu`, ma scalo di 1 o -1 |
|
|
c$$$* nel caso si tratti di un cluster |
|
|
c$$$* in cui la strip con il segnale massimo non coincide |
|
|
c$$$* con la strip con il rapposto s/n massimo!!! |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$ if(cog2.lt.eta2(1,iang))then !temp |
|
|
c$$$ cog2=cog2+1. !temp |
|
|
c$$$ iflag=1 !temp |
|
|
c$$$ else !temp |
|
|
c$$$ cog2=cog2-1. !temp |
|
|
c$$$ iflag=-1 !temp |
|
|
c$$$ endif !temp |
|
|
c$$$c print*,'shifted >>> ',cog2 |
|
|
c$$$ endif |
|
|
|
|
662 |
iadd=0 |
iadd=0 |
663 |
10 continue |
10 continue |
664 |
if(cog2.lt.eta2(1,iang))then |
if(cog2.lt.eta2(1,iang))then |
665 |
cog2 = cog2 + 1 |
cog2 = cog2 + 1 |
666 |
iadd = iadd + 1 |
iadd = iadd + 1 |
667 |
|
if(iadd>iaddmax)goto 111 |
668 |
goto 10 |
goto 10 |
669 |
endif |
endif |
670 |
20 continue |
20 continue |
671 |
if(cog2.gt.eta2(netaval,iang))then |
if(cog2.gt.eta2(netaval,iang))then |
672 |
cog2 = cog2 - 1 |
cog2 = cog2 - 1 |
673 |
iadd = iadd - 1 |
iadd = iadd - 1 |
674 |
|
if(iadd<-1*iaddmax)goto 111 |
675 |
goto 20 |
goto 20 |
676 |
endif |
endif |
677 |
|
goto 1111 |
678 |
|
111 continue |
679 |
|
if(DEBUG.eq.1)print*,'pfaeta2 *** warning *** anomalous cluster' |
680 |
|
if(DEBUG.eq.1)print*,'--> COG(2) = ',cog2-iadd,' (set to zero)' |
681 |
|
cog2=0 |
682 |
|
1111 continue |
683 |
|
|
684 |
* -------------------------------- |
* -------------------------------- |
685 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
714 |
c$$$ cog2=cog2+1. !temp |
c$$$ cog2=cog2+1. !temp |
715 |
c$$$ endif |
c$$$ endif |
716 |
|
|
717 |
if(DEBUG)print*,'ETA2 (ic ',ic,' ang',angle,')' |
if(DEBUG.EQ.1)print*,'ETA2 (ic ',ic,' ang',angle,')' |
718 |
$ ,cog2-iadd,' -->',pfaeta2 |
$ ,cog2-iadd,' -->',pfaeta2 |
719 |
|
|
720 |
|
|
744 |
|
|
745 |
iview = VIEW(ic) |
iview = VIEW(ic) |
746 |
lad = nld(MAXS(ic),VIEW(ic)) |
lad = nld(MAXS(ic),VIEW(ic)) |
747 |
cog3 = cog(3,ic) |
cog3 = cog(3,ic) |
748 |
|
cc = cog3 |
749 |
|
cog3 = cc |
750 |
pfaeta3=cog3 |
pfaeta3=cog3 |
751 |
|
|
752 |
|
* ---------------- |
753 |
* find angular bin |
* find angular bin |
754 |
|
* ---------------- |
755 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
756 |
do iang=1,nangbin |
do iang=1,nangbin |
757 |
c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle |
c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle |
760 |
goto 98 |
goto 98 |
761 |
endif |
endif |
762 |
enddo |
enddo |
763 |
if(DEBUG) |
if(DEBUG.EQ.1) |
764 |
$ print*,'pfaeta3 *** warning *** angle out of range: ',angle |
$ print*,'pfaeta3 *** warning *** angle out of range: ',angle |
765 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
766 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
767 |
98 continue !jump here if ok |
98 continue !jump here if ok |
768 |
|
|
769 |
|
* ------------- |
770 |
|
* within +/-0.5 |
771 |
|
* ------------- |
772 |
|
|
773 |
c$$$* find extremes of interpolation |
iaddmax=10 |
|
c$$$ iflag=0 |
|
|
c$$$* -------------------------------- |
|
|
c$$$ if(cog3.lt.eta3(1,iang).or.cog3.gt.eta3(netaval,iang))then |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* non salto piu`, ma scalo di 1 o -1 |
|
|
c$$$* nel caso si tratti di un cluster |
|
|
c$$$* in cui la strip con il segnale massimo non coincide |
|
|
c$$$* con la strip con il rapposto s/n massimo!!! |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$ if(cog2.lt.eta2(1,iang))then !temp |
|
|
c$$$ cog2=cog2+1. !temp |
|
|
c$$$ iflag=1 !temp |
|
|
c$$$ else !temp |
|
|
c$$$ cog2=cog2-1. !temp |
|
|
c$$$ iflag=-1 !temp |
|
|
c$$$ endif !temp |
|
|
c$$$c print*,'shifted >>> ',cog2 |
|
|
c$$$ endif |
|
|
|
|
|
|
|
774 |
iadd=0 |
iadd=0 |
775 |
10 continue |
10 continue |
776 |
if(cog3.lt.eta3(1,iang))then |
if(cog3.lt.eta3(1,iang))then |
777 |
cog3 = cog3 + 1 |
cog3 = cog3 + 1. |
778 |
iadd = iadd + 1 |
iadd = iadd + 1 |
779 |
|
if(iadd>iaddmax) goto 111 |
780 |
goto 10 |
goto 10 |
781 |
endif |
endif |
782 |
20 continue |
20 continue |
783 |
if(cog3.gt.eta3(netaval,iang))then |
if(cog3.gt.eta3(netaval,iang))then |
784 |
cog3 = cog3 - 1 |
cog3 = cog3 - 1. |
785 |
iadd = iadd - 1 |
iadd = iadd - 1 |
786 |
|
if(iadd<-1*iaddmax) goto 111 |
787 |
goto 20 |
goto 20 |
788 |
endif |
endif |
789 |
|
goto 1111 |
790 |
|
111 continue |
791 |
|
if(DEBUG.eq.1)print*,'pfaeta3 *** warning *** anomalous cluster' |
792 |
|
if(DEBUG.eq.1)print*,'--> COG(3) = ',cog3-iadd,' (set to zero)' |
793 |
|
cog3=0 |
794 |
|
1111 continue |
795 |
|
|
796 |
* -------------------------------- |
* -------------------------------- |
797 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
817 |
pfaeta3 = AA*cog3+BB |
pfaeta3 = AA*cog3+BB |
818 |
pfaeta3 = pfaeta3 - iadd |
pfaeta3 = pfaeta3 - iadd |
819 |
|
|
|
c$$$ if(iflag.eq.1)then |
|
|
c$$$ pfaeta2=pfaeta2-1. !temp |
|
|
c$$$ cog2=cog2-1. !temp |
|
|
c$$$ endif |
|
|
c$$$ if(iflag.eq.-1)then |
|
|
c$$$ pfaeta2=pfaeta2+1. !temp |
|
|
c$$$ cog2=cog2+1. !temp |
|
|
c$$$ endif |
|
820 |
|
|
821 |
if(DEBUG)print*,'ETA3 (ic ',ic,' ang',angle,')' |
if(DEBUG.EQ.1)print*,'ETA3 (ic ',ic,' ang',angle,')' |
822 |
$ ,cog3-iadd,' -->',pfaeta3 |
$ ,cog3-iadd,' -->',pfaeta3 |
823 |
|
|
824 |
100 return |
100 return |
850 |
cog4=cog(4,ic) |
cog4=cog(4,ic) |
851 |
pfaeta4=cog4 |
pfaeta4=cog4 |
852 |
|
|
853 |
|
* ---------------- |
854 |
* find angular bin |
* find angular bin |
855 |
|
* ---------------- |
856 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
857 |
do iang=1,nangbin |
do iang=1,nangbin |
858 |
c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle |
c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle |
861 |
goto 98 |
goto 98 |
862 |
endif |
endif |
863 |
enddo |
enddo |
864 |
if(DEBUG) |
if(DEBUG.EQ.1) |
865 |
$ print*,'pfaeta4 *** warning *** angle out of range: ',angle |
$ print*,'pfaeta4 *** warning *** angle out of range: ',angle |
866 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
867 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
868 |
98 continue !jump here if ok |
98 continue !jump here if ok |
869 |
|
|
870 |
|
* ------------- |
871 |
|
* within +/-0.5 |
872 |
|
* ------------- |
873 |
|
|
874 |
c$$$* find extremes of interpolation |
iaddmax=10 |
|
c$$$ iflag=0 |
|
|
c$$$* -------------------------------- |
|
|
c$$$ if(cog3.lt.eta3(1,iang).or.cog3.gt.eta3(netaval,iang))then |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* non salto piu`, ma scalo di 1 o -1 |
|
|
c$$$* nel caso si tratti di un cluster |
|
|
c$$$* in cui la strip con il segnale massimo non coincide |
|
|
c$$$* con la strip con il rapposto s/n massimo!!! |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$ if(cog2.lt.eta2(1,iang))then !temp |
|
|
c$$$ cog2=cog2+1. !temp |
|
|
c$$$ iflag=1 !temp |
|
|
c$$$ else !temp |
|
|
c$$$ cog2=cog2-1. !temp |
|
|
c$$$ iflag=-1 !temp |
|
|
c$$$ endif !temp |
|
|
c$$$c print*,'shifted >>> ',cog2 |
|
|
c$$$ endif |
|
|
|
|
|
|
|
875 |
iadd=0 |
iadd=0 |
876 |
10 continue |
10 continue |
877 |
if(cog4.lt.eta4(1,iang))then |
if(cog4.lt.eta4(1,iang))then |
878 |
cog4 = cog4 + 1 |
cog4 = cog4 + 1 |
879 |
iadd = iadd + 1 |
iadd = iadd + 1 |
880 |
|
if(iadd>iaddmax)goto 111 |
881 |
goto 10 |
goto 10 |
882 |
endif |
endif |
883 |
20 continue |
20 continue |
884 |
if(cog4.gt.eta4(netaval,iang))then |
if(cog4.gt.eta4(netaval,iang))then |
885 |
cog4 = cog4 - 1 |
cog4 = cog4 - 1 |
886 |
iadd = iadd - 1 |
iadd = iadd - 1 |
887 |
|
if(iadd<-1*iaddmax)goto 111 |
888 |
goto 20 |
goto 20 |
889 |
endif |
endif |
890 |
|
goto 1111 |
891 |
|
111 continue |
892 |
|
if(DEBUG.eq.1)print*,'pfaeta4 *** warning *** anomalous cluster' |
893 |
|
if(DEBUG.eq.1)print*,'--> COG(4) = ',cog4-iadd,' (set to zero)' |
894 |
|
cog4=0 |
895 |
|
1111 continue |
896 |
|
|
897 |
* -------------------------------- |
* -------------------------------- |
898 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
927 |
c$$$ cog2=cog2+1. !temp |
c$$$ cog2=cog2+1. !temp |
928 |
c$$$ endif |
c$$$ endif |
929 |
|
|
930 |
if(DEBUG)print*,'ETA4 (ic ',ic,' ang',angle,')' |
if(DEBUG.EQ.1)print*,'ETA4 (ic ',ic,' ang',angle,')' |
931 |
$ ,cog4-iadd,' -->',pfaeta4 |
$ ,cog4-iadd,' -->',pfaeta4 |
932 |
|
|
933 |
100 return |
100 return |
936 |
|
|
937 |
|
|
938 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
c$$$ real function cog0(ncog,ic) |
|
|
c$$$*------------------------------------------------- |
|
|
c$$$* this function returns |
|
|
c$$$* |
|
|
c$$$* - the Center-Of-Gravity of the cluster IC |
|
|
c$$$* evaluated using NCOG strips, |
|
|
c$$$* calculated relative to MAXS(IC) |
|
|
c$$$* |
|
|
c$$$* - zero in case that not enough strips |
|
|
c$$$* have a positive signal |
|
|
c$$$* |
|
|
c$$$* NOTE: |
|
|
c$$$* This is the old definition, used by Straulino. |
|
|
c$$$* The new routine, according to Landi, |
|
|
c$$$* is COG(NCOG,IC) |
|
|
c$$$*------------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'level1.f' |
|
|
c$$$ |
|
|
c$$$* --> signal of the central strip |
|
|
c$$$ sc = CLSIGNAL(INDMAX(ic)) !center |
|
|
c$$$ |
|
|
c$$$* signal of adjacent strips |
|
|
c$$$* --> left |
|
|
c$$$ sl1 = 0 !left 1 |
|
|
c$$$ if( |
|
|
c$$$ $ (INDMAX(ic)-1).ge.INDSTART(ic) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1)) |
|
|
c$$$ |
|
|
c$$$ sl2 = 0 !left 2 |
|
|
c$$$ if( |
|
|
c$$$ $ (INDMAX(ic)-2).ge.INDSTART(ic) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2)) |
|
|
c$$$ |
|
|
c$$$* --> right |
|
|
c$$$ sr1 = 0 !right 1 |
|
|
c$$$ if( |
|
|
c$$$ $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
|
|
c$$$ $ .or. |
|
|
c$$$ $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1)) |
|
|
c$$$ |
|
|
c$$$ sr2 = 0 !right 2 |
|
|
c$$$ if( |
|
|
c$$$ $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
|
|
c$$$ $ .or. |
|
|
c$$$ $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2)) |
|
|
c$$$ |
|
|
c$$$************************************************************ |
|
|
c$$$* COG computation |
|
|
c$$$************************************************************ |
|
|
c$$$ |
|
|
c$$$c print*,sl2,sl1,sc,sr1,sr2 |
|
|
c$$$ |
|
|
c$$$ COG = 0. |
|
|
c$$$ |
|
|
c$$$ if(sl1.gt.sr1.and.sl1.gt.0.)then |
|
|
c$$$ |
|
|
c$$$ if(ncog.eq.2.and.sl1.ne.0)then |
|
|
c$$$ COG = -sl1/(sl1+sc) |
|
|
c$$$ elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then |
|
|
c$$$ COG = (sr1-sl1)/(sl1+sc+sr1) |
|
|
c$$$ elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then |
|
|
c$$$ COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) |
|
|
c$$$ else |
|
|
c$$$ COG = 0. |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ elseif(sl1.le.sr1.and.sr1.gt.0.)then |
|
|
c$$$ |
|
|
c$$$ if(ncog.eq.2.and.sr1.ne.0)then |
|
|
c$$$ COG = sr1/(sc+sr1) |
|
|
c$$$ elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then |
|
|
c$$$ COG = (sr1-sl1)/(sl1+sc+sr1) |
|
|
c$$$ elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then |
|
|
c$$$ COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1) |
|
|
c$$$ else |
|
|
c$$$ COG = 0. |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ COG0 = COG |
|
|
c$$$ |
|
|
c$$$c print *,ncog,ic,cog,'/////////////' |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
|
|
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
939 |
real function cog(ncog,ic) |
real function cog(ncog,ic) |
940 |
*------------------------------------------------- |
*------------------------------------------------- |
941 |
* this function returns |
* this function returns |
995 |
|
|
996 |
COG = 0. |
COG = 0. |
997 |
|
|
998 |
c print*,'## ',sl2,sl1,sc,sr1,sr2 |
c print *,'## ',sl2,sl1,sc,sr1,sr2 |
999 |
|
|
1000 |
c ============================================================== |
c ============================================================== |
1001 |
if(ncog.eq.1)then |
if(ncog.eq.1)then |
1002 |
COG = 0. |
COG = 0. |
1003 |
if(sr1.gt.sc)cog=1. !NEW |
if(sr1.gt.sc)cog=1. |
1004 |
if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. !NEW |
if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. |
1005 |
c ============================================================== |
c ============================================================== |
1006 |
elseif(ncog.eq.2)then |
elseif(ncog.eq.2)then |
1007 |
|
COG = 0. |
1008 |
if(sl1.gt.sr1)then |
if(sl1.gt.sr1)then |
1009 |
if((sl1+sc).ne.0)COG = -sl1/(sl1+sc) |
if((sl1+sc).ne.0)COG = -sl1/(sl1+sc) |
1010 |
elseif(sl1.lt.sr1)then |
elseif(sl1.lt.sr1)then |
1011 |
if((sc+sr1).ne.0)COG = sr1/(sc+sr1) |
if((sc+sr1).ne.0)COG = sr1/(sc+sr1) |
1012 |
elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then !NEW |
elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then |
1013 |
if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1) |
if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1) |
1014 |
$ .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) !NEW |
$ .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) |
1015 |
if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1) |
if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1) |
1016 |
$ .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) !NEW |
$ .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) |
1017 |
endif |
endif |
1018 |
c if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic) |
c if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic) |
1019 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
1020 |
c ============================================================== |
c ============================================================== |
1021 |
elseif(ncog.eq.3)then |
elseif(ncog.eq.3)then |
1022 |
if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1) |
COG = 0 |
1023 |
c if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic) |
sss = sc |
1024 |
|
if( sl1.ne.-9999. )COG = COG-sl1 |
1025 |
|
if( sl1.ne.-9999. )sss = sss+sl1 |
1026 |
|
if( sr1.ne.-9999. )COG = COG+sr1 |
1027 |
|
if( sr1.ne.-9999. )sss = sss+sr1 |
1028 |
|
if(sss.ne.0)COG=COG/sss |
1029 |
|
|
1030 |
|
c if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1) |
1031 |
|
c if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic) |
1032 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
1033 |
c ============================================================== |
c ============================================================== |
1034 |
elseif(ncog.eq.4)then |
elseif(ncog.eq.4)then |
1035 |
|
|
1036 |
|
COG = 0 |
1037 |
|
sss = sc |
1038 |
|
if( sl1.ne.-9999. )COG = COG-sl1 |
1039 |
|
if( sl1.ne.-9999. )sss = sss+sl1 |
1040 |
|
if( sr1.ne.-9999. )COG = COG+sr1 |
1041 |
|
if( sr1.ne.-9999. )sss = sss+sr1 |
1042 |
if(sl2.gt.sr2)then |
if(sl2.gt.sr2)then |
1043 |
if((sl2+sl1+sc+sr1).ne.0) |
if((sl2+sss).ne.0) |
1044 |
$ COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) |
$ COG = (COG-2*sl2)/(sl2+sss) |
1045 |
elseif(sl2.lt.sr2)then |
elseif(sl2.lt.sr2)then |
1046 |
if((sr2+sl1+sc+sr1).ne.0) |
if((sr2+sss).ne.0) |
1047 |
$ COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1) |
$ COG = (2*sr2+COG)/(sr2+sss) |
1048 |
elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then !NEW |
elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then |
1049 |
if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2) |
if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2) |
1050 |
$ .and.(sl2+sl1+sc+sr1).ne.0 ) |
$ .and.(sl2+sss).ne.0 ) |
1051 |
$ cog = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) !NEW |
$ cog = (cog-2*sl2)/(sl2+sss) |
1052 |
if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2) |
if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2) |
1053 |
$ .and.(sr2+sl1+sc+sr1).ne.0 ) |
$ .and.(sr2+sss).ne.0 ) |
1054 |
$ cog = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1) !NEW |
$ cog = (2*sr2+cog)/(sr2+sss) |
1055 |
endif |
endif |
1056 |
|
c ============================================================== |
1057 |
|
elseif(ncog.eq.5)then |
1058 |
|
COG = 0 |
1059 |
|
sss = sc |
1060 |
|
if( sl1.ne.-9999. )COG = COG-sl1 |
1061 |
|
if( sl1.ne.-9999. )sss = sss+sl1 |
1062 |
|
if( sr1.ne.-9999. )COG = COG+sr1 |
1063 |
|
if( sr1.ne.-9999. )sss = sss+sr1 |
1064 |
|
if( sl2.ne.-9999. )COG = COG-2*sl2 |
1065 |
|
if( sl2.ne.-9999. )sss = sss+sl2 |
1066 |
|
if( sr2.ne.-9999. )COG = COG+2*sr2 |
1067 |
|
if( sr2.ne.-9999. )sss = sss+sr2 |
1068 |
|
if(sss.ne.0)COG=COG/sss |
1069 |
else |
else |
1070 |
print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1071 |
$ ,' not implemented' |
$ ,' not implemented' |
1136 |
|
|
1137 |
c print *,'## cog ',ncog,ic,cog,'/////////////' |
c print *,'## cog ',ncog,ic,cog,'/////////////' |
1138 |
|
|
1139 |
|
if(COG.lt.-0.75.or.COG.gt.+0.75)then |
1140 |
|
if(DEBUG.eq.1) |
1141 |
|
$ print*,'cog *** warning *** anomalous cluster ??? --> ' |
1142 |
|
if(DEBUG.eq.1) |
1143 |
|
$ print*,sl2,sl1,sc,sr1,sr2,' --> COG(',ncog,') = ',COG |
1144 |
|
endif |
1145 |
|
|
1146 |
|
|
1147 |
return |
return |
1148 |
end |
end |
1149 |
|
|
1289 |
SGN = 0. |
SGN = 0. |
1290 |
SNU = 0. |
SNU = 0. |
1291 |
SDE = 0. |
SDE = 0. |
|
c$$$ do i=INDMAX(IC),istart,-1 |
|
|
c$$$ ipos = i-INDMAX(ic) |
|
|
c$$$ cut = incut*CLSIGMA(i) |
|
|
c$$$ if(CLSIGNAL(i).gt.cut)then |
|
|
c$$$ COG = COG + ipos*CLSIGNAL(i) |
|
|
c$$$ SGN = SGN + CLSIGNAL(i) |
|
|
c$$$ else |
|
|
c$$$ goto 10 |
|
|
c$$$ endif |
|
|
c$$$ enddo |
|
|
c$$$ 10 continue |
|
|
c$$$ do i=INDMAX(IC)+1,istop |
|
|
c$$$ ipos = i-INDMAX(ic) |
|
|
c$$$ cut = incut*CLSIGMA(i) |
|
|
c$$$ if(CLSIGNAL(i).gt.cut)then |
|
|
c$$$ COG = COG + ipos*CLSIGNAL(i) |
|
|
c$$$ SGN = SGN + CLSIGNAL(i) |
|
|
c$$$ else |
|
|
c$$$ goto 20 |
|
|
c$$$ endif |
|
|
c$$$ enddo |
|
|
c$$$ 20 continue |
|
|
c$$$ if(SGN.le.0)then |
|
|
c$$$ print*,'fbad_cog(0,ic) --> ic, dedx ',ic,SGN |
|
|
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
|
|
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
|
|
c$$$ print*,'fbad_cog(0,ic) --> NOT EVALUATED ' |
|
|
c$$$ else |
|
|
c$$$ COG=COG/SGN |
|
|
c$$$ endif |
|
1292 |
|
|
1293 |
do i=INDMAX(IC),istart,-1 |
do i=INDMAX(IC),istart,-1 |
1294 |
ipos = i-INDMAX(ic) |
ipos = i-INDMAX(ic) |
1337 |
|
|
1338 |
|
|
1339 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1340 |
real function fbad_cog0(ncog,ic) |
|
1341 |
|
real function riscogtheor(ncog,ic) |
1342 |
*------------------------------------------------------- |
*------------------------------------------------------- |
|
* this function returns a factor that takes into |
|
|
* account deterioration of the spatial resolution |
|
|
* in the case BAD strips are included in the cluster. |
|
|
* This factor should multiply the nominal spatial |
|
|
* resolution. |
|
1343 |
* |
* |
1344 |
* NB!!! |
* this function returns the expected resolution |
1345 |
* (this is the old version. It consider only the two |
* obtained by propagating the strip noise |
1346 |
* strips with the greatest signal. The new one is |
* to the center-of-gravity coordinate |
1347 |
* fbad_cog(ncog,ic) ) |
* |
1348 |
* |
* ncog = n.strip used in the coordinate evaluation |
1349 |
|
* (ncog=0 => all strips above threshold) |
1350 |
|
* |
1351 |
*------------------------------------------------------- |
*------------------------------------------------------- |
1352 |
|
|
1353 |
include 'commontracker.f' |
include 'commontracker.f' |
1354 |
include 'level1.f' |
include 'level1.f' |
1355 |
include 'calib.f' |
include 'calib.f' |
1356 |
|
|
1357 |
|
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
1358 |
|
incut = incuty |
1359 |
|
pitch = pitchY / 1.e4 |
1360 |
|
else !X-view |
1361 |
|
incut = incutx |
1362 |
|
pitch = pitchX / 1.e4 |
1363 |
|
endif |
1364 |
|
|
1365 |
|
func = 100000. |
1366 |
|
stot = 0. |
1367 |
|
|
1368 |
|
if (ncog.gt.0) then |
1369 |
|
|
1370 |
* --> signal of the central strip |
* --> signal of the central strip |
1371 |
sc = CLSIGNAL(INDMAX(ic)) !center |
sc = CLSIGNAL(INDMAX(ic)) !center |
1372 |
|
fsc = clsigma(INDMAX(ic)) |
1373 |
|
* --> signal of adjacent strips |
1374 |
|
sl1 = 0 !left 1 |
1375 |
|
fsl1 = 1 !left 1 |
1376 |
|
if( |
1377 |
|
$ (INDMAX(ic)-1).ge.INDSTART(ic) |
1378 |
|
$ )then |
1379 |
|
sl1 = CLSIGNAL(INDMAX(ic)-1) |
1380 |
|
fsl1 = clsigma(INDMAX(ic)-1) |
1381 |
|
endif |
1382 |
|
|
1383 |
* signal of adjacent strips |
sl2 = 0 !left 2 |
1384 |
* --> left |
fsl2 = 1 !left 2 |
1385 |
sl1 = 0 !left 1 |
if( |
1386 |
if( |
$ (INDMAX(ic)-2).ge.INDSTART(ic) |
1387 |
$ (INDMAX(ic)-1).ge.INDSTART(ic) |
$ )then |
1388 |
$ ) |
sl2 = CLSIGNAL(INDMAX(ic)-2) |
1389 |
$ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1)) |
fsl2 = clsigma(INDMAX(ic)-2) |
1390 |
|
endif |
1391 |
sl2 = 0 !left 2 |
sr1 = 0 !right 1 |
1392 |
if( |
fsr1 = 1 !right 1 |
1393 |
$ (INDMAX(ic)-2).ge.INDSTART(ic) |
if( |
1394 |
$ ) |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
1395 |
$ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2)) |
$ .or. |
1396 |
|
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
1397 |
* --> right |
$ )then |
1398 |
sr1 = 0 !right 1 |
sr1 = CLSIGNAL(INDMAX(ic)+1) |
1399 |
if( |
fsr1 = clsigma(INDMAX(ic)+1) |
1400 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
endif |
1401 |
$ .or. |
sr2 = 0 !right 2 |
1402 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
fsr2 = 1 !right 2 |
1403 |
$ ) |
if( |
1404 |
$ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1)) |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
1405 |
|
$ .or. |
1406 |
sr2 = 0 !right 2 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
1407 |
if( |
$ )then |
1408 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
sr2 = CLSIGNAL(INDMAX(ic)+2) |
1409 |
$ .or. |
fsr2 = clsigma(INDMAX(ic)+2) |
1410 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
endif |
|
$ ) |
|
|
$ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2)) |
|
1411 |
|
|
1412 |
|
|
|
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
|
|
f = 4. |
|
|
si = 8.4 |
|
|
else !X-view |
|
|
f = 6. |
|
|
si = 3.9 |
|
|
endif |
|
1413 |
|
|
1414 |
fbad_cog = 1. |
************************************************************ |
1415 |
f0 = 1 |
* COG2-3-4 computation |
1416 |
f1 = 1 |
************************************************************ |
1417 |
f2 = 1 |
|
1418 |
f3 = 1 |
c print*,sl2,sl1,sc,sr1,sr2 |
1419 |
if(sl1.gt.sr1.and.sl1.gt.0.)then |
|
1420 |
|
vCOG = cog(ncog,ic)!0. |
1421 |
|
|
1422 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
if(ncog.eq.1)then |
1423 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f1=f |
func = 1./12. |
1424 |
c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f3=f |
stot = 1. |
1425 |
|
elseif(ncog.eq.2)then |
1426 |
if(ncog.eq.2.and.sl1.ne.0)then |
if(sl1.gt.sr1)then |
1427 |
fbad_cog = (f1**2*sc**2/sl1**2+f0**2)/(sc**2/sl1**2+1.) |
func = (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2) |
1428 |
elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then |
stot = sl1+sc |
1429 |
fbad_cog = 1. |
elseif(sl1.le.sr1)then |
1430 |
elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then |
func = (fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1431 |
fbad_cog = 1. |
stot = sc+sr1 |
1432 |
|
endif |
1433 |
|
elseif(ncog.eq.3)then |
1434 |
|
func = |
1435 |
|
$ (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1436 |
|
stot = sl1+sc+sr1 |
1437 |
|
elseif(ncog.eq.4)then |
1438 |
|
if(sl2.gt.sr2)then |
1439 |
|
func = |
1440 |
|
$ (fsl2*(-2-vCOG)**2+fsl1*(-1-vCOG)**2 |
1441 |
|
$ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1442 |
|
stot = sl2+sl1+sc+sr1 |
1443 |
|
elseif(sl2.le.sr2)then |
1444 |
|
func = |
1445 |
|
$ (fsl1*(-1-vCOG)**2 |
1446 |
|
$ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2+fsr2*(2-vCOG)**2) |
1447 |
|
stot = sl2+sl1+sc+sr1 |
1448 |
|
endif |
1449 |
else |
else |
1450 |
fbad_cog = 1. |
print*,'function riscogtheor(NCOG,IC) ==> NCOG=',NCOG |
1451 |
|
$ ,' not implemented' |
1452 |
endif |
endif |
1453 |
|
|
1454 |
elseif(sl1.le.sr1.and.sr1.gt.0.)then |
elseif(ncog.eq.0)then |
1455 |
|
* ========================= |
1456 |
|
* COG computation |
1457 |
|
* ========================= |
1458 |
|
|
1459 |
|
vCOG = cog(0,ic) |
1460 |
|
|
1461 |
|
iv = VIEW(ic) |
1462 |
|
istart = INDSTART(IC) |
1463 |
|
istop = TOTCLLENGTH |
1464 |
|
if(ic.lt.NCLSTR1)istop = INDSTART(IC+1)-1 |
1465 |
|
ccc SGN = 0. |
1466 |
|
SNU = 0. |
1467 |
|
ccc SDE = 0. |
1468 |
|
|
1469 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
do i=INDMAX(IC),istart,-1 |
1470 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f1=f |
ipos = i-INDMAX(ic) |
1471 |
c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f3=f |
cut = incut*CLSIGMA(i) |
1472 |
|
if(CLSIGNAL(i).gt.cut)then |
1473 |
if(ncog.eq.2.and.sr1.ne.0)then |
fs = clsigma(i) |
1474 |
fbad_cog = (f1**2*sc**2/sr1**2+f0**2)/(sc**2/sr1**2+1.) |
SNU = SNU + fs*(ipos-vCOG)**2 |
1475 |
elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then |
stot = stot + CLSIGNAL(i) |
1476 |
fbad_cog = 1. |
else |
1477 |
elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then |
goto 10 |
1478 |
fbad_cog = 1. |
endif |
1479 |
|
enddo |
1480 |
|
10 continue |
1481 |
|
do i=INDMAX(IC)+1,istop |
1482 |
|
ipos = i-INDMAX(ic) |
1483 |
|
cut = incut*CLSIGMA(i) |
1484 |
|
if(CLSIGNAL(i).gt.cut)then |
1485 |
|
fs = clsigma(i) |
1486 |
|
SNU = SNU + fs*(ipos-vCOG)**2 |
1487 |
|
stot = stot + CLSIGNAL(i) |
1488 |
|
else |
1489 |
|
goto 20 |
1490 |
|
endif |
1491 |
|
enddo |
1492 |
|
20 continue |
1493 |
|
if(SDE.ne.0)then |
1494 |
|
FUNC=SNU |
1495 |
else |
else |
1496 |
fbad_cog = 1. |
|
1497 |
endif |
endif |
1498 |
|
|
1499 |
|
else |
1500 |
|
|
1501 |
|
FUNC=0 |
1502 |
|
print*,'function FUNC(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1503 |
|
print*,' (NCOG must be >= 0)' |
1504 |
|
|
1505 |
|
|
1506 |
endif |
endif |
1507 |
|
|
1508 |
fbad_cog0 = sqrt(fbad_cog) |
|
1509 |
|
if(stot.gt.0..and.func.gt.0.)then |
1510 |
|
func = sqrt(func) |
1511 |
|
func = pitch * func/stot |
1512 |
|
endif |
1513 |
|
|
1514 |
|
riscogtheor = func |
1515 |
|
|
1516 |
return |
return |
1517 |
end |
end |
1518 |
|
|
1519 |
|
|
1520 |
|
|
1521 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1522 |
|
|
1523 |
|
real function risetatheor(ncog,ic,angle) |
1524 |
|
*------------------------------------------------------- |
1525 |
|
* |
1526 |
|
* this function returns the expected resolution |
1527 |
|
* obtained by propagating the strip noise |
1528 |
|
* to the coordinate evaluated with non-linear eta-function |
1529 |
|
* |
1530 |
|
* ncog = n.strip used in the coordinate evaluation |
1531 |
|
* (ncog=0 => ncog=2,3,4 according to angle) |
1532 |
|
* |
1533 |
|
*------------------------------------------------------- |
1534 |
|
|
1535 |
|
include 'commontracker.f' |
1536 |
|
include 'level1.f' |
1537 |
|
include 'calib.f' |
1538 |
|
|
1539 |
|
|
1540 |
|
func = 1. |
1541 |
|
|
1542 |
|
iview = VIEW(ic) |
1543 |
|
lad = nld(MAXS(ic),VIEW(ic)) |
1544 |
|
|
1545 |
|
* ------------------------------------------------ |
1546 |
|
* number of strip to be used (in case of ncog = 0) |
1547 |
|
* ------------------------------------------------ |
1548 |
|
|
1549 |
|
inoeta = 0 |
1550 |
|
|
1551 |
|
if(mod(int(iview),2).eq.1)then !Y-view |
1552 |
|
|
1553 |
|
pitch = pitchY / 1.e4 |
1554 |
|
|
1555 |
|
if(ncog.eq.0)then |
1556 |
|
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
1557 |
|
ncog = 2 |
1558 |
|
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
1559 |
|
ncog = 3 |
1560 |
|
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
1561 |
|
ncog = 4 |
1562 |
|
else |
1563 |
|
ncog = 4 |
1564 |
|
inoeta = 1 |
1565 |
|
endif |
1566 |
|
endif |
1567 |
|
|
1568 |
|
else !X-view |
1569 |
|
|
1570 |
|
pitch = pitchX / 1.e4 |
1571 |
|
|
1572 |
|
if(ncog.eq.0)then |
1573 |
|
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
1574 |
|
ncog = 2 |
1575 |
|
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
1576 |
|
ncog = 3 |
1577 |
|
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
1578 |
|
ncog = 4 |
1579 |
|
else |
1580 |
|
ncog = 4 |
1581 |
|
inoeta = 1 |
1582 |
|
endif |
1583 |
|
endif |
1584 |
|
|
1585 |
|
endif |
1586 |
|
|
1587 |
|
func = riscogtheor(ncog,ic) |
1588 |
|
|
1589 |
|
risetatheor = func |
1590 |
|
|
1591 |
|
if(inoeta.eq.1)return ! no eta correction is applied --> exit |
1592 |
|
if(ncog.lt.1.or.ncog.gt.4)return |
1593 |
|
|
1594 |
|
* ---------------- |
1595 |
|
* find angular bin |
1596 |
|
* ---------------- |
1597 |
|
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
1598 |
|
do iang=1,nangbin |
1599 |
|
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
1600 |
|
iangle=iang |
1601 |
|
goto 98 |
1602 |
|
endif |
1603 |
|
enddo |
1604 |
|
if(DEBUG.EQ.1)print* |
1605 |
|
$ ,'risetatheor *** warning *** angle out of range: ',angle |
1606 |
|
if(angle.le.angL(1))iang=1 |
1607 |
|
if(angle.ge.angR(nangbin))iang=nangbin |
1608 |
|
98 continue !jump here if ok |
1609 |
|
|
1610 |
|
* ------------- |
1611 |
|
* within +/-0.5 |
1612 |
|
* ------------- |
1613 |
|
|
1614 |
|
vcog = cog(ncog,ic) |
1615 |
|
|
1616 |
|
etamin = eta2(1,iang) |
1617 |
|
etamax = eta2(netaval,iang) |
1618 |
|
|
1619 |
|
iaddmax=10 |
1620 |
|
iadd=0 |
1621 |
|
10 continue |
1622 |
|
if(vcog.lt.etamin)then |
1623 |
|
vcog = vcog + 1 |
1624 |
|
iadd = iadd + 1 |
1625 |
|
if(iadd>iaddmax)goto 111 |
1626 |
|
goto 10 |
1627 |
|
endif |
1628 |
|
20 continue |
1629 |
|
if(vcog.gt.etamax)then |
1630 |
|
vcog = vcog - 1 |
1631 |
|
iadd = iadd - 1 |
1632 |
|
if(iadd<-1*iaddmax)goto 111 |
1633 |
|
goto 20 |
1634 |
|
endif |
1635 |
|
goto 1111 |
1636 |
|
111 continue |
1637 |
|
if(DEBUG.eq.1) |
1638 |
|
$ print*,'risetatheor *** warning *** anomalous cluster' |
1639 |
|
if(DEBUG.eq.1) |
1640 |
|
$ print*,'--> COG(',ncog,') = ',vcog-iadd,' (set to zero)' |
1641 |
|
vcog=0 |
1642 |
|
1111 continue |
1643 |
|
|
1644 |
|
* ------------------------------------------------ |
1645 |
|
* interpolation |
1646 |
|
* ------------------------------------------------ |
1647 |
|
|
1648 |
|
|
1649 |
|
ibin = netaval |
1650 |
|
do i=2,netaval |
1651 |
|
if(ncog.eq.2)eta=eta2(i,iang) |
1652 |
|
if(ncog.eq.3)eta=eta3(i,iang) |
1653 |
|
if(ncog.eq.4)eta=eta4(i,iang) |
1654 |
|
if(eta.ge.vcog)then |
1655 |
|
ibin = i |
1656 |
|
goto 99 |
1657 |
|
endif |
1658 |
|
enddo |
1659 |
|
99 continue |
1660 |
|
|
1661 |
|
if(ncog.eq.2)then |
1662 |
|
x1 = eta2(ibin-1,iang) |
1663 |
|
x2 = eta2(ibin,iang) |
1664 |
|
y1 = feta2(ibin-1,iview,lad,iang) |
1665 |
|
y2 = feta2(ibin,iview,lad,iang) |
1666 |
|
elseif(ncog.eq.3)then |
1667 |
|
x1 = eta3(ibin-1,iang) |
1668 |
|
x2 = eta3(ibin,iang) |
1669 |
|
y1 = feta3(ibin-1,iview,lad,iang) |
1670 |
|
y2 = feta3(ibin,iview,lad,iang) |
1671 |
|
elseif(ncog.eq.4)then |
1672 |
|
x1 = eta4(ibin-1,iang) |
1673 |
|
x2 = eta4(ibin,iang) |
1674 |
|
y1 = feta4(ibin-1,iview,lad,iang) |
1675 |
|
y2 = feta4(ibin,iview,lad,iang) |
1676 |
|
endif |
1677 |
|
|
1678 |
|
func = func * (y2-y1)/(x2-x1) |
1679 |
|
|
1680 |
|
risetatheor = func |
1681 |
|
|
1682 |
|
return |
1683 |
|
end |
1684 |
|
|
1685 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1686 |
|
|
2178 |
|
|
2179 |
|
|
2180 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
2181 |
real function pfacorr(ic,angle) !(1) |
real function pfacorr(ic,angle) |
2182 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
2183 |
* this function returns the landi correction for this cluster |
* this function returns the landi correction for this cluster |
2184 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
2200 |
goto 98 |
goto 98 |
2201 |
endif |
endif |
2202 |
enddo |
enddo |
2203 |
if(DEBUG) |
if(DEBUG.eq.1) |
2204 |
$ print*,'pfacorr *** warning *** angle out of range: ',angle |
$ print*,'pfacorr *** warning *** angle out of range: ',angle |
2205 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
2206 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
2207 |
98 continue !jump here if ok |
98 continue !jump here if ok |
2208 |
|
|
2209 |
pfacorr = fcorr(iview,lad,iang) |
pfacorr = fcorr(iview,lad,iang) |
2210 |
|
|
2211 |
if(DEBUG)print*,'CORR (ic ',ic,' ang',angle,') -->',pfacorr |
if(DEBUG.eq.1)print*,'LANDI (ic ',ic,' ang',angle,') -->',pfacorr |
|
|
|
2212 |
|
|
2213 |
|
|
2214 |
100 return |
100 return |
2215 |
end |
end |