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) |
58 |
|
59 |
integer ipfa |
60 |
c character*10 cpfa |
61 |
character*4 cpfa ! EM GCC4.7 |
62 |
|
63 |
CPFA='COG4' |
64 |
if(ipfa.eq.0)CPFA='ETA' |
65 |
if(ipfa.eq.2)CPFA='ETA2' |
66 |
if(ipfa.eq.3)CPFA='ETA3' |
67 |
if(ipfa.eq.4)CPFA='ETA4' |
68 |
if(ipfa.eq.5)CPFA='ETAL' |
69 |
if(ipfa.eq.10)CPFA='COG' |
70 |
if(ipfa.eq.11)CPFA='COG1' |
71 |
if(ipfa.eq.12)CPFA='COG2' |
72 |
if(ipfa.eq.13)CPFA='COG3' |
73 |
if(ipfa.eq.14)CPFA='COG4' |
74 |
|
75 |
end |
76 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
77 |
real function effectiveangle(ang,iview,bbb) |
78 |
|
79 |
include 'commontracker.f' |
80 |
real tgtemp |
81 |
|
82 |
effectiveangle = 0. |
83 |
|
84 |
if(mod(iview,2).eq.0)then |
85 |
c ================================================= |
86 |
c X view |
87 |
c ================================================= |
88 |
c here bbb is the y component of the m.field |
89 |
angx = ang |
90 |
by = bbb |
91 |
if(iview.eq.12) angx = -1. * ang |
92 |
if(iview.eq.12) by = -1. * bbb |
93 |
cc tgtemp = tan(ang*acos(-1.)/180.) + pmuH_h*by*0.00001 !ORRORE!! |
94 |
tgtemp = tan(angx*acos(-1.)/180.) + REAL(pmuH_h*by*0.00001) ! EM GCC4.7 pmuH_h is double precision but all the others are real... |
95 |
|
96 |
elseif(mod(iview,2).eq.1)then |
97 |
c ================================================= |
98 |
c Y view |
99 |
c ================================================= |
100 |
c here bbb is the x component of the m.filed |
101 |
angy = ang |
102 |
bx = bbb |
103 |
tgtemp = tan(angy*acos(-1.)/180.)+real(pmuH_e*bx*0.00001) ! EM GCC4.7 pmuH_h is double precision but all the others are real... |
104 |
|
105 |
endif |
106 |
effectiveangle = 180.*atan(tgtemp)/acos(-1.) |
107 |
|
108 |
return |
109 |
end |
110 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
111 |
real function fieldcorr(iview,bbb) |
112 |
|
113 |
include 'commontracker.f' |
114 |
|
115 |
fieldcorr = 0. |
116 |
|
117 |
if(mod(iview,2).eq.0)then |
118 |
|
119 |
c ================================================= |
120 |
c X view |
121 |
c ================================================= |
122 |
c here bbb is the y component of the m.field |
123 |
by = bbb |
124 |
if(iview.eq.12) by = -1. * bbb |
125 |
fieldcorr = -1. * 0.5*REAL(pmuH_h*by*0.00001*SiDimZ/pitchX)! EM GCC4.7 pmuH_h is double precision but all the others are real... |
126 |
|
127 |
elseif(mod(iview,2).eq.1)then |
128 |
c ================================================= |
129 |
c Y view |
130 |
c ================================================= |
131 |
c here bbb is the x component of the m.filed |
132 |
bx = bbb |
133 |
fieldcorr = 0.5*real(pmuH_e*bx*0.00001*SiDimZ/pitchY) ! EM GCC4.7 pmuH_h is double precision but all the others are real... |
134 |
|
135 |
endif |
136 |
|
137 |
return |
138 |
end |
139 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
140 |
|
141 |
subroutine applypfa(PFAtt,ic,ang,corr,res) |
142 |
*--------------------------------------------------------------- |
143 |
* this subroutine calculate the coordinate of cluster ic (in |
144 |
* strip units), relative to the strip with the maximum signal, |
145 |
* and its spatial resolution (in cm), applying PFAtt. |
146 |
* ang is the effective angle, relative to the sensor |
147 |
*--------------------------------------------------------------- |
148 |
|
149 |
character*4 PFAtt |
150 |
include 'commontracker.f' |
151 |
include 'level1.f' |
152 |
real corr, res ! EM GCC4.7 |
153 |
corr = 0. |
154 |
res = 0. |
155 |
|
156 |
if(ic.le.0)return |
157 |
|
158 |
iview = VIEW(ic) |
159 |
|
160 |
if(mod(iview,2).eq.0)then |
161 |
c ================================================= |
162 |
c X view |
163 |
c ================================================= |
164 |
|
165 |
res = RESXAV |
166 |
|
167 |
if(PFAtt.eq.'COG1')then |
168 |
|
169 |
corr = 0. |
170 |
res = REAL(1e-4*pitchX/sqrt(12.))!!res EM GCC4.7 |
171 |
|
172 |
elseif(PFAtt.eq.'COG2')then |
173 |
|
174 |
corr = cog(2,ic) |
175 |
res = risx_cog(abs(ang))!TEMPORANEO |
176 |
res = res*fbad_cog(2,ic) |
177 |
|
178 |
elseif(PFAtt.eq.'COG3')then |
179 |
|
180 |
corr = cog(3,ic) |
181 |
res = risx_cog(abs(ang))!TEMPORANEO |
182 |
res = res*fbad_cog(3,ic) |
183 |
|
184 |
elseif(PFAtt.eq.'COG4')then |
185 |
|
186 |
corr = cog(4,ic) |
187 |
res = risx_cog(abs(ang))!TEMPORANEO |
188 |
res = res*fbad_cog(4,ic) |
189 |
|
190 |
elseif(PFAtt.eq.'ETA2')then |
191 |
|
192 |
corr = pfaeta2(ic,ang) |
193 |
res = risxeta2(abs(ang)) |
194 |
res = res*fbad_cog(2,ic) |
195 |
|
196 |
elseif(PFAtt.eq.'ETA3')then |
197 |
|
198 |
corr = pfaeta3(ic,ang) |
199 |
res = risxeta3(abs(ang)) |
200 |
res = res*fbad_cog(3,ic) |
201 |
|
202 |
elseif(PFAtt.eq.'ETA4')then |
203 |
|
204 |
corr = pfaeta4(ic,ang) |
205 |
res = risxeta4(abs(ang)) |
206 |
res = res*fbad_cog(4,ic) |
207 |
|
208 |
elseif(PFAtt.eq.'ETA')then |
209 |
|
210 |
corr = pfaeta(ic,ang) |
211 |
c res = riseta(ic,ang) |
212 |
res = riseta(iview,ang) |
213 |
res = res*fbad_eta(ic,ang) |
214 |
|
215 |
elseif(PFAtt.eq.'ETAL')then |
216 |
|
217 |
corr = pfaetal(ic,ang) |
218 |
res = riseta(iview,ang) |
219 |
res = res*fbad_eta(ic,ang) |
220 |
|
221 |
elseif(PFAtt.eq.'COG')then |
222 |
|
223 |
corr = cog(0,ic) |
224 |
res = risx_cog(abs(ang)) |
225 |
res = res*fbad_cog(0,ic) |
226 |
|
227 |
else |
228 |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAtt |
229 |
endif |
230 |
|
231 |
|
232 |
* ====================================== |
233 |
* temporary patch for saturated clusters |
234 |
* ====================================== |
235 |
if( nsatstrips(ic).gt.0 )then |
236 |
c corr = cog(4,ic) |
237 |
corr = digsat(ic) |
238 |
res = REAL(pitchX*1e-4/sqrt(12.)) !EM GCC4.7 |
239 |
cc cc=cog(4,ic) |
240 |
c$$$ print*,ic,' *** ',cc |
241 |
c$$$ print*,ic,' *** ',res |
242 |
endif |
243 |
|
244 |
|
245 |
elseif(mod(iview,2).eq.1)then |
246 |
c ================================================= |
247 |
c Y view |
248 |
c ================================================= |
249 |
|
250 |
res = RESYAV |
251 |
|
252 |
if(PFAtt.eq.'COG1')then |
253 |
|
254 |
corr = 0 |
255 |
res = REAL(1e-4*pitchY/sqrt(12.))!res EM GCC4.7 |
256 |
|
257 |
elseif(PFAtt.eq.'COG2')then |
258 |
|
259 |
corr = cog(2,ic) |
260 |
res = risy_cog(abs(ang))!TEMPORANEO |
261 |
res = res*fbad_cog(2,ic) |
262 |
|
263 |
elseif(PFAtt.eq.'COG3')then |
264 |
|
265 |
corr = cog(3,ic) |
266 |
res = risy_cog(abs(ang))!TEMPORANEO |
267 |
res = res*fbad_cog(3,ic) |
268 |
|
269 |
elseif(PFAtt.eq.'COG4')then |
270 |
|
271 |
corr = cog(4,ic) |
272 |
res = risy_cog(abs(ang))!TEMPORANEO |
273 |
res = res*fbad_cog(4,ic) |
274 |
|
275 |
elseif(PFAtt.eq.'ETA2')then |
276 |
|
277 |
corr = pfaeta2(ic,ang) |
278 |
res = risyeta2(abs(ang)) |
279 |
res = res*fbad_cog(2,ic) |
280 |
|
281 |
elseif(PFAtt.eq.'ETA3')then |
282 |
|
283 |
corr = pfaeta3(ic,ang) |
284 |
res = res*fbad_cog(3,ic) |
285 |
|
286 |
elseif(PFAtt.eq.'ETA4')then |
287 |
|
288 |
corr = pfaeta4(ic,ang) |
289 |
res = res*fbad_cog(4,ic) |
290 |
|
291 |
elseif(PFAtt.eq.'ETA')then |
292 |
|
293 |
corr = pfaeta(ic,ang) |
294 |
c res = riseta(ic,ang) |
295 |
res = riseta(iview,ang) |
296 |
res = res*fbad_eta(ic,ang) |
297 |
|
298 |
elseif(PFAtt.eq.'ETAL')then |
299 |
|
300 |
corr = pfaetal(ic,ang) |
301 |
res = riseta(iview,ang) |
302 |
res = res*fbad_eta(ic,ang) |
303 |
|
304 |
elseif(PFAtt.eq.'COG')then |
305 |
|
306 |
corr = cog(0,ic) |
307 |
res = risy_cog(abs(ang)) |
308 |
res = res*fbad_cog(0,ic) |
309 |
|
310 |
else |
311 |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (y) --> ',PFAtt |
312 |
endif |
313 |
|
314 |
|
315 |
* ====================================== |
316 |
* temporary patch for saturated clusters |
317 |
* ====================================== |
318 |
if( nsatstrips(ic).gt.0 )then |
319 |
c corr = cog(4,ic) |
320 |
corr = digsat(ic) |
321 |
res = REAL(pitchY*1e-4/sqrt(12.)) ! EM GCC4.7 |
322 |
cc cc=cog(4,ic) |
323 |
c$$$ print*,ic,' *** ',cc |
324 |
c$$$ print*,ic,' *** ',res |
325 |
endif |
326 |
|
327 |
endif |
328 |
end |
329 |
|
330 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
331 |
integer function npfastrips(ic,angle) |
332 |
*-------------------------------------------------------------- |
333 |
* thid function returns the number of strips used |
334 |
* to evaluate the position of a cluster, according to the p.f.a. |
335 |
*-------------------------------------------------------------- |
336 |
include 'commontracker.f' |
337 |
include 'level1.f' |
338 |
include 'calib.f' |
339 |
|
340 |
character*4 usedPFA |
341 |
|
342 |
|
343 |
|
344 |
call idtoc(pfaid,usedPFA) |
345 |
|
346 |
npfastrips=-1 |
347 |
|
348 |
if(usedPFA.eq.'COG1')npfastrips=1 |
349 |
if(usedPFA.eq.'COG2')npfastrips=2 |
350 |
if(usedPFA.eq.'COG3')npfastrips=3 |
351 |
if(usedPFA.eq.'COG4')npfastrips=4 |
352 |
if(usedPFA.eq.'ETA2')npfastrips=2 |
353 |
if(usedPFA.eq.'ETA3')npfastrips=3 |
354 |
if(usedPFA.eq.'ETA4')npfastrips=4 |
355 |
* ---------------------------------------------------------------- |
356 |
if(usedPFA.eq.'ETA'.or.usedPFA.eq.'ETAL')then |
357 |
c print*,VIEW(ic),angle |
358 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
359 |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
360 |
npfastrips=2 |
361 |
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
362 |
npfastrips=3 |
363 |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
364 |
npfastrips=4 |
365 |
else |
366 |
npfastrips=4 !COG4 |
367 |
endif |
368 |
else !X-view |
369 |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
370 |
npfastrips=2 |
371 |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
372 |
npfastrips=3 |
373 |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
374 |
npfastrips=4 |
375 |
else |
376 |
npfastrips=4 !COG4 |
377 |
endif |
378 |
endif |
379 |
endif |
380 |
* ---------------------------------------------------------------- |
381 |
if(usedPFA.eq.'COG')then |
382 |
|
383 |
npfastrips=0 |
384 |
|
385 |
c$$$ iv=VIEW(ic) |
386 |
c$$$ if(mod(iv,2).eq.1)incut=incuty |
387 |
c$$$ if(mod(iv,2).eq.0)incut=incutx |
388 |
c$$$ istart = INDSTART(IC) |
389 |
c$$$ istop = TOTCLLENGTH |
390 |
c$$$ if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
391 |
c$$$ mu = 0 |
392 |
c$$$ do i = INDMAX(IC),istart,-1 |
393 |
c$$$ ipos = i-INDMAX(ic) |
394 |
c$$$ cut = incut*CLSIGMA(i) |
395 |
c$$$ if(CLSIGNAL(i).ge.cut)then |
396 |
c$$$ mu = mu + 1 |
397 |
c$$$ print*,i,mu |
398 |
c$$$ else |
399 |
c$$$ goto 10 |
400 |
c$$$ endif |
401 |
c$$$ enddo |
402 |
c$$$ 10 continue |
403 |
c$$$ do i = INDMAX(IC)+1,istop |
404 |
c$$$ ipos = i-INDMAX(ic) |
405 |
c$$$ cut = incut*CLSIGMA(i) |
406 |
c$$$ if(CLSIGNAL(i).ge.cut)then |
407 |
c$$$ mu = mu + 1 |
408 |
c$$$ print*,i,mu |
409 |
c$$$ else |
410 |
c$$$ goto 20 |
411 |
c$$$ endif |
412 |
c$$$ enddo |
413 |
c$$$ 20 continue |
414 |
c$$$ npfastrips=mu |
415 |
|
416 |
endif |
417 |
* ---------------------------------------------------------------- |
418 |
|
419 |
c print*,pfaid,usedPFA,angle,npfastrips |
420 |
|
421 |
return |
422 |
end |
423 |
|
424 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
425 |
real function pfaeta(ic,angle) |
426 |
*-------------------------------------------------------------- |
427 |
* this function returns the position (in strip units) |
428 |
* it calls: |
429 |
* - pfaeta2(ic,angle) |
430 |
* - pfaeta3(ic,angle) |
431 |
* - pfaeta4(ic,angle) |
432 |
* according to the angle |
433 |
*-------------------------------------------------------------- |
434 |
include 'commontracker.f' |
435 |
include 'level1.f' |
436 |
include 'calib.f' |
437 |
|
438 |
pfaeta = 0 |
439 |
|
440 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
441 |
|
442 |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
443 |
pfaeta = pfaeta2(ic,angle) |
444 |
cc print*,pfaeta2(ic,angle) |
445 |
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
446 |
pfaeta = pfaeta3(ic,angle) |
447 |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
448 |
pfaeta = pfaeta4(ic,angle) |
449 |
else |
450 |
pfaeta = cog(4,ic) |
451 |
endif |
452 |
|
453 |
else !X-view |
454 |
|
455 |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
456 |
pfaeta = pfaeta2(ic,angle) |
457 |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
458 |
pfaeta = pfaeta3(ic,angle) |
459 |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
460 |
pfaeta = pfaeta4(ic,angle) |
461 |
else |
462 |
pfaeta = cog(4,ic) |
463 |
endif |
464 |
|
465 |
endif |
466 |
|
467 |
c 100 return |
468 |
return |
469 |
end |
470 |
|
471 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
472 |
real function pfaetal(ic,angle) |
473 |
*-------------------------------------------------------------- |
474 |
* this function returns the position (in strip units) |
475 |
* it calls: |
476 |
* - pfaeta2(ic,angle)+pfcorr(ic,angle) |
477 |
* - pfaeta3(ic,angle)+pfcorr(ic,angle) |
478 |
* - pfaeta4(ic,angle)+pfcorr(ic,angle) |
479 |
* according to the angle |
480 |
*-------------------------------------------------------------- |
481 |
include 'commontracker.f' |
482 |
include 'level1.f' |
483 |
include 'calib.f' |
484 |
|
485 |
pfaetal = 0 |
486 |
|
487 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
488 |
|
489 |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
490 |
pfaetal = pfaeta2(ic,angle)+pfacorr(ic,angle) |
491 |
cc print*,VIEW(ic),angle,pfaeta2(ic,angle),pfacorr(ic,angle) |
492 |
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
493 |
pfaetal = pfaeta3(ic,angle)+pfacorr(ic,angle) |
494 |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
495 |
pfaetal = pfaeta4(ic,angle)+pfacorr(ic,angle) |
496 |
else |
497 |
pfaetal = cog(4,ic) |
498 |
endif |
499 |
|
500 |
else !X-view |
501 |
|
502 |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
503 |
pfaetal = pfaeta2(ic,angle)+pfacorr(ic,angle) |
504 |
cc print*,VIEW(ic),angle,pfaeta2(ic,angle),pfacorr(ic,angle) |
505 |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
506 |
pfaetal = pfaeta3(ic,angle)+pfacorr(ic,angle) |
507 |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
508 |
pfaetal = pfaeta4(ic,angle)+pfacorr(ic,angle) |
509 |
else |
510 |
pfaetal = cog(4,ic) |
511 |
endif |
512 |
|
513 |
endif |
514 |
|
515 |
c 100 return |
516 |
return |
517 |
end |
518 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
519 |
c real function riseta(ic,angle) |
520 |
real function riseta(iview,angle) |
521 |
*-------------------------------------------------------------- |
522 |
* this function returns the average spatial resolution |
523 |
* (in cm) for the ETA algorithm (function pfaeta(ic,angle)) |
524 |
* it calls: |
525 |
* - risxeta2(angle) |
526 |
* - risyeta2(angle) |
527 |
* - risxeta3(angle) |
528 |
* - risxeta4(angle) |
529 |
* according to the angle |
530 |
*-------------------------------------------------------------- |
531 |
include 'commontracker.f' |
532 |
include 'level1.f' |
533 |
include 'calib.f' |
534 |
|
535 |
riseta = 0. |
536 |
|
537 |
c if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
538 |
if(mod(iview,2).eq.1)then !Y-view |
539 |
|
540 |
|
541 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
542 |
riseta = risyeta2(angle) |
543 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
544 |
riseta = risy_cog(angle) !ATTENZIONE!! |
545 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
546 |
riseta = risy_cog(angle) !ATTENZIONE!! |
547 |
else |
548 |
riseta = risy_cog(angle) |
549 |
endif |
550 |
|
551 |
else !X-view |
552 |
|
553 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
554 |
riseta = risxeta2(angle) |
555 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
556 |
riseta = risxeta3(angle) |
557 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
558 |
riseta = risxeta4(angle) |
559 |
else |
560 |
riseta = risx_cog(angle) |
561 |
endif |
562 |
|
563 |
endif |
564 |
|
565 |
|
566 |
c 100 return |
567 |
return |
568 |
end |
569 |
|
570 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
571 |
real function fbad_eta(ic,angle) |
572 |
*------------------------------------------------------- |
573 |
* this function returns a factor that takes into |
574 |
* account deterioration of the spatial resolution |
575 |
* in the case BAD strips are included in the cluster. |
576 |
* This factor should multiply the nominal spatial |
577 |
* resolution. |
578 |
* It calls the function FBAD_COG(NCOG,IC), |
579 |
* accordingto the angle |
580 |
* |
581 |
* >>> cosi` non e` corretto!! |
582 |
* >>> l'errore sulla coordinata eta si ottiene moltiplicando |
583 |
* >>> l'errore sulla coordinata cog per la derivata della |
584 |
* >>> distribuzione eta... pur sapendolo l'ho sempre ignorato... |
585 |
* >>> deve essere modificato!!!! |
586 |
* |
587 |
*------------------------------------------------------- |
588 |
|
589 |
include 'commontracker.f' |
590 |
include 'level1.f' |
591 |
include 'calib.f' |
592 |
fbad_eta = 0 |
593 |
|
594 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
595 |
|
596 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
597 |
fbad_eta = fbad_cog(2,ic) |
598 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
599 |
fbad_eta = fbad_cog(3,ic) |
600 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
601 |
fbad_eta = fbad_cog(4,ic) |
602 |
else |
603 |
fbad_eta = fbad_cog(4,ic) |
604 |
endif |
605 |
|
606 |
else !X-view |
607 |
|
608 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
609 |
fbad_eta = fbad_cog(2,ic) |
610 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
611 |
fbad_eta = fbad_cog(3,ic) |
612 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
613 |
fbad_eta = fbad_cog(4,ic) |
614 |
else |
615 |
fbad_eta = fbad_cog(4,ic) |
616 |
endif |
617 |
|
618 |
endif |
619 |
|
620 |
return |
621 |
end |
622 |
|
623 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
624 |
real function pfaeta2(ic,angle) |
625 |
*-------------------------------------------------------------- |
626 |
* this function returns |
627 |
* |
628 |
* - the position (in strip units) |
629 |
* corrected according to the ETA2 Position Finding Algorithm. |
630 |
* The function performs an interpolation of FETA2%ETA2 |
631 |
* |
632 |
* - if the angle is out of range, the calibration parameters |
633 |
* of the lowest or higher bin are used |
634 |
* |
635 |
*-------------------------------------------------------------- |
636 |
include 'commontracker.f' |
637 |
include 'calib.f' |
638 |
include 'level1.f' |
639 |
|
640 |
real cog2,angle |
641 |
integer iview,lad |
642 |
|
643 |
iview = VIEW(ic) |
644 |
lad = nld(MAXS(ic),VIEW(ic)) |
645 |
cog2 = cog(2,ic) |
646 |
pfaeta2 = cog2 |
647 |
|
648 |
* ---------------- |
649 |
* find angular bin |
650 |
* ---------------- |
651 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
652 |
do iang=1,nangbin |
653 |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
654 |
iangle=iang |
655 |
goto 98 |
656 |
endif |
657 |
enddo |
658 |
if(DEBUG.EQ.1) |
659 |
$ print*,'pfaeta2 *** warning *** angle out of range: ',angle |
660 |
if(angle.le.angL(1))iang=1 |
661 |
if(angle.ge.angR(nangbin))iang=nangbin |
662 |
98 continue !jump here if ok |
663 |
|
664 |
* ------------- |
665 |
* within +/-0.5 |
666 |
* ------------- |
667 |
|
668 |
iaddmax=10 |
669 |
iadd=0 |
670 |
10 continue |
671 |
if(cog2.lt.eta2(1,iang))then |
672 |
cog2 = cog2 + 1 |
673 |
iadd = iadd + 1 |
674 |
if(iadd>iaddmax)goto 111 |
675 |
goto 10 |
676 |
endif |
677 |
20 continue |
678 |
if(cog2.gt.eta2(netaval,iang))then |
679 |
cog2 = cog2 - 1 |
680 |
iadd = iadd - 1 |
681 |
if(iadd<-1*iaddmax)goto 111 |
682 |
goto 20 |
683 |
endif |
684 |
goto 1111 |
685 |
111 continue |
686 |
if(DEBUG.eq.1)print*,'pfaeta2 *** warning *** anomalous cluster' |
687 |
if(DEBUG.eq.1)print*,'--> COG(2) = ',cog2-iadd,' (set to zero)' |
688 |
cog2=0 |
689 |
1111 continue |
690 |
|
691 |
* -------------------------------- |
692 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
693 |
do i=2,netaval |
694 |
if(eta2(i,iang).gt.cog2)then |
695 |
|
696 |
x1 = eta2(i-1,iang) |
697 |
x2 = eta2(i,iang) |
698 |
y1 = feta2(i-1,iview,lad,iang) |
699 |
y2 = feta2(i,iview,lad,iang) |
700 |
|
701 |
c print*,'*****',i,view,lad,iang |
702 |
c print*,'-----',x1,x2,y1,y2 |
703 |
goto 99 |
704 |
endif |
705 |
enddo |
706 |
99 continue |
707 |
|
708 |
|
709 |
AA=(y2-y1)/(x2-x1) |
710 |
BB=y1-AA*x1 |
711 |
|
712 |
pfaeta2 = AA*cog2+BB |
713 |
pfaeta2 = pfaeta2 - iadd |
714 |
|
715 |
c$$$ if(iflag.eq.1)then |
716 |
c$$$ pfaeta2=pfaeta2-1. !temp |
717 |
c$$$ cog2=cog2-1. !temp |
718 |
c$$$ endif |
719 |
c$$$ if(iflag.eq.-1)then |
720 |
c$$$ pfaeta2=pfaeta2+1. !temp |
721 |
c$$$ cog2=cog2+1. !temp |
722 |
c$$$ endif |
723 |
|
724 |
if(DEBUG.EQ.1)print*,'ETA2 (ic ',ic,' ang',angle,')' |
725 |
$ ,cog2-iadd,' -->',pfaeta2 |
726 |
|
727 |
|
728 |
c 100 return |
729 |
return |
730 |
end |
731 |
|
732 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
733 |
real function pfaeta3(ic,angle) !(1) |
734 |
*-------------------------------------------------------------- |
735 |
* this function returns |
736 |
* |
737 |
* - the position (in strip units) |
738 |
* corrected according to the ETA3 Position Finding Algorithm. |
739 |
* The function performs an interpolation of FETA3%ETA3 |
740 |
* |
741 |
* - if the angle is out of range, the calibration parameters |
742 |
* of the lowest or higher bin are used |
743 |
* |
744 |
*-------------------------------------------------------------- |
745 |
include 'commontracker.f' |
746 |
include 'calib.f' |
747 |
include 'level1.f' |
748 |
|
749 |
real cog3,angle |
750 |
integer iview,lad |
751 |
|
752 |
|
753 |
iview = VIEW(ic) |
754 |
lad = nld(MAXS(ic),VIEW(ic)) |
755 |
cog3 = cog(3,ic) |
756 |
cc = cog3 |
757 |
cog3 = cc |
758 |
pfaeta3=cog3 |
759 |
|
760 |
* ---------------- |
761 |
* find angular bin |
762 |
* ---------------- |
763 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
764 |
do iang=1,nangbin |
765 |
c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle |
766 |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
767 |
iangle=iang |
768 |
goto 98 |
769 |
endif |
770 |
enddo |
771 |
if(DEBUG.EQ.1) |
772 |
$ print*,'pfaeta3 *** warning *** angle out of range: ',angle |
773 |
if(angle.le.angL(1))iang=1 |
774 |
if(angle.ge.angR(nangbin))iang=nangbin |
775 |
98 continue !jump here if ok |
776 |
|
777 |
* ------------- |
778 |
* within +/-0.5 |
779 |
* ------------- |
780 |
|
781 |
iaddmax=10 |
782 |
iadd=0 |
783 |
10 continue |
784 |
if(cog3.lt.eta3(1,iang))then |
785 |
cog3 = cog3 + 1. |
786 |
iadd = iadd + 1 |
787 |
if(iadd>iaddmax) goto 111 |
788 |
goto 10 |
789 |
endif |
790 |
20 continue |
791 |
if(cog3.gt.eta3(netaval,iang))then |
792 |
cog3 = cog3 - 1. |
793 |
iadd = iadd - 1 |
794 |
if(iadd<-1*iaddmax) goto 111 |
795 |
goto 20 |
796 |
endif |
797 |
goto 1111 |
798 |
111 continue |
799 |
if(DEBUG.eq.1)print*,'pfaeta3 *** warning *** anomalous cluster' |
800 |
if(DEBUG.eq.1)print*,'--> COG(3) = ',cog3-iadd,' (set to zero)' |
801 |
cog3=0 |
802 |
1111 continue |
803 |
|
804 |
* -------------------------------- |
805 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
806 |
do i=2,netaval |
807 |
if(eta3(i,iang).gt.cog3)then |
808 |
|
809 |
x1 = eta3(i-1,iang) |
810 |
x2 = eta3(i,iang) |
811 |
y1 = feta3(i-1,iview,lad,iang) |
812 |
y2 = feta3(i,iview,lad,iang) |
813 |
|
814 |
c print*,'*****',i,view,lad,iang |
815 |
c print*,'-----',x1,x2,y1,y2 |
816 |
goto 99 |
817 |
endif |
818 |
enddo |
819 |
99 continue |
820 |
|
821 |
|
822 |
AA=(y2-y1)/(x2-x1) |
823 |
BB=y1-AA*x1 |
824 |
|
825 |
pfaeta3 = AA*cog3+BB |
826 |
pfaeta3 = pfaeta3 - iadd |
827 |
|
828 |
|
829 |
if(DEBUG.EQ.1)print*,'ETA3 (ic ',ic,' ang',angle,')' |
830 |
$ ,cog3-iadd,' -->',pfaeta3 |
831 |
|
832 |
c 100 return |
833 |
return |
834 |
end |
835 |
|
836 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
837 |
real function pfaeta4(ic,angle) |
838 |
*-------------------------------------------------------------- |
839 |
* this function returns |
840 |
* |
841 |
* - the position (in strip units) |
842 |
* corrected according to the ETA4 Position Finding Algorithm. |
843 |
* The function performs an interpolation of FETA3%ETA3 |
844 |
* |
845 |
* - if the angle is out of range, the calibration parameters |
846 |
* of the lowest or higher bin are used |
847 |
* |
848 |
*-------------------------------------------------------------- |
849 |
include 'commontracker.f' |
850 |
include 'calib.f' |
851 |
include 'level1.f' |
852 |
|
853 |
real cog4,angle |
854 |
integer iview,lad |
855 |
|
856 |
|
857 |
iview = VIEW(ic) |
858 |
lad = nld(MAXS(ic),VIEW(ic)) |
859 |
cog4=cog(4,ic) |
860 |
pfaeta4=cog4 |
861 |
|
862 |
* ---------------- |
863 |
* find angular bin |
864 |
* ---------------- |
865 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
866 |
do iang=1,nangbin |
867 |
c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle |
868 |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
869 |
iangle=iang |
870 |
goto 98 |
871 |
endif |
872 |
enddo |
873 |
if(DEBUG.EQ.1) |
874 |
$ print*,'pfaeta4 *** warning *** angle out of range: ',angle |
875 |
if(angle.le.angL(1))iang=1 |
876 |
if(angle.ge.angR(nangbin))iang=nangbin |
877 |
98 continue !jump here if ok |
878 |
|
879 |
* ------------- |
880 |
* within +/-0.5 |
881 |
* ------------- |
882 |
|
883 |
iaddmax=10 |
884 |
iadd=0 |
885 |
10 continue |
886 |
if(cog4.lt.eta4(1,iang))then |
887 |
cog4 = cog4 + 1 |
888 |
iadd = iadd + 1 |
889 |
if(iadd>iaddmax)goto 111 |
890 |
goto 10 |
891 |
endif |
892 |
20 continue |
893 |
if(cog4.gt.eta4(netaval,iang))then |
894 |
cog4 = cog4 - 1 |
895 |
iadd = iadd - 1 |
896 |
if(iadd<-1*iaddmax)goto 111 |
897 |
goto 20 |
898 |
endif |
899 |
goto 1111 |
900 |
111 continue |
901 |
if(DEBUG.eq.1)print*,'pfaeta4 *** warning *** anomalous cluster' |
902 |
if(DEBUG.eq.1)print*,'--> COG(4) = ',cog4-iadd,' (set to zero)' |
903 |
cog4=0 |
904 |
1111 continue |
905 |
|
906 |
* -------------------------------- |
907 |
c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2 |
908 |
do i=2,netaval |
909 |
if(eta4(i,iang).gt.cog4)then |
910 |
|
911 |
x1 = eta4(i-1,iang) |
912 |
x2 = eta4(i,iang) |
913 |
y1 = feta4(i-1,iview,lad,iang) |
914 |
y2 = feta4(i,iview,lad,iang) |
915 |
|
916 |
c print*,'*****',i,view,lad,iang |
917 |
c print*,'-----',x1,x2,y1,y2 |
918 |
goto 99 |
919 |
endif |
920 |
enddo |
921 |
99 continue |
922 |
|
923 |
|
924 |
AA=(y2-y1)/(x2-x1) |
925 |
BB=y1-AA*x1 |
926 |
|
927 |
pfaeta4 = AA*cog4+BB |
928 |
pfaeta4 = pfaeta4 - iadd |
929 |
|
930 |
c$$$ if(iflag.eq.1)then |
931 |
c$$$ pfaeta2=pfaeta2-1. !temp |
932 |
c$$$ cog2=cog2-1. !temp |
933 |
c$$$ endif |
934 |
c$$$ if(iflag.eq.-1)then |
935 |
c$$$ pfaeta2=pfaeta2+1. !temp |
936 |
c$$$ cog2=cog2+1. !temp |
937 |
c$$$ endif |
938 |
|
939 |
if(DEBUG.EQ.1)print*,'ETA4 (ic ',ic,' ang',angle,')' |
940 |
$ ,cog4-iadd,' -->',pfaeta4 |
941 |
|
942 |
c 100 return |
943 |
return |
944 |
end |
945 |
|
946 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
947 |
real function digsat(ic) |
948 |
*------------------------------------------------- |
949 |
* |
950 |
* |
951 |
*------------------------------------------------- |
952 |
include 'commontracker.f' |
953 |
include 'calib.f' |
954 |
include 'level1.f' |
955 |
|
956 |
integer nsat |
957 |
real pitchsat |
958 |
|
959 |
nsat = 0 |
960 |
pitchsat = 0. |
961 |
iv=VIEW(ic) |
962 |
istart = INDSTART(IC) |
963 |
istop = TOTCLLENGTH |
964 |
if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
965 |
do i = INDMAX(IC),istart,-1 |
966 |
if( (mod(iv,2).eq.1.and.CLADC(i).lt.ADCsatx) |
967 |
$ .or. |
968 |
$ (mod(iv,2).eq.0.and.CLADC(i).gt.ADCsaty) )then |
969 |
nsat = nsat + 1 |
970 |
pitchsat = pitchsat + i - INDMAX(IC) |
971 |
else |
972 |
goto 10 |
973 |
endif |
974 |
enddo |
975 |
10 continue |
976 |
do i = INDMAX(IC)+1,istop |
977 |
if( (mod(iv,2).eq.1.and.CLADC(i).lt.ADCsatx) |
978 |
$ .or. |
979 |
$ (mod(iv,2).eq.0.and.CLADC(i).gt.ADCsaty) )then |
980 |
nsat = nsat + 1 |
981 |
pitchsat = pitchsat + i - INDMAX(IC) |
982 |
else |
983 |
goto 20 |
984 |
endif |
985 |
enddo |
986 |
20 continue |
987 |
|
988 |
digsat = 0 |
989 |
if (nsat.gt.0) digsat = pitchsat / nsat |
990 |
|
991 |
return |
992 |
end |
993 |
|
994 |
|
995 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
996 |
real function cog(ncog,ic) |
997 |
*------------------------------------------------- |
998 |
* this function returns |
999 |
* |
1000 |
* - if NCOG=0, the Center-Of-Gravity of the |
1001 |
* cluster IC, relative to MAXS(IC), according to |
1002 |
* the cluster multiplicity |
1003 |
* |
1004 |
* - if NCOG>0, the Center-Of-Gravity of the cluster IC |
1005 |
* evaluated using NCOG strips, even if they have a |
1006 |
* negative signal (according to Landi) |
1007 |
* |
1008 |
*------------------------------------------------- |
1009 |
|
1010 |
|
1011 |
include 'commontracker.f' |
1012 |
include 'calib.f' |
1013 |
include 'level1.f' |
1014 |
|
1015 |
|
1016 |
|
1017 |
if (ncog.gt.0) then |
1018 |
* =========================== |
1019 |
* ETA2 ETA3 ETA4 computation |
1020 |
* =========================== |
1021 |
|
1022 |
* --> signal of the central strip |
1023 |
sc = CLSIGNAL(INDMAX(ic)) !center |
1024 |
* signal of adjacent strips |
1025 |
sl1 = -9999. !left 1 |
1026 |
if( |
1027 |
$ (INDMAX(ic)-1).ge.INDSTART(ic) |
1028 |
$ ) |
1029 |
$ sl1 = CLSIGNAL(INDMAX(ic)-1) |
1030 |
|
1031 |
sl2 = -9999. !left 2 |
1032 |
if( |
1033 |
$ (INDMAX(ic)-2).ge.INDSTART(ic) |
1034 |
$ ) |
1035 |
$ sl2 = CLSIGNAL(INDMAX(ic)-2) |
1036 |
|
1037 |
sr1 = -9999. !right 1 |
1038 |
if( |
1039 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
1040 |
$ .or. |
1041 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
1042 |
$ ) |
1043 |
$ sr1 = CLSIGNAL(INDMAX(ic)+1) |
1044 |
|
1045 |
sr2 = -9999. !right 2 |
1046 |
if( |
1047 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
1048 |
$ .or. |
1049 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
1050 |
$ ) |
1051 |
$ sr2 = CLSIGNAL(INDMAX(ic)+2) |
1052 |
|
1053 |
COG = 0. |
1054 |
|
1055 |
c print *,'## ',sl2,sl1,sc,sr1,sr2 |
1056 |
|
1057 |
c ============================================================== |
1058 |
if(ncog.eq.1)then |
1059 |
COG = 0. |
1060 |
if(sr1.gt.sc)cog=1. |
1061 |
if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. |
1062 |
c ============================================================== |
1063 |
elseif(ncog.eq.2)then |
1064 |
COG = 0. |
1065 |
if(sl1.gt.sr1)then |
1066 |
if((sl1+sc).ne.0)COG = -sl1/(sl1+sc) |
1067 |
elseif(sl1.lt.sr1)then |
1068 |
if((sc+sr1).ne.0)COG = sr1/(sc+sr1) |
1069 |
elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then |
1070 |
if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1) |
1071 |
$ .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) |
1072 |
if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1) |
1073 |
$ .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) |
1074 |
endif |
1075 |
c if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic) |
1076 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
1077 |
c ============================================================== |
1078 |
elseif(ncog.eq.3)then |
1079 |
COG = 0 |
1080 |
sss = sc |
1081 |
if( sl1.ne.-9999. )COG = COG-sl1 |
1082 |
if( sl1.ne.-9999. )sss = sss+sl1 |
1083 |
if( sr1.ne.-9999. )COG = COG+sr1 |
1084 |
if( sr1.ne.-9999. )sss = sss+sr1 |
1085 |
if(sss.ne.0)COG=COG/sss |
1086 |
|
1087 |
c if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1) |
1088 |
c if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic) |
1089 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
1090 |
c ============================================================== |
1091 |
elseif(ncog.eq.4)then |
1092 |
|
1093 |
COG = 0 |
1094 |
sss = sc |
1095 |
if( sl1.ne.-9999. )COG = COG-sl1 |
1096 |
if( sl1.ne.-9999. )sss = sss+sl1 |
1097 |
if( sr1.ne.-9999. )COG = COG+sr1 |
1098 |
if( sr1.ne.-9999. )sss = sss+sr1 |
1099 |
if(sl2.gt.sr2)then |
1100 |
if((sl2+sss).ne.0) |
1101 |
$ COG = (COG-2*sl2)/(sl2+sss) |
1102 |
elseif(sl2.lt.sr2)then |
1103 |
if((sr2+sss).ne.0) |
1104 |
$ COG = (2*sr2+COG)/(sr2+sss) |
1105 |
elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then |
1106 |
if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2) |
1107 |
$ .and.(sl2+sss).ne.0 ) |
1108 |
$ cog = (cog-2*sl2)/(sl2+sss) |
1109 |
if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2) |
1110 |
$ .and.(sr2+sss).ne.0 ) |
1111 |
$ cog = (2*sr2+cog)/(sr2+sss) |
1112 |
endif |
1113 |
c ============================================================== |
1114 |
elseif(ncog.eq.5)then |
1115 |
COG = 0 |
1116 |
sss = sc |
1117 |
if( sl1.ne.-9999. )COG = COG-sl1 |
1118 |
if( sl1.ne.-9999. )sss = sss+sl1 |
1119 |
if( sr1.ne.-9999. )COG = COG+sr1 |
1120 |
if( sr1.ne.-9999. )sss = sss+sr1 |
1121 |
if( sl2.ne.-9999. )COG = COG-2*sl2 |
1122 |
if( sl2.ne.-9999. )sss = sss+sl2 |
1123 |
if( sr2.ne.-9999. )COG = COG+2*sr2 |
1124 |
if( sr2.ne.-9999. )sss = sss+sr2 |
1125 |
if(sss.ne.0)COG=COG/sss |
1126 |
else |
1127 |
print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1128 |
$ ,' not implemented' |
1129 |
COG = 0. |
1130 |
endif |
1131 |
|
1132 |
c print*,'NCOG ',ncog,ic,' @@@ ',sl1,sc,sr1,' @@@ ',cog |
1133 |
|
1134 |
elseif(ncog.eq.0)then |
1135 |
* ========================= |
1136 |
* COG computation |
1137 |
* ========================= |
1138 |
|
1139 |
iv=VIEW(ic) |
1140 |
if(mod(iv,2).eq.1)incut=NINT(incuty) ! incut is implicitly INTEGER, incuty is REAL |
1141 |
if(mod(iv,2).eq.0)incut=NINT(incutx) ! incut is implicitly INTEGER, incutx is REAL |
1142 |
istart = INDSTART(IC) |
1143 |
istop = TOTCLLENGTH |
1144 |
if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
1145 |
COG = 0 |
1146 |
SGN = 0. |
1147 |
mu = 0 |
1148 |
c print*,'-------' |
1149 |
do i = INDMAX(IC),istart,-1 |
1150 |
ipos = i-INDMAX(ic) |
1151 |
cut = incut*CLSIGMA(i) |
1152 |
if(CLSIGNAL(i).ge.cut)then |
1153 |
COG = COG + ipos*CLSIGNAL(i) |
1154 |
SGN = SGN + CLSIGNAL(i) |
1155 |
mu = mu + 1 |
1156 |
c print*,ipos,CLSIGNAL(i) |
1157 |
else |
1158 |
goto 10 |
1159 |
endif |
1160 |
enddo |
1161 |
10 continue |
1162 |
do i = INDMAX(IC)+1,istop |
1163 |
ipos = i-INDMAX(ic) |
1164 |
cut = incut*CLSIGMA(i) |
1165 |
if(CLSIGNAL(i).ge.cut)then |
1166 |
COG = COG + ipos*CLSIGNAL(i) |
1167 |
SGN = SGN + CLSIGNAL(i) |
1168 |
mu = mu + 1 |
1169 |
c print*,ipos,CLSIGNAL(i) |
1170 |
else |
1171 |
goto 20 |
1172 |
endif |
1173 |
enddo |
1174 |
20 continue |
1175 |
if(SGN.le.0)then |
1176 |
print*,'cog(0,ic) --> ic, dedx ',ic,SGN |
1177 |
print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
1178 |
print*,(CLSIGNAL(i),i=istart,istop) |
1179 |
c print*,'cog(0,ic) --> NOT EVALUATED ' |
1180 |
else |
1181 |
COG=COG/SGN |
1182 |
endif |
1183 |
c print*,'-------' |
1184 |
|
1185 |
else |
1186 |
|
1187 |
COG=0 |
1188 |
print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1189 |
print*,' (NCOG must be >= 0)' |
1190 |
|
1191 |
|
1192 |
endif |
1193 |
|
1194 |
c print *,'## cog ',ncog,ic,cog,'/////////////' |
1195 |
|
1196 |
if(COG.lt.-0.75.or.COG.gt.+0.75)then |
1197 |
if(DEBUG.eq.1) |
1198 |
$ print*,'cog *** warning *** anomalous cluster ??? --> ' |
1199 |
if(DEBUG.eq.1) |
1200 |
$ print*,sl2,sl1,sc,sr1,sr2,' --> COG(',ncog,') = ',COG |
1201 |
endif |
1202 |
|
1203 |
|
1204 |
return |
1205 |
end |
1206 |
|
1207 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1208 |
|
1209 |
real function fbad_cog(ncog,ic) |
1210 |
*------------------------------------------------------- |
1211 |
* this function returns a factor that takes into |
1212 |
* account deterioration of the spatial resolution |
1213 |
* in the case BAD strips are included in the cluster. |
1214 |
* This factor should multiply the nominal spatial |
1215 |
* resolution. |
1216 |
* |
1217 |
*------------------------------------------------------- |
1218 |
|
1219 |
include 'commontracker.f' |
1220 |
include 'level1.f' |
1221 |
include 'calib.f' |
1222 |
|
1223 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
1224 |
si = 8.4 !average good-strip noise |
1225 |
f = 4. !average bad-strip noise: f*si |
1226 |
incut=NINT(incuty) |
1227 |
else !X-view |
1228 |
si = 3.9 !average good-strip noise |
1229 |
f = 6. !average bad-strip noise: f*si |
1230 |
incut=NINT(incutx) |
1231 |
endif |
1232 |
|
1233 |
fbad_cog = 1. |
1234 |
|
1235 |
if (ncog.gt.0) then |
1236 |
|
1237 |
* --> signal of the central strip |
1238 |
sc = CLSIGNAL(INDMAX(ic)) !center |
1239 |
fsc = 1 |
1240 |
c if( CLBAD(INDMAX(ic)).eq.0 )fsc=f |
1241 |
fsc = clsigma(INDMAX(ic))/si |
1242 |
* --> signal of adjacent strips |
1243 |
sl1 = 0 !left 1 |
1244 |
fsl1 = 1 !left 1 |
1245 |
if( |
1246 |
$ (INDMAX(ic)-1).ge.INDSTART(ic) |
1247 |
$ )then |
1248 |
sl1 = CLSIGNAL(INDMAX(ic)-1) |
1249 |
c if( CLBAD(INDMAX(ic)-1).eq.0)fsl1=f |
1250 |
fsl1 = clsigma(INDMAX(ic)-1)/si |
1251 |
endif |
1252 |
|
1253 |
sl2 = 0 !left 2 |
1254 |
fsl2 = 1 !left 2 |
1255 |
if( |
1256 |
$ (INDMAX(ic)-2).ge.INDSTART(ic) |
1257 |
$ )then |
1258 |
sl2 = CLSIGNAL(INDMAX(ic)-2) |
1259 |
c if(CLBAD(INDMAX(ic)-2).eq.0)fsl2=f |
1260 |
fsl2 = clsigma(INDMAX(ic)-2)/si |
1261 |
endif |
1262 |
sr1 = 0 !right 1 |
1263 |
fsr1 = 1 !right 1 |
1264 |
if( |
1265 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
1266 |
$ .or. |
1267 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
1268 |
$ )then |
1269 |
sr1 = CLSIGNAL(INDMAX(ic)+1) |
1270 |
c if(CLBAD(INDMAX(ic)+1).eq.0)fsr1=f |
1271 |
fsr1 = clsigma(INDMAX(ic)+1)/si |
1272 |
endif |
1273 |
sr2 = 0 !right 2 |
1274 |
fsr2 = 1 !right 2 |
1275 |
if( |
1276 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
1277 |
$ .or. |
1278 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
1279 |
$ )then |
1280 |
sr2 = CLSIGNAL(INDMAX(ic)+2) |
1281 |
c if(CLBAD(INDMAX(ic)+2).eq.0)fsr2=f |
1282 |
fsr2 = clsigma(INDMAX(ic)+2)/si |
1283 |
endif |
1284 |
|
1285 |
|
1286 |
|
1287 |
************************************************************ |
1288 |
* COG2-3-4 computation |
1289 |
************************************************************ |
1290 |
|
1291 |
c print*,sl2,sl1,sc,sr1,sr2 |
1292 |
|
1293 |
vCOG = cog(ncog,ic)!0. |
1294 |
|
1295 |
if(ncog.eq.2)then |
1296 |
if(sl1.gt.sr1)then |
1297 |
c COG = -sl1/(sl1+sc) |
1298 |
fbad_cog = (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2) |
1299 |
fbad_cog = fbad_cog / ((-1-vCOG)**2+(-vCOG)**2) |
1300 |
elseif(sl1.le.sr1)then |
1301 |
c COG = sr1/(sc+sr1) |
1302 |
fbad_cog = (fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1303 |
fbad_cog = fbad_cog / ((-vCOG)**2+(1-vCOG)**2) |
1304 |
endif |
1305 |
elseif(ncog.eq.3)then |
1306 |
c COG = (sr1-sl1)/(sl1+sc+sr1) |
1307 |
fbad_cog = |
1308 |
$ (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1309 |
fbad_cog = |
1310 |
$ fbad_cog / ((-1-vCOG)**2+(-vCOG)**2+(1-vCOG)**2) |
1311 |
elseif(ncog.eq.4)then |
1312 |
if(sl2.gt.sr2)then |
1313 |
c COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) |
1314 |
fbad_cog = |
1315 |
$ (fsl2*(-2-vCOG)**2+fsl1*(-1-vCOG)**2 |
1316 |
$ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1317 |
fbad_cog = |
1318 |
$ fbad_cog / ((-2-vCOG)**2+(-1-vCOG)**2 |
1319 |
$ +(-vCOG)**2+(1-vCOG)**2) |
1320 |
elseif(sl2.le.sr2)then |
1321 |
c COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1) |
1322 |
fbad_cog = |
1323 |
$ (fsl1*(-1-vCOG)**2 |
1324 |
$ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2+fsr2*(2-vCOG)**2) |
1325 |
fbad_cog = |
1326 |
$ fbad_cog / ((-1-vCOG)**2 |
1327 |
$ +(-vCOG)**2+(1-vCOG)**2+(2-vCOG)**2) |
1328 |
endif |
1329 |
else |
1330 |
print*,'function FBAD_COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1331 |
print*,' (NCOG must be <= 4)' |
1332 |
c COG = 0. |
1333 |
endif |
1334 |
|
1335 |
elseif(ncog.eq.0)then |
1336 |
* ========================= |
1337 |
* COG computation |
1338 |
* ========================= |
1339 |
|
1340 |
vCOG = cog(0,ic) |
1341 |
|
1342 |
iv = VIEW(ic) |
1343 |
istart = INDSTART(IC) |
1344 |
istop = TOTCLLENGTH |
1345 |
if(ic.lt.NCLSTR1)istop = INDSTART(IC+1)-1 |
1346 |
SGN = 0. |
1347 |
SNU = 0. |
1348 |
SDE = 0. |
1349 |
|
1350 |
do i=INDMAX(IC),istart,-1 |
1351 |
ipos = i-INDMAX(ic) |
1352 |
cut = incut*CLSIGMA(i) |
1353 |
if(CLSIGNAL(i).gt.cut)then |
1354 |
fs = clsigma(i)/si |
1355 |
SNU = SNU + fs*(ipos-vCOG)**2 |
1356 |
SDE = SDE + (ipos-vCOG)**2 |
1357 |
else |
1358 |
goto 10 |
1359 |
endif |
1360 |
enddo |
1361 |
10 continue |
1362 |
do i=INDMAX(IC)+1,istop |
1363 |
ipos = i-INDMAX(ic) |
1364 |
cut = incut*CLSIGMA(i) |
1365 |
if(CLSIGNAL(i).gt.cut)then |
1366 |
fs = clsigma(i)/si |
1367 |
SNU = SNU + fs*(ipos-vCOG)**2 |
1368 |
SDE = SDE + (ipos-vCOG)**2 |
1369 |
else |
1370 |
goto 20 |
1371 |
endif |
1372 |
enddo |
1373 |
20 continue |
1374 |
if(SDE.ne.0)then |
1375 |
FBAD_COG=SNU/SDE |
1376 |
else |
1377 |
|
1378 |
endif |
1379 |
|
1380 |
else |
1381 |
|
1382 |
FBAD_COG=0 |
1383 |
print*,'function FBAD_COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1384 |
print*,' (NCOG must be >= 0)' |
1385 |
|
1386 |
|
1387 |
endif |
1388 |
|
1389 |
|
1390 |
fbad_cog = sqrt(fbad_cog) |
1391 |
|
1392 |
return |
1393 |
end |
1394 |
|
1395 |
|
1396 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1397 |
|
1398 |
real function riscogtheor(ncog,ic) |
1399 |
*------------------------------------------------------- |
1400 |
* |
1401 |
* this function returns the expected resolution |
1402 |
* obtained by propagating the strip noise |
1403 |
* to the center-of-gravity coordinate |
1404 |
* |
1405 |
* ncog = n.strip used in the coordinate evaluation |
1406 |
* (ncog=0 => all strips above threshold) |
1407 |
* |
1408 |
*------------------------------------------------------- |
1409 |
|
1410 |
include 'commontracker.f' |
1411 |
include 'level1.f' |
1412 |
include 'calib.f' |
1413 |
|
1414 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
1415 |
incut = NINT(incuty) ! EM GCC4.7 |
1416 |
pitch = REAL(pitchY / 1.e4) |
1417 |
else !X-view |
1418 |
incut = NINT(incutx) ! EM GCC4.7 |
1419 |
pitch = REAL(pitchX / 1.e4) |
1420 |
endif |
1421 |
|
1422 |
func = 100000. |
1423 |
stot = 0. |
1424 |
|
1425 |
if (ncog.gt.0) then |
1426 |
|
1427 |
* --> signal of the central strip |
1428 |
sc = CLSIGNAL(INDMAX(ic)) !center |
1429 |
fsc = clsigma(INDMAX(ic)) |
1430 |
* --> signal of adjacent strips |
1431 |
sl1 = 0 !left 1 |
1432 |
fsl1 = 1 !left 1 |
1433 |
if( |
1434 |
$ (INDMAX(ic)-1).ge.INDSTART(ic) |
1435 |
$ )then |
1436 |
sl1 = CLSIGNAL(INDMAX(ic)-1) |
1437 |
fsl1 = clsigma(INDMAX(ic)-1) |
1438 |
endif |
1439 |
|
1440 |
sl2 = 0 !left 2 |
1441 |
fsl2 = 1 !left 2 |
1442 |
if( |
1443 |
$ (INDMAX(ic)-2).ge.INDSTART(ic) |
1444 |
$ )then |
1445 |
sl2 = CLSIGNAL(INDMAX(ic)-2) |
1446 |
fsl2 = clsigma(INDMAX(ic)-2) |
1447 |
endif |
1448 |
sr1 = 0 !right 1 |
1449 |
fsr1 = 1 !right 1 |
1450 |
if( |
1451 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
1452 |
$ .or. |
1453 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
1454 |
$ )then |
1455 |
sr1 = CLSIGNAL(INDMAX(ic)+1) |
1456 |
fsr1 = clsigma(INDMAX(ic)+1) |
1457 |
endif |
1458 |
sr2 = 0 !right 2 |
1459 |
fsr2 = 1 !right 2 |
1460 |
if( |
1461 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
1462 |
$ .or. |
1463 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
1464 |
$ )then |
1465 |
sr2 = CLSIGNAL(INDMAX(ic)+2) |
1466 |
fsr2 = clsigma(INDMAX(ic)+2) |
1467 |
endif |
1468 |
|
1469 |
|
1470 |
|
1471 |
************************************************************ |
1472 |
* COG2-3-4 computation |
1473 |
************************************************************ |
1474 |
|
1475 |
c print*,sl2,sl1,sc,sr1,sr2 |
1476 |
|
1477 |
vCOG = cog(ncog,ic)!0. |
1478 |
|
1479 |
if(ncog.eq.1)then |
1480 |
func = 1./12. |
1481 |
stot = 1. |
1482 |
elseif(ncog.eq.2)then |
1483 |
if(sl1.gt.sr1)then |
1484 |
func = (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2) |
1485 |
stot = sl1+sc |
1486 |
elseif(sl1.le.sr1)then |
1487 |
func = (fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1488 |
stot = sc+sr1 |
1489 |
endif |
1490 |
elseif(ncog.eq.3)then |
1491 |
func = |
1492 |
$ (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1493 |
stot = sl1+sc+sr1 |
1494 |
elseif(ncog.eq.4)then |
1495 |
if(sl2.gt.sr2)then |
1496 |
func = |
1497 |
$ (fsl2*(-2-vCOG)**2+fsl1*(-1-vCOG)**2 |
1498 |
$ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2) |
1499 |
stot = sl2+sl1+sc+sr1 |
1500 |
elseif(sl2.le.sr2)then |
1501 |
func = |
1502 |
$ (fsl1*(-1-vCOG)**2 |
1503 |
$ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2+fsr2*(2-vCOG)**2) |
1504 |
stot = sl2+sl1+sc+sr1 |
1505 |
endif |
1506 |
else |
1507 |
print*,'function riscogtheor(NCOG,IC) ==> NCOG=',NCOG |
1508 |
$ ,' not implemented' |
1509 |
endif |
1510 |
|
1511 |
elseif(ncog.eq.0)then |
1512 |
* ========================= |
1513 |
* COG computation |
1514 |
* ========================= |
1515 |
|
1516 |
vCOG = cog(0,ic) |
1517 |
|
1518 |
iv = VIEW(ic) |
1519 |
istart = INDSTART(IC) |
1520 |
istop = TOTCLLENGTH |
1521 |
if(ic.lt.NCLSTR1)istop = INDSTART(IC+1)-1 |
1522 |
ccc SGN = 0. |
1523 |
SNU = 0. |
1524 |
ccc SDE = 0. |
1525 |
|
1526 |
do i=INDMAX(IC),istart,-1 |
1527 |
ipos = i-INDMAX(ic) |
1528 |
cut = incut*CLSIGMA(i) |
1529 |
if(CLSIGNAL(i).gt.cut)then |
1530 |
fs = clsigma(i) |
1531 |
SNU = SNU + fs*(ipos-vCOG)**2 |
1532 |
stot = stot + CLSIGNAL(i) |
1533 |
else |
1534 |
goto 10 |
1535 |
endif |
1536 |
enddo |
1537 |
10 continue |
1538 |
do i=INDMAX(IC)+1,istop |
1539 |
ipos = i-INDMAX(ic) |
1540 |
cut = incut*CLSIGMA(i) |
1541 |
if(CLSIGNAL(i).gt.cut)then |
1542 |
fs = clsigma(i) |
1543 |
SNU = SNU + fs*(ipos-vCOG)**2 |
1544 |
stot = stot + CLSIGNAL(i) |
1545 |
else |
1546 |
goto 20 |
1547 |
endif |
1548 |
enddo |
1549 |
20 continue |
1550 |
if(SDE.ne.0)then |
1551 |
FUNC=SNU |
1552 |
else |
1553 |
|
1554 |
endif |
1555 |
|
1556 |
else |
1557 |
|
1558 |
FUNC=0 |
1559 |
print*,'function FUNC(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
1560 |
print*,' (NCOG must be >= 0)' |
1561 |
|
1562 |
|
1563 |
endif |
1564 |
|
1565 |
|
1566 |
if(stot.gt.0..and.func.gt.0.)then |
1567 |
func = sqrt(func) |
1568 |
func = pitch * func/stot |
1569 |
endif |
1570 |
|
1571 |
riscogtheor = func |
1572 |
|
1573 |
return |
1574 |
end |
1575 |
|
1576 |
|
1577 |
|
1578 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1579 |
|
1580 |
real function risetatheor(ncog,ic,angle) |
1581 |
*------------------------------------------------------- |
1582 |
* |
1583 |
* this function returns the expected resolution |
1584 |
* obtained by propagating the strip noise |
1585 |
* to the coordinate evaluated with non-linear eta-function |
1586 |
* |
1587 |
* ncog = n.strip used in the coordinate evaluation |
1588 |
* (ncog=0 => ncog=2,3,4 according to angle) |
1589 |
* |
1590 |
*------------------------------------------------------- |
1591 |
|
1592 |
include 'commontracker.f' |
1593 |
include 'level1.f' |
1594 |
include 'calib.f' |
1595 |
|
1596 |
|
1597 |
func = 1. |
1598 |
|
1599 |
iview = VIEW(ic) |
1600 |
lad = nld(MAXS(ic),VIEW(ic)) |
1601 |
|
1602 |
* ------------------------------------------------ |
1603 |
* number of strip to be used (in case of ncog = 0) |
1604 |
* ------------------------------------------------ |
1605 |
|
1606 |
inoeta = 0 |
1607 |
|
1608 |
if(mod(int(iview),2).eq.1)then !Y-view |
1609 |
|
1610 |
pitch = REAL(pitchY / 1.e4) !EM GCC 4.7 |
1611 |
|
1612 |
if(ncog.eq.0)then |
1613 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
1614 |
ncog = 2 |
1615 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
1616 |
ncog = 3 |
1617 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
1618 |
ncog = 4 |
1619 |
else |
1620 |
ncog = 4 |
1621 |
inoeta = 1 |
1622 |
endif |
1623 |
endif |
1624 |
|
1625 |
else !X-view |
1626 |
|
1627 |
pitch = REAL(pitchX / 1.e4) ! EM GCC4.7 |
1628 |
|
1629 |
if(ncog.eq.0)then |
1630 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
1631 |
ncog = 2 |
1632 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
1633 |
ncog = 3 |
1634 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
1635 |
ncog = 4 |
1636 |
else |
1637 |
ncog = 4 |
1638 |
inoeta = 1 |
1639 |
endif |
1640 |
endif |
1641 |
|
1642 |
endif |
1643 |
|
1644 |
func = riscogtheor(ncog,ic) |
1645 |
|
1646 |
risetatheor = func |
1647 |
|
1648 |
if(inoeta.eq.1)return ! no eta correction is applied --> exit |
1649 |
if(ncog.lt.1.or.ncog.gt.4)return |
1650 |
|
1651 |
* ---------------- |
1652 |
* find angular bin |
1653 |
* ---------------- |
1654 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
1655 |
do iang=1,nangbin |
1656 |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
1657 |
iangle=iang |
1658 |
goto 98 |
1659 |
endif |
1660 |
enddo |
1661 |
if(DEBUG.EQ.1)print* |
1662 |
$ ,'risetatheor *** warning *** angle out of range: ',angle |
1663 |
if(angle.le.angL(1))iang=1 |
1664 |
if(angle.ge.angR(nangbin))iang=nangbin |
1665 |
98 continue !jump here if ok |
1666 |
|
1667 |
* ------------- |
1668 |
* within +/-0.5 |
1669 |
* ------------- |
1670 |
|
1671 |
vcog = cog(ncog,ic) |
1672 |
|
1673 |
etamin = eta2(1,iang) |
1674 |
etamax = eta2(netaval,iang) |
1675 |
|
1676 |
iaddmax=10 |
1677 |
iadd=0 |
1678 |
10 continue |
1679 |
if(vcog.lt.etamin)then |
1680 |
vcog = vcog + 1 |
1681 |
iadd = iadd + 1 |
1682 |
if(iadd>iaddmax)goto 111 |
1683 |
goto 10 |
1684 |
endif |
1685 |
20 continue |
1686 |
if(vcog.gt.etamax)then |
1687 |
vcog = vcog - 1 |
1688 |
iadd = iadd - 1 |
1689 |
if(iadd<-1*iaddmax)goto 111 |
1690 |
goto 20 |
1691 |
endif |
1692 |
goto 1111 |
1693 |
111 continue |
1694 |
if(DEBUG.eq.1) |
1695 |
$ print*,'risetatheor *** warning *** anomalous cluster' |
1696 |
if(DEBUG.eq.1) |
1697 |
$ print*,'--> COG(',ncog,') = ',vcog-iadd,' (set to zero)' |
1698 |
vcog=0 |
1699 |
1111 continue |
1700 |
|
1701 |
* ------------------------------------------------ |
1702 |
* interpolation |
1703 |
* ------------------------------------------------ |
1704 |
|
1705 |
|
1706 |
ibin = netaval |
1707 |
do i=2,netaval |
1708 |
if(ncog.eq.2)eta=eta2(i,iang) |
1709 |
if(ncog.eq.3)eta=eta3(i,iang) |
1710 |
if(ncog.eq.4)eta=eta4(i,iang) |
1711 |
if(eta.ge.vcog)then |
1712 |
ibin = i |
1713 |
goto 99 |
1714 |
endif |
1715 |
enddo |
1716 |
99 continue |
1717 |
|
1718 |
if(ncog.eq.2)then |
1719 |
x1 = eta2(ibin-1,iang) |
1720 |
x2 = eta2(ibin,iang) |
1721 |
y1 = feta2(ibin-1,iview,lad,iang) |
1722 |
y2 = feta2(ibin,iview,lad,iang) |
1723 |
elseif(ncog.eq.3)then |
1724 |
x1 = eta3(ibin-1,iang) |
1725 |
x2 = eta3(ibin,iang) |
1726 |
y1 = feta3(ibin-1,iview,lad,iang) |
1727 |
y2 = feta3(ibin,iview,lad,iang) |
1728 |
elseif(ncog.eq.4)then |
1729 |
x1 = eta4(ibin-1,iang) |
1730 |
x2 = eta4(ibin,iang) |
1731 |
y1 = feta4(ibin-1,iview,lad,iang) |
1732 |
y2 = feta4(ibin,iview,lad,iang) |
1733 |
endif |
1734 |
|
1735 |
func = func * (y2-y1)/(x2-x1) |
1736 |
|
1737 |
risetatheor = func |
1738 |
|
1739 |
return |
1740 |
end |
1741 |
|
1742 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1743 |
|
1744 |
FUNCTION risxeta2(x) |
1745 |
|
1746 |
DOUBLE PRECISION HQUADF ! EM GCC4.7 |
1747 |
DOUBLE PRECISION V( 1) |
1748 |
INTEGER NPAR, NDIM, IMQFUN, I, J |
1749 |
DOUBLE PRECISION HQDJ, VV, VCONST |
1750 |
DOUBLE PRECISION SIGVMI( 1), SIGVT( 1) |
1751 |
DOUBLE PRECISION SIGV( 18, 1) |
1752 |
DOUBLE PRECISION SIGDEL( 18) |
1753 |
DOUBLE PRECISION SIGA( 18) |
1754 |
DATA NPAR, NDIM, IMQFUN / 18, 1, 1/ |
1755 |
DATA VCONST / 0.000000000000 / |
1756 |
DATA SIGVMI / -20.50000000000 / |
1757 |
DATA SIGVT / 41.00000000000 / |
1758 |
DATA SIGV / 0.6097560748458E-01 |
1759 |
+, 0.1097560971975 |
1760 |
+, 0.1341463327408 |
1761 |
+, 0.1829268187284 |
1762 |
+, 0.2317073047161 |
1763 |
+, 0.4268292486668 |
1764 |
+, 0.4756097495556 |
1765 |
+, 0.4999999701977 |
1766 |
+, 0.5243902206421 |
1767 |
+, 0.5731707215309 |
1768 |
+, 0.7682926654816 |
1769 |
+, 0.8170731663704 |
1770 |
+, 0.8658536076546 |
1771 |
+, 0.8902438879013 |
1772 |
+, 0.9390243291855 |
1773 |
+, 0.000000000000 |
1774 |
+, 1.000000000000 |
1775 |
+, 0.3658536374569 |
1776 |
+/ |
1777 |
DATA SIGDEL / 0.4878048598766E-01 |
1778 |
+, 0.4878048598766E-01 |
1779 |
+, 0.4878048598766E-01 |
1780 |
+, 0.4878048598766E-01 |
1781 |
+, 0.4878048598766E-01 |
1782 |
+, 0.4878048598766E-01 |
1783 |
+, 0.4878048598766E-01 |
1784 |
+, 0.4878048598766E-01 |
1785 |
+, 0.4878048598766E-01 |
1786 |
+, 0.4878048598766E-01 |
1787 |
+, 0.4878048598766E-01 |
1788 |
+, 0.4878048598766E-01 |
1789 |
+, 0.4878048598766E-01 |
1790 |
+, 0.4878048598766E-01 |
1791 |
+, 0.4878048598766E-01 |
1792 |
+, 0.1999999994950E-05 |
1793 |
+, 0.1999999994950E-05 |
1794 |
+, 0.9756097197533E-01 |
1795 |
+/ |
1796 |
DATA SIGA / 51.65899502118 |
1797 |
+, -150.4733247841 |
1798 |
+, 143.0468613786 |
1799 |
+, -16.56096738997 |
1800 |
+, 5.149319798083 |
1801 |
+, 21.57149712673 |
1802 |
+, -39.46652322782 |
1803 |
+, 47.13181632948 |
1804 |
+, -32.93197883680 |
1805 |
+, 16.38645317092 |
1806 |
+, 1.453688482992 |
1807 |
+, -10.00547244421 |
1808 |
+, 131.3517670587 |
1809 |
+, -140.6351538257 |
1810 |
+, 49.05515749582 |
1811 |
+, -23.00028974788 |
1812 |
+, -22.58470403729 |
1813 |
+, -3.824682486418 |
1814 |
+/ |
1815 |
|
1816 |
V(1)= abs(x) |
1817 |
if(V(1).gt.20.)V(1)=20. |
1818 |
|
1819 |
HQUADF = 0. |
1820 |
DO 20 J = 1, NPAR |
1821 |
HQDJ = 0. |
1822 |
DO 10 I = 1, NDIM |
1823 |
VV = (V (I) - SIGVMI (I)) / SIGVT (I) |
1824 |
HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2 |
1825 |
10 CONTINUE |
1826 |
HQDJ = HQDJ + SIGDEL (J) ** 2 |
1827 |
HQDJ = SQRT (HQDJ) |
1828 |
HQUADF = HQUADF + SIGA (J) * HQDJ |
1829 |
20 CONTINUE |
1830 |
IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF) |
1831 |
|
1832 |
risxeta2=REAL(HQUADF* 1e-4) ! EM GCC4.7 all computation here are done in double precision but the function returns REAL since it is undefined and it is used in the code in single precision variables |
1833 |
|
1834 |
END |
1835 |
|
1836 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1837 |
FUNCTION risxeta3(x) |
1838 |
DOUBLE PRECISION HQUADF ! EM GCC4.7 |
1839 |
DOUBLE PRECISION V( 1) |
1840 |
INTEGER NPAR, NDIM, IMQFUN, I, J |
1841 |
DOUBLE PRECISION HQDJ, VV, VCONST |
1842 |
DOUBLE PRECISION SIGVMI( 1), SIGVT( 1) |
1843 |
DOUBLE PRECISION SIGV( 18, 1) |
1844 |
DOUBLE PRECISION SIGDEL( 18) |
1845 |
DOUBLE PRECISION SIGA( 18) |
1846 |
DATA NPAR, NDIM, IMQFUN / 18, 1, 1/ |
1847 |
DATA VCONST / 0.000000000000 / |
1848 |
DATA SIGVMI / -20.50000000000 / |
1849 |
DATA SIGVT / 41.00000000000 / |
1850 |
DATA SIGV / 0.6097560748458E-01 |
1851 |
+, 0.1097560971975 |
1852 |
+, 0.1341463327408 |
1853 |
+, 0.1829268187284 |
1854 |
+, 0.2317073047161 |
1855 |
+, 0.4756097495556 |
1856 |
+, 0.4999999701977 |
1857 |
+, 0.5243902206421 |
1858 |
+, 0.7682926654816 |
1859 |
+, 0.8170731663704 |
1860 |
+, 0.8658536076546 |
1861 |
+, 0.8902438879013 |
1862 |
+, 0.9390243291855 |
1863 |
+, 0.000000000000 |
1864 |
+, 1.000000000000 |
1865 |
+, 0.3658536374569 |
1866 |
+, 0.4146341383457 |
1867 |
+, 0.6097560524940 |
1868 |
+/ |
1869 |
DATA SIGDEL / 0.4878048598766E-01 |
1870 |
+, 0.4878048598766E-01 |
1871 |
+, 0.4878048598766E-01 |
1872 |
+, 0.4878048598766E-01 |
1873 |
+, 0.4878048598766E-01 |
1874 |
+, 0.4878048598766E-01 |
1875 |
+, 0.4878048598766E-01 |
1876 |
+, 0.4878048598766E-01 |
1877 |
+, 0.4878048598766E-01 |
1878 |
+, 0.4878048598766E-01 |
1879 |
+, 0.4878048598766E-01 |
1880 |
+, 0.4878048598766E-01 |
1881 |
+, 0.4878048598766E-01 |
1882 |
+, 0.1999999994950E-05 |
1883 |
+, 0.1999999994950E-05 |
1884 |
+, 0.9756097197533E-01 |
1885 |
+, 0.9756097197533E-01 |
1886 |
+, 0.9756097197533E-01 |
1887 |
+/ |
1888 |
DATA SIGA / 55.18284054458 |
1889 |
+, -160.3358431242 |
1890 |
+, 144.6939185763 |
1891 |
+, -20.45200854118 |
1892 |
+, 5.223570087108 |
1893 |
+,-0.4171476953945 |
1894 |
+, -27.67911907462 |
1895 |
+, 17.70327157495 |
1896 |
+, -1.867165491707 |
1897 |
+, -8.884458169181 |
1898 |
+, 124.3526608791 |
1899 |
+, -143.3309398345 |
1900 |
+, 50.80345027122 |
1901 |
+, -16.44454904415 |
1902 |
+, -15.73785568450 |
1903 |
+, -22.71810502561 |
1904 |
+, 36.86170101430 |
1905 |
+, 2.437918198452 |
1906 |
+/ |
1907 |
|
1908 |
V(1) = abs(x) |
1909 |
if(V(1).gt.20.)V(1)=20. |
1910 |
|
1911 |
HQUADF = 0. |
1912 |
DO 20 J = 1, NPAR |
1913 |
HQDJ = 0. |
1914 |
DO 10 I = 1, NDIM |
1915 |
VV = (V (I) - SIGVMI (I)) / SIGVT (I) |
1916 |
HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2 |
1917 |
10 CONTINUE |
1918 |
HQDJ = HQDJ + SIGDEL (J) ** 2 |
1919 |
HQDJ = SQRT (HQDJ) |
1920 |
HQUADF = HQUADF + SIGA (J) * HQDJ |
1921 |
20 CONTINUE |
1922 |
IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF) |
1923 |
|
1924 |
risxeta3 = REAL(HQUADF* 1e-4) ! EM GCC4.7 all computation here are done in double precision but the function returns REAL since it is undefined and it is used in the code in single precision variables |
1925 |
|
1926 |
END |
1927 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
1928 |
FUNCTION risxeta4(x) |
1929 |
DOUBLE PRECISION HQUADF ! EM GCC4.7 |
1930 |
DOUBLE PRECISION V( 1) |
1931 |
INTEGER NPAR, NDIM, IMQFUN, I, J |
1932 |
DOUBLE PRECISION HQDJ, VV, VCONST |
1933 |
DOUBLE PRECISION SIGVMI( 1), SIGVT( 1) |
1934 |
DOUBLE PRECISION SIGV( 18, 1) |
1935 |
DOUBLE PRECISION SIGDEL( 18) |
1936 |
DOUBLE PRECISION SIGA( 18) |
1937 |
DATA NPAR, NDIM, IMQFUN / 18, 1, 1/ |
1938 |
DATA VCONST / 0.000000000000 / |
1939 |
DATA SIGVMI / -20.50000000000 / |
1940 |
DATA SIGVT / 41.00000000000 / |
1941 |
DATA SIGV / 0.3658536449075E-01 |
1942 |
+, 0.6097560748458E-01 |
1943 |
+, 0.1097560971975 |
1944 |
+, 0.1341463327408 |
1945 |
+, 0.4756097495556 |
1946 |
+, 0.5243902206421 |
1947 |
+, 0.8658536076546 |
1948 |
+, 0.8902438879013 |
1949 |
+, 0.9390243291855 |
1950 |
+, 0.9634146094322 |
1951 |
+, 0.000000000000 |
1952 |
+, 1.000000000000 |
1953 |
+, 0.3658536374569 |
1954 |
+, 0.4146341383457 |
1955 |
+, 0.6097560524940 |
1956 |
+, 0.6585365533829 |
1957 |
+, 0.7560975551605 |
1958 |
+, 0.2439024299383 |
1959 |
+/ |
1960 |
DATA SIGDEL / 0.4878048598766E-01 |
1961 |
+, 0.4878048598766E-01 |
1962 |
+, 0.4878048598766E-01 |
1963 |
+, 0.4878048598766E-01 |
1964 |
+, 0.4878048598766E-01 |
1965 |
+, 0.4878048598766E-01 |
1966 |
+, 0.4878048598766E-01 |
1967 |
+, 0.4878048598766E-01 |
1968 |
+, 0.4878048598766E-01 |
1969 |
+, 0.4878048598766E-01 |
1970 |
+, 0.1999999994950E-05 |
1971 |
+, 0.1999999994950E-05 |
1972 |
+, 0.9756097197533E-01 |
1973 |
+, 0.9756097197533E-01 |
1974 |
+, 0.9756097197533E-01 |
1975 |
+, 0.9756097197533E-01 |
1976 |
+, 0.9756097197533E-01 |
1977 |
+, 0.1951219439507 |
1978 |
+/ |
1979 |
DATA SIGA / -43.61551887895 |
1980 |
+, 57.88466995373 |
1981 |
+, -92.04113299504 |
1982 |
+, 74.08166649890 |
1983 |
+, -9.768686062558 |
1984 |
+, -4.304496875334 |
1985 |
+, 72.62237333937 |
1986 |
+, -91.21920840618 |
1987 |
+, 56.75519978630 |
1988 |
+, -43.21115751243 |
1989 |
+, 12.79984505413 |
1990 |
+, 12.10074868595 |
1991 |
+, -6.238587250860 |
1992 |
+, 23.43447356326 |
1993 |
+, 17.98221401495 |
1994 |
+, -7.980332610975 |
1995 |
+, -3.426733307051 |
1996 |
+, -8.683439558751 |
1997 |
+/ |
1998 |
|
1999 |
V(1)=abs(x) |
2000 |
if(V(1).gt.20.)V(1)=20. |
2001 |
|
2002 |
HQUADF = 0. |
2003 |
DO 20 J = 1, NPAR |
2004 |
HQDJ = 0. |
2005 |
DO 10 I = 1, NDIM |
2006 |
VV = (V (I) - SIGVMI (I)) / SIGVT (I) |
2007 |
HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2 |
2008 |
10 CONTINUE |
2009 |
HQDJ = HQDJ + SIGDEL (J) ** 2 |
2010 |
HQDJ = SQRT (HQDJ) |
2011 |
HQUADF = HQUADF + SIGA (J) * HQDJ |
2012 |
20 CONTINUE |
2013 |
IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF) |
2014 |
|
2015 |
risxeta4=REAL(HQUADF* 1e-4) ! EM GCC4.7 all computation here are done in double precision but the function returns REAL since it is undefined and it is used in the code in single precision variables |
2016 |
|
2017 |
END |
2018 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
2019 |
FUNCTION risyeta2(x) |
2020 |
DOUBLE PRECISION HQUADF ! EM GCC4.7 |
2021 |
DOUBLE PRECISION V( 1) |
2022 |
INTEGER NPAR, NDIM, IMQFUN, I, J |
2023 |
DOUBLE PRECISION HQDJ, VV, VCONST |
2024 |
DOUBLE PRECISION SIGVMI( 1), SIGVT( 1) |
2025 |
DOUBLE PRECISION SIGV( 12, 1) |
2026 |
DOUBLE PRECISION SIGDEL( 12) |
2027 |
DOUBLE PRECISION SIGA( 12) |
2028 |
DATA NPAR, NDIM, IMQFUN / 12, 1, 1/ |
2029 |
DATA VCONST / 0.000000000000 / |
2030 |
DATA SIGVMI / -20.50000000000 / |
2031 |
DATA SIGVT / 41.00000000000 / |
2032 |
DATA SIGV / 0.1585365831852 |
2033 |
+, 0.4024389982224 |
2034 |
+, 0.4756097495556 |
2035 |
+, 0.5243902206421 |
2036 |
+, 0.5975609421730 |
2037 |
+, 0.8414633870125 |
2038 |
+, 0.000000000000 |
2039 |
+, 1.000000000000 |
2040 |
+, 0.2682926654816 |
2041 |
+, 0.3170731663704 |
2042 |
+, 0.7073170542717 |
2043 |
+, 0.7560975551605 |
2044 |
+/ |
2045 |
DATA SIGDEL / 0.4878048598766E-01 |
2046 |
+, 0.4878048598766E-01 |
2047 |
+, 0.4878048598766E-01 |
2048 |
+, 0.4878048598766E-01 |
2049 |
+, 0.4878048598766E-01 |
2050 |
+, 0.4878048598766E-01 |
2051 |
+, 0.1999999994950E-05 |
2052 |
+, 0.1999999994950E-05 |
2053 |
+, 0.9756097197533E-01 |
2054 |
+, 0.9756097197533E-01 |
2055 |
+, 0.9756097197533E-01 |
2056 |
+, 0.9756097197533E-01 |
2057 |
+/ |
2058 |
DATA SIGA / 14.57433603529 |
2059 |
+, -15.93532436156 |
2060 |
+, -13.24628335221 |
2061 |
+, -14.31193855410 |
2062 |
+, -12.67339684488 |
2063 |
+, 18.19876051780 |
2064 |
+, -5.270493486725 |
2065 |
+, -5.107670990828 |
2066 |
+, -9.553262933901 |
2067 |
+, 43.34150727448 |
2068 |
+, 55.91366786432 |
2069 |
+, -29.38037318563 |
2070 |
+/ |
2071 |
|
2072 |
v(1)= abs(x) |
2073 |
if(V(1).gt.20.)V(1)=20. |
2074 |
|
2075 |
HQUADF = 0. |
2076 |
DO 20 J = 1, NPAR |
2077 |
HQDJ = 0. |
2078 |
DO 10 I = 1, NDIM |
2079 |
VV = (V (I) - SIGVMI (I)) / SIGVT (I) |
2080 |
HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2 |
2081 |
10 CONTINUE |
2082 |
HQDJ = HQDJ + SIGDEL (J) ** 2 |
2083 |
HQDJ = SQRT (HQDJ) |
2084 |
HQUADF = HQUADF + SIGA (J) * HQDJ |
2085 |
20 CONTINUE |
2086 |
IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF) |
2087 |
|
2088 |
risyeta2=REAL(HQUADF* 1e-4) ! EM GCC4.7 all computation here are done in double precision but the function returns REAL since it is undefined and it is used in the code in single precision variables |
2089 |
|
2090 |
END |
2091 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
2092 |
|
2093 |
FUNCTION risy_cog(x) |
2094 |
DOUBLE PRECISION HQUADF ! EM GCC4.7 |
2095 |
DOUBLE PRECISION V( 1) |
2096 |
INTEGER NPAR, NDIM, IMQFUN, I, J |
2097 |
DOUBLE PRECISION HQDJ, VV, VCONST |
2098 |
DOUBLE PRECISION SIGVMI( 1), SIGVT( 1) |
2099 |
DOUBLE PRECISION SIGV( 10, 1) |
2100 |
DOUBLE PRECISION SIGDEL( 10) |
2101 |
DOUBLE PRECISION SIGA( 10) |
2102 |
DATA NPAR, NDIM, IMQFUN / 10, 1, 1/ |
2103 |
DATA VCONST / 0.000000000000 / |
2104 |
DATA SIGVMI / -20.50000000000 / |
2105 |
DATA SIGVT / 41.00000000000 / |
2106 |
DATA SIGV / 0.1585365831852 |
2107 |
+, 0.8414633870125 |
2108 |
+, 0.000000000000 |
2109 |
+, 1.000000000000 |
2110 |
+, 0.4634146094322 |
2111 |
+, 0.5121951103210 |
2112 |
+, 0.5609756112099 |
2113 |
+, 0.6585365533829 |
2114 |
+, 0.7073170542717 |
2115 |
+, 0.3414633870125 |
2116 |
+/ |
2117 |
DATA SIGDEL / 0.4878048598766E-01 |
2118 |
+, 0.4878048598766E-01 |
2119 |
+, 0.1999999994950E-05 |
2120 |
+, 0.1999999994950E-05 |
2121 |
+, 0.9756097197533E-01 |
2122 |
+, 0.9756097197533E-01 |
2123 |
+, 0.9756097197533E-01 |
2124 |
+, 0.9756097197533E-01 |
2125 |
+, 0.9756097197533E-01 |
2126 |
+, 0.1951219439507 |
2127 |
+/ |
2128 |
DATA SIGA / 23.73833445988 |
2129 |
+, 24.10182100013 |
2130 |
+, 1.865894323190 |
2131 |
+, 1.706006262931 |
2132 |
+, -1.075607857202 |
2133 |
+, -22.11489493403 |
2134 |
+, 1.663100707801 |
2135 |
+, 4.089852595440 |
2136 |
+, -4.314993873697 |
2137 |
+, -2.174479487744 |
2138 |
+/ |
2139 |
|
2140 |
V(1)=abs(x) |
2141 |
if(V(1).gt.20.)V(1)=20. |
2142 |
|
2143 |
HQUADF = 0. |
2144 |
DO 20 J = 1, NPAR |
2145 |
HQDJ = 0. |
2146 |
DO 10 I = 1, NDIM |
2147 |
VV = (V (I) - SIGVMI (I)) / SIGVT (I) |
2148 |
HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2 |
2149 |
10 CONTINUE |
2150 |
HQDJ = HQDJ + SIGDEL (J) ** 2 |
2151 |
HQDJ = SQRT (HQDJ) |
2152 |
HQUADF = HQUADF + SIGA (J) * HQDJ |
2153 |
20 CONTINUE |
2154 |
IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF) |
2155 |
|
2156 |
risy_cog=REAL(HQUADF* 1e-4) ! EM GCC4.7 all computation here are done in double precision but the function returns REAL since it is undefined and it is used in the code in single precision variables |
2157 |
|
2158 |
END |
2159 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
2160 |
FUNCTION risx_cog(x) |
2161 |
DOUBLE PRECISION HQUADF ! EM GCC4.7 |
2162 |
DOUBLE PRECISION V( 1) |
2163 |
INTEGER NPAR, NDIM, IMQFUN, I, J |
2164 |
DOUBLE PRECISION HQDJ, VV, VCONST |
2165 |
DOUBLE PRECISION SIGVMI( 1), SIGVT( 1) |
2166 |
DOUBLE PRECISION SIGV( 15, 1) |
2167 |
DOUBLE PRECISION SIGDEL( 15) |
2168 |
DOUBLE PRECISION SIGA( 15) |
2169 |
DATA NPAR, NDIM, IMQFUN / 15, 1, 1/ |
2170 |
DATA VCONST / 0.000000000000 / |
2171 |
DATA SIGVMI / -20.50000000000 / |
2172 |
DATA SIGVT / 41.00000000000 / |
2173 |
DATA SIGV / 0.6097560748458E-01 |
2174 |
+, 0.8536584675312E-01 |
2175 |
+, 0.1341463327408 |
2176 |
+, 0.2317073047161 |
2177 |
+, 0.2804878056049 |
2178 |
+, 0.3780487775803 |
2179 |
+, 0.6219512224197 |
2180 |
+, 0.7195121645927 |
2181 |
+, 0.7682926654816 |
2182 |
+, 0.8658536076546 |
2183 |
+, 0.9146341085434 |
2184 |
+, 0.9390243291855 |
2185 |
+, 0.000000000000 |
2186 |
+, 1.000000000000 |
2187 |
+, 0.5121951103210 |
2188 |
+/ |
2189 |
DATA SIGDEL / 0.4878048598766E-01 |
2190 |
+, 0.4878048598766E-01 |
2191 |
+, 0.4878048598766E-01 |
2192 |
+, 0.4878048598766E-01 |
2193 |
+, 0.4878048598766E-01 |
2194 |
+, 0.4878048598766E-01 |
2195 |
+, 0.4878048598766E-01 |
2196 |
+, 0.4878048598766E-01 |
2197 |
+, 0.4878048598766E-01 |
2198 |
+, 0.4878048598766E-01 |
2199 |
+, 0.4878048598766E-01 |
2200 |
+, 0.4878048598766E-01 |
2201 |
+, 0.1999999994950E-05 |
2202 |
+, 0.1999999994950E-05 |
2203 |
+, 0.9756097197533E-01 |
2204 |
+/ |
2205 |
DATA SIGA / 31.95672945139 |
2206 |
+, -34.23286209245 |
2207 |
+, -6.298459168211 |
2208 |
+, 10.98847700545 |
2209 |
+,-0.3052213535054 |
2210 |
+, 13.10517991464 |
2211 |
+, 15.60290821679 |
2212 |
+, -1.956118448507 |
2213 |
+, 12.41453816720 |
2214 |
+, -7.354056408553 |
2215 |
+, -32.32512668778 |
2216 |
+, 30.61116178966 |
2217 |
+, 1.418505329236 |
2218 |
+, 1.583492573619 |
2219 |
+, -18.48799977042 |
2220 |
+/ |
2221 |
|
2222 |
V(1)=abs(x) |
2223 |
if(V(1).gt.20.)V(1)=20. |
2224 |
|
2225 |
HQUADF = 0. |
2226 |
DO 20 J = 1, NPAR |
2227 |
HQDJ = 0. |
2228 |
DO 10 I = 1, NDIM |
2229 |
VV = (V (I) - SIGVMI (I)) / SIGVT (I) |
2230 |
HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2 |
2231 |
10 CONTINUE |
2232 |
HQDJ = HQDJ + SIGDEL (J) ** 2 |
2233 |
HQDJ = SQRT (HQDJ) |
2234 |
HQUADF = HQUADF + SIGA (J) * HQDJ |
2235 |
20 CONTINUE |
2236 |
IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF) |
2237 |
|
2238 |
risx_cog = REAL(HQUADF * 1e-4) ! EM GCC4.7 all computation here are done in double precision but the function returns REAL since it is undefined and it is used in the code in single precision variables |
2239 |
|
2240 |
END |
2241 |
|
2242 |
|
2243 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
2244 |
real function pfacorr(ic,angle) |
2245 |
*-------------------------------------------------------------- |
2246 |
* this function returns the landi correction for this cluster |
2247 |
*-------------------------------------------------------------- |
2248 |
include 'commontracker.f' |
2249 |
include 'calib.f' |
2250 |
include 'level1.f' |
2251 |
|
2252 |
real angle |
2253 |
integer iview,lad |
2254 |
|
2255 |
iview = VIEW(ic) |
2256 |
lad = nld(MAXS(ic),VIEW(ic)) |
2257 |
|
2258 |
* find angular bin |
2259 |
* (in futuro possiamo pensare di interpolare anche sull'angolo) |
2260 |
do iang=1,nangbin |
2261 |
if(angL(iang).lt.angle.and.angR(iang).ge.angle)then |
2262 |
iangle=iang |
2263 |
goto 98 |
2264 |
endif |
2265 |
enddo |
2266 |
if(DEBUG.eq.1) |
2267 |
$ print*,'pfacorr *** warning *** angle out of range: ',angle |
2268 |
if(angle.le.angL(1))iang=1 |
2269 |
if(angle.ge.angR(nangbin))iang=nangbin |
2270 |
98 continue !jump here if ok |
2271 |
|
2272 |
pfacorr = fcorr(iview,lad,iang) |
2273 |
|
2274 |
if(DEBUG.eq.1)print*,'LANDI (ic ',ic,' ang',angle,') -->',pfacorr |
2275 |
|
2276 |
|
2277 |
c 100 return |
2278 |
return |
2279 |
end |