| 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 |
|
* real function pfaeta(ic,angle) |
| 12 |
|
* real function pfaetal(ic,angle) |
| 13 |
|
* real function pfaeta2(ic,angle) |
| 14 |
|
* real function pfaeta3(ic,angle) |
| 15 |
|
* real function pfaeta4(ic,angle) |
| 16 |
|
* real function cog(ncog,ic) |
| 17 |
|
* |
| 18 |
|
* real function fbad_cog(ncog,ic) |
| 19 |
|
* real function fbad_eta(ic,angle) |
| 20 |
|
* |
| 21 |
|
* real function riseta(iview,angle) |
| 22 |
|
* FUNCTION risxeta2(x) |
| 23 |
|
* FUNCTION risxeta3(x) |
| 24 |
|
* FUNCTION risxeta4(x) |
| 25 |
|
* FUNCTION risyeta2(x) |
| 26 |
|
* FUNCTION risy_cog(x) |
| 27 |
|
* FUNCTION risx_cog(x) |
| 28 |
|
* |
| 29 |
|
* real function pfacorr(ic,angle) |
| 30 |
|
* |
| 31 |
|
* real function effectiveangle(ang,iview,bbb) |
| 32 |
|
* real function fieldcorr(iview,bbb) |
| 33 |
|
* |
| 34 |
|
* NB - The angle is the "effective angle", which is relative |
| 35 |
|
* to the sensor and it takes into account the magnetic field |
| 36 |
|
* |
| 37 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 38 |
|
|
| 39 |
subroutine idtoc(ipfa,cpfa) |
subroutine idtoc(ipfa,cpfa) |
| 40 |
|
|
| 41 |
integer ipfa |
integer ipfa |
| 42 |
character*4 cpfa |
character*10 cpfa |
| 43 |
|
|
| 44 |
CPFA='COG4' |
CPFA='COG4' |
| 45 |
if(ipfa.eq.0)CPFA='ETA' |
if(ipfa.eq.0)CPFA='ETA' |
| 54 |
if(ipfa.eq.14)CPFA='COG4' |
if(ipfa.eq.14)CPFA='COG4' |
| 55 |
|
|
| 56 |
end |
end |
| 57 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 58 |
|
real function effectiveangle(ang,iview,bbb) |
| 59 |
|
|
| 60 |
|
include 'commontracker.f' |
| 61 |
|
|
| 62 |
|
effectiveangle = 0. |
| 63 |
|
|
| 64 |
|
if(mod(iview,2).eq.0)then |
| 65 |
|
c ================================================= |
| 66 |
|
c X view |
| 67 |
|
c ================================================= |
| 68 |
|
c here bbb is the y component of the m.field |
| 69 |
|
angx = ang |
| 70 |
|
by = bbb |
| 71 |
|
if(iview.eq.12) angx = -1. * ang |
| 72 |
|
if(iview.eq.12) by = -1. * bbb |
| 73 |
|
tgtemp = tan(ang*acos(-1.)/180.) + pmuH_h*by*0.00001 |
| 74 |
|
|
| 75 |
|
elseif(mod(iview,2).eq.1)then |
| 76 |
|
c ================================================= |
| 77 |
|
c Y view |
| 78 |
|
c ================================================= |
| 79 |
|
c here bbb is the x component of the m.filed |
| 80 |
|
angy = ang |
| 81 |
|
bx = bbb |
| 82 |
|
tgtemp = tan(angy*acos(-1.)/180.)+pmuH_e*bx*0.00001 |
| 83 |
|
|
| 84 |
|
endif |
| 85 |
|
effectiveangle = 180.*atan(tgtemp)/acos(-1.) |
| 86 |
|
|
| 87 |
|
return |
| 88 |
|
end |
| 89 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 90 |
* this file contains all subroutines and functions |
real function fieldcorr(iview,bbb) |
| 91 |
* that are needed for position finding algorithms |
|
| 92 |
* |
include 'commontracker.f' |
| 93 |
* |
|
| 94 |
|
fieldcorr = 0. |
| 95 |
|
|
| 96 |
|
if(mod(iview,2).eq.0)then |
| 97 |
|
|
| 98 |
|
c ================================================= |
| 99 |
|
c X view |
| 100 |
|
c ================================================= |
| 101 |
|
c here bbb is the y component of the m.field |
| 102 |
|
by = bbb |
| 103 |
|
if(iview.eq.12) by = -1. * bbb |
| 104 |
|
fieldcorr = -1. * 0.5*pmuH_h*by*0.00001*SiDimZ/pitchX |
| 105 |
|
|
| 106 |
|
elseif(mod(iview,2).eq.1)then |
| 107 |
|
c ================================================= |
| 108 |
|
c Y view |
| 109 |
|
c ================================================= |
| 110 |
|
c here bbb is the x component of the m.filed |
| 111 |
|
bx = bbb |
| 112 |
|
fieldcorr = 0.5*pmuH_e*bx*0.00001*SiDimZ/pitchY |
| 113 |
|
|
| 114 |
|
endif |
| 115 |
|
|
| 116 |
|
return |
| 117 |
|
end |
| 118 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 119 |
|
|
| 120 |
|
subroutine applypfa(PFAtt,ic,ang,corr,res) |
| 121 |
|
*--------------------------------------------------------------- |
| 122 |
|
* this subroutine calculate the coordinate of cluster ic (in |
| 123 |
|
* strip units), relative to the strip with the maximum signal, |
| 124 |
|
* and its spatial resolution (in cm), applying PFAtt. |
| 125 |
|
* ang is the effective angle, relative to the sensor |
| 126 |
|
*--------------------------------------------------------------- |
| 127 |
|
|
| 128 |
|
character*4 PFAtt |
| 129 |
|
include 'commontracker.f' |
| 130 |
|
include 'level1.f' |
| 131 |
|
|
| 132 |
|
corr = 0 |
| 133 |
|
res = 0 |
| 134 |
|
|
| 135 |
|
if(ic.le.0)return |
| 136 |
|
|
| 137 |
|
iview = VIEW(ic) |
| 138 |
|
|
| 139 |
|
if(mod(iview,2).eq.0)then |
| 140 |
|
c ================================================= |
| 141 |
|
c X view |
| 142 |
|
c ================================================= |
| 143 |
|
|
| 144 |
|
res = RESXAV |
| 145 |
|
|
| 146 |
|
if(PFAtt.eq.'COG1')then |
| 147 |
|
|
| 148 |
|
corr = 0 |
| 149 |
|
res = 1e-4*pitchX/sqrt(12.)!!res |
| 150 |
|
|
| 151 |
|
elseif(PFAtt.eq.'COG2')then |
| 152 |
|
|
| 153 |
|
corr = cog(2,ic) |
| 154 |
|
res = risx_cog(abs(ang))!TEMPORANEO |
| 155 |
|
res = res*fbad_cog(2,ic) |
| 156 |
|
|
| 157 |
|
elseif(PFAtt.eq.'COG3')then |
| 158 |
|
|
| 159 |
|
corr = cog(3,ic) |
| 160 |
|
res = risx_cog(abs(ang))!TEMPORANEO |
| 161 |
|
res = res*fbad_cog(3,ic) |
| 162 |
|
|
| 163 |
|
elseif(PFAtt.eq.'COG4')then |
| 164 |
|
|
| 165 |
|
corr = cog(4,ic) |
| 166 |
|
res = risx_cog(abs(ang))!TEMPORANEO |
| 167 |
|
res = res*fbad_cog(4,ic) |
| 168 |
|
|
| 169 |
|
elseif(PFAtt.eq.'ETA2')then |
| 170 |
|
|
| 171 |
|
corr = pfaeta2(ic,ang) |
| 172 |
|
res = risxeta2(abs(ang)) |
| 173 |
|
res = res*fbad_cog(2,ic) |
| 174 |
|
|
| 175 |
|
elseif(PFAtt.eq.'ETA3')then |
| 176 |
|
|
| 177 |
|
corr = pfaeta3(ic,ang) |
| 178 |
|
res = risxeta3(abs(ang)) |
| 179 |
|
res = res*fbad_cog(3,ic) |
| 180 |
|
|
| 181 |
|
elseif(PFAtt.eq.'ETA4')then |
| 182 |
|
|
| 183 |
|
corr = pfaeta4(ic,ang) |
| 184 |
|
res = risxeta4(abs(ang)) |
| 185 |
|
res = res*fbad_cog(4,ic) |
| 186 |
|
|
| 187 |
|
elseif(PFAtt.eq.'ETA')then |
| 188 |
|
|
| 189 |
|
corr = pfaeta(ic,ang) |
| 190 |
|
c res = riseta(ic,ang) |
| 191 |
|
res = riseta(iview,ang) |
| 192 |
|
res = res*fbad_eta(ic,ang) |
| 193 |
|
|
| 194 |
|
elseif(PFAtt.eq.'ETAL')then |
| 195 |
|
|
| 196 |
|
corr = pfaetal(ic,ang) |
| 197 |
|
res = riseta(iview,ang) |
| 198 |
|
res = res*fbad_eta(ic,ang) |
| 199 |
|
|
| 200 |
|
elseif(PFAtt.eq.'COG')then |
| 201 |
|
|
| 202 |
|
corr = cog(0,ic) |
| 203 |
|
res = risx_cog(abs(ang)) |
| 204 |
|
res = res*fbad_cog(0,ic) |
| 205 |
|
|
| 206 |
|
else |
| 207 |
|
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAtt |
| 208 |
|
endif |
| 209 |
|
|
| 210 |
|
|
| 211 |
|
* ====================================== |
| 212 |
|
* temporary patch for saturated clusters |
| 213 |
|
* ====================================== |
| 214 |
|
if( nsatstrips(ic).gt.0 )then |
| 215 |
|
corr = cog(4,ic) |
| 216 |
|
res = pitchX*1e-4/sqrt(12.) |
| 217 |
|
cc cc=cog(4,ic) |
| 218 |
|
c$$$ print*,ic,' *** ',cc |
| 219 |
|
c$$$ print*,ic,' *** ',res |
| 220 |
|
endif |
| 221 |
|
|
| 222 |
|
|
| 223 |
|
elseif(mod(iview,2).eq.1)then |
| 224 |
|
c ================================================= |
| 225 |
|
c Y view |
| 226 |
|
c ================================================= |
| 227 |
|
|
| 228 |
|
res = RESYAV |
| 229 |
|
|
| 230 |
|
if(PFAtt.eq.'COG1')then |
| 231 |
|
|
| 232 |
|
corr = 0 |
| 233 |
|
res = 1e-4*pitchY/sqrt(12.)!res |
| 234 |
|
|
| 235 |
|
elseif(PFAtt.eq.'COG2')then |
| 236 |
|
|
| 237 |
|
corr = cog(2,ic) |
| 238 |
|
res = risy_cog(abs(ang))!TEMPORANEO |
| 239 |
|
res = res*fbad_cog(2,ic) |
| 240 |
|
|
| 241 |
|
elseif(PFAtt.eq.'COG3')then |
| 242 |
|
|
| 243 |
|
corr = cog(3,ic) |
| 244 |
|
res = risy_cog(abs(ang))!TEMPORANEO |
| 245 |
|
res = res*fbad_cog(3,ic) |
| 246 |
|
|
| 247 |
|
elseif(PFAtt.eq.'COG4')then |
| 248 |
|
|
| 249 |
|
corr = cog(4,ic) |
| 250 |
|
res = risy_cog(abs(ang))!TEMPORANEO |
| 251 |
|
res = res*fbad_cog(4,ic) |
| 252 |
|
|
| 253 |
|
elseif(PFAtt.eq.'ETA2')then |
| 254 |
|
|
| 255 |
|
corr = pfaeta2(ic,ang) |
| 256 |
|
res = risyeta2(abs(ang)) |
| 257 |
|
res = res*fbad_cog(2,ic) |
| 258 |
|
|
| 259 |
|
elseif(PFAtt.eq.'ETA3')then |
| 260 |
|
|
| 261 |
|
corr = pfaeta3(ic,ang) |
| 262 |
|
res = res*fbad_cog(3,ic) |
| 263 |
|
|
| 264 |
|
elseif(PFAtt.eq.'ETA4')then |
| 265 |
|
|
| 266 |
|
corr = pfaeta4(ic,ang) |
| 267 |
|
res = res*fbad_cog(4,ic) |
| 268 |
|
|
| 269 |
|
elseif(PFAtt.eq.'ETA')then |
| 270 |
|
|
| 271 |
|
corr = pfaeta(ic,ang) |
| 272 |
|
c res = riseta(ic,ang) |
| 273 |
|
res = riseta(iview,ang) |
| 274 |
|
res = res*fbad_eta(ic,ang) |
| 275 |
|
|
| 276 |
|
elseif(PFAtt.eq.'ETAL')then |
| 277 |
|
|
| 278 |
|
corr = pfaetal(ic,ang) |
| 279 |
|
res = riseta(iview,ang) |
| 280 |
|
res = res*fbad_eta(ic,ang) |
| 281 |
|
|
| 282 |
|
elseif(PFAtt.eq.'COG')then |
| 283 |
|
|
| 284 |
integer function npfastrips(ic,PFA,angle) |
corr = cog(0,ic) |
| 285 |
|
res = risy_cog(abs(ang)) |
| 286 |
|
res = res*fbad_cog(0,ic) |
| 287 |
|
|
| 288 |
|
else |
| 289 |
|
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (y) --> ',PFAtt |
| 290 |
|
endif |
| 291 |
|
|
| 292 |
|
|
| 293 |
|
* ====================================== |
| 294 |
|
* temporary patch for saturated clusters |
| 295 |
|
* ====================================== |
| 296 |
|
if( nsatstrips(ic).gt.0 )then |
| 297 |
|
corr = cog(4,ic) |
| 298 |
|
res = pitchY*1e-4/sqrt(12.) |
| 299 |
|
cc cc=cog(4,ic) |
| 300 |
|
c$$$ print*,ic,' *** ',cc |
| 301 |
|
c$$$ print*,ic,' *** ',res |
| 302 |
|
endif |
| 303 |
|
|
| 304 |
|
endif |
| 305 |
|
end |
| 306 |
|
|
| 307 |
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 308 |
|
integer function npfastrips(ic,angle) |
| 309 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
| 310 |
* thid function returns the number of strips used |
* thid function returns the number of strips used |
| 311 |
* 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. |
| 314 |
include 'level1.f' |
include 'level1.f' |
| 315 |
include 'calib.f' |
include 'calib.f' |
| 316 |
|
|
| 317 |
character*4 usedPFA,PFA |
character*4 usedPFA |
| 318 |
|
|
| 319 |
|
|
| 320 |
|
|
| 321 |
usedPFA=PFA |
call idtoc(pfaid,usedPFA) |
| 322 |
|
|
| 323 |
npfastrips=0 |
npfastrips=-1 |
| 324 |
|
|
| 325 |
if(usedPFA.eq.'COG1')npfastrips=1 |
if(usedPFA.eq.'COG1')npfastrips=1 |
| 326 |
if(usedPFA.eq.'COG2')npfastrips=2 |
if(usedPFA.eq.'COG2')npfastrips=2 |
| 330 |
if(usedPFA.eq.'ETA3')npfastrips=3 |
if(usedPFA.eq.'ETA3')npfastrips=3 |
| 331 |
if(usedPFA.eq.'ETA4')npfastrips=4 |
if(usedPFA.eq.'ETA4')npfastrips=4 |
| 332 |
* ---------------------------------------------------------------- |
* ---------------------------------------------------------------- |
| 333 |
if(usedPFA.eq.'ETA')then |
if(usedPFA.eq.'ETA'.or.usedPFA.eq.'ETAL')then |
| 334 |
c print*,VIEW(ic),angle |
c print*,VIEW(ic),angle |
| 335 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
| 336 |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
| 340 |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
| 341 |
npfastrips=4 |
npfastrips=4 |
| 342 |
else |
else |
| 343 |
npfastrips=4 |
npfastrips=4 !COG4 |
|
c usedPFA='COG' |
|
| 344 |
endif |
endif |
| 345 |
else !X-view |
else !X-view |
| 346 |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
| 350 |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
| 351 |
npfastrips=4 |
npfastrips=4 |
| 352 |
else |
else |
| 353 |
npfastrips=4 |
npfastrips=4 !COG4 |
|
c usedPFA='COG' |
|
| 354 |
endif |
endif |
| 355 |
endif |
endif |
| 356 |
endif |
endif |
| 357 |
* ---------------------------------------------------------------- |
* ---------------------------------------------------------------- |
| 358 |
if(usedPFA.eq.'COG')then |
if(usedPFA.eq.'COG')then |
| 359 |
|
|
| 360 |
iv=VIEW(ic) |
npfastrips=0 |
| 361 |
if(mod(iv,2).eq.1)incut=incuty |
|
| 362 |
if(mod(iv,2).eq.0)incut=incutx |
c$$$ iv=VIEW(ic) |
| 363 |
istart = INDSTART(IC) |
c$$$ if(mod(iv,2).eq.1)incut=incuty |
| 364 |
istop = TOTCLLENGTH |
c$$$ if(mod(iv,2).eq.0)incut=incutx |
| 365 |
if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
c$$$ istart = INDSTART(IC) |
| 366 |
mu = 0 |
c$$$ istop = TOTCLLENGTH |
| 367 |
do i = INDMAX(IC),istart,-1 |
c$$$ if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
| 368 |
ipos = i-INDMAX(ic) |
c$$$ mu = 0 |
| 369 |
cut = incut*CLSIGMA(i) |
c$$$ do i = INDMAX(IC),istart,-1 |
| 370 |
if(CLSIGNAL(i).ge.cut)then |
c$$$ ipos = i-INDMAX(ic) |
| 371 |
mu = mu + 1 |
c$$$ cut = incut*CLSIGMA(i) |
| 372 |
print*,i,mu |
c$$$ if(CLSIGNAL(i).ge.cut)then |
| 373 |
else |
c$$$ mu = mu + 1 |
| 374 |
goto 10 |
c$$$ print*,i,mu |
| 375 |
endif |
c$$$ else |
| 376 |
enddo |
c$$$ goto 10 |
| 377 |
10 continue |
c$$$ endif |
| 378 |
do i = INDMAX(IC)+1,istop |
c$$$ enddo |
| 379 |
ipos = i-INDMAX(ic) |
c$$$ 10 continue |
| 380 |
cut = incut*CLSIGMA(i) |
c$$$ do i = INDMAX(IC)+1,istop |
| 381 |
if(CLSIGNAL(i).ge.cut)then |
c$$$ ipos = i-INDMAX(ic) |
| 382 |
mu = mu + 1 |
c$$$ cut = incut*CLSIGMA(i) |
| 383 |
print*,i,mu |
c$$$ if(CLSIGNAL(i).ge.cut)then |
| 384 |
else |
c$$$ mu = mu + 1 |
| 385 |
goto 20 |
c$$$ print*,i,mu |
| 386 |
endif |
c$$$ else |
| 387 |
enddo |
c$$$ goto 20 |
| 388 |
20 continue |
c$$$ endif |
| 389 |
npfastrips=mu |
c$$$ enddo |
| 390 |
|
c$$$ 20 continue |
| 391 |
|
c$$$ npfastrips=mu |
| 392 |
|
|
| 393 |
endif |
endif |
| 394 |
* ---------------------------------------------------------------- |
* ---------------------------------------------------------------- |
| 395 |
|
|
| 396 |
c print*,pfastrips |
c print*,pfaid,usedPFA,angle,npfastrips |
| 397 |
|
|
| 398 |
return |
return |
| 399 |
end |
end |
| 416 |
|
|
| 417 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
| 418 |
|
|
| 419 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
| 420 |
pfaeta = pfaeta2(ic,angle) |
pfaeta = pfaeta2(ic,angle) |
| 421 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
cc print*,pfaeta2(ic,angle) |
| 422 |
|
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
| 423 |
pfaeta = pfaeta3(ic,angle) |
pfaeta = pfaeta3(ic,angle) |
| 424 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
| 425 |
pfaeta = pfaeta4(ic,angle) |
pfaeta = pfaeta4(ic,angle) |
| 426 |
else |
else |
| 427 |
pfaeta = cog(4,ic) |
pfaeta = cog(4,ic) |
| 429 |
|
|
| 430 |
else !X-view |
else !X-view |
| 431 |
|
|
| 432 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
| 433 |
pfaeta = pfaeta2(ic,angle) |
pfaeta = pfaeta2(ic,angle) |
| 434 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
| 435 |
pfaeta = pfaeta3(ic,angle) |
pfaeta = pfaeta3(ic,angle) |
| 436 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
| 437 |
pfaeta = pfaeta4(ic,angle) |
pfaeta = pfaeta4(ic,angle) |
| 438 |
else |
else |
| 439 |
pfaeta = cog(4,ic) |
pfaeta = cog(4,ic) |
| 458 |
include 'level1.f' |
include 'level1.f' |
| 459 |
include 'calib.f' |
include 'calib.f' |
| 460 |
|
|
| 461 |
pfaeta = 0 |
pfaetal = 0 |
| 462 |
|
|
| 463 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
| 464 |
|
|
| 465 |
if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then |
if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then |
| 466 |
pfaeta = pfaeta2(ic,angle)+pfacorr(ic,angle) |
pfaetal = pfaeta2(ic,angle)+pfacorr(ic,angle) |
| 467 |
elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then |
cc print*,VIEW(ic),angle,pfaeta2(ic,angle),pfacorr(ic,angle) |
| 468 |
pfaeta = pfaeta3(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then |
| 469 |
elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then |
pfaetal = pfaeta3(ic,angle)+pfacorr(ic,angle) |
| 470 |
pfaeta = pfaeta4(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then |
| 471 |
|
pfaetal = pfaeta4(ic,angle)+pfacorr(ic,angle) |
| 472 |
else |
else |
| 473 |
pfaeta = cog(4,ic) |
pfaetal = cog(4,ic) |
| 474 |
endif |
endif |
| 475 |
|
|
| 476 |
else !X-view |
else !X-view |
| 477 |
|
|
| 478 |
if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then |
if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then |
| 479 |
pfaeta = pfaeta2(ic,angle)+pfacorr(ic,angle) |
pfaetal = pfaeta2(ic,angle)+pfacorr(ic,angle) |
| 480 |
elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then |
cc print*,VIEW(ic),angle,pfaeta2(ic,angle),pfacorr(ic,angle) |
| 481 |
pfaeta = pfaeta3(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then |
| 482 |
elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then |
pfaetal = pfaeta3(ic,angle)+pfacorr(ic,angle) |
| 483 |
pfaeta = pfaeta4(ic,angle)+pfacorr(ic,angle) |
elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then |
| 484 |
|
pfaetal = pfaeta4(ic,angle)+pfacorr(ic,angle) |
| 485 |
else |
else |
| 486 |
pfaeta = cog(4,ic) |
pfaetal = cog(4,ic) |
| 487 |
endif |
endif |
| 488 |
|
|
| 489 |
endif |
endif |
| 620 |
goto 98 |
goto 98 |
| 621 |
endif |
endif |
| 622 |
enddo |
enddo |
| 623 |
if(DEBUG) |
if(DEBUG.EQ.1) |
| 624 |
$ print*,'pfaeta2 *** warning *** angle out of range: ',angle |
$ print*,'pfaeta2 *** warning *** angle out of range: ',angle |
| 625 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
| 626 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
| 627 |
98 continue !jump here if ok |
98 continue !jump here if ok |
| 628 |
|
|
| 629 |
|
|
| 696 |
c$$$ cog2=cog2+1. !temp |
c$$$ cog2=cog2+1. !temp |
| 697 |
c$$$ endif |
c$$$ endif |
| 698 |
|
|
| 699 |
if(DEBUG)print*,'ETA2 (ic ',ic,' ang',angle,')' |
if(DEBUG.EQ.1)print*,'ETA2 (ic ',ic,' ang',angle,')' |
| 700 |
$ ,cog2-iadd,' -->',pfaeta2 |
$ ,cog2-iadd,' -->',pfaeta2 |
| 701 |
|
|
| 702 |
|
|
| 738 |
goto 98 |
goto 98 |
| 739 |
endif |
endif |
| 740 |
enddo |
enddo |
| 741 |
if(DEBUG) |
if(DEBUG.EQ.1) |
| 742 |
$ print*,'pfaeta3 *** warning *** angle out of range: ',angle |
$ print*,'pfaeta3 *** warning *** angle out of range: ',angle |
| 743 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
| 744 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
| 745 |
98 continue !jump here if ok |
98 continue !jump here if ok |
| 746 |
|
|
| 747 |
|
|
| 813 |
c$$$ cog2=cog2+1. !temp |
c$$$ cog2=cog2+1. !temp |
| 814 |
c$$$ endif |
c$$$ endif |
| 815 |
|
|
| 816 |
if(DEBUG)print*,'ETA3 (ic ',ic,' ang',angle,')' |
if(DEBUG.EQ.1)print*,'ETA3 (ic ',ic,' ang',angle,')' |
| 817 |
$ ,cog3-iadd,' -->',pfaeta3 |
$ ,cog3-iadd,' -->',pfaeta3 |
| 818 |
|
|
| 819 |
100 return |
100 return |
| 854 |
goto 98 |
goto 98 |
| 855 |
endif |
endif |
| 856 |
enddo |
enddo |
| 857 |
if(DEBUG) |
if(DEBUG.EQ.1) |
| 858 |
$ print*,'pfaeta4 *** warning *** angle out of range: ',angle |
$ print*,'pfaeta4 *** warning *** angle out of range: ',angle |
| 859 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
| 860 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
| 861 |
98 continue !jump here if ok |
98 continue !jump here if ok |
| 862 |
|
|
| 863 |
|
|
| 929 |
c$$$ cog2=cog2+1. !temp |
c$$$ cog2=cog2+1. !temp |
| 930 |
c$$$ endif |
c$$$ endif |
| 931 |
|
|
| 932 |
if(DEBUG)print*,'ETA4 (ic ',ic,' ang',angle,')' |
if(DEBUG.EQ.1)print*,'ETA4 (ic ',ic,' ang',angle,')' |
| 933 |
$ ,cog4-iadd,' -->',pfaeta4 |
$ ,cog4-iadd,' -->',pfaeta4 |
| 934 |
|
|
| 935 |
100 return |
100 return |
| 938 |
|
|
| 939 |
|
|
| 940 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
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 |
|
|
|
|
|
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
| 941 |
real function cog(ncog,ic) |
real function cog(ncog,ic) |
| 942 |
*------------------------------------------------- |
*------------------------------------------------- |
| 943 |
* this function returns |
* this function returns |
| 1002 |
c ============================================================== |
c ============================================================== |
| 1003 |
if(ncog.eq.1)then |
if(ncog.eq.1)then |
| 1004 |
COG = 0. |
COG = 0. |
| 1005 |
if(sr1.gt.sc)cog=1. !NEW |
if(sr1.gt.sc)cog=1. |
| 1006 |
if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. !NEW |
if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. |
| 1007 |
c ============================================================== |
c ============================================================== |
| 1008 |
elseif(ncog.eq.2)then |
elseif(ncog.eq.2)then |
| 1009 |
|
COG = 0. |
| 1010 |
if(sl1.gt.sr1)then |
if(sl1.gt.sr1)then |
| 1011 |
if((sl1+sc).ne.0)COG = -sl1/(sl1+sc) |
if((sl1+sc).ne.0)COG = -sl1/(sl1+sc) |
| 1012 |
elseif(sl1.lt.sr1)then |
elseif(sl1.lt.sr1)then |
| 1013 |
if((sc+sr1).ne.0)COG = sr1/(sc+sr1) |
if((sc+sr1).ne.0)COG = sr1/(sc+sr1) |
| 1014 |
elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then !NEW |
elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then |
| 1015 |
if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1) |
if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1) |
| 1016 |
$ .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) !NEW |
$ .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) |
| 1017 |
if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1) |
if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1) |
| 1018 |
$ .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) !NEW |
$ .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) |
| 1019 |
endif |
endif |
| 1020 |
c if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic) |
c if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic) |
| 1021 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
| 1022 |
c ============================================================== |
c ============================================================== |
| 1023 |
elseif(ncog.eq.3)then |
elseif(ncog.eq.3)then |
| 1024 |
if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1) |
COG = 0 |
| 1025 |
c if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic) |
sss = sc |
| 1026 |
|
if( sl1.ne.-9999. )COG = COG-sl1 |
| 1027 |
|
if( sl1.ne.-9999. )sss = sss+sl1 |
| 1028 |
|
if( sr1.ne.-9999. )COG = COG+sr1 |
| 1029 |
|
if( sr1.ne.-9999. )sss = sss+sr1 |
| 1030 |
|
if(sss.ne.0)COG=COG/sss |
| 1031 |
|
|
| 1032 |
|
c if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1) |
| 1033 |
|
c if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic) |
| 1034 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
c $ ,' : ',sl2,sl1,sc,sr1,sr2 |
| 1035 |
c ============================================================== |
c ============================================================== |
| 1036 |
elseif(ncog.eq.4)then |
elseif(ncog.eq.4)then |
| 1037 |
|
|
| 1038 |
|
COG = 0 |
| 1039 |
|
sss = sc |
| 1040 |
|
if( sl1.ne.-9999. )COG = COG-sl1 |
| 1041 |
|
if( sl1.ne.-9999. )sss = sss+sl1 |
| 1042 |
|
if( sr1.ne.-9999. )COG = COG+sr1 |
| 1043 |
|
if( sr1.ne.-9999. )sss = sss+sr1 |
| 1044 |
if(sl2.gt.sr2)then |
if(sl2.gt.sr2)then |
| 1045 |
if((sl2+sl1+sc+sr1).ne.0) |
if((sl2+sss).ne.0) |
| 1046 |
$ COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) |
$ COG = (COG-2*sl2)/(sl2+sss) |
| 1047 |
elseif(sl2.lt.sr2)then |
elseif(sl2.lt.sr2)then |
| 1048 |
if((sr2+sl1+sc+sr1).ne.0) |
if((sr2+sss).ne.0) |
| 1049 |
$ COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1) |
$ COG = (2*sr2+COG)/(sr2+sss) |
| 1050 |
elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then !NEW |
elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then |
| 1051 |
if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2) |
if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2) |
| 1052 |
$ .and.(sl2+sl1+sc+sr1).ne.0 ) |
$ .and.(sl2+sss).ne.0 ) |
| 1053 |
$ cog = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) !NEW |
$ cog = (cog-2*sl2)/(sl2+sss) |
| 1054 |
if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2) |
if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2) |
| 1055 |
$ .and.(sr2+sl1+sc+sr1).ne.0 ) |
$ .and.(sr2+sss).ne.0 ) |
| 1056 |
$ cog = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1) !NEW |
$ cog = (2*sr2+cog)/(sr2+sss) |
| 1057 |
endif |
endif |
| 1058 |
|
c ============================================================== |
| 1059 |
|
elseif(ncog.eq.5)then |
| 1060 |
|
COG = 0 |
| 1061 |
|
sss = sc |
| 1062 |
|
if( sl1.ne.-9999. )COG = COG-sl1 |
| 1063 |
|
if( sl1.ne.-9999. )sss = sss+sl1 |
| 1064 |
|
if( sr1.ne.-9999. )COG = COG+sr1 |
| 1065 |
|
if( sr1.ne.-9999. )sss = sss+sr1 |
| 1066 |
|
if( sl2.ne.-9999. )COG = COG-2*sl2 |
| 1067 |
|
if( sl2.ne.-9999. )sss = sss+sl2 |
| 1068 |
|
if( sr2.ne.-9999. )COG = COG+2*sr2 |
| 1069 |
|
if( sr2.ne.-9999. )sss = sss+sr2 |
| 1070 |
|
if(sss.ne.0)COG=COG/sss |
| 1071 |
else |
else |
| 1072 |
print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG |
| 1073 |
$ ,' not implemented' |
$ ,' not implemented' |
| 1283 |
SGN = 0. |
SGN = 0. |
| 1284 |
SNU = 0. |
SNU = 0. |
| 1285 |
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 |
|
| 1286 |
|
|
| 1287 |
do i=INDMAX(IC),istart,-1 |
do i=INDMAX(IC),istart,-1 |
| 1288 |
ipos = i-INDMAX(ic) |
ipos = i-INDMAX(ic) |
| 1330 |
end |
end |
| 1331 |
|
|
| 1332 |
|
|
| 1333 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
c$$$*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 1334 |
real function fbad_cog0(ncog,ic) |
c$$$ real function fbad_cog0(ncog,ic) |
| 1335 |
*------------------------------------------------------- |
c$$$*------------------------------------------------------- |
| 1336 |
* this function returns a factor that takes into |
c$$$* this function returns a factor that takes into |
| 1337 |
* account deterioration of the spatial resolution |
c$$$* account deterioration of the spatial resolution |
| 1338 |
* in the case BAD strips are included in the cluster. |
c$$$* in the case BAD strips are included in the cluster. |
| 1339 |
* This factor should multiply the nominal spatial |
c$$$* This factor should multiply the nominal spatial |
| 1340 |
* resolution. |
c$$$* resolution. |
| 1341 |
* |
c$$$* |
| 1342 |
* NB!!! |
c$$$* NB!!! |
| 1343 |
* (this is the old version. It consider only the two |
c$$$* (this is the old version. It consider only the two |
| 1344 |
* strips with the greatest signal. The new one is |
c$$$* strips with the greatest signal. The new one is |
| 1345 |
* fbad_cog(ncog,ic) ) |
c$$$* fbad_cog(ncog,ic) ) |
| 1346 |
* |
c$$$* |
| 1347 |
*------------------------------------------------------- |
c$$$*------------------------------------------------------- |
| 1348 |
|
c$$$ |
| 1349 |
include 'commontracker.f' |
c$$$ include 'commontracker.f' |
| 1350 |
include 'level1.f' |
c$$$ include 'level1.f' |
| 1351 |
include 'calib.f' |
c$$$ include 'calib.f' |
| 1352 |
|
c$$$ |
| 1353 |
* --> signal of the central strip |
c$$$* --> signal of the central strip |
| 1354 |
sc = CLSIGNAL(INDMAX(ic)) !center |
c$$$ sc = CLSIGNAL(INDMAX(ic)) !center |
| 1355 |
|
c$$$ |
| 1356 |
* signal of adjacent strips |
c$$$* signal of adjacent strips |
| 1357 |
* --> left |
c$$$* --> left |
| 1358 |
sl1 = 0 !left 1 |
c$$$ sl1 = 0 !left 1 |
| 1359 |
if( |
c$$$ if( |
| 1360 |
$ (INDMAX(ic)-1).ge.INDSTART(ic) |
c$$$ $ (INDMAX(ic)-1).ge.INDSTART(ic) |
| 1361 |
$ ) |
c$$$ $ ) |
| 1362 |
$ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1)) |
c$$$ $ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1)) |
| 1363 |
|
c$$$ |
| 1364 |
sl2 = 0 !left 2 |
c$$$ sl2 = 0 !left 2 |
| 1365 |
if( |
c$$$ if( |
| 1366 |
$ (INDMAX(ic)-2).ge.INDSTART(ic) |
c$$$ $ (INDMAX(ic)-2).ge.INDSTART(ic) |
| 1367 |
$ ) |
c$$$ $ ) |
| 1368 |
$ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2)) |
c$$$ $ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2)) |
| 1369 |
|
c$$$ |
| 1370 |
* --> right |
c$$$* --> right |
| 1371 |
sr1 = 0 !right 1 |
c$$$ sr1 = 0 !right 1 |
| 1372 |
if( |
c$$$ if( |
| 1373 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
c$$$ $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
| 1374 |
$ .or. |
c$$$ $ .or. |
| 1375 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
c$$$ $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
| 1376 |
$ ) |
c$$$ $ ) |
| 1377 |
$ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1)) |
c$$$ $ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1)) |
| 1378 |
|
c$$$ |
| 1379 |
sr2 = 0 !right 2 |
c$$$ sr2 = 0 !right 2 |
| 1380 |
if( |
c$$$ if( |
| 1381 |
$ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
c$$$ $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
| 1382 |
$ .or. |
c$$$ $ .or. |
| 1383 |
$ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
c$$$ $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
| 1384 |
$ ) |
c$$$ $ ) |
| 1385 |
$ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2)) |
c$$$ $ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2)) |
| 1386 |
|
c$$$ |
| 1387 |
|
c$$$ |
| 1388 |
if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
c$$$ if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
| 1389 |
f = 4. |
c$$$ f = 4. |
| 1390 |
si = 8.4 |
c$$$ si = 8.4 |
| 1391 |
else !X-view |
c$$$ else !X-view |
| 1392 |
f = 6. |
c$$$ f = 6. |
| 1393 |
si = 3.9 |
c$$$ si = 3.9 |
| 1394 |
endif |
c$$$ endif |
| 1395 |
|
c$$$ |
| 1396 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1397 |
f0 = 1 |
c$$$ f0 = 1 |
| 1398 |
f1 = 1 |
c$$$ f1 = 1 |
| 1399 |
f2 = 1 |
c$$$ f2 = 1 |
| 1400 |
f3 = 1 |
c$$$ f3 = 1 |
| 1401 |
if(sl1.gt.sr1.and.sl1.gt.0.)then |
c$$$ if(sl1.gt.sr1.and.sl1.gt.0.)then |
| 1402 |
|
c$$$ |
| 1403 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
| 1404 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f1=f |
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f1=f |
| 1405 |
c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f3=f |
c$$$c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f3=f |
| 1406 |
|
c$$$ |
| 1407 |
if(ncog.eq.2.and.sl1.ne.0)then |
c$$$ if(ncog.eq.2.and.sl1.ne.0)then |
| 1408 |
fbad_cog = (f1**2*sc**2/sl1**2+f0**2)/(sc**2/sl1**2+1.) |
c$$$ fbad_cog = (f1**2*sc**2/sl1**2+f0**2)/(sc**2/sl1**2+1.) |
| 1409 |
elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then |
c$$$ elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then |
| 1410 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1411 |
elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then |
c$$$ elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then |
| 1412 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1413 |
else |
c$$$ else |
| 1414 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1415 |
endif |
c$$$ endif |
| 1416 |
|
c$$$ |
| 1417 |
elseif(sl1.le.sr1.and.sr1.gt.0.)then |
c$$$ elseif(sl1.le.sr1.and.sr1.gt.0.)then |
| 1418 |
|
c$$$ |
| 1419 |
|
c$$$ |
| 1420 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
| 1421 |
if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f1=f |
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f1=f |
| 1422 |
c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f3=f |
c$$$c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f3=f |
| 1423 |
|
c$$$ |
| 1424 |
if(ncog.eq.2.and.sr1.ne.0)then |
c$$$ if(ncog.eq.2.and.sr1.ne.0)then |
| 1425 |
fbad_cog = (f1**2*sc**2/sr1**2+f0**2)/(sc**2/sr1**2+1.) |
c$$$ fbad_cog = (f1**2*sc**2/sr1**2+f0**2)/(sc**2/sr1**2+1.) |
| 1426 |
elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then |
c$$$ elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then |
| 1427 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1428 |
elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then |
c$$$ elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then |
| 1429 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1430 |
else |
c$$$ else |
| 1431 |
fbad_cog = 1. |
c$$$ fbad_cog = 1. |
| 1432 |
endif |
c$$$ endif |
| 1433 |
|
c$$$ |
| 1434 |
endif |
c$$$ endif |
| 1435 |
|
c$$$ |
| 1436 |
fbad_cog0 = sqrt(fbad_cog) |
c$$$ fbad_cog0 = sqrt(fbad_cog) |
| 1437 |
|
c$$$ |
| 1438 |
return |
c$$$ return |
| 1439 |
end |
c$$$ end |
| 1440 |
|
c$$$ |
| 1441 |
|
c$$$ |
| 1442 |
|
c$$$ |
| 1443 |
|
|
| 1444 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 1445 |
|
|
| 1937 |
|
|
| 1938 |
|
|
| 1939 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
| 1940 |
real function pfacorr(ic,angle) !(1) |
real function pfacorr(ic,angle) |
| 1941 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
| 1942 |
* this function returns the landi correction for this cluster |
* this function returns the landi correction for this cluster |
| 1943 |
*-------------------------------------------------------------- |
*-------------------------------------------------------------- |
| 1959 |
goto 98 |
goto 98 |
| 1960 |
endif |
endif |
| 1961 |
enddo |
enddo |
| 1962 |
if(DEBUG) |
if(DEBUG.eq.1) |
| 1963 |
$ print*,'pfacorr *** warning *** angle out of range: ',angle |
$ print*,'pfacorr *** warning *** angle out of range: ',angle |
| 1964 |
if(angle.lt.angL(1))iang=1 |
if(angle.le.angL(1))iang=1 |
| 1965 |
if(angle.gt.angR(nangbin))iang=nangbin |
if(angle.ge.angR(nangbin))iang=nangbin |
| 1966 |
98 continue !jump here if ok |
98 continue !jump here if ok |
| 1967 |
|
|
| 1968 |
pfacorr = fcorr(iview,lad,iang) |
pfacorr = fcorr(iview,lad,iang) |
| 1969 |
|
|
| 1970 |
if(DEBUG)print*,'CORR (ic ',ic,' ang',angle,') -->',pfacorr |
if(DEBUG.eq.1)print*,'CORR (ic ',ic,' ang',angle,') -->',pfacorr |
| 1971 |
|
|
| 1972 |
|
|
| 1973 |
100 return |
100 return |