| 1 |
************************************************************ |
| 2 |
* The following subroutines |
| 3 |
* - track_finding >> hough transform |
| 4 |
* - track_fitting >> bob golden fitting |
| 5 |
* all the procedures to create LEVEL2 data, starting from LEVEL1 data. |
| 6 |
* |
| 7 |
* |
| 8 |
* |
| 9 |
* (This subroutine and all the dependent subroutines |
| 10 |
* will be included in the flight software) |
| 11 |
************************************************************ |
| 12 |
subroutine track_finding(iflag) |
| 13 |
|
| 14 |
include 'commontracker.f' |
| 15 |
include 'level1.f' |
| 16 |
include 'common_momanhough.f' |
| 17 |
include 'common_mech.f' |
| 18 |
include 'common_xyzPAM.f' |
| 19 |
include 'common_mini_2.f' |
| 20 |
include 'calib.f' |
| 21 |
include 'level2.f' |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
c print*,'======================================================' |
| 26 |
c$$$ do ic=1,NCLSTR1 |
| 27 |
c$$$ if(.false. |
| 28 |
c$$$ $ .or.nsatstrips(ic).gt.0 |
| 29 |
c$$$c $ .or.nbadstrips(0,ic).gt.0 |
| 30 |
c$$$c $ .or.nbadstrips(4,ic).gt.0 |
| 31 |
c$$$c $ .or.nbadstrips(3,ic).gt.0 |
| 32 |
c$$$ $ .or..false.)then |
| 33 |
c$$$ print*,'--- cl-',ic,' ------------------------' |
| 34 |
c$$$ istart = INDSTART(IC) |
| 35 |
c$$$ istop = TOTCLLENGTH |
| 36 |
c$$$ if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1 |
| 37 |
c$$$ print*,'ADC ',(CLADC(i),i=istart,istop) |
| 38 |
c$$$ print*,'s/n ',(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
| 39 |
c$$$ print*,'sgnl ',(CLSIGNAL(i),i=istart,istop) |
| 40 |
c$$$ print*,'strip ',(i-INDMAX(ic),i=istart,istop) |
| 41 |
c$$$ print*,'view ',VIEW(ic) |
| 42 |
c$$$ print*,'maxs ',MAXS(ic) |
| 43 |
c$$$ print*,'COG4 ',cog(4,ic) |
| 44 |
c$$$ ff = fbad_cog(4,ic) |
| 45 |
c$$$ print*,'fbad ',ff |
| 46 |
c$$$ print*,(CLBAD(i),i=istart,istop) |
| 47 |
c$$$ bb=nbadstrips(0,ic) |
| 48 |
c$$$ print*,'#BAD (tot)',bb |
| 49 |
c$$$ bb=nbadstrips(4,ic) |
| 50 |
c$$$ print*,'#BAD (4)',bb |
| 51 |
c$$$ bb=nbadstrips(3,ic) |
| 52 |
c$$$ print*,'#BAD (3)',bb |
| 53 |
c$$$ ss=nsatstrips(ic) |
| 54 |
c$$$ print*,'#saturated ',ss |
| 55 |
c$$$ endif |
| 56 |
c$$$ enddo |
| 57 |
|
| 58 |
*------------------------------------------------------------------------------- |
| 59 |
* STEP 1 |
| 60 |
*------------------------------------------------------------------------------- |
| 61 |
* X-Y cluster association |
| 62 |
* |
| 63 |
* Clusters are associated to form COUPLES |
| 64 |
* Clusters not associated in any couple are called SINGLETS |
| 65 |
* |
| 66 |
* Track identification (Hough transform) and fitting is first done on couples. |
| 67 |
* Hence singlets are possibly added to the track. |
| 68 |
* |
| 69 |
* Variables assigned by the routine "cl_to_couples" are those in the |
| 70 |
* common blocks: |
| 71 |
* - common/clusters/cl_good |
| 72 |
* - common/couples/clx,cly,ncp_plane,ncp_tot,cp_useds1,cp_useds2 |
| 73 |
* - common/singlets/ncls,cls,cl_single |
| 74 |
*------------------------------------------------------------------------------- |
| 75 |
*------------------------------------------------------------------------------- |
| 76 |
|
| 77 |
|
| 78 |
call cl_to_couples(iflag) |
| 79 |
if(iflag.eq.1)then !bad event |
| 80 |
goto 880 !go to next event |
| 81 |
endif |
| 82 |
|
| 83 |
*----------------------------------------------------- |
| 84 |
*----------------------------------------------------- |
| 85 |
* HOUGH TRASFORM |
| 86 |
*----------------------------------------------------- |
| 87 |
*----------------------------------------------------- |
| 88 |
|
| 89 |
|
| 90 |
*------------------------------------------------------------------------------- |
| 91 |
* STEP 2 |
| 92 |
*------------------------------------------------------------------------------- |
| 93 |
* |
| 94 |
* Association of couples to form |
| 95 |
* - DOUBLETS in YZ view |
| 96 |
* - TRIPLETS in XZ view |
| 97 |
* |
| 98 |
* Variables assigned by the routine "cp_to_doubtrip" are those in the |
| 99 |
* common blocks: |
| 100 |
* - common/hough_param/ |
| 101 |
* $ alfayz1, !Y0 |
| 102 |
* $ alfayz2, !tg theta-yz |
| 103 |
* $ alfaxz1, !X0 |
| 104 |
* $ alfaxz2, !tg theta-xz |
| 105 |
* $ alfaxz3 !1/r |
| 106 |
* - common/doublets/ndblt,cpyz1,cpyz2 |
| 107 |
* - common/triplets/ntrpt,cpxz1,cpxz2,cpxz3 |
| 108 |
*------------------------------------------------------------------------------- |
| 109 |
*------------------------------------------------------------------------------- |
| 110 |
|
| 111 |
|
| 112 |
call cp_to_doubtrip(iflag) |
| 113 |
if(iflag.eq.1)then !bad event |
| 114 |
goto 880 !go to next event |
| 115 |
endif |
| 116 |
|
| 117 |
|
| 118 |
*------------------------------------------------------------------------------- |
| 119 |
* STEP 3 |
| 120 |
*------------------------------------------------------------------------------- |
| 121 |
* |
| 122 |
* Classification of doublets and triplets to form CLOUDS, |
| 123 |
* according to distance in parameter space. |
| 124 |
* |
| 125 |
* cloud = cluster of points (doublets/triplets) in parameter space |
| 126 |
* |
| 127 |
* |
| 128 |
* |
| 129 |
* Variables assigned by the routine "doub_to_YZcloud" are those in the |
| 130 |
* common blocks: |
| 131 |
* - common/clouds_yz/ |
| 132 |
* $ nclouds_yz |
| 133 |
* $ ,alfayz1_av,alfayz2_av |
| 134 |
* $ ,ptcloud_yz,db_cloud,cpcloud_yz |
| 135 |
* |
| 136 |
* Variables assigned by the routine "trip_to_XZcloud" are those in the |
| 137 |
* common blocks: |
| 138 |
* common/clouds_xz/ |
| 139 |
* $ nclouds_xz xz2_av,alfaxz3_av |
| 140 |
* $ ,ptcloud_xz,tr_cloud,cpcloud_xz |
| 141 |
*------------------------------------------------------------------------------- |
| 142 |
*------------------------------------------------------------------------------- |
| 143 |
* count number of hit planes |
| 144 |
planehit=0 |
| 145 |
do np=1,nplanes |
| 146 |
if(ncp_plane(np).ne.0)then |
| 147 |
planehit=planehit+1 |
| 148 |
endif |
| 149 |
enddo |
| 150 |
if(planehit.lt.3) goto 880 ! exit |
| 151 |
|
| 152 |
nptxz_min=x_min_start |
| 153 |
nplxz_min=x_min_start |
| 154 |
|
| 155 |
nptyz_min=y_min_start |
| 156 |
nplyz_min=y_min_start |
| 157 |
|
| 158 |
cutdistyz=cutystart |
| 159 |
cutdistxz=cutxstart |
| 160 |
|
| 161 |
878 continue |
| 162 |
call doub_to_YZcloud(iflag) |
| 163 |
if(iflag.eq.1)then !bad event |
| 164 |
goto 880 !fill ntp and go to next event |
| 165 |
endif |
| 166 |
if(nclouds_yz.eq.0.and.cutdistyz.lt.maxcuty)then |
| 167 |
if(cutdistyz.lt.maxcuty/2)then |
| 168 |
cutdistyz=cutdistyz+cutystep |
| 169 |
else |
| 170 |
cutdistyz=cutdistyz+(3*cutystep) |
| 171 |
endif |
| 172 |
goto 878 |
| 173 |
endif |
| 174 |
|
| 175 |
if(planehit.eq.3) goto 881 |
| 176 |
|
| 177 |
879 continue |
| 178 |
call trip_to_XZcloud(iflag) |
| 179 |
if(iflag.eq.1)then !bad event |
| 180 |
goto 880 !fill ntp and go to next event |
| 181 |
endif |
| 182 |
|
| 183 |
if(nclouds_xz.eq.0.and.cutdistxz.lt.maxcutx)then |
| 184 |
cutdistxz=cutdistxz+cutxstep |
| 185 |
goto 879 |
| 186 |
endif |
| 187 |
|
| 188 |
|
| 189 |
881 continue |
| 190 |
* if there is at least three planes on the Y view decreases cuts on X view |
| 191 |
if(nclouds_xz.eq.0.and.nclouds_yz.gt.0.and. |
| 192 |
$ nplxz_min.ne.y_min_start)then |
| 193 |
nptxz_min=x_min_step |
| 194 |
nplxz_min=x_min_start-x_min_step |
| 195 |
goto 879 |
| 196 |
endif |
| 197 |
|
| 198 |
880 return |
| 199 |
end |
| 200 |
|
| 201 |
************************************************************ |
| 202 |
|
| 203 |
|
| 204 |
subroutine track_fitting(iflag) |
| 205 |
|
| 206 |
include 'commontracker.f' |
| 207 |
include 'level1.f' |
| 208 |
include 'common_momanhough.f' |
| 209 |
include 'common_mech.f' |
| 210 |
include 'common_xyzPAM.f' |
| 211 |
include 'common_mini_2.f' |
| 212 |
include 'calib.f' |
| 213 |
include 'level2.f' |
| 214 |
|
| 215 |
c include 'momanhough_init.f' |
| 216 |
|
| 217 |
logical FIMAGE ! |
| 218 |
real trackimage(NTRACKSMAX) |
| 219 |
real*8 AL_GUESS(5) |
| 220 |
|
| 221 |
*------------------------------------------------------------------------------- |
| 222 |
* STEP 4 (ITERATED until any other physical track isn't found) |
| 223 |
*------------------------------------------------------------------------------- |
| 224 |
* |
| 225 |
* YZ and XZ clouds are combined in order to obtain the initial guess |
| 226 |
* of the candidate-track parameters. |
| 227 |
* A minimum number of matching couples between YZ and XZ clouds is required. |
| 228 |
* |
| 229 |
* A TRACK CANDIDATE is defined by |
| 230 |
* - the couples resulting from the INTERSECTION of the two clouds, and |
| 231 |
* - the associated track parameters (evaluated by performing a zero-order |
| 232 |
* track fitting) |
| 233 |
* |
| 234 |
* The NTRACKS candidate-track parameters are stored in common block: |
| 235 |
* |
| 236 |
* - common/track_candidates/NTRACKS,AL_STORE |
| 237 |
* $ ,XV_STORE,YV_STORE,ZV_STORE |
| 238 |
* $ ,XM_STORE,YM_STORE,ZM_STORE |
| 239 |
* $ ,RESX_STORE,RESY_STORE |
| 240 |
* $ ,AXV_STORE,AYV_STORE |
| 241 |
* $ ,XGOOD_STORE,YGOOD_STORE |
| 242 |
* $ ,CP_STORE,RCHI2_STORE |
| 243 |
* |
| 244 |
*------------------------------------------------------------------------------- |
| 245 |
*------------------------------------------------------------------------------- |
| 246 |
ntrk=0 !counter of identified physical tracks |
| 247 |
|
| 248 |
11111 continue !<<<<<<< come here when performing a new search |
| 249 |
|
| 250 |
c iflag=0 |
| 251 |
call clouds_to_ctrack(iflag) |
| 252 |
if(iflag.eq.1)then !no candidate tracks found |
| 253 |
goto 880 !fill ntp and go to next event |
| 254 |
endif |
| 255 |
|
| 256 |
FIMAGE=.false. !processing best track (not track image) |
| 257 |
ibest=0 !best track among candidates |
| 258 |
iimage=0 !track image |
| 259 |
* ------------- select the best track ------------- |
| 260 |
c$$$ rchi2best=1000000000. |
| 261 |
c$$$ do i=1,ntracks |
| 262 |
c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. |
| 263 |
c$$$ $ RCHI2_STORE(i).gt.0)then |
| 264 |
c$$$ ibest=i |
| 265 |
c$$$ rchi2best=RCHI2_STORE(i) |
| 266 |
c$$$ endif |
| 267 |
c$$$ enddo |
| 268 |
c$$$ if(ibest.eq.0)goto 880 !>> no good candidates |
| 269 |
|
| 270 |
* ------------------------------------------------------- |
| 271 |
* order track-candidates according to: |
| 272 |
* 1st) decreasing n.points |
| 273 |
* 2nd) increasing chi**2 |
| 274 |
* ------------------------------------------------------- |
| 275 |
rchi2best=1000000000. |
| 276 |
ndofbest=0 |
| 277 |
do i=1,ntracks |
| 278 |
ndof=0 |
| 279 |
do ii=1,nplanes |
| 280 |
ndof=ndof |
| 281 |
$ +int(xgood_store(ii,i)) |
| 282 |
$ +int(ygood_store(ii,i)) |
| 283 |
enddo |
| 284 |
if(ndof.gt.ndofbest)then |
| 285 |
ibest=i |
| 286 |
rchi2best=RCHI2_STORE(i) |
| 287 |
ndofbest=ndof |
| 288 |
elseif(ndof.eq.ndofbest)then |
| 289 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
| 290 |
$ RCHI2_STORE(i).gt.0)then |
| 291 |
ibest=i |
| 292 |
rchi2best=RCHI2_STORE(i) |
| 293 |
ndofbest=ndof |
| 294 |
endif |
| 295 |
endif |
| 296 |
enddo |
| 297 |
|
| 298 |
c$$$ rchi2best=1000000000. |
| 299 |
c$$$ ndofbest=0 !(1) |
| 300 |
c$$$ do i=1,ntracks |
| 301 |
c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. |
| 302 |
c$$$ $ RCHI2_STORE(i).gt.0)then |
| 303 |
c$$$ ndof=0 !(1) |
| 304 |
c$$$ do ii=1,nplanes !(1) |
| 305 |
c$$$ ndof=ndof !(1) |
| 306 |
c$$$ $ +int(xgood_store(ii,i)) !(1) |
| 307 |
c$$$ $ +int(ygood_store(ii,i)) !(1) |
| 308 |
c$$$ enddo !(1) |
| 309 |
c$$$ if(ndof.ge.ndofbest)then !(1) |
| 310 |
c$$$ ibest=i |
| 311 |
c$$$ rchi2best=RCHI2_STORE(i) |
| 312 |
c$$$ ndofbest=ndof !(1) |
| 313 |
c$$$ endif !(1) |
| 314 |
c$$$ endif |
| 315 |
c$$$ enddo |
| 316 |
|
| 317 |
if(ibest.eq.0)goto 880 !>> no good candidates |
| 318 |
*------------------------------------------------------------------------------- |
| 319 |
* The best track candidate (ibest) is selected and a new fitting is performed. |
| 320 |
* Previous to this, the track is refined by: |
| 321 |
* - possibly adding new COUPLES or SINGLETS from the missing planes |
| 322 |
* - evaluating the coordinates with improved PFAs |
| 323 |
* ( angle-dependent ETA algorithms ) |
| 324 |
*------------------------------------------------------------------------------- |
| 325 |
|
| 326 |
1212 continue !<<<<< come here to fit track-image |
| 327 |
|
| 328 |
if(.not.FIMAGE)then !processing best candidate |
| 329 |
icand=ibest |
| 330 |
else !processing image |
| 331 |
icand=iimage |
| 332 |
iimage=0 |
| 333 |
endif |
| 334 |
if(icand.eq.0)then |
| 335 |
if(VERBOSE.EQ.1)then |
| 336 |
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
| 337 |
$ ,ibest,iimage |
| 338 |
endif |
| 339 |
return |
| 340 |
endif |
| 341 |
|
| 342 |
* *-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
| 343 |
call refine_track(icand) |
| 344 |
* *-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
| 345 |
|
| 346 |
* ********************************************************** |
| 347 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
| 348 |
* ********************************************************** |
| 349 |
call guess() |
| 350 |
do i=1,5 |
| 351 |
AL_GUESS(i)=AL(i) |
| 352 |
enddo |
| 353 |
c print*,'## guess: ',al |
| 354 |
|
| 355 |
do i=1,5 |
| 356 |
AL(i)=dble(AL_STORE(i,icand)) |
| 357 |
enddo |
| 358 |
|
| 359 |
IDCAND = icand !fitted track-candidate |
| 360 |
ifail=0 !error flag in chi2 computation |
| 361 |
jstep=0 !# minimization steps |
| 362 |
|
| 363 |
iprint=0 |
| 364 |
c if(DEBUG.EQ.1)iprint=1 |
| 365 |
if(VERBOSE.EQ.1)iprint=1 |
| 366 |
if(DEBUG.EQ.1)iprint=2 |
| 367 |
call mini2(jstep,ifail,iprint) |
| 368 |
if(ifail.ne.0) then |
| 369 |
if(VERBOSE.EQ.1)then |
| 370 |
print *, |
| 371 |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
| 372 |
$ ,iev |
| 373 |
|
| 374 |
c$$$ print*,'guess: ',(al_guess(i),i=1,5) |
| 375 |
c$$$ print*,'previous: ',(al_store(i,icand),i=1,5) |
| 376 |
c$$$ print*,'result: ',(al(i),i=1,5) |
| 377 |
c$$$ print*,'xgood ',xgood |
| 378 |
c$$$ print*,'ygood ',ygood |
| 379 |
c$$$ print*,'----------------------------------------------' |
| 380 |
endif |
| 381 |
c chi2=-chi2 |
| 382 |
endif |
| 383 |
|
| 384 |
if(DEBUG.EQ.1)then |
| 385 |
print*,'----------------------------- improved track coord' |
| 386 |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
| 387 |
do ip=1,6 |
| 388 |
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
| 389 |
$ ,xm_A(ip),ym_A(ip),xm_B(ip),ym_B(ip) |
| 390 |
$ ,xgood(ip),ygood(ip),resx(ip),resy(ip) |
| 391 |
enddo |
| 392 |
endif |
| 393 |
|
| 394 |
c rchi2=chi2/dble(ndof) |
| 395 |
if(DEBUG.EQ.1)then |
| 396 |
print*,' ' |
| 397 |
print*,'****** SELECTED TRACK *************' |
| 398 |
print*,'# R. chi2 RIG' |
| 399 |
print*,' --- ',chi2,' --- ' |
| 400 |
$ ,1./abs(AL(5)) |
| 401 |
print*,'***********************************' |
| 402 |
endif |
| 403 |
* ********************************************************** |
| 404 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
| 405 |
* ********************************************************** |
| 406 |
|
| 407 |
|
| 408 |
* ------------- search if the track has an IMAGE ------------- |
| 409 |
* ------------- (also this is stored ) ------------- |
| 410 |
if(FIMAGE)goto 122 !>>> jump! (this is already an image) |
| 411 |
|
| 412 |
* ----------------------------------------------------- |
| 413 |
* first check if the track is ambiguous |
| 414 |
* ----------------------------------------------------- |
| 415 |
* (modified on august 2007 by ElenaV) |
| 416 |
is1=0 |
| 417 |
do ip=1,NPLANES |
| 418 |
if(SENSOR_STORE(ip,icand).ne.0)then |
| 419 |
is1=SENSOR_STORE(ip,icand) |
| 420 |
if(ip.eq.6)is1=3-is1 !last plane inverted |
| 421 |
endif |
| 422 |
enddo |
| 423 |
if(is1.eq.0)then |
| 424 |
if(WARNING.EQ.1)print*,'** WARNING ** sensor=0' |
| 425 |
goto 122 !jump |
| 426 |
endif |
| 427 |
c print*,'is1 ',is1 |
| 428 |
do ip=1,NPLANES |
| 429 |
is2 = SENSOR_STORE(ip,icand) !sensor |
| 430 |
c print*,'is2 ',is2,' ip ',ip |
| 431 |
if(ip.eq.6.and.is2.ne.0)is2=3-is2 !last plane inverted |
| 432 |
if( |
| 433 |
$ (is1.ne.is2.and.is2.ne.0) |
| 434 |
$ )goto 122 !jump (this track cannot have an image) |
| 435 |
enddo |
| 436 |
if(DEBUG.eq.1)print*,' >>> ambiguous track! ' |
| 437 |
* now search for track-image among track candidates |
| 438 |
c$$$ do i=1,ntracks |
| 439 |
c$$$ iimage=i |
| 440 |
c$$$ do ip=1,nplanes |
| 441 |
c$$$ if( CP_STORE(nplanes-ip+1,icand).ne. |
| 442 |
c$$$ $ -1*CP_STORE(nplanes-ip+1,i).and. |
| 443 |
c$$$ $ CP_STORE(nplanes-ip+1,i).ne.0.and. |
| 444 |
c$$$ $ CP_STORE(nplanes-ip+1,icand).ne.0 )iimage=0 |
| 445 |
c$$$ print*,' track ',i,' CP ',CP_STORE(nplanes-ip+1,i) |
| 446 |
c$$$ $ ,CP_STORE(nplanes-ip+1,icand),iimage |
| 447 |
c$$$ enddo |
| 448 |
c$$$ if( iimage.ne.0.and. |
| 449 |
c$$$c $ RCHI2_STORE(i).le.CHI2MAX.and. |
| 450 |
c$$$c $ RCHI2_STORE(i).gt.0.and. |
| 451 |
c$$$ $ .true.)then |
| 452 |
c$$$ if(DEBUG.EQ.1)print*,'Track candidate ',iimage |
| 453 |
c$$$ $ ,' >>> TRACK IMAGE >>> of' |
| 454 |
c$$$ $ ,ibest |
| 455 |
c$$$ goto 122 !image track found |
| 456 |
c$$$ endif |
| 457 |
c$$$ enddo |
| 458 |
* --------------------------------------------------------------- |
| 459 |
* take the candidate with the greatest number of matching couples |
| 460 |
* if more than one satisfies the requirement, |
| 461 |
* choose the one with more points and lower chi2 |
| 462 |
* --------------------------------------------------------------- |
| 463 |
* count the number of matching couples |
| 464 |
ncpmax = 0 |
| 465 |
iimage = 0 !id of candidate with better matching |
| 466 |
do i=1,ntracks |
| 467 |
ncp=0 |
| 468 |
do ip=1,nplanes |
| 469 |
if(CP_STORE(nplanes-ip+1,icand).ne.0)then |
| 470 |
if( |
| 471 |
$ CP_STORE(nplanes-ip+1,i).ne.0 |
| 472 |
$ .and. |
| 473 |
$ CP_STORE(nplanes-ip+1,icand).eq. |
| 474 |
$ -1*CP_STORE(nplanes-ip+1,i) |
| 475 |
$ )then |
| 476 |
ncp=ncp+1 !ok |
| 477 |
elseif( |
| 478 |
$ CP_STORE(nplanes-ip+1,i).ne.0 |
| 479 |
$ .and. |
| 480 |
$ CP_STORE(nplanes-ip+1,icand).ne. |
| 481 |
$ -1*CP_STORE(nplanes-ip+1,i) |
| 482 |
$ )then |
| 483 |
ncp = 0 |
| 484 |
goto 117 !it is not an image candidate |
| 485 |
else |
| 486 |
|
| 487 |
endif |
| 488 |
endif |
| 489 |
c$$$ print*,' track ',i,' CP ',CP_STORE(nplanes-ip+1,i) |
| 490 |
c$$$ $ ,CP_STORE(nplanes-ip+1,icand),ncp |
| 491 |
enddo |
| 492 |
117 continue |
| 493 |
trackimage(i)=ncp !number of matching couples |
| 494 |
if(ncp>ncpmax)then |
| 495 |
ncpmax=ncp |
| 496 |
iimage=i |
| 497 |
endif |
| 498 |
enddo |
| 499 |
* check if there are more than one image candidates |
| 500 |
ngood=0 |
| 501 |
do i=1,ntracks |
| 502 |
if( ncpmax.ne.0.and.trackimage(i).eq.ncpmax )ngood=ngood+1 |
| 503 |
enddo |
| 504 |
* if there are, choose the best one |
| 505 |
if(ngood.gt.1)then |
| 506 |
* ------------------------------------------------------- |
| 507 |
* order track-candidates according to: |
| 508 |
* 1st) decreasing n.points |
| 509 |
* 2nd) increasing chi**2 |
| 510 |
* ------------------------------------------------------- |
| 511 |
rchi2best=1000000000. |
| 512 |
ndofbest=0 |
| 513 |
do i=1,ntracks |
| 514 |
if( trackimage(i).eq.ncpmax )then |
| 515 |
ndof=0 |
| 516 |
do ii=1,nplanes |
| 517 |
ndof=ndof |
| 518 |
$ +int(xgood_store(ii,i)) |
| 519 |
$ +int(ygood_store(ii,i)) |
| 520 |
enddo |
| 521 |
if(ndof.gt.ndofbest)then |
| 522 |
iimage=i |
| 523 |
rchi2best=RCHI2_STORE(i) |
| 524 |
ndofbest=ndof |
| 525 |
elseif(ndof.eq.ndofbest)then |
| 526 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
| 527 |
$ RCHI2_STORE(i).gt.0)then |
| 528 |
iimage=i |
| 529 |
rchi2best=RCHI2_STORE(i) |
| 530 |
ndofbest=ndof |
| 531 |
endif |
| 532 |
endif |
| 533 |
endif |
| 534 |
enddo |
| 535 |
|
| 536 |
endif |
| 537 |
|
| 538 |
if(DEBUG.EQ.1)print*,'Track candidate ',iimage |
| 539 |
$ ,' >>> TRACK IMAGE >>> of' |
| 540 |
$ ,ibest |
| 541 |
|
| 542 |
122 continue |
| 543 |
|
| 544 |
|
| 545 |
* --- and store the results -------------------------------- |
| 546 |
ntrk = ntrk + 1 !counter of found tracks |
| 547 |
if(.not.FIMAGE |
| 548 |
$ .and.iimage.eq.0) image(ntrk)= 0 |
| 549 |
if(.not.FIMAGE |
| 550 |
$ .and.iimage.ne.0)image(ntrk)=ntrk+1 !this is the image of the next |
| 551 |
if(FIMAGE) image(ntrk)=ntrk-1 !this is the image of the previous |
| 552 |
call fill_level2_tracks(ntrk) !==> good2=.true. |
| 553 |
c print*,'++++++++++ iimage,fimage,ntrk,image ' |
| 554 |
c $ ,iimage,fimage,ntrk,image(ntrk) |
| 555 |
|
| 556 |
if(ntrk.eq.NTRKMAX)then |
| 557 |
if(verbose.eq.1) |
| 558 |
$ print*, |
| 559 |
$ '** warning ** number of identified '// |
| 560 |
$ 'tracks exceeds vector dimension ' |
| 561 |
$ ,'( ',NTRKMAX,' )' |
| 562 |
cc good2=.false. |
| 563 |
goto 880 !fill ntp and go to next event |
| 564 |
endif |
| 565 |
if(iimage.ne.0)then |
| 566 |
FIMAGE=.true. ! |
| 567 |
goto 1212 !>>> fit image-track |
| 568 |
endif |
| 569 |
|
| 570 |
* --- then remove selected clusters (ibest+iimage) from clouds ---- |
| 571 |
call clean_XYclouds(ibest,iflag) |
| 572 |
if(iflag.eq.1)then !bad event |
| 573 |
goto 880 !fill ntp and go to next event |
| 574 |
endif |
| 575 |
|
| 576 |
* ********************************************************** |
| 577 |
* condition to start a new search |
| 578 |
* ********************************************************** |
| 579 |
ixznew=0 |
| 580 |
do ixz=1,nclouds_xz |
| 581 |
if(ptcloud_xz(ixz).ge.nptxz_min)ixznew=1 |
| 582 |
enddo |
| 583 |
iyznew=0 |
| 584 |
do iyz=1,nclouds_yz |
| 585 |
if(ptcloud_yz(iyz).ge.nptyz_min)iyznew=1 |
| 586 |
enddo |
| 587 |
|
| 588 |
if(ixznew.ne.0.and. |
| 589 |
$ iyznew.ne.0.and. |
| 590 |
$ rchi2best.le.CHI2MAX.and. |
| 591 |
c $ rchi2best.lt.15..and. |
| 592 |
$ .true.)then |
| 593 |
if(DEBUG.EQ.1)then |
| 594 |
print*,'***** NEW SEARCH ****' |
| 595 |
endif |
| 596 |
goto 11111 !try new search |
| 597 |
|
| 598 |
endif |
| 599 |
* ********************************************** |
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
880 return |
| 604 |
end |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
************************************************************ |
| 609 |
************************************************************ |
| 610 |
************************************************************ |
| 611 |
************************************************************ |
| 612 |
* |
| 613 |
* This routine provides the coordinates (in cm) in the PAMELA reference system: |
| 614 |
* - of the point associated with a COUPLE ---> (xPAM,yPAM,zPAM) |
| 615 |
* - of the extremes of the segment |
| 616 |
* associated with a SINGLET ---------------> (xPAM_A,yPAM_A,zPAM_A) |
| 617 |
* ---> (xPAM_B,yPAM_B,zPAM_B) |
| 618 |
* |
| 619 |
* It also assigns the spatial resolution to the evaluated coordinates, |
| 620 |
* as a function (in principle) of the multiplicity, the angle, the PFA etc... |
| 621 |
* |
| 622 |
* |
| 623 |
* To call the routine you must pass the arguments: |
| 624 |
* icx - ID of cluster x |
| 625 |
* icy - ID of cluster y |
| 626 |
* sensor - sensor (1,2) |
| 627 |
* PFAx - Position Finding Algorithm in x (COG2,ETA2,...) |
| 628 |
* PFAy - Position Finding Algorithm in y (COG2,ETA2,...) |
| 629 |
* angx - Projected angle in x |
| 630 |
* angy - Projected angle in y |
| 631 |
* bfx - x-component of magnetci field |
| 632 |
* bfy - y-component of magnetic field |
| 633 |
* |
| 634 |
* --------- COUPLES ------------------------------------------------------- |
| 635 |
* The couple defines a point in the space. |
| 636 |
* The coordinates of the point are evaluated as follows: |
| 637 |
* 1 - the corrected coordinates relative to the sensor are evaluated |
| 638 |
* according to the chosen PFA --> (xi,yi,0) |
| 639 |
* 2 - coordinates are rotated and traslated, according to the aligmnet |
| 640 |
* parameters, and expressed in the reference system of the mechanical |
| 641 |
* sensor --> (xrt,yrt,zrt) |
| 642 |
* 3 - coordinates are finally converted to the PAMELA reference system |
| 643 |
* --> (xPAM,yPAM,zPAM) |
| 644 |
* |
| 645 |
* --------- SINGLETS ------------------------------------------------------- |
| 646 |
* Since a coordinate is missing, the singlet defines not a point |
| 647 |
* in the space but a segment AB (parallel to the strips). |
| 648 |
* In this case the routine returns the coordinates in the PAMELA reference |
| 649 |
* system of the two extremes A and B of the segment: |
| 650 |
* --> (xPAM_A,yPAM_A,zPAM_A) |
| 651 |
* --> (xPAM_B,yPAM_B,zPAM_B) |
| 652 |
* |
| 653 |
* ========================================================== |
| 654 |
* |
| 655 |
* The output of the routine is stored in the commons: |
| 656 |
* |
| 657 |
* double precision xPAM,yPAM,zPAM |
| 658 |
* common/coord_xyz_PAM/xPAM,yPAM,zPAM |
| 659 |
* |
| 660 |
* double precision xPAM_A,yPAM_A,zPAM_A |
| 661 |
* double precision xPAM_B,yPAM_B,zPAM_B |
| 662 |
* common/coord_AB_PAM/xPAM_A,yPAM_A,zPAM_A,xPAM_B,yPAM_B,zPAM_B |
| 663 |
* |
| 664 |
* double precision resxPAM,resyPAM |
| 665 |
* common/resolution_PAM/resxPAM,resyPAM |
| 666 |
* |
| 667 |
* (in file common_xyzPAM.f) |
| 668 |
* |
| 669 |
* |
| 670 |
|
| 671 |
subroutine xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 672 |
|
| 673 |
|
| 674 |
include 'commontracker.f' |
| 675 |
include 'level1.f' |
| 676 |
include 'calib.f' |
| 677 |
include 'common_align.f' |
| 678 |
include 'common_mech.f' |
| 679 |
include 'common_xyzPAM.f' |
| 680 |
|
| 681 |
integer icx,icy !X-Y cluster ID |
| 682 |
integer sensor |
| 683 |
integer viewx,viewy |
| 684 |
character*4 PFAx,PFAy !PFA to be used |
| 685 |
real ax,ay !X-Y geometric angle |
| 686 |
real angx,angy !X-Y effective angle |
| 687 |
real bfx,bfy !X-Y b-field components |
| 688 |
|
| 689 |
real stripx,stripy |
| 690 |
|
| 691 |
double precision xrt,yrt,zrt |
| 692 |
double precision xrt_A,yrt_A,zrt_A |
| 693 |
double precision xrt_B,yrt_B,zrt_B |
| 694 |
|
| 695 |
|
| 696 |
parameter (ndivx=30) |
| 697 |
|
| 698 |
|
| 699 |
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
| 700 |
|
| 701 |
resxPAM = 0 |
| 702 |
resyPAM = 0 |
| 703 |
|
| 704 |
xPAM = 0. |
| 705 |
yPAM = 0. |
| 706 |
zPAM = 0. |
| 707 |
xPAM_A = 0. |
| 708 |
yPAM_A = 0. |
| 709 |
zPAM_A = 0. |
| 710 |
xPAM_B = 0. |
| 711 |
yPAM_B = 0. |
| 712 |
zPAM_B = 0. |
| 713 |
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
| 714 |
|
| 715 |
if(sensor.lt.1.or.sensor.gt.2)then |
| 716 |
print*,'xyz_PAM ***ERROR*** wrong input ' |
| 717 |
print*,'sensor ',sensor |
| 718 |
icx=0 |
| 719 |
icy=0 |
| 720 |
endif |
| 721 |
|
| 722 |
* ----------------- |
| 723 |
* CLUSTER X |
| 724 |
* ----------------- |
| 725 |
if(icx.ne.0)then |
| 726 |
|
| 727 |
viewx = VIEW(icx) |
| 728 |
nldx = nld(MAXS(icx),VIEW(icx)) |
| 729 |
nplx = npl(VIEW(icx)) |
| 730 |
resxPAM = RESXAV |
| 731 |
stripx = float(MAXS(icx)) |
| 732 |
|
| 733 |
if( |
| 734 |
$ viewx.lt.1.or. |
| 735 |
$ viewx.gt.12.or. |
| 736 |
$ nldx.lt.1.or. |
| 737 |
$ nldx.gt.3.or. |
| 738 |
$ stripx.lt.1.or. |
| 739 |
$ stripx.gt.3072.or. |
| 740 |
$ .false.)then |
| 741 |
print*,'xyz_PAM ***ERROR*** wrong input ' |
| 742 |
print*,'icx ',icx,'view ',viewx,'nld ',nldx,'strip ',stripx |
| 743 |
icx = 0 |
| 744 |
goto 10 |
| 745 |
endif |
| 746 |
|
| 747 |
* -------------------------- |
| 748 |
* magnetic-field corrections |
| 749 |
* -------------------------- |
| 750 |
angtemp = ax |
| 751 |
bfytemp = bfy |
| 752 |
* ///////////////////////////////// |
| 753 |
* AAAAHHHHHHHH!!!!!!!!!!!!!!!!!!!!! |
| 754 |
* *grvzkkjsdgjhhhgngbn###>:( |
| 755 |
* ///////////////////////////////// |
| 756 |
c if(nplx.eq.6) angtemp = -1. * ax |
| 757 |
c if(nplx.eq.6) bfytemp = -1. * bfy |
| 758 |
if(viewx.eq.12) angtemp = -1. * ax |
| 759 |
if(viewx.eq.12) bfytemp = -1. * bfy |
| 760 |
tgtemp = tan(angtemp*acos(-1.)/180.) + pmuH_h*bfytemp*0.00001 |
| 761 |
angx = 180.*atan(tgtemp)/acos(-1.) |
| 762 |
stripx = stripx - 0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
| 763 |
c$$$ print*,nplx,ax,bfy/10. |
| 764 |
c$$$ print*,angx,0.5*pmuH_h*bfytemp*0.00001*SiDimZ/pitchX |
| 765 |
c$$$ print*,'========================' |
| 766 |
c$$$ if(bfy.ne.0.)print*,viewx,'-x- ' |
| 767 |
c$$$ $ ,bfy,-1*0.5*pmuH_h*bfytemp*0.00001*SiDimZ |
| 768 |
* -------------------------- |
| 769 |
|
| 770 |
c$$$ print*,'--- x-cl ---' |
| 771 |
c$$$ istart = INDSTART(ICX) |
| 772 |
c$$$ istop = TOTCLLENGTH |
| 773 |
c$$$ if(icx.lt.NCLSTR1)istop=INDSTART(ICX+1)-1 |
| 774 |
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
| 775 |
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
| 776 |
c$$$ print*,INDMAX(icx) |
| 777 |
c$$$ print*,cog(4,icx) |
| 778 |
c$$$ print*,fbad_cog(4,icx) |
| 779 |
|
| 780 |
|
| 781 |
if(PFAx.eq.'COG1')then |
| 782 |
|
| 783 |
stripx = stripx |
| 784 |
resxPAM = 1e-4*pitchX/sqrt(12.)!!resxPAM |
| 785 |
|
| 786 |
elseif(PFAx.eq.'COG2')then |
| 787 |
|
| 788 |
stripx = stripx + cog(2,icx) |
| 789 |
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
| 790 |
resxPAM = resxPAM*fbad_cog(2,icx) |
| 791 |
|
| 792 |
elseif(PFAx.eq.'COG3')then |
| 793 |
|
| 794 |
stripx = stripx + cog(3,icx) |
| 795 |
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
| 796 |
resxPAM = resxPAM*fbad_cog(3,icx) |
| 797 |
|
| 798 |
elseif(PFAx.eq.'COG4')then |
| 799 |
|
| 800 |
stripx = stripx + cog(4,icx) |
| 801 |
resxPAM = risx_cog(abs(angx))!TEMPORANEO |
| 802 |
resxPAM = resxPAM*fbad_cog(4,icx) |
| 803 |
|
| 804 |
elseif(PFAx.eq.'ETA2')then |
| 805 |
|
| 806 |
stripx = stripx + pfaeta2(icx,angx) |
| 807 |
resxPAM = risxeta2(abs(angx)) |
| 808 |
resxPAM = resxPAM*fbad_cog(2,icx) |
| 809 |
c$$$ if(DEBUG.EQ.1.and.fbad_cog(2,icx).ne.1) |
| 810 |
c$$$ $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 811 |
|
| 812 |
elseif(PFAx.eq.'ETA3')then |
| 813 |
|
| 814 |
stripx = stripx + pfaeta3(icx,angx) |
| 815 |
resxPAM = risxeta3(abs(angx)) |
| 816 |
resxPAM = resxPAM*fbad_cog(3,icx) |
| 817 |
c if(DEBUG.and.fbad_cog(3,icx).ne.1) |
| 818 |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx) |
| 819 |
|
| 820 |
elseif(PFAx.eq.'ETA4')then |
| 821 |
|
| 822 |
stripx = stripx + pfaeta4(icx,angx) |
| 823 |
resxPAM = risxeta4(abs(angx)) |
| 824 |
resxPAM = resxPAM*fbad_cog(4,icx) |
| 825 |
c if(DEBUG.and.fbad_cog(4,icx).ne.1) |
| 826 |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx) |
| 827 |
|
| 828 |
elseif(PFAx.eq.'ETA')then |
| 829 |
|
| 830 |
stripx = stripx + pfaeta(icx,angx) |
| 831 |
c resxPAM = riseta(icx,angx) |
| 832 |
resxPAM = riseta(viewx,angx) |
| 833 |
resxPAM = resxPAM*fbad_eta(icx,angx) |
| 834 |
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
| 835 |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 836 |
|
| 837 |
elseif(PFAx.eq.'ETAL')then |
| 838 |
|
| 839 |
stripx = stripx + pfaetal(icx,angx) |
| 840 |
resxPAM = riseta(viewx,angx) |
| 841 |
resxPAM = resxPAM*fbad_eta(icx,angx) |
| 842 |
c if(DEBUG.and.fbad_cog(2,icx).ne.1) |
| 843 |
c $ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 844 |
|
| 845 |
elseif(PFAx.eq.'COG')then |
| 846 |
|
| 847 |
stripx = stripx + cog(0,icx) |
| 848 |
resxPAM = risx_cog(abs(angx)) |
| 849 |
resxPAM = resxPAM*fbad_cog(0,icx) |
| 850 |
|
| 851 |
else |
| 852 |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
| 853 |
endif |
| 854 |
|
| 855 |
|
| 856 |
* ====================================== |
| 857 |
* temporary patch for saturated clusters |
| 858 |
* ====================================== |
| 859 |
if( nsatstrips(icx).gt.0 )then |
| 860 |
stripx = stripx + cog(4,icx) |
| 861 |
resxPAM = pitchX*1e-4/sqrt(12.) |
| 862 |
cc cc=cog(4,icx) |
| 863 |
c$$$ print*,icx,' *** ',cc |
| 864 |
c$$$ print*,icx,' *** ',resxPAM |
| 865 |
endif |
| 866 |
|
| 867 |
10 endif |
| 868 |
|
| 869 |
|
| 870 |
* ----------------- |
| 871 |
* CLUSTER Y |
| 872 |
* ----------------- |
| 873 |
|
| 874 |
if(icy.ne.0)then |
| 875 |
|
| 876 |
viewy = VIEW(icy) |
| 877 |
nldy = nld(MAXS(icy),VIEW(icy)) |
| 878 |
nply = npl(VIEW(icy)) |
| 879 |
resyPAM = RESYAV |
| 880 |
stripy = float(MAXS(icy)) |
| 881 |
|
| 882 |
if( |
| 883 |
$ viewy.lt.1.or. |
| 884 |
$ viewy.gt.12.or. |
| 885 |
$ nldy.lt.1.or. |
| 886 |
$ nldy.gt.3.or. |
| 887 |
$ stripy.lt.1.or. |
| 888 |
$ stripy.gt.3072.or. |
| 889 |
$ .false.)then |
| 890 |
print*,'xyz_PAM ***ERROR*** wrong input ' |
| 891 |
print*,'icy ',icy,'view ',viewy,'nld ',nldy,'strip ',stripy |
| 892 |
icy = 0 |
| 893 |
goto 20 |
| 894 |
endif |
| 895 |
|
| 896 |
if(icx.ne.0.and.(nply.ne.nplx.or.nldy.ne.nldx))then |
| 897 |
if(DEBUG.EQ.1) then |
| 898 |
print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' |
| 899 |
$ ,icx,icy |
| 900 |
endif |
| 901 |
goto 100 |
| 902 |
endif |
| 903 |
* -------------------------- |
| 904 |
* magnetic-field corrections |
| 905 |
* -------------------------- |
| 906 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
| 907 |
angy = 180.*atan(tgtemp)/acos(-1.) |
| 908 |
stripy = stripy + 0.5*pmuH_e*bfx*0.00001*SiDimZ/pitchY |
| 909 |
c$$$ if(bfx.ne.0.)print*,viewy,'-y- ' |
| 910 |
c$$$ $ ,bfx,0.5*pmuH_e*bfx*0.00001*SiDimZ |
| 911 |
* -------------------------- |
| 912 |
|
| 913 |
c$$$ print*,'--- y-cl ---' |
| 914 |
c$$$ istart = INDSTART(ICY) |
| 915 |
c$$$ istop = TOTCLLENGTH |
| 916 |
c$$$ if(icy.lt.NCLSTR1)istop=INDSTART(ICY+1)-1 |
| 917 |
c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop) |
| 918 |
c$$$ print*,(CLSIGNAL(i),i=istart,istop) |
| 919 |
c$$$ print*,INDMAX(icy) |
| 920 |
c$$$ print*,cog(4,icy) |
| 921 |
c$$$ print*,fbad_cog(4,icy) |
| 922 |
|
| 923 |
if(PFAy.eq.'COG1')then |
| 924 |
|
| 925 |
stripy = stripy |
| 926 |
resyPAM = 1e-4*pitchY/sqrt(12.)!resyPAM |
| 927 |
|
| 928 |
elseif(PFAy.eq.'COG2')then |
| 929 |
|
| 930 |
stripy = stripy + cog(2,icy) |
| 931 |
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
| 932 |
resyPAM = resyPAM*fbad_cog(2,icy) |
| 933 |
|
| 934 |
elseif(PFAy.eq.'COG3')then |
| 935 |
|
| 936 |
stripy = stripy + cog(3,icy) |
| 937 |
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
| 938 |
resyPAM = resyPAM*fbad_cog(3,icy) |
| 939 |
|
| 940 |
elseif(PFAy.eq.'COG4')then |
| 941 |
|
| 942 |
stripy = stripy + cog(4,icy) |
| 943 |
resyPAM = risy_cog(abs(angy))!TEMPORANEO |
| 944 |
resyPAM = resyPAM*fbad_cog(4,icy) |
| 945 |
|
| 946 |
elseif(PFAy.eq.'ETA2')then |
| 947 |
|
| 948 |
stripy = stripy + pfaeta2(icy,angy) |
| 949 |
resyPAM = risyeta2(abs(angy)) |
| 950 |
resyPAM = resyPAM*fbad_cog(2,icy) |
| 951 |
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 952 |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 953 |
|
| 954 |
elseif(PFAy.eq.'ETA3')then |
| 955 |
|
| 956 |
stripy = stripy + pfaeta3(icy,angy) |
| 957 |
resyPAM = resyPAM*fbad_cog(3,icy) |
| 958 |
c if(DEBUG.and.fbad_cog(3,icy).ne.1) |
| 959 |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy) |
| 960 |
|
| 961 |
elseif(PFAy.eq.'ETA4')then |
| 962 |
|
| 963 |
stripy = stripy + pfaeta4(icy,angy) |
| 964 |
resyPAM = resyPAM*fbad_cog(4,icy) |
| 965 |
c if(DEBUG.and.fbad_cog(4,icy).ne.1) |
| 966 |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy) |
| 967 |
|
| 968 |
elseif(PFAy.eq.'ETA')then |
| 969 |
|
| 970 |
stripy = stripy + pfaeta(icy,angy) |
| 971 |
c resyPAM = riseta(icy,angy) |
| 972 |
resyPAM = riseta(viewy,angy) |
| 973 |
resyPAM = resyPAM*fbad_eta(icy,angy) |
| 974 |
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 975 |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 976 |
|
| 977 |
elseif(PFAy.eq.'ETAL')then |
| 978 |
|
| 979 |
stripy = stripy + pfaetal(icy,angy) |
| 980 |
resyPAM = riseta(viewy,angy) |
| 981 |
resyPAM = resyPAM*fbad_eta(icy,angy) |
| 982 |
c if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 983 |
c $ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 984 |
|
| 985 |
elseif(PFAy.eq.'COG')then |
| 986 |
|
| 987 |
stripy = stripy + cog(0,icy) |
| 988 |
resyPAM = risy_cog(abs(angy)) |
| 989 |
resyPAM = resyPAM*fbad_cog(0,icy) |
| 990 |
|
| 991 |
else |
| 992 |
if(DEBUG.EQ.1) print*,'*** Non valid p.f.a. (x) --> ',PFAx |
| 993 |
endif |
| 994 |
|
| 995 |
|
| 996 |
* ====================================== |
| 997 |
* temporary patch for saturated clusters |
| 998 |
* ====================================== |
| 999 |
if( nsatstrips(icy).gt.0 )then |
| 1000 |
stripy = stripy + cog(4,icy) |
| 1001 |
resyPAM = pitchY*1e-4/sqrt(12.) |
| 1002 |
cc cc=cog(4,icy) |
| 1003 |
c$$$ print*,icy,' *** ',cc |
| 1004 |
c$$$ print*,icy,' *** ',resyPAM |
| 1005 |
endif |
| 1006 |
|
| 1007 |
|
| 1008 |
20 endif |
| 1009 |
|
| 1010 |
c$$$ print*,'## stripx,stripy ',stripx,stripy |
| 1011 |
|
| 1012 |
c=========================================================== |
| 1013 |
C COUPLE |
| 1014 |
C=========================================================== |
| 1015 |
if(icx.ne.0.and.icy.ne.0)then |
| 1016 |
|
| 1017 |
c------------------------------------------------------------------------ |
| 1018 |
c (xi,yi,zi) = mechanical coordinates in the silicon sensor frame |
| 1019 |
c------------------------------------------------------------------------ |
| 1020 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 1021 |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
| 1022 |
if(DEBUG.EQ.1) then |
| 1023 |
print*,'xyz_PAM (couple):', |
| 1024 |
$ ' WARNING: false X strip: strip ',stripx |
| 1025 |
endif |
| 1026 |
endif |
| 1027 |
xi = acoordsi(stripx,viewx) |
| 1028 |
yi = acoordsi(stripy,viewy) |
| 1029 |
zi = 0. |
| 1030 |
|
| 1031 |
|
| 1032 |
c------------------------------------------------------------------------ |
| 1033 |
c (xrt,yrt,zrt) = rototranslated coordinates in the silicon sensor frame |
| 1034 |
c------------------------------------------------------------------------ |
| 1035 |
c N.B. I convert angles from microradiants to radiants |
| 1036 |
|
| 1037 |
xrt = xi |
| 1038 |
$ - omega(nplx,nldx,sensor)*yi |
| 1039 |
$ + gamma(nplx,nldx,sensor)*zi |
| 1040 |
$ + dx(nplx,nldx,sensor) |
| 1041 |
|
| 1042 |
yrt = omega(nplx,nldx,sensor)*xi |
| 1043 |
$ + yi |
| 1044 |
$ - beta(nplx,nldx,sensor)*zi |
| 1045 |
$ + dy(nplx,nldx,sensor) |
| 1046 |
|
| 1047 |
zrt = -gamma(nplx,nldx,sensor)*xi |
| 1048 |
$ + beta(nplx,nldx,sensor)*yi |
| 1049 |
$ + zi |
| 1050 |
$ + dz(nplx,nldx,sensor) |
| 1051 |
|
| 1052 |
c xrt = xi |
| 1053 |
c yrt = yi |
| 1054 |
c zrt = zi |
| 1055 |
|
| 1056 |
c------------------------------------------------------------------------ |
| 1057 |
c (xPAM,yPAM,zPAM) = measured coordinates (in cm) |
| 1058 |
c in PAMELA reference system |
| 1059 |
c------------------------------------------------------------------------ |
| 1060 |
|
| 1061 |
xPAM = dcoord(xrt,viewx,nldx,sensor) / 1.d4 |
| 1062 |
yPAM = dcoord(yrt,viewy,nldy,sensor) / 1.d4 |
| 1063 |
zPAM = ( zrt + z_mech_sensor(nplx,nldx,sensor)*1000. ) / 1.d4 |
| 1064 |
|
| 1065 |
xPAM_A = 0. |
| 1066 |
yPAM_A = 0. |
| 1067 |
zPAM_A = 0. |
| 1068 |
|
| 1069 |
xPAM_B = 0. |
| 1070 |
yPAM_B = 0. |
| 1071 |
zPAM_B = 0. |
| 1072 |
|
| 1073 |
elseif( |
| 1074 |
$ (icx.ne.0.and.icy.eq.0).or. |
| 1075 |
$ (icx.eq.0.and.icy.ne.0).or. |
| 1076 |
$ .false. |
| 1077 |
$ )then |
| 1078 |
|
| 1079 |
c------------------------------------------------------------------------ |
| 1080 |
c (xi,yi,zi) = mechanical coordinates in the silicon sensor frame |
| 1081 |
c------------------------------------------------------------------------ |
| 1082 |
|
| 1083 |
if(icy.ne.0)then |
| 1084 |
c=========================================================== |
| 1085 |
C Y-SINGLET |
| 1086 |
C=========================================================== |
| 1087 |
nplx = nply |
| 1088 |
nldx = nldy |
| 1089 |
viewx = viewy + 1 |
| 1090 |
|
| 1091 |
yi = acoordsi(stripy,viewy) |
| 1092 |
|
| 1093 |
xi_A = edgeY_d - SiDimX/2 |
| 1094 |
yi_A = yi |
| 1095 |
zi_A = 0. |
| 1096 |
|
| 1097 |
xi_B = SiDimX/2 - edgeY_u |
| 1098 |
yi_B = yi |
| 1099 |
zi_B = 0. |
| 1100 |
|
| 1101 |
c print*,'Y-cl ',icy,stripy,' --> ',yi |
| 1102 |
c print*,xi_A,' <--> ',xi_B |
| 1103 |
|
| 1104 |
elseif(icx.ne.0)then |
| 1105 |
c=========================================================== |
| 1106 |
C X-SINGLET |
| 1107 |
C=========================================================== |
| 1108 |
|
| 1109 |
nply = nplx |
| 1110 |
nldy = nldx |
| 1111 |
viewy = viewx - 1 |
| 1112 |
|
| 1113 |
c print*,'X-singlet ',icx,nplx,nldx,viewx,stripx |
| 1114 |
c if((stripx.le.3).or.(stripx.ge.1022)) then !X has 1018 strips... |
| 1115 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 1116 |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
| 1117 |
if(DEBUG.EQ.1) then |
| 1118 |
print*,'xyz_PAM (X-singlet):', |
| 1119 |
$ ' WARNING: false X strip: strip ',stripx |
| 1120 |
endif |
| 1121 |
endif |
| 1122 |
xi = acoordsi(stripx,viewx) |
| 1123 |
|
| 1124 |
xi_A = xi |
| 1125 |
yi_A = edgeX_d - SiDimY/2 |
| 1126 |
zi_A = 0. |
| 1127 |
|
| 1128 |
xi_B = xi |
| 1129 |
yi_B = SiDimY/2 - edgeX_u |
| 1130 |
zi_B = 0. |
| 1131 |
|
| 1132 |
if(viewy.eq.11)then |
| 1133 |
yi = yi_A |
| 1134 |
yi_A = yi_B |
| 1135 |
yi_B = yi |
| 1136 |
endif |
| 1137 |
|
| 1138 |
c print*,'X-cl ',icx,stripx,' --> ',xi |
| 1139 |
c print*,yi_A,' <--> ',yi_B |
| 1140 |
|
| 1141 |
else |
| 1142 |
if(DEBUG.EQ.1) then |
| 1143 |
print *,'routine xyz_PAM ---> not properly used !!!' |
| 1144 |
print *,'icx = ',icx |
| 1145 |
print *,'icy = ',icy |
| 1146 |
endif |
| 1147 |
goto 100 |
| 1148 |
|
| 1149 |
endif |
| 1150 |
c------------------------------------------------------------------------ |
| 1151 |
c (xrt,yrt,zrt) = rototranslated coordinates in the silicon sensor frame |
| 1152 |
c------------------------------------------------------------------------ |
| 1153 |
c N.B. I convert angles from microradiants to radiants |
| 1154 |
|
| 1155 |
xrt_A = xi_A |
| 1156 |
$ - omega(nplx,nldx,sensor)*yi_A |
| 1157 |
$ + gamma(nplx,nldx,sensor)*zi_A |
| 1158 |
$ + dx(nplx,nldx,sensor) |
| 1159 |
|
| 1160 |
yrt_A = omega(nplx,nldx,sensor)*xi_A |
| 1161 |
$ + yi_A |
| 1162 |
$ - beta(nplx,nldx,sensor)*zi_A |
| 1163 |
$ + dy(nplx,nldx,sensor) |
| 1164 |
|
| 1165 |
zrt_A = -gamma(nplx,nldx,sensor)*xi_A |
| 1166 |
$ + beta(nplx,nldx,sensor)*yi_A |
| 1167 |
$ + zi_A |
| 1168 |
$ + dz(nplx,nldx,sensor) |
| 1169 |
|
| 1170 |
xrt_B = xi_B |
| 1171 |
$ - omega(nplx,nldx,sensor)*yi_B |
| 1172 |
$ + gamma(nplx,nldx,sensor)*zi_B |
| 1173 |
$ + dx(nplx,nldx,sensor) |
| 1174 |
|
| 1175 |
yrt_B = omega(nplx,nldx,sensor)*xi_B |
| 1176 |
$ + yi_B |
| 1177 |
$ - beta(nplx,nldx,sensor)*zi_B |
| 1178 |
$ + dy(nplx,nldx,sensor) |
| 1179 |
|
| 1180 |
zrt_B = -gamma(nplx,nldx,sensor)*xi_B |
| 1181 |
$ + beta(nplx,nldx,sensor)*yi_B |
| 1182 |
$ + zi_B |
| 1183 |
$ + dz(nplx,nldx,sensor) |
| 1184 |
|
| 1185 |
|
| 1186 |
c xrt = xi |
| 1187 |
c yrt = yi |
| 1188 |
c zrt = zi |
| 1189 |
|
| 1190 |
c------------------------------------------------------------------------ |
| 1191 |
c (xPAM,yPAM,zPAM) = measured coordinates (in cm) |
| 1192 |
c in PAMELA reference system |
| 1193 |
c------------------------------------------------------------------------ |
| 1194 |
|
| 1195 |
xPAM = 0. |
| 1196 |
yPAM = 0. |
| 1197 |
zPAM = 0. |
| 1198 |
|
| 1199 |
xPAM_A = dcoord(xrt_A,viewx,nldx,sensor) / 1.d4 |
| 1200 |
yPAM_A = dcoord(yrt_A,viewy,nldy,sensor) / 1.d4 |
| 1201 |
zPAM_A = ( zrt_A + z_mech_sensor(nplx,nldx,sensor)*1000.)/ 1.d4 |
| 1202 |
|
| 1203 |
xPAM_B = dcoord(xrt_B,viewx,nldx,sensor) / 1.d4 |
| 1204 |
yPAM_B = dcoord(yrt_B,viewy,nldy,sensor) / 1.d4 |
| 1205 |
zPAM_B = ( zrt_B + z_mech_sensor(nplx,nldx,sensor)*1000.)/ 1.d4 |
| 1206 |
|
| 1207 |
|
| 1208 |
c print*,'A-(',xPAM_A,yPAM_A,') B-(',xPAM_B,yPAM_B,')' |
| 1209 |
|
| 1210 |
else |
| 1211 |
if(DEBUG.EQ.1) then |
| 1212 |
print *,'routine xyz_PAM ---> not properly used !!!' |
| 1213 |
print *,'icx = ',icx |
| 1214 |
print *,'icy = ',icy |
| 1215 |
endif |
| 1216 |
endif |
| 1217 |
|
| 1218 |
|
| 1219 |
c print*,'## xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
| 1220 |
c print*,'## xPAM_A,yPAM_A,zPAM_A ',xPAM_A,yPAM_A,zPAM_A |
| 1221 |
c print*,'## xPAM_B,yPAM_B,zPAM_B ',xPAM_B,yPAM_B,zPAM_B |
| 1222 |
|
| 1223 |
100 continue |
| 1224 |
end |
| 1225 |
|
| 1226 |
************************************************************************ |
| 1227 |
* Call xyz_PAM subroutine with default PFA and fill the mini2 common. |
| 1228 |
* (done to be called from c/c++) |
| 1229 |
************************************************************************ |
| 1230 |
|
| 1231 |
subroutine xyzpam(ip,icx,icy,lad,sensor,ax,ay,bfx,bfy) |
| 1232 |
|
| 1233 |
include 'commontracker.f' |
| 1234 |
include 'level1.f' |
| 1235 |
include 'common_mini_2.f' |
| 1236 |
include 'common_xyzPAM.f' |
| 1237 |
include 'common_mech.f' |
| 1238 |
include 'calib.f' |
| 1239 |
|
| 1240 |
* flag to chose PFA |
| 1241 |
c$$$ character*10 PFA |
| 1242 |
c$$$ common/FINALPFA/PFA |
| 1243 |
|
| 1244 |
integer icx,icy !X-Y cluster ID |
| 1245 |
integer sensor |
| 1246 |
character*4 PFAx,PFAy !PFA to be used |
| 1247 |
real ax,ay !X-Y geometric angle |
| 1248 |
real bfx,bfy !X-Y b-field components |
| 1249 |
|
| 1250 |
ipx=0 |
| 1251 |
ipy=0 |
| 1252 |
|
| 1253 |
c$$$ PFAx = 'COG4'!PFA |
| 1254 |
c$$$ PFAy = 'COG4'!PFA |
| 1255 |
|
| 1256 |
|
| 1257 |
if(icx.gt.nclstr1.or.icy.gt.nclstr1)then |
| 1258 |
print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1259 |
$ ,' does not exists (nclstr1=',nclstr1,')' |
| 1260 |
icx = -1*icx |
| 1261 |
icy = -1*icy |
| 1262 |
return |
| 1263 |
|
| 1264 |
endif |
| 1265 |
|
| 1266 |
call idtoc(pfaid,PFAx) |
| 1267 |
call idtoc(pfaid,PFAy) |
| 1268 |
|
| 1269 |
cc print*,PFAx,PFAy |
| 1270 |
|
| 1271 |
c$$$ call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1272 |
|
| 1273 |
c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy |
| 1274 |
|
| 1275 |
if(icx.ne.0.and.icy.ne.0)then |
| 1276 |
|
| 1277 |
ipx=npl(VIEW(icx)) |
| 1278 |
ipy=npl(VIEW(icy)) |
| 1279 |
c$$$ if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) |
| 1280 |
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1281 |
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
| 1282 |
|
| 1283 |
if( (nplanes-ipx+1).ne.ip )then |
| 1284 |
print*,'xyzpam: ***WARNING*** cluster ',icx |
| 1285 |
$ ,' does not belong to plane: ',ip |
| 1286 |
icx = -1*icx |
| 1287 |
return |
| 1288 |
endif |
| 1289 |
if( (nplanes-ipy+1).ne.ip )then |
| 1290 |
print*,'xyzpam: ***WARNING*** cluster ',icy |
| 1291 |
$ ,' does not belong to plane: ',ip |
| 1292 |
icy = -1*icy |
| 1293 |
return |
| 1294 |
endif |
| 1295 |
|
| 1296 |
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1297 |
|
| 1298 |
xgood(ip) = 1. |
| 1299 |
ygood(ip) = 1. |
| 1300 |
resx(ip) = resxPAM |
| 1301 |
resy(ip) = resyPAM |
| 1302 |
|
| 1303 |
xm(ip) = xPAM |
| 1304 |
ym(ip) = yPAM |
| 1305 |
zm(ip) = zPAM |
| 1306 |
xm_A(ip) = 0. |
| 1307 |
ym_A(ip) = 0. |
| 1308 |
xm_B(ip) = 0. |
| 1309 |
ym_B(ip) = 0. |
| 1310 |
|
| 1311 |
c zv(ip) = zPAM |
| 1312 |
|
| 1313 |
elseif(icx.eq.0.and.icy.ne.0)then |
| 1314 |
|
| 1315 |
ipy=npl(VIEW(icy)) |
| 1316 |
c$$$ if((nplanes-ipy+1).ne.ip) |
| 1317 |
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1318 |
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
| 1319 |
if( (nplanes-ipy+1).ne.ip )then |
| 1320 |
print*,'xyzpam: ***WARNING*** cluster ',icy |
| 1321 |
$ ,' does not belong to plane: ',ip |
| 1322 |
icy = -1*icy |
| 1323 |
return |
| 1324 |
endif |
| 1325 |
|
| 1326 |
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1327 |
|
| 1328 |
xgood(ip) = 0. |
| 1329 |
ygood(ip) = 1. |
| 1330 |
resx(ip) = 1000. |
| 1331 |
resy(ip) = resyPAM |
| 1332 |
|
| 1333 |
xm(ip) = -100. |
| 1334 |
ym(ip) = -100. |
| 1335 |
zm(ip) = (zPAM_A+zPAM_B)/2. |
| 1336 |
xm_A(ip) = xPAM_A |
| 1337 |
ym_A(ip) = yPAM_A |
| 1338 |
xm_B(ip) = xPAM_B |
| 1339 |
ym_B(ip) = yPAM_B |
| 1340 |
|
| 1341 |
c zv(ip) = (zPAM_A+zPAM_B)/2. |
| 1342 |
|
| 1343 |
elseif(icx.ne.0.and.icy.eq.0)then |
| 1344 |
|
| 1345 |
ipx=npl(VIEW(icx)) |
| 1346 |
c$$$ if((nplanes-ipx+1).ne.ip) |
| 1347 |
c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy |
| 1348 |
c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy |
| 1349 |
|
| 1350 |
if( (nplanes-ipx+1).ne.ip )then |
| 1351 |
print*,'xyzpam: ***WARNING*** cluster ',icx |
| 1352 |
$ ,' does not belong to plane: ',ip |
| 1353 |
icx = -1*icx |
| 1354 |
return |
| 1355 |
endif |
| 1356 |
|
| 1357 |
call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) |
| 1358 |
|
| 1359 |
xgood(ip) = 1. |
| 1360 |
ygood(ip) = 0. |
| 1361 |
resx(ip) = resxPAM |
| 1362 |
resy(ip) = 1000. |
| 1363 |
|
| 1364 |
xm(ip) = -100. |
| 1365 |
ym(ip) = -100. |
| 1366 |
zm(ip) = (zPAM_A+zPAM_B)/2. |
| 1367 |
xm_A(ip) = xPAM_A |
| 1368 |
ym_A(ip) = yPAM_A |
| 1369 |
xm_B(ip) = xPAM_B |
| 1370 |
ym_B(ip) = yPAM_B |
| 1371 |
|
| 1372 |
c zv(ip) = (zPAM_A+zPAM_B)/2. |
| 1373 |
|
| 1374 |
else |
| 1375 |
|
| 1376 |
il = 2 |
| 1377 |
if(lad.ne.0)il=lad |
| 1378 |
is = 1 |
| 1379 |
if(sensor.ne.0)is=sensor |
| 1380 |
c print*,nplanes-ip+1,il,is |
| 1381 |
|
| 1382 |
xgood(ip) = 0. |
| 1383 |
ygood(ip) = 0. |
| 1384 |
resx(ip) = 1000. |
| 1385 |
resy(ip) = 1000. |
| 1386 |
|
| 1387 |
xm(ip) = -100. |
| 1388 |
ym(ip) = -100. |
| 1389 |
zm(ip) = z_mech_sensor(nplanes-ip+1,il,is)*1000./1.d4 |
| 1390 |
xm_A(ip) = 0. |
| 1391 |
ym_A(ip) = 0. |
| 1392 |
xm_B(ip) = 0. |
| 1393 |
ym_B(ip) = 0. |
| 1394 |
|
| 1395 |
c zv(ip) = z_mech_sensor(nplanes-ip+1,il,is)*1000./1.d4 |
| 1396 |
|
| 1397 |
endif |
| 1398 |
|
| 1399 |
if(DEBUG.EQ.1)then |
| 1400 |
c print*,'----------------------------- track coord' |
| 1401 |
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
| 1402 |
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
| 1403 |
$ ,xm_A(ip),ym_A(ip),xm_B(ip),ym_B(ip) |
| 1404 |
$ ,xgood(ip),ygood(ip),resx(ip),resy(ip) |
| 1405 |
c$$$ print*,'-----------------------------' |
| 1406 |
endif |
| 1407 |
end |
| 1408 |
|
| 1409 |
******************************************************************************** |
| 1410 |
******************************************************************************** |
| 1411 |
******************************************************************************** |
| 1412 |
* |
| 1413 |
* The function distance_to(XP,YP) should be used after |
| 1414 |
* a call to the xyz_PAM routine and it evaluate the |
| 1415 |
* NORMALIZED distance (PROJECTED on the XY plane) between |
| 1416 |
* the point (XP,YP), argument of the function, |
| 1417 |
* and: |
| 1418 |
* |
| 1419 |
* - the point (xPAM,yPAM,zPAM), in the case of a COUPLE |
| 1420 |
* or |
| 1421 |
* - the segment (xPAM_A,yPAM_A,zPAM_A)-(xPAM_B,yPAM_B,zPAM_B), |
| 1422 |
* in the case of a SINGLET. |
| 1423 |
* |
| 1424 |
* ( The routine xyz_PAM fills the common defined in "common_xyzPAM.f", |
| 1425 |
* which stores the coordinates of the couple/singlet ) |
| 1426 |
* |
| 1427 |
******************************************************************************** |
| 1428 |
|
| 1429 |
real function distance_to(XPP,YPP) |
| 1430 |
|
| 1431 |
include 'common_xyzPAM.f' |
| 1432 |
|
| 1433 |
* ----------------------------------- |
| 1434 |
* it computes the normalized distance |
| 1435 |
* ( i.e. distance/resolution ) |
| 1436 |
* ----------------------------------- |
| 1437 |
|
| 1438 |
double precision distance,RE |
| 1439 |
double precision BETA,ALFA,xmi,ymi |
| 1440 |
|
| 1441 |
* ---------------------- |
| 1442 |
if ( |
| 1443 |
+ xPAM.eq.0.and. |
| 1444 |
+ yPAM.eq.0.and. |
| 1445 |
+ zPAM.eq.0.and. |
| 1446 |
+ xPAM_A.ne.0.and. |
| 1447 |
+ yPAM_A.ne.0.and. |
| 1448 |
+ zPAM_A.ne.0.and. |
| 1449 |
+ xPAM_B.ne.0.and. |
| 1450 |
+ yPAM_B.ne.0.and. |
| 1451 |
+ zPAM_B.ne.0.and. |
| 1452 |
+ .true.)then |
| 1453 |
* ----------------------- |
| 1454 |
* DISTANCE TO --- SINGLET |
| 1455 |
* ----------------------- |
| 1456 |
if(abs(sngl(xPAM_B-xPAM_A)).lt.abs(sngl(yPAM_B-yPAM_A)))then |
| 1457 |
* |||---------- X CLUSTER |
| 1458 |
|
| 1459 |
BETA = (xPAM_B-xPAM_A)/(yPAM_B-yPAM_A) |
| 1460 |
ALFA = xPAM_A - BETA * yPAM_A |
| 1461 |
|
| 1462 |
ymi = ( YPP + BETA*XPP - BETA*ALFA )/(1+BETA**2) |
| 1463 |
if(ymi.lt.dmin1(yPAM_A,yPAM_B))ymi=dmin1(yPAM_A,yPAM_B) |
| 1464 |
if(ymi.gt.dmax1(yPAM_A,yPAM_B))ymi=dmax1(yPAM_A,yPAM_B) |
| 1465 |
xmi = ALFA + BETA * ymi |
| 1466 |
RE = resxPAM |
| 1467 |
|
| 1468 |
else |
| 1469 |
* |||---------- Y CLUSTER |
| 1470 |
|
| 1471 |
BETA = (yPAM_B-yPAM_A)/(xPAM_B-xPAM_A) |
| 1472 |
ALFA = yPAM_A - BETA * xPAM_A |
| 1473 |
|
| 1474 |
xmi = ( XPP + BETA*YPP - BETA*ALFA )/(1+BETA**2) |
| 1475 |
if(xmi.lt.dmin1(xPAM_A,xPAM_B))xmi=dmin1(xPAM_A,xPAM_B) |
| 1476 |
if(xmi.gt.dmax1(xPAM_A,xPAM_B))xmi=dmax1(xPAM_A,xPAM_B) |
| 1477 |
ymi = ALFA + BETA * xmi |
| 1478 |
RE = resyPAM |
| 1479 |
|
| 1480 |
endif |
| 1481 |
|
| 1482 |
distance= |
| 1483 |
$ ((xmi-XPP)**2+(ymi-YPP)**2)!QUIQUI |
| 1484 |
cc $ ((xmi-XPP)**2+(ymi-YPP)**2)/RE**2 |
| 1485 |
distance=dsqrt(distance) |
| 1486 |
|
| 1487 |
c$$$ print*,xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b |
| 1488 |
c$$$ $ ,' --- distance_to --- ',xpp,ypp |
| 1489 |
c$$$ print*,' resolution ',re |
| 1490 |
|
| 1491 |
|
| 1492 |
* ---------------------- |
| 1493 |
elseif( |
| 1494 |
+ xPAM.ne.0.and. |
| 1495 |
+ yPAM.ne.0.and. |
| 1496 |
+ zPAM.ne.0.and. |
| 1497 |
+ xPAM_A.eq.0.and. |
| 1498 |
+ yPAM_A.eq.0.and. |
| 1499 |
+ zPAM_A.eq.0.and. |
| 1500 |
+ xPAM_B.eq.0.and. |
| 1501 |
+ yPAM_B.eq.0.and. |
| 1502 |
+ zPAM_B.eq.0.and. |
| 1503 |
+ .true.)then |
| 1504 |
* ---------------------- |
| 1505 |
* DISTANCE TO --- COUPLE |
| 1506 |
* ---------------------- |
| 1507 |
|
| 1508 |
distance= |
| 1509 |
$ ((xPAM-XPP))**2 !QUIQUI |
| 1510 |
$ + |
| 1511 |
$ ((yPAM-YPP))**2 |
| 1512 |
c$$$ $ ((xPAM-XPP)/resxPAM)**2 |
| 1513 |
c$$$ $ + |
| 1514 |
c$$$ $ ((yPAM-YPP)/resyPAM)**2 |
| 1515 |
distance=dsqrt(distance) |
| 1516 |
|
| 1517 |
c$$$ print*,xPAM,yPAM,zPAM |
| 1518 |
c$$$ $ ,' --- distance_to --- ',xpp,ypp |
| 1519 |
c$$$ print*,' resolution ',resxPAM,resyPAM |
| 1520 |
|
| 1521 |
else |
| 1522 |
|
| 1523 |
c print* |
| 1524 |
c $ ,' function distance_to ---> wrong usage!!!' |
| 1525 |
c print*,' xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
| 1526 |
c print*,' xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b ' |
| 1527 |
c $ ,xPAM_A,yPAM_A,zPAM_A,xPAM_b,yPAM_b,zPAM_b |
| 1528 |
endif |
| 1529 |
|
| 1530 |
distance_to = sngl(distance) |
| 1531 |
|
| 1532 |
return |
| 1533 |
end |
| 1534 |
|
| 1535 |
******************************************************************************** |
| 1536 |
******************************************************************************** |
| 1537 |
******************************************************************************** |
| 1538 |
******************************************************************************** |
| 1539 |
|
| 1540 |
subroutine whichsensor(nplPAM,xPAM,yPAM,ladder,sensor) |
| 1541 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 1542 |
* Given the plane (1-6 from BOTTOM to TOP!!) and the (xPAM,yPAM) |
| 1543 |
* coordinates (in the PAMELA reference system), it returns |
| 1544 |
* the ladder and the sensor which the point belongs to. |
| 1545 |
* |
| 1546 |
* The method to assign a point to a sensor consists in |
| 1547 |
* - calculating the sum of the distances between the point |
| 1548 |
* and the sensor edges |
| 1549 |
* - requiring that it is less-equal than (SiDimX+SiDimY) |
| 1550 |
* |
| 1551 |
* NB -- SiDimX and SiDimY are not the dimentions of the SENSITIVE volume |
| 1552 |
* but of the whole silicon sensor |
| 1553 |
* |
| 1554 |
* CONVENTION: |
| 1555 |
* - sensor 1 is the one closest to the hybrid |
| 1556 |
* - ladder 1 is the first to be read out (strips from 1 to 1024) |
| 1557 |
* |
| 1558 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 1559 |
include 'commontracker.f' |
| 1560 |
include 'common_align.f' |
| 1561 |
|
| 1562 |
integer ladder,sensor,viewx,viewy |
| 1563 |
real c1(4),c2(4),c3(4) |
| 1564 |
data c1/1.,0.,0.,1./ |
| 1565 |
data c2/1.,-1.,-1.,1./ |
| 1566 |
data c3/1.,1.,0.,0./ |
| 1567 |
real*8 yvvv,xvvv |
| 1568 |
double precision xi,yi,zi |
| 1569 |
double precision xrt,yrt,zrt |
| 1570 |
real AA,BB |
| 1571 |
real yvv(4),xvv(4) |
| 1572 |
|
| 1573 |
* tollerance to consider the track inside the sensitive area |
| 1574 |
real ptoll |
| 1575 |
data ptoll/150./ !um |
| 1576 |
|
| 1577 |
external nviewx,nviewy,acoordsi,dcoord |
| 1578 |
|
| 1579 |
nplpt = nplPAM !plane |
| 1580 |
viewx = nviewx(nplpt) |
| 1581 |
viewy = nviewy(nplpt) |
| 1582 |
|
| 1583 |
do il=1,nladders_view |
| 1584 |
do is=1,2 |
| 1585 |
|
| 1586 |
do iv=1,4 !loop on sensor vertexes |
| 1587 |
stripx = (il-c1(iv))*1024 + c1(iv) + c2(iv)*3 |
| 1588 |
stripy = (il-c3(iv))*1024 + c3(iv) |
| 1589 |
c------------------------------------------------------------------------ |
| 1590 |
c (xi,yi,zi) = mechanical coordinates in the silicon sensor frame |
| 1591 |
c------------------------------------------------------------------------ |
| 1592 |
if(((mod(int(stripx+0.5)-1,1024)+1).le.3) |
| 1593 |
$ .or.((mod(int(stripx+0.5)-1,1024)+1).ge.1022)) then !X has 1018 strips... |
| 1594 |
c if((stripx.le.3).or.(stripx.ge.1022)) then !X has 1018 strips... |
| 1595 |
c print*,'whichsensor: ', |
| 1596 |
c $ ' WARNING: false X strip: strip ',stripx |
| 1597 |
endif |
| 1598 |
xi = acoordsi(stripx,viewx) |
| 1599 |
yi = acoordsi(stripy,viewy) |
| 1600 |
zi = 0. |
| 1601 |
c------------------------------------------------------------------------ |
| 1602 |
c (xrt,yrt,zrt) = rototranslated coordinates in the silicon sensor frame |
| 1603 |
c------------------------------------------------------------------------ |
| 1604 |
c N.B. I convert angles from microradiants to radiants |
| 1605 |
xrt = xi |
| 1606 |
$ - omega(nplpt,il,is)*yi |
| 1607 |
$ + gamma(nplpt,il,is)*zi |
| 1608 |
$ + dx(nplpt,il,is) |
| 1609 |
yrt = omega(nplpt,il,is)*xi |
| 1610 |
$ + yi |
| 1611 |
$ - beta(nplpt,il,is)*zi |
| 1612 |
$ + dy(nplpt,il,is) |
| 1613 |
zrt = -gamma(nplpt,il,is)*xi |
| 1614 |
$ + beta(nplpt,il,is)*yi |
| 1615 |
$ + zi |
| 1616 |
$ + dz(nplpt,il,is) |
| 1617 |
c------------------------------------------------------------------------ |
| 1618 |
c measured coordinates (in cm) in PAMELA reference system |
| 1619 |
c------------------------------------------------------------------------ |
| 1620 |
yvvv = dcoord(yrt,viewy,il,is) / 1.d4 |
| 1621 |
xvvv = dcoord(xrt,viewx,il,is) / 1.d4 |
| 1622 |
|
| 1623 |
yvv(iv)=sngl(yvvv) |
| 1624 |
xvv(iv)=sngl(xvvv) |
| 1625 |
c print*,'LADDER ',il,' SENSOR ',is,' vertexes >> ' |
| 1626 |
c $ ,iv,xvv(iv),yvv(iv) |
| 1627 |
enddo !end loop on sensor vertexes |
| 1628 |
|
| 1629 |
dtot=0. |
| 1630 |
do iside=1,4,2 !loop on sensor edges X |
| 1631 |
iv1=iside |
| 1632 |
iv2=mod(iside,4)+1 |
| 1633 |
* straight line passing trhough two consecutive vertexes |
| 1634 |
AA = (yvv(iv1)-yvv(iv2))/(xvv(iv1)-xvv(iv2)) |
| 1635 |
BB = yvv(iv1) - AA*xvv(iv1) |
| 1636 |
* point along the straight line closer to the track |
| 1637 |
xoo = (xPAM+AA*yPAM-AA*BB)/(1+AA**2) |
| 1638 |
yoo = AA*xoo + BB |
| 1639 |
* sum of the distances |
| 1640 |
dtot = dtot + |
| 1641 |
$ sqrt((xPAM-xoo)**2+(yPAM-yoo)**2) |
| 1642 |
enddo !end loop on sensor edges |
| 1643 |
do iside=2,4,2 !loop on sensor edges Y |
| 1644 |
iv1=iside |
| 1645 |
iv2=mod(iside,4)+1 |
| 1646 |
* straight line passing trhough two consecutive vertexes |
| 1647 |
AA = (xvv(iv1)-xvv(iv2))/(yvv(iv1)-yvv(iv2)) |
| 1648 |
BB = xvv(iv1) - AA*yvv(iv1) |
| 1649 |
* point along the straight line closer to the track |
| 1650 |
yoo = (yPAM+AA*xPAM-AA*BB)/(1+AA**2) |
| 1651 |
xoo = AA*yoo + BB |
| 1652 |
* sum of the distances |
| 1653 |
dtot = dtot + |
| 1654 |
$ sqrt((xPAM-xoo)**2+(yPAM-yoo)**2) |
| 1655 |
enddo !end loop on sensor edges |
| 1656 |
|
| 1657 |
|
| 1658 |
* half-perimeter of sensitive area |
| 1659 |
Perim = |
| 1660 |
$ SiDimX - edgeX_l - edgeX_r |
| 1661 |
$ +SiDimY - edgeY_l - edgeY_r |
| 1662 |
Perim = (Perim + ptoll)/1.e4 |
| 1663 |
if(dtot.le.Perim)goto 100 |
| 1664 |
|
| 1665 |
|
| 1666 |
enddo |
| 1667 |
enddo |
| 1668 |
|
| 1669 |
ladder = 0 |
| 1670 |
sensor = 0 |
| 1671 |
goto 200 |
| 1672 |
|
| 1673 |
100 continue |
| 1674 |
ladder = il |
| 1675 |
sensor = is |
| 1676 |
|
| 1677 |
|
| 1678 |
200 return |
| 1679 |
end |
| 1680 |
|
| 1681 |
|
| 1682 |
|
| 1683 |
************************************************************************* |
| 1684 |
|
| 1685 |
subroutine reverse(v,n,temp) !invert the order of the components of v(n) vector |
| 1686 |
|
| 1687 |
implicit double precision (A-H,O-Z) |
| 1688 |
|
| 1689 |
dimension v(*) |
| 1690 |
dimension temp(*) |
| 1691 |
integer i,n |
| 1692 |
|
| 1693 |
do i=1,n |
| 1694 |
temp(i)=v(n+1-i) |
| 1695 |
enddo |
| 1696 |
|
| 1697 |
do i=1,n |
| 1698 |
v(i)=temp(i) |
| 1699 |
enddo |
| 1700 |
|
| 1701 |
return |
| 1702 |
end |
| 1703 |
|
| 1704 |
************************************************************************* |
| 1705 |
************************************************************************* |
| 1706 |
************************************************************************* |
| 1707 |
************************************************************************* |
| 1708 |
************************************************************************* |
| 1709 |
************************************************************************* |
| 1710 |
************************************************************************* |
| 1711 |
************************************************************************* |
| 1712 |
************************************************************************* |
| 1713 |
************************************************************************* |
| 1714 |
************************************************************************* |
| 1715 |
************************************************************************* |
| 1716 |
************************************************************************* |
| 1717 |
************************************************************************* |
| 1718 |
************************************************************************* |
| 1719 |
integer function ip_cp(id) |
| 1720 |
* |
| 1721 |
* given the couple id, |
| 1722 |
* it returns the plane number |
| 1723 |
* |
| 1724 |
include 'commontracker.f' |
| 1725 |
include 'level1.f' |
| 1726 |
c include 'common_analysis.f' |
| 1727 |
include 'common_momanhough.f' |
| 1728 |
|
| 1729 |
ip_cp=0 |
| 1730 |
ncpp=0 |
| 1731 |
do ip=1,nplanes |
| 1732 |
ncpp=ncpp+ncp_plane(ip) |
| 1733 |
if(ncpp.ge.abs(id))then |
| 1734 |
ip_cp=ip |
| 1735 |
goto 100 |
| 1736 |
endif |
| 1737 |
enddo |
| 1738 |
100 continue |
| 1739 |
return |
| 1740 |
end |
| 1741 |
|
| 1742 |
|
| 1743 |
integer function is_cp(id) |
| 1744 |
* |
| 1745 |
* given the couple id, |
| 1746 |
* it returns the sensor number |
| 1747 |
* |
| 1748 |
is_cp=0 |
| 1749 |
if(id.lt.0)is_cp=1 |
| 1750 |
if(id.gt.0)is_cp=2 |
| 1751 |
c if(id.eq.0)print*,'IS_CP ===> wrong couple id !!!' |
| 1752 |
|
| 1753 |
return |
| 1754 |
end |
| 1755 |
|
| 1756 |
|
| 1757 |
integer function icp_cp(id) |
| 1758 |
* |
| 1759 |
* given the couple id, |
| 1760 |
* it returns the id number ON THE PLANE |
| 1761 |
* |
| 1762 |
include 'commontracker.f' |
| 1763 |
include 'level1.f' |
| 1764 |
c include 'common_analysis.f' |
| 1765 |
include 'common_momanhough.f' |
| 1766 |
|
| 1767 |
icp_cp=0 |
| 1768 |
|
| 1769 |
ncpp=0 |
| 1770 |
do ip=1,nplanes |
| 1771 |
ncppold=ncpp |
| 1772 |
ncpp=ncpp+ncp_plane(ip) |
| 1773 |
if(ncpp.ge.abs(id))then |
| 1774 |
icp_cp=abs(id)-ncppold |
| 1775 |
goto 100 |
| 1776 |
endif |
| 1777 |
enddo |
| 1778 |
100 continue |
| 1779 |
return |
| 1780 |
end |
| 1781 |
|
| 1782 |
|
| 1783 |
|
| 1784 |
integer function id_cp(ip,icp,is) |
| 1785 |
* |
| 1786 |
* given a plane, a couple and the sensor |
| 1787 |
* it returns the absolute couple id |
| 1788 |
* negative if sensor =1 |
| 1789 |
* positive if sensor =2 |
| 1790 |
* |
| 1791 |
include 'commontracker.f' |
| 1792 |
include 'level1.f' |
| 1793 |
c include 'calib.f' |
| 1794 |
c include 'level1.f' |
| 1795 |
c include 'common_analysis.f' |
| 1796 |
include 'common_momanhough.f' |
| 1797 |
|
| 1798 |
id_cp=0 |
| 1799 |
|
| 1800 |
if(ip.gt.1)then |
| 1801 |
do i=1,ip-1 |
| 1802 |
id_cp = id_cp + ncp_plane(i) |
| 1803 |
enddo |
| 1804 |
endif |
| 1805 |
|
| 1806 |
id_cp = id_cp + icp |
| 1807 |
|
| 1808 |
if(is.eq.1) id_cp = -id_cp |
| 1809 |
|
| 1810 |
return |
| 1811 |
end |
| 1812 |
|
| 1813 |
|
| 1814 |
|
| 1815 |
|
| 1816 |
************************************************************************* |
| 1817 |
************************************************************************* |
| 1818 |
************************************************************************* |
| 1819 |
************************************************************************* |
| 1820 |
************************************************************************* |
| 1821 |
************************************************************************* |
| 1822 |
|
| 1823 |
|
| 1824 |
*************************************************** |
| 1825 |
* * |
| 1826 |
* * |
| 1827 |
* * |
| 1828 |
* * |
| 1829 |
* * |
| 1830 |
* * |
| 1831 |
************************************************** |
| 1832 |
|
| 1833 |
subroutine cl_to_couples(iflag) |
| 1834 |
|
| 1835 |
include 'commontracker.f' |
| 1836 |
include 'level1.f' |
| 1837 |
include 'common_momanhough.f' |
| 1838 |
c include 'momanhough_init.f' |
| 1839 |
include 'calib.f' |
| 1840 |
c include 'level1.f' |
| 1841 |
|
| 1842 |
* output flag |
| 1843 |
* -------------- |
| 1844 |
* 0 = good event |
| 1845 |
* 1 = bad event |
| 1846 |
* -------------- |
| 1847 |
integer iflag |
| 1848 |
|
| 1849 |
integer badseed,badclx,badcly |
| 1850 |
|
| 1851 |
if(DEBUG.EQ.1)print*,'cl_to_couples:' |
| 1852 |
|
| 1853 |
* init variables |
| 1854 |
ncp_tot=0 |
| 1855 |
do ip=1,nplanes |
| 1856 |
do ico=1,ncouplemax |
| 1857 |
clx(ip,ico)=0 |
| 1858 |
cly(ip,ico)=0 |
| 1859 |
enddo |
| 1860 |
ncp_plane(ip)=0 |
| 1861 |
do icl=1,nclstrmax_level2 |
| 1862 |
cls(ip,icl)=1 |
| 1863 |
enddo |
| 1864 |
ncls(ip)=0 |
| 1865 |
enddo |
| 1866 |
do icl=1,nclstrmax_level2 |
| 1867 |
cl_single(icl) = 1 |
| 1868 |
cl_good(icl) = 0 |
| 1869 |
enddo |
| 1870 |
do iv=1,nviews |
| 1871 |
ncl_view(iv) = 0 |
| 1872 |
mask_view(iv) = 0 !all included |
| 1873 |
enddo |
| 1874 |
|
| 1875 |
* count number of cluster per view |
| 1876 |
do icl=1,nclstr1 |
| 1877 |
ncl_view(VIEW(icl)) = ncl_view(VIEW(icl)) + 1 |
| 1878 |
enddo |
| 1879 |
* mask views with too many clusters |
| 1880 |
do iv=1,nviews |
| 1881 |
if( ncl_view(iv).gt. nclusterlimit)then |
| 1882 |
c mask_view(iv) = 1 |
| 1883 |
mask_view(iv) = mask_view(iv) + 2**0 |
| 1884 |
if(DEBUG.EQ.1) |
| 1885 |
$ print*,' * WARNING * cl_to_couple: n.clusters > ' |
| 1886 |
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
| 1887 |
endif |
| 1888 |
enddo |
| 1889 |
|
| 1890 |
|
| 1891 |
* start association |
| 1892 |
ncouples=0 |
| 1893 |
do icx=1,nclstr1 !loop on cluster (X) |
| 1894 |
if(mod(VIEW(icx),2).eq.1)goto 10 |
| 1895 |
|
| 1896 |
* ---------------------------------------------------- |
| 1897 |
* jump masked views (X VIEW) |
| 1898 |
* ---------------------------------------------------- |
| 1899 |
if( mask_view(VIEW(icx)).ne.0 ) goto 10 |
| 1900 |
* ---------------------------------------------------- |
| 1901 |
* cut on charge (X VIEW) |
| 1902 |
* ---------------------------------------------------- |
| 1903 |
if(sgnl(icx).lt.dedx_x_min)then |
| 1904 |
cl_single(icx)=0 |
| 1905 |
goto 10 |
| 1906 |
endif |
| 1907 |
* ---------------------------------------------------- |
| 1908 |
* cut BAD (X VIEW) |
| 1909 |
* ---------------------------------------------------- |
| 1910 |
badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
| 1911 |
ifirst=INDSTART(icx) |
| 1912 |
if(icx.ne.nclstr1) then |
| 1913 |
ilast=INDSTART(icx+1)-1 |
| 1914 |
else |
| 1915 |
ilast=TOTCLLENGTH |
| 1916 |
endif |
| 1917 |
badclx=badseed |
| 1918 |
do igood=-ngoodstr,ngoodstr |
| 1919 |
ibad=1 |
| 1920 |
if((INDMAX(icx)+igood).gt.ifirst.and. |
| 1921 |
$ (INDMAX(icx)+igood).lt.ilast.and. |
| 1922 |
$ .true.)then |
| 1923 |
ibad=BAD(VIEW(icx), |
| 1924 |
$ nvk(MAXS(icx)+igood), |
| 1925 |
$ nst(MAXS(icx)+igood)) |
| 1926 |
endif |
| 1927 |
badclx=badclx*ibad |
| 1928 |
enddo |
| 1929 |
* ---------------------------------------------------- |
| 1930 |
* >>> eliminato il taglio sulle BAD <<< |
| 1931 |
* ---------------------------------------------------- |
| 1932 |
c if(badcl.eq.0)then |
| 1933 |
c cl_single(icx)=0 |
| 1934 |
c goto 10 |
| 1935 |
c endif |
| 1936 |
* ---------------------------------------------------- |
| 1937 |
|
| 1938 |
cl_good(icx)=1 |
| 1939 |
nplx=npl(VIEW(icx)) |
| 1940 |
nldx=nld(MAXS(icx),VIEW(icx)) |
| 1941 |
|
| 1942 |
do icy=1,nclstr1 !loop on cluster (Y) |
| 1943 |
if(mod(VIEW(icy),2).eq.0)goto 20 |
| 1944 |
|
| 1945 |
* ---------------------------------------------------- |
| 1946 |
* jump masked views (Y VIEW) |
| 1947 |
* ---------------------------------------------------- |
| 1948 |
if( mask_view(VIEW(icy)).ne.0 ) goto 20 |
| 1949 |
|
| 1950 |
* ---------------------------------------------------- |
| 1951 |
* cut on charge (Y VIEW) |
| 1952 |
* ---------------------------------------------------- |
| 1953 |
if(sgnl(icy).lt.dedx_y_min)then |
| 1954 |
cl_single(icy)=0 |
| 1955 |
goto 20 |
| 1956 |
endif |
| 1957 |
* ---------------------------------------------------- |
| 1958 |
* cut BAD (Y VIEW) |
| 1959 |
* ---------------------------------------------------- |
| 1960 |
badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
| 1961 |
ifirst=INDSTART(icy) |
| 1962 |
if(icy.ne.nclstr1) then |
| 1963 |
ilast=INDSTART(icy+1)-1 |
| 1964 |
else |
| 1965 |
ilast=TOTCLLENGTH |
| 1966 |
endif |
| 1967 |
badcly=badseed |
| 1968 |
do igood=-ngoodstr,ngoodstr |
| 1969 |
ibad=1 |
| 1970 |
if((INDMAX(icy)+igood).gt.ifirst.and. |
| 1971 |
$ (INDMAX(icy)+igood).lt.ilast.and. |
| 1972 |
$ .true.) |
| 1973 |
$ ibad=BAD(VIEW(icy), |
| 1974 |
$ nvk(MAXS(icy)+igood), |
| 1975 |
$ nst(MAXS(icy)+igood)) |
| 1976 |
badcly=badcly*ibad |
| 1977 |
enddo |
| 1978 |
* ---------------------------------------------------- |
| 1979 |
* >>> eliminato il taglio sulle BAD <<< |
| 1980 |
* ---------------------------------------------------- |
| 1981 |
c if(badcl.eq.0)then |
| 1982 |
c cl_single(icy)=0 |
| 1983 |
c goto 20 |
| 1984 |
c endif |
| 1985 |
* ---------------------------------------------------- |
| 1986 |
|
| 1987 |
cl_good(icy)=1 |
| 1988 |
nply=npl(VIEW(icy)) |
| 1989 |
nldy=nld(MAXS(icy),VIEW(icy)) |
| 1990 |
|
| 1991 |
* ---------------------------------------------- |
| 1992 |
* CONDITION TO FORM A COUPLE |
| 1993 |
* ---------------------------------------------- |
| 1994 |
* geometrical consistency (same plane and ladder) |
| 1995 |
if(nply.eq.nplx.and.nldy.eq.nldx)then |
| 1996 |
* charge correlation |
| 1997 |
* (modified to be applied only below saturation... obviously) |
| 1998 |
|
| 1999 |
if( .not.(sgnl(icy).gt.chsaty.and.sgnl(icx).gt.chsatx) |
| 2000 |
$ .and. |
| 2001 |
$ .not.(sgnl(icy).lt.chmipy.and.sgnl(icx).lt.chmipx) |
| 2002 |
$ .and. |
| 2003 |
$ (badclx.eq.1.and.badcly.eq.1) |
| 2004 |
$ .and. |
| 2005 |
$ .true.)then |
| 2006 |
|
| 2007 |
ddd=(sgnl(icy) |
| 2008 |
$ -kch(nplx,nldx)*sgnl(icx)-cch(nplx,nldx)) |
| 2009 |
ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
| 2010 |
|
| 2011 |
c cut = chcut * sch(nplx,nldx) |
| 2012 |
|
| 2013 |
sss=(kch(nplx,nldx)*sgnl(icy)+sgnl(icx) |
| 2014 |
$ -kch(nplx,nldx)*cch(nplx,nldx)) |
| 2015 |
sss=sss/sqrt(kch(nplx,nldx)**2+1) |
| 2016 |
cut = chcut * (16 + sss/50.) |
| 2017 |
|
| 2018 |
if(abs(ddd).gt.cut)then |
| 2019 |
goto 20 !charge not consistent |
| 2020 |
endif |
| 2021 |
endif |
| 2022 |
|
| 2023 |
if(ncp_plane(nplx).gt.ncouplemax)then |
| 2024 |
if(verbose.eq.1)print*, |
| 2025 |
$ '** warning ** number of identified '// |
| 2026 |
$ 'couples on plane ',nplx, |
| 2027 |
$ 'exceeds vector dimention ' |
| 2028 |
$ ,'( ',ncouplemax,' ) --> masked!' |
| 2029 |
c mask_view(nviewx(nplx)) = 2 |
| 2030 |
c mask_view(nviewy(nply)) = 2 |
| 2031 |
mask_view(nviewx(nplx))= mask_view(nviewx(nplx))+ 2**1 |
| 2032 |
mask_view(nviewy(nply))= mask_view(nviewy(nply))+ 2**1 |
| 2033 |
goto 10 |
| 2034 |
endif |
| 2035 |
|
| 2036 |
* ------------------> COUPLE <------------------ |
| 2037 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
| 2038 |
clx(nplx,ncp_plane(nplx))=icx |
| 2039 |
cly(nply,ncp_plane(nplx))=icy |
| 2040 |
cl_single(icx)=0 |
| 2041 |
cl_single(icy)=0 |
| 2042 |
* ---------------------------------------------- |
| 2043 |
|
| 2044 |
endif |
| 2045 |
|
| 2046 |
20 continue |
| 2047 |
enddo !end loop on clusters(Y) |
| 2048 |
|
| 2049 |
10 continue |
| 2050 |
enddo !end loop on clusters(X) |
| 2051 |
|
| 2052 |
|
| 2053 |
do icl=1,nclstr1 |
| 2054 |
if(cl_single(icl).eq.1)then |
| 2055 |
ip=npl(VIEW(icl)) |
| 2056 |
ncls(ip)=ncls(ip)+1 |
| 2057 |
cls(ip,ncls(ip))=icl |
| 2058 |
endif |
| 2059 |
enddo |
| 2060 |
|
| 2061 |
|
| 2062 |
if(DEBUG.EQ.1)then |
| 2063 |
print*,'clusters ',nclstr1 |
| 2064 |
print*,'good ',(cl_good(i),i=1,nclstr1) |
| 2065 |
print*,'singlets',(cl_single(i),i=1,nclstr1) |
| 2066 |
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
| 2067 |
endif |
| 2068 |
|
| 2069 |
do ip=1,6 |
| 2070 |
ncp_tot = ncp_tot + ncp_plane(ip) |
| 2071 |
enddo |
| 2072 |
|
| 2073 |
return |
| 2074 |
end |
| 2075 |
|
| 2076 |
*************************************************** |
| 2077 |
* * |
| 2078 |
* * |
| 2079 |
* * |
| 2080 |
* * |
| 2081 |
* * |
| 2082 |
* * |
| 2083 |
************************************************** |
| 2084 |
|
| 2085 |
subroutine cp_to_doubtrip(iflag) |
| 2086 |
|
| 2087 |
include 'commontracker.f' |
| 2088 |
include 'level1.f' |
| 2089 |
include 'common_momanhough.f' |
| 2090 |
include 'common_xyzPAM.f' |
| 2091 |
include 'common_mini_2.f' |
| 2092 |
include 'calib.f' |
| 2093 |
|
| 2094 |
|
| 2095 |
* output flag |
| 2096 |
* -------------- |
| 2097 |
* 0 = good event |
| 2098 |
* 1 = bad event |
| 2099 |
* -------------- |
| 2100 |
integer iflag |
| 2101 |
|
| 2102 |
|
| 2103 |
* ----------------------------- |
| 2104 |
* DOUBLETS/TRIPLETS coordinates |
| 2105 |
c double precision xm1,ym1,zm1 |
| 2106 |
c double precision xm2,ym2,zm2 |
| 2107 |
c double precision xm3,ym3,zm3 |
| 2108 |
|
| 2109 |
real xm1,ym1,zm1 |
| 2110 |
real xm2,ym2,zm2 |
| 2111 |
real xm3,ym3,zm3 |
| 2112 |
* ----------------------------- |
| 2113 |
* variable needed for tricircle: |
| 2114 |
real xp(3),zp(3)!TRIPLETS coordinates, to find a circle |
| 2115 |
EQUIVALENCE (xm1,xp(1)) |
| 2116 |
EQUIVALENCE (xm2,xp(2)) |
| 2117 |
EQUIVALENCE (xm3,xp(3)) |
| 2118 |
EQUIVALENCE (zm1,zp(1)) |
| 2119 |
EQUIVALENCE (zm2,zp(2)) |
| 2120 |
EQUIVALENCE (zm3,zp(3)) |
| 2121 |
real angp(3),resp(3),chi |
| 2122 |
real xc,zc,radius |
| 2123 |
* ----------------------------- |
| 2124 |
|
| 2125 |
if(DEBUG.EQ.1)print*,'cp_to_doubtrip:' |
| 2126 |
|
| 2127 |
* -------------------------------------------- |
| 2128 |
* put a limit to the maximum number of couples |
| 2129 |
* per plane, in order to apply hough transform |
| 2130 |
* (couples recovered during track refinement) |
| 2131 |
* -------------------------------------------- |
| 2132 |
do ip=1,nplanes |
| 2133 |
if(ncp_plane(ip).gt.ncouplelimit)then |
| 2134 |
c mask_view(nviewx(ip)) = 8 |
| 2135 |
c mask_view(nviewy(ip)) = 8 |
| 2136 |
mask_view(nviewx(ip)) = mask_view(nviewx(ip)) + 2**7 |
| 2137 |
mask_view(nviewy(ip)) = mask_view(nviewy(ip)) + 2**7 |
| 2138 |
endif |
| 2139 |
enddo |
| 2140 |
|
| 2141 |
|
| 2142 |
ndblt=0 !number of doublets |
| 2143 |
ntrpt=0 !number of triplets |
| 2144 |
|
| 2145 |
do ip1=1,(nplanes-1) !loop on planes - COPPIA 1 |
| 2146 |
if( mask_view(nviewx(ip1)).ne.0 .or. |
| 2147 |
$ mask_view(nviewy(ip1)).ne.0 )goto 10 !skip plane |
| 2148 |
do is1=1,2 !loop on sensors - COPPIA 1 |
| 2149 |
do icp1=1,ncp_plane(ip1) !loop on COPPIA 1 |
| 2150 |
icx1=clx(ip1,icp1) |
| 2151 |
icy1=cly(ip1,icp1) |
| 2152 |
c call xyz_PAM(icx1,icy1,is1,'COG2','COG2',0.,0.)!(1) |
| 2153 |
c call xyz_PAM(icx1,icy1,is1,PFAdef,PFAdef,0.,0.) !(1) |
| 2154 |
call xyz_PAM(icx1,icy1,is1,PFAdef,PFAdef,0.,0.,0.,0.) |
| 2155 |
xm1=xPAM |
| 2156 |
ym1=yPAM |
| 2157 |
zm1=zPAM |
| 2158 |
c print*,'***',is1,xm1,ym1,zm1 |
| 2159 |
|
| 2160 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
| 2161 |
if( mask_view(nviewx(ip2)).ne.0 .or. |
| 2162 |
$ mask_view(nviewy(ip2)).ne.0 )goto 20 !skip plane |
| 2163 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
| 2164 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
| 2165 |
icx2=clx(ip2,icp2) |
| 2166 |
icy2=cly(ip2,icp2) |
| 2167 |
c call xyz_PAM |
| 2168 |
c $ (icx2,icy2,is2,'COG2','COG2',0.,0.)!(1) |
| 2169 |
c call xyz_PAM |
| 2170 |
c $ (icx2,icy2,is2,PFAdef,PFAdef,0.,0.) !(1) |
| 2171 |
call xyz_PAM |
| 2172 |
$ (icx2,icy2,is2,PFAdef,PFAdef,0.,0.,0.,0.) |
| 2173 |
xm2=xPAM |
| 2174 |
ym2=yPAM |
| 2175 |
zm2=zPAM |
| 2176 |
|
| 2177 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2178 |
* track parameters on Y VIEW |
| 2179 |
* (2 couples needed) |
| 2180 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2181 |
if(ndblt.eq.ndblt_max)then |
| 2182 |
if(verbose.eq.1)print*, |
| 2183 |
$ '** warning ** number of identified '// |
| 2184 |
$ 'doublets exceeds vector dimention ' |
| 2185 |
$ ,'( ',ndblt_max,' )' |
| 2186 |
c good2=.false. |
| 2187 |
c goto 880 !fill ntp and go to next event |
| 2188 |
do iv=1,12 |
| 2189 |
c mask_view(iv) = 3 |
| 2190 |
mask_view(iv) = mask_view(iv)+ 2**2 |
| 2191 |
enddo |
| 2192 |
iflag=1 |
| 2193 |
return |
| 2194 |
endif |
| 2195 |
ndblt = ndblt + 1 |
| 2196 |
* store doublet info |
| 2197 |
cpyz1(ndblt)=id_cp(ip1,icp1,is1) |
| 2198 |
cpyz2(ndblt)=id_cp(ip2,icp2,is2) |
| 2199 |
* tg(th_yz) |
| 2200 |
alfayz2(ndblt)=(ym1-ym2)/(zm1-zm2) |
| 2201 |
* y0 (cm) |
| 2202 |
alfayz1(ndblt)=alfayz2(ndblt)*(zini-zm1)+ym1 |
| 2203 |
|
| 2204 |
**** -----------------------------------------------**** |
| 2205 |
**** reject non phisical couples **** |
| 2206 |
**** -----------------------------------------------**** |
| 2207 |
if( |
| 2208 |
$ abs(alfayz2(ndblt)).gt.alfyz2_max |
| 2209 |
$ .or. |
| 2210 |
$ abs(alfayz1(ndblt)).gt.alfyz1_max |
| 2211 |
$ )ndblt = ndblt-1 |
| 2212 |
|
| 2213 |
c$$$ if(iev.eq.33)then |
| 2214 |
c$$$ print*,'********* ',ndblt,' -- ',icp1,icp2,is1,is2 |
| 2215 |
c$$$ $ ,' || ',icx1,icy1,icx2,icy2 |
| 2216 |
c$$$ $ ,' || ',xm1,ym1,xm2,ym2 |
| 2217 |
c$$$ $ ,' || ',alfayz2(ndblt),alfayz1(ndblt) |
| 2218 |
c$$$ endif |
| 2219 |
c$$$ |
| 2220 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2221 |
* track parameters on Y VIEW - end |
| 2222 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2223 |
|
| 2224 |
|
| 2225 |
if(ip2.eq.nplanes)goto 31 !no possible combination with 3 couples |
| 2226 |
|
| 2227 |
do ip3=(ip2+1),nplanes !loop on planes - COPPIA 3 |
| 2228 |
if( mask_view(nviewx(ip3)).ne.0 .or. |
| 2229 |
$ mask_view(nviewy(ip3)).ne.0 )goto 30 !skip plane |
| 2230 |
do is3=1,2 !loop on sensors - COPPIA 3 |
| 2231 |
|
| 2232 |
do icp3=1,ncp_plane(ip3) !loop on COPPIA 3 |
| 2233 |
icx3=clx(ip3,icp3) |
| 2234 |
icy3=cly(ip3,icp3) |
| 2235 |
c call xyz_PAM |
| 2236 |
c $ (icx3,icy3,is3,'COG2','COG2',0.,0.)!(1) |
| 2237 |
c call xyz_PAM |
| 2238 |
c $ (icx3,icy3,is3,PFAdef,PFAdef,0.,0.) !(1) |
| 2239 |
call xyz_PAM |
| 2240 |
$ (icx3,icy3,is3,PFAdef,PFAdef |
| 2241 |
$ ,0.,0.,0.,0.) |
| 2242 |
xm3=xPAM |
| 2243 |
ym3=yPAM |
| 2244 |
zm3=zPAM |
| 2245 |
* find the circle passing through the three points |
| 2246 |
c$$$ call tricircle(3,xp,zp,angp,resp,chi |
| 2247 |
c$$$ $ ,xc,zc,radius,iflag) |
| 2248 |
iflag = DEBUG |
| 2249 |
call tricircle(3,xp,zp,angp,resp,chi |
| 2250 |
$ ,xc,zc,radius,iflag) |
| 2251 |
c print*,xc,zc,radius |
| 2252 |
* the circle must intersect the reference plane |
| 2253 |
if( |
| 2254 |
c $ (xc.le.-1.*xclimit.or. |
| 2255 |
c $ xc.ge.xclimit).and. |
| 2256 |
$ radius**2.ge.(ZINI-zc)**2.and. |
| 2257 |
$ iflag.eq.0.and. |
| 2258 |
$ .true.)then |
| 2259 |
|
| 2260 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2261 |
* track parameters on X VIEW |
| 2262 |
* (3 couples needed) |
| 2263 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2264 |
if(ntrpt.eq.ntrpt_max)then |
| 2265 |
if(verbose.eq.1)print*, |
| 2266 |
$ '** warning ** number of identified '// |
| 2267 |
$ 'triplets exceeds vector dimention ' |
| 2268 |
$ ,'( ',ntrpt_max,' )' |
| 2269 |
c good2=.false. |
| 2270 |
c goto 880 !fill ntp and go to next event |
| 2271 |
do iv=1,nviews |
| 2272 |
c mask_view(iv) = 4 |
| 2273 |
mask_view(iv)=mask_view(iv)+ 2**3 |
| 2274 |
enddo |
| 2275 |
iflag=1 |
| 2276 |
return |
| 2277 |
endif |
| 2278 |
ntrpt = ntrpt +1 |
| 2279 |
* store triplet info |
| 2280 |
cpxz1(ntrpt)=id_cp(ip1,icp1,is1) |
| 2281 |
cpxz2(ntrpt)=id_cp(ip2,icp2,is2) |
| 2282 |
cpxz3(ntrpt)=id_cp(ip3,icp3,is3) |
| 2283 |
|
| 2284 |
if(xc.lt.0)then |
| 2285 |
*************POSITIVE DEFLECTION |
| 2286 |
alfaxz1(ntrpt) = xc+sqrt(radius**2-(ZINI-zc)**2) |
| 2287 |
alfaxz2(ntrpt) = (ZINI-zc)/sqrt(radius**2-(ZINI-zc)**2) |
| 2288 |
alfaxz3(ntrpt) = 1/radius |
| 2289 |
else |
| 2290 |
*************NEGATIVE DEFLECTION |
| 2291 |
alfaxz1(ntrpt) = xc-sqrt(radius**2-(ZINI-zc)**2) |
| 2292 |
alfaxz2(ntrpt) = -(ZINI-zc)/sqrt(radius**2-(ZINI-zc)**2) |
| 2293 |
alfaxz3(ntrpt) = -1/radius |
| 2294 |
endif |
| 2295 |
|
| 2296 |
**** -----------------------------------------------**** |
| 2297 |
**** reject non phisical triplets **** |
| 2298 |
**** -----------------------------------------------**** |
| 2299 |
if( |
| 2300 |
$ abs(alfaxz2(ntrpt)).gt.alfxz2_max |
| 2301 |
$ .or. |
| 2302 |
$ abs(alfaxz1(ntrpt)).gt.alfxz1_max |
| 2303 |
$ )ntrpt = ntrpt-1 |
| 2304 |
|
| 2305 |
|
| 2306 |
c print*,alfaxz1(ntrpt),alfaxz2(ntrpt),alfaxz3(ntrpt) |
| 2307 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2308 |
* track parameters on X VIEW - end |
| 2309 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2310 |
endif |
| 2311 |
enddo !end loop on COPPIA 3 |
| 2312 |
enddo !end loop on sensors - COPPIA 3 |
| 2313 |
30 continue |
| 2314 |
enddo !end loop on planes - COPPIA 3 |
| 2315 |
31 continue |
| 2316 |
|
| 2317 |
1 enddo !end loop on COPPIA 2 |
| 2318 |
enddo !end loop on sensors - COPPIA 2 |
| 2319 |
20 continue |
| 2320 |
enddo !end loop on planes - COPPIA 2 |
| 2321 |
|
| 2322 |
enddo !end loop on COPPIA1 |
| 2323 |
enddo !end loop on sensors - COPPIA 1 |
| 2324 |
10 continue |
| 2325 |
enddo !end loop on planes - COPPIA 1 |
| 2326 |
|
| 2327 |
if(DEBUG.EQ.1)then |
| 2328 |
print*,'--- doublets ',ndblt |
| 2329 |
print*,'--- triplets ',ntrpt |
| 2330 |
endif |
| 2331 |
|
| 2332 |
c goto 880 !ntp fill |
| 2333 |
|
| 2334 |
|
| 2335 |
return |
| 2336 |
end |
| 2337 |
|
| 2338 |
|
| 2339 |
|
| 2340 |
*************************************************** |
| 2341 |
* * |
| 2342 |
* * |
| 2343 |
* * |
| 2344 |
* * |
| 2345 |
* * |
| 2346 |
* * |
| 2347 |
************************************************** |
| 2348 |
|
| 2349 |
subroutine doub_to_YZcloud(iflag) |
| 2350 |
|
| 2351 |
include 'commontracker.f' |
| 2352 |
include 'level1.f' |
| 2353 |
include 'common_momanhough.f' |
| 2354 |
c include 'momanhough_init.f' |
| 2355 |
|
| 2356 |
|
| 2357 |
* output flag |
| 2358 |
* -------------- |
| 2359 |
* 0 = good event |
| 2360 |
* 1 = bad event |
| 2361 |
* -------------- |
| 2362 |
integer iflag |
| 2363 |
|
| 2364 |
integer db_used(ndblt_max) |
| 2365 |
integer db_temp(ndblt_max) |
| 2366 |
integer db_all(ndblt_max) !stores db ID in each cloud |
| 2367 |
|
| 2368 |
integer hit_plane(nplanes) |
| 2369 |
|
| 2370 |
* mask for used couples |
| 2371 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
| 2372 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
| 2373 |
|
| 2374 |
if(DEBUG.EQ.1)print*,'doub_to_YZcloud:' |
| 2375 |
|
| 2376 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2377 |
* classification of DOUBLETS |
| 2378 |
* according to distance in parameter space |
| 2379 |
* (cloud = group of points (doublets) in parameter space) |
| 2380 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2381 |
do idb=1,ndblt |
| 2382 |
db_used(idb)=0 |
| 2383 |
enddo |
| 2384 |
|
| 2385 |
distance=0 |
| 2386 |
nclouds_yz=0 !number of clouds |
| 2387 |
npt_tot=0 |
| 2388 |
nloop=0 |
| 2389 |
90 continue |
| 2390 |
do idb1=1,ndblt !loop (1) on DOUBLETS |
| 2391 |
if(db_used(idb1).eq.1)goto 2228 !db already included in a cloud |
| 2392 |
|
| 2393 |
c print*,'--------------' |
| 2394 |
c print*,'** ',idb1,' **' |
| 2395 |
|
| 2396 |
do icp=1,ncp_tot |
| 2397 |
cp_useds1(icp)=0 !init |
| 2398 |
cp_useds2(icp)=0 !init |
| 2399 |
enddo |
| 2400 |
do idb=1,ndblt |
| 2401 |
db_all(idb)=0 |
| 2402 |
enddo |
| 2403 |
if(cpyz1(idb1).gt.0)cp_useds2(cpyz1(idb1))=1 |
| 2404 |
if(cpyz1(idb1).lt.0)cp_useds1(-cpyz1(idb1))=1 |
| 2405 |
if(cpyz2(idb1).gt.0)cp_useds2(cpyz2(idb1))=1 |
| 2406 |
if(cpyz2(idb1).lt.0)cp_useds1(-cpyz2(idb1))=1 |
| 2407 |
temp1 = alfayz1(idb1) |
| 2408 |
temp2 = alfayz2(idb1) |
| 2409 |
npt=1 !counter of points in the cloud |
| 2410 |
|
| 2411 |
db_all(npt) = idb1 |
| 2412 |
|
| 2413 |
nptloop=1 |
| 2414 |
db_temp(1)=idb1 |
| 2415 |
|
| 2416 |
88 continue |
| 2417 |
|
| 2418 |
npv=0 !# new points inlcuded |
| 2419 |
do iloop=1,nptloop |
| 2420 |
idbref=db_temp(iloop) !local point of reference |
| 2421 |
ccccc if(db_used(idbref).eq.1)goto 1188 !next |
| 2422 |
|
| 2423 |
do idb2=1,ndblt !loop (2) on DOUBLETS |
| 2424 |
if(idb2.eq.idbref)goto 1118 !next doublet |
| 2425 |
if(db_used(idb2).eq.1)goto 1118 |
| 2426 |
|
| 2427 |
|
| 2428 |
* doublet distance in parameter space |
| 2429 |
distance= |
| 2430 |
$ ((alfayz1(idbref)-alfayz1(idb2))/Dalfayz1)**2 |
| 2431 |
$ +((alfayz2(idbref)-alfayz2(idb2))/Dalfayz2)**2 |
| 2432 |
distance = sqrt(distance) |
| 2433 |
|
| 2434 |
c$$$ if(iev.eq.33)then |
| 2435 |
c$$$ if(distance.lt.100) |
| 2436 |
c$$$ $ print*,'********* ',idb1,idbref,idb2,distance |
| 2437 |
c$$$ if(distance.lt.100) |
| 2438 |
c$$$ $ print*,'********* ',alfayz1(idbref),alfayz1(idb2) |
| 2439 |
c$$$ $ ,alfayz2(idbref),alfayz2(idb2) |
| 2440 |
c$$$ endif |
| 2441 |
if(distance.lt.cutdistyz)then |
| 2442 |
|
| 2443 |
c print*,idb1,idb2,distance,' cloud ',nclouds_yz |
| 2444 |
if(cpyz1(idb2).gt.0)cp_useds2(cpyz1(idb2))=1 |
| 2445 |
if(cpyz1(idb2).lt.0)cp_useds1(-cpyz1(idb2))=1 |
| 2446 |
if(cpyz2(idb2).gt.0)cp_useds2(cpyz2(idb2))=1 |
| 2447 |
if(cpyz2(idb2).lt.0)cp_useds1(-cpyz2(idb2))=1 |
| 2448 |
npt = npt + 1 !counter of points in the cloud |
| 2449 |
|
| 2450 |
npv = npv +1 |
| 2451 |
db_temp(npv) = idb2 |
| 2452 |
db_used(idbref) = 1 |
| 2453 |
db_used(idb2) = 1 |
| 2454 |
|
| 2455 |
db_all(npt) = idb2 |
| 2456 |
|
| 2457 |
temp1 = temp1 + alfayz1(idb2) |
| 2458 |
temp2 = temp2 + alfayz2(idb2) |
| 2459 |
c print*,'* idbref,idb2 ',idbref,idb2 |
| 2460 |
endif |
| 2461 |
|
| 2462 |
1118 continue |
| 2463 |
enddo !end loop (2) on DOUBLETS |
| 2464 |
|
| 2465 |
1188 continue |
| 2466 |
enddo !end loop on... bo? |
| 2467 |
|
| 2468 |
nptloop=npv |
| 2469 |
if(nptloop.ne.0)goto 88 |
| 2470 |
|
| 2471 |
* ------------------------------------------ |
| 2472 |
* stores the cloud only if |
| 2473 |
* 1) it includes a minimum number of REAL couples |
| 2474 |
* 1bis) it inlcudes a minimum number of doublets |
| 2475 |
* 2) it is not already stored |
| 2476 |
* ------------------------------------------ |
| 2477 |
do ip=1,nplanes |
| 2478 |
hit_plane(ip)=0 |
| 2479 |
enddo |
| 2480 |
ncpused=0 |
| 2481 |
do icp=1,ncp_tot |
| 2482 |
if(cp_useds1(icp).ne.0.or.cp_useds2(icp).ne.0)then |
| 2483 |
ncpused=ncpused+1 |
| 2484 |
ip=ip_cp(icp) |
| 2485 |
hit_plane(ip)=1 |
| 2486 |
endif |
| 2487 |
enddo |
| 2488 |
nplused=0 |
| 2489 |
do ip=1,nplanes |
| 2490 |
nplused=nplused+ hit_plane(ip) |
| 2491 |
enddo |
| 2492 |
c print*,'>>>> ',ncpused,npt,nplused |
| 2493 |
c if(ncpused.lt.ncpyz_min)goto 2228 !next doublet |
| 2494 |
if(npt.lt.nptyz_min)goto 2228 !next doublet |
| 2495 |
if(nplused.lt.nplyz_min)goto 2228 !next doublet |
| 2496 |
|
| 2497 |
* ~~~~~~~~~~~~~~~~~ |
| 2498 |
* >>> NEW CLOUD <<< |
| 2499 |
|
| 2500 |
if(nclouds_yz.ge.ncloyz_max)then |
| 2501 |
if(verbose.eq.1)print*, |
| 2502 |
$ '** warning ** number of identified '// |
| 2503 |
$ 'YZ clouds exceeds vector dimention ' |
| 2504 |
$ ,'( ',ncloyz_max,' )' |
| 2505 |
c good2=.false. |
| 2506 |
c goto 880 !fill ntp and go to next event |
| 2507 |
do iv=1,nviews |
| 2508 |
c mask_view(iv) = 5 |
| 2509 |
mask_view(iv) = mask_view(iv) + 2**4 |
| 2510 |
enddo |
| 2511 |
iflag=1 |
| 2512 |
return |
| 2513 |
endif |
| 2514 |
|
| 2515 |
nclouds_yz = nclouds_yz + 1 !increase counter |
| 2516 |
alfayz1_av(nclouds_yz) = temp1/npt !store average parameter |
| 2517 |
alfayz2_av(nclouds_yz) = temp2/npt ! " |
| 2518 |
do icp=1,ncp_tot |
| 2519 |
cpcloud_yz(nclouds_yz,icp)= |
| 2520 |
$ cp_useds1(icp)+2*cp_useds2(icp) !store cp info |
| 2521 |
enddo |
| 2522 |
ptcloud_yz(nclouds_yz)=npt |
| 2523 |
c ptcloud_yz_nt(nclouds_yz)=npt |
| 2524 |
do ipt=1,npt |
| 2525 |
db_cloud(npt_tot+ipt) = db_all(ipt) |
| 2526 |
c print*,'>> ',ipt,db_all(ipt) |
| 2527 |
enddo |
| 2528 |
npt_tot=npt_tot+npt |
| 2529 |
if(DEBUG.EQ.1)then |
| 2530 |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
| 2531 |
print*,'>>>> cloud ',nclouds_yz,' --- ',npt,' points' |
| 2532 |
print*,'- alfayz1 ',alfayz1_av(nclouds_yz) |
| 2533 |
print*,'- alfayz2 ',alfayz2_av(nclouds_yz) |
| 2534 |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
| 2535 |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
| 2536 |
print*,'cpcloud_yz ' |
| 2537 |
$ ,(cpcloud_yz(nclouds_yz,icp),icp=1,ncp_tot) |
| 2538 |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
| 2539 |
c$$$ print*,'nt-uple: ptcloud_yz(',nclouds_yz,') = ' |
| 2540 |
c$$$ $ ,ptcloud_yz(nclouds_yz) |
| 2541 |
c$$$ print*,'nt-uple: db_cloud(...) = ' |
| 2542 |
c$$$ $ ,(db_cloud(iii),iii=npt_tot-npt+1,npt_tot) |
| 2543 |
endif |
| 2544 |
* >>> NEW CLOUD <<< |
| 2545 |
* ~~~~~~~~~~~~~~~~~ |
| 2546 |
2228 continue |
| 2547 |
enddo !end loop (1) on DOUBLETS |
| 2548 |
|
| 2549 |
|
| 2550 |
if(nloop.lt.nstepy)then |
| 2551 |
cutdistyz = cutdistyz+cutystep |
| 2552 |
nloop = nloop+1 |
| 2553 |
goto 90 |
| 2554 |
endif |
| 2555 |
|
| 2556 |
if(DEBUG.EQ.1)then |
| 2557 |
print*,'---------------------- ' |
| 2558 |
print*,'Y-Z total clouds ',nclouds_yz |
| 2559 |
print*,' ' |
| 2560 |
endif |
| 2561 |
|
| 2562 |
|
| 2563 |
return |
| 2564 |
end |
| 2565 |
|
| 2566 |
|
| 2567 |
|
| 2568 |
|
| 2569 |
|
| 2570 |
*************************************************** |
| 2571 |
* * |
| 2572 |
* * |
| 2573 |
* * |
| 2574 |
* * |
| 2575 |
* * |
| 2576 |
* * |
| 2577 |
************************************************** |
| 2578 |
|
| 2579 |
subroutine trip_to_XZcloud(iflag) |
| 2580 |
|
| 2581 |
include 'commontracker.f' |
| 2582 |
include 'level1.f' |
| 2583 |
include 'common_momanhough.f' |
| 2584 |
c include 'momanhough_init.f' |
| 2585 |
|
| 2586 |
|
| 2587 |
* output flag |
| 2588 |
* -------------- |
| 2589 |
* 0 = good event |
| 2590 |
* 1 = bad event |
| 2591 |
* -------------- |
| 2592 |
integer iflag |
| 2593 |
|
| 2594 |
integer tr_used(ntrpt_max) |
| 2595 |
integer tr_temp(ntrpt_max) |
| 2596 |
integer tr_incl(ntrpt_max) |
| 2597 |
integer tr_all(ntrpt_max) !stores tr ID in each cloud |
| 2598 |
|
| 2599 |
integer hit_plane(nplanes) |
| 2600 |
|
| 2601 |
* mask for used couples |
| 2602 |
integer cp_useds1(ncouplemaxtot) ! sensor 1 |
| 2603 |
integer cp_useds2(ncouplemaxtot) ! sensor 2 |
| 2604 |
|
| 2605 |
if(DEBUG.EQ.1)print*,'trip_to_XZcloud:' |
| 2606 |
|
| 2607 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2608 |
* classification of TRIPLETS |
| 2609 |
* according to distance in parameter space |
| 2610 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2611 |
do itr=1,ntrpt |
| 2612 |
tr_used(itr)=0 |
| 2613 |
enddo |
| 2614 |
|
| 2615 |
distance=0 |
| 2616 |
nclouds_xz=0 !number of clouds |
| 2617 |
npt_tot=0 !total number of selected triplets |
| 2618 |
nloop=0 |
| 2619 |
91 continue |
| 2620 |
do itr1=1,ntrpt !loop (1) on TRIPLETS |
| 2621 |
if(tr_used(itr1).eq.1)goto 22288 !already included in a cloud |
| 2622 |
c print*,'--------------' |
| 2623 |
c print*,'** ',itr1,' **' |
| 2624 |
|
| 2625 |
do icp=1,ncp_tot |
| 2626 |
cp_useds1(icp)=0 |
| 2627 |
cp_useds2(icp)=0 |
| 2628 |
enddo |
| 2629 |
do itr=1,ntrpt |
| 2630 |
tr_all(itr)=0 !list of included triplets |
| 2631 |
enddo |
| 2632 |
if(cpxz1(itr1).gt.0)cp_useds2(cpxz1(itr1))=1 |
| 2633 |
if(cpxz1(itr1).lt.0)cp_useds1(-cpxz1(itr1))=1 |
| 2634 |
if(cpxz2(itr1).gt.0)cp_useds2(cpxz2(itr1))=1 |
| 2635 |
if(cpxz2(itr1).lt.0)cp_useds1(-cpxz2(itr1))=1 |
| 2636 |
if(cpxz3(itr1).gt.0)cp_useds2(cpxz3(itr1))=1 |
| 2637 |
if(cpxz3(itr1).lt.0)cp_useds1(-cpxz3(itr1))=1 |
| 2638 |
temp1 = alfaxz1(itr1) |
| 2639 |
temp2 = alfaxz2(itr1) |
| 2640 |
temp3 = alfaxz3(itr1) |
| 2641 |
npt=1 !counter of points in the cloud |
| 2642 |
|
| 2643 |
tr_all(npt) = itr1 |
| 2644 |
|
| 2645 |
nptloop=1 |
| 2646 |
c tr_temp(1)=itr1 |
| 2647 |
tr_incl(1)=itr1 |
| 2648 |
|
| 2649 |
8881 continue |
| 2650 |
|
| 2651 |
npv=0 !# new points inlcuded |
| 2652 |
do iloop=1,nptloop |
| 2653 |
itrref=tr_incl(iloop) !local point of reference |
| 2654 |
do itr2=1,ntrpt !loop (2) on TRIPLETS |
| 2655 |
if(itr2.eq.itr1)goto 11188 !next triplet |
| 2656 |
if(tr_used(itr2).eq.1)goto 11188 !next triplet |
| 2657 |
* triplet distance in parameter space |
| 2658 |
* solo i due parametri spaziali per il momemnto |
| 2659 |
distance= |
| 2660 |
$ ((alfaxz1(itrref)-alfaxz1(itr2))/Dalfaxz1)**2 |
| 2661 |
$ +((alfaxz2(itrref)-alfaxz2(itr2))/Dalfaxz2)**2 |
| 2662 |
distance = sqrt(distance) |
| 2663 |
|
| 2664 |
* ------------------------------------------------------------------------ |
| 2665 |
* FORCE INCLUSION OF TRIPLETS COMPOSED BY SAME COUPLES, IGNORING THE IMAGE |
| 2666 |
* ------------------------------------------------------------------------ |
| 2667 |
* (added in august 2007) |
| 2668 |
istrimage=0 |
| 2669 |
if( |
| 2670 |
$ abs(cpxz1(itrref)).eq.abs(cpxz1(itr2)).and. |
| 2671 |
$ abs(cpxz2(itrref)).eq.abs(cpxz2(itr2)).and. |
| 2672 |
$ abs(cpxz3(itrref)).eq.abs(cpxz3(itr2)).and. |
| 2673 |
$ .true.)istrimage=1 |
| 2674 |
|
| 2675 |
if(distance.lt.cutdistxz.or.istrimage.eq.1)then |
| 2676 |
c print*,idb1,idb2,distance,' cloud ',nclouds_yz |
| 2677 |
if(cpxz1(itr2).gt.0)cp_useds2(cpxz1(itr2))=1 |
| 2678 |
if(cpxz1(itr2).lt.0)cp_useds1(-cpxz1(itr2))=1 |
| 2679 |
if(cpxz2(itr2).gt.0)cp_useds2(cpxz2(itr2))=1 |
| 2680 |
if(cpxz2(itr2).lt.0)cp_useds1(-cpxz2(itr2))=1 |
| 2681 |
if(cpxz3(itr2).gt.0)cp_useds2(cpxz3(itr2))=1 |
| 2682 |
if(cpxz3(itr2).lt.0)cp_useds1(-cpxz3(itr2))=1 |
| 2683 |
npt = npt + 1 !counter of points in the cloud |
| 2684 |
|
| 2685 |
npv = npv +1 |
| 2686 |
tr_temp(npv) = itr2 |
| 2687 |
tr_used(itrref) = 1 |
| 2688 |
tr_used(itr2) = 1 |
| 2689 |
|
| 2690 |
tr_all(npt) = itr2 |
| 2691 |
|
| 2692 |
temp1 = temp1 + alfaxz1(itr2) |
| 2693 |
temp2 = temp2 + alfaxz2(itr2) |
| 2694 |
temp3 = temp3 + alfaxz3(itr2) |
| 2695 |
c print*,'* itrref,itr2 ',itrref,itr2,distance |
| 2696 |
endif |
| 2697 |
|
| 2698 |
11188 continue |
| 2699 |
enddo !end loop (2) on TRIPLETS |
| 2700 |
|
| 2701 |
11888 continue |
| 2702 |
enddo !end loop on... bo? |
| 2703 |
|
| 2704 |
nptloop=npv |
| 2705 |
do i=1,npv |
| 2706 |
tr_incl(i)=tr_temp(i) |
| 2707 |
enddo |
| 2708 |
if(nptloop.ne.0)goto 8881 |
| 2709 |
|
| 2710 |
* ------------------------------------------ |
| 2711 |
* stores the cloud only if |
| 2712 |
* 1) it includes a minimum number of REAL couples |
| 2713 |
* 1bis) |
| 2714 |
* 2) it is not already stored |
| 2715 |
* ------------------------------------------ |
| 2716 |
c print*,'check cp_used' |
| 2717 |
do ip=1,nplanes |
| 2718 |
hit_plane(ip)=0 |
| 2719 |
enddo |
| 2720 |
ncpused=0 |
| 2721 |
do icp=1,ncp_tot |
| 2722 |
if(cp_useds1(icp).ne.0.or.cp_useds2(icp).ne.0)then |
| 2723 |
ncpused=ncpused+1 |
| 2724 |
ip=ip_cp(icp) |
| 2725 |
hit_plane(ip)=1 |
| 2726 |
endif |
| 2727 |
enddo |
| 2728 |
nplused=0 |
| 2729 |
do ip=1,nplanes |
| 2730 |
nplused=nplused+ hit_plane(ip) |
| 2731 |
enddo |
| 2732 |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
| 2733 |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
| 2734 |
if(nplused.lt.nplxz_min)goto 22288 !next triplet |
| 2735 |
|
| 2736 |
* ~~~~~~~~~~~~~~~~~ |
| 2737 |
* >>> NEW CLOUD <<< |
| 2738 |
if(nclouds_xz.ge.ncloxz_max)then |
| 2739 |
if(verbose.eq.1)print*, |
| 2740 |
$ '** warning ** number of identified '// |
| 2741 |
$ 'XZ clouds exceeds vector dimention ' |
| 2742 |
$ ,'( ',ncloxz_max,' )' |
| 2743 |
c good2=.false. |
| 2744 |
c goto 880 !fill ntp and go to next event |
| 2745 |
do iv=1,nviews |
| 2746 |
c mask_view(iv) = 6 |
| 2747 |
mask_view(iv) = mask_view(iv) + 2**5 |
| 2748 |
enddo |
| 2749 |
iflag=1 |
| 2750 |
return |
| 2751 |
endif |
| 2752 |
nclouds_xz = nclouds_xz + 1 !increase counter |
| 2753 |
alfaxz1_av(nclouds_xz) = temp1/npt !store average parameter |
| 2754 |
alfaxz2_av(nclouds_xz) = temp2/npt ! " |
| 2755 |
alfaxz3_av(nclouds_xz) = temp3/npt ! " |
| 2756 |
do icp=1,ncp_tot |
| 2757 |
cpcloud_xz(nclouds_xz,icp)= |
| 2758 |
$ cp_useds1(icp)+2*cp_useds2(icp) !store cp info |
| 2759 |
enddo |
| 2760 |
ptcloud_xz(nclouds_xz)=npt |
| 2761 |
do ipt=1,npt |
| 2762 |
tr_cloud(npt_tot+ipt) = tr_all(ipt) |
| 2763 |
enddo |
| 2764 |
npt_tot=npt_tot+npt |
| 2765 |
|
| 2766 |
if(DEBUG.EQ.1)then |
| 2767 |
print*,'-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~' |
| 2768 |
print*,'>>>> cloud ',nclouds_xz,' --- ',npt,' points' |
| 2769 |
print*,'- alfaxz1 ',alfaxz1_av(nclouds_xz) |
| 2770 |
print*,'- alfaxz2 ',alfaxz2_av(nclouds_xz) |
| 2771 |
print*,'- alfaxz3 ',alfaxz3_av(nclouds_xz) |
| 2772 |
print*,'cp_useds1 ',(cp_useds1(icp),icp=1,ncp_tot) |
| 2773 |
print*,'cp_useds2 ',(cp_useds2(icp),icp=1,ncp_tot) |
| 2774 |
print*,'cpcloud_xz ' |
| 2775 |
$ ,(cpcloud_xz(nclouds_xz,icp),icp=1,ncp_tot) |
| 2776 |
print*,'hit_plane ',(hit_plane(ip),ip=1,nplanes) |
| 2777 |
c$$$ print*,'nt-uple: ptcloud_xz(',nclouds_xz,') = ' |
| 2778 |
c$$$ $ ,ptcloud_xz(nclouds_xz) |
| 2779 |
c$$$ print*,'nt-uple: tr_cloud(...) = ' |
| 2780 |
c$$$ $ ,(tr_cloud(iii),iii=npt_tot-npt+1,npt_tot) |
| 2781 |
endif |
| 2782 |
* >>> NEW CLOUD <<< |
| 2783 |
* ~~~~~~~~~~~~~~~~~ |
| 2784 |
22288 continue |
| 2785 |
enddo !end loop (1) on DOUBLETS |
| 2786 |
|
| 2787 |
if(nloop.lt.nstepx)then |
| 2788 |
cutdistxz=cutdistxz+cutxstep |
| 2789 |
nloop=nloop+1 |
| 2790 |
goto 91 |
| 2791 |
endif |
| 2792 |
|
| 2793 |
if(DEBUG.EQ.1)then |
| 2794 |
print*,'---------------------- ' |
| 2795 |
print*,'X-Z total clouds ',nclouds_xz |
| 2796 |
print*,' ' |
| 2797 |
endif |
| 2798 |
|
| 2799 |
|
| 2800 |
return |
| 2801 |
end |
| 2802 |
|
| 2803 |
|
| 2804 |
*************************************************** |
| 2805 |
* * |
| 2806 |
* * |
| 2807 |
* * |
| 2808 |
* * |
| 2809 |
* * |
| 2810 |
* * |
| 2811 |
************************************************** |
| 2812 |
|
| 2813 |
subroutine clouds_to_ctrack(iflag) |
| 2814 |
|
| 2815 |
include 'commontracker.f' |
| 2816 |
include 'level1.f' |
| 2817 |
include 'common_momanhough.f' |
| 2818 |
include 'common_xyzPAM.f' |
| 2819 |
include 'common_mini_2.f' |
| 2820 |
include 'common_mech.f' |
| 2821 |
|
| 2822 |
|
| 2823 |
|
| 2824 |
* output flag |
| 2825 |
* -------------- |
| 2826 |
* 0 = good event |
| 2827 |
* 1 = bad event |
| 2828 |
* -------------- |
| 2829 |
integer iflag |
| 2830 |
|
| 2831 |
* ----------------------------------------------------------- |
| 2832 |
* mask to store (locally) the couples included |
| 2833 |
* in the intersection bewteen a XZ and YZ cloud |
| 2834 |
integer cpintersec(ncouplemaxtot) |
| 2835 |
* ----------------------------------------------------------- |
| 2836 |
* list of matching couples in the combination |
| 2837 |
* between a XZ and YZ cloud |
| 2838 |
integer cp_match(nplanes,2*ncouplemax) |
| 2839 |
integer ncp_match(nplanes) |
| 2840 |
* ----------------------------------------------------------- |
| 2841 |
integer hit_plane(nplanes) |
| 2842 |
* ----------------------------------------------------------- |
| 2843 |
* variables for track fitting |
| 2844 |
double precision AL_INI(5) |
| 2845 |
* ----------------------------------------------------------- |
| 2846 |
|
| 2847 |
if(DEBUG.EQ.1)print*,'clouds_to_ctrack:' |
| 2848 |
|
| 2849 |
|
| 2850 |
ntracks=0 !counter of track candidates |
| 2851 |
|
| 2852 |
do iyz=1,nclouds_yz !loop on YZ couds |
| 2853 |
do ixz=1,nclouds_xz !loop on XZ couds |
| 2854 |
|
| 2855 |
* -------------------------------------------------- |
| 2856 |
* check of consistency of the clouds |
| 2857 |
* ---> required a minimum number of matching couples |
| 2858 |
* the track fit will be performed on the INTERSECTION |
| 2859 |
* of the two clouds |
| 2860 |
* -------------------------------------------------- |
| 2861 |
do ip=1,nplanes |
| 2862 |
hit_plane(ip)=0 |
| 2863 |
ncp_match(ip)=0 |
| 2864 |
do icpp=1,ncouplemax |
| 2865 |
cp_match(ip,icpp)=0 !init couple list |
| 2866 |
enddo |
| 2867 |
enddo |
| 2868 |
ncp_ok=0 |
| 2869 |
do icp=1,ncp_tot !loop over couples |
| 2870 |
* get info on |
| 2871 |
cpintersec(icp)=min( |
| 2872 |
$ cpcloud_yz(iyz,icp), |
| 2873 |
$ cpcloud_xz(ixz,icp)) |
| 2874 |
if( |
| 2875 |
$ (cpcloud_yz(iyz,icp).eq.1.and.cpcloud_xz(ixz,icp).eq.2).or. |
| 2876 |
$ (cpcloud_yz(iyz,icp).eq.2.and.cpcloud_xz(ixz,icp).eq.1).or. |
| 2877 |
$ .false.)cpintersec(icp)=0 |
| 2878 |
* cpintersec is >0 if yz and xz clouds contain the same image of couple icp |
| 2879 |
if(cpintersec(icp).ne.0)then |
| 2880 |
ncp_ok=ncp_ok+1 |
| 2881 |
|
| 2882 |
ip=ip_cp(icp) |
| 2883 |
hit_plane(ip)=1 |
| 2884 |
if(cpintersec(icp).eq.1)then |
| 2885 |
* 1) only the couple image in sensor 1 matches |
| 2886 |
id=-icp |
| 2887 |
ncp_match(ip)=ncp_match(ip)+1 |
| 2888 |
cp_match(ip,ncp_match(ip))=id |
| 2889 |
elseif(cpintersec(icp).eq.2)then |
| 2890 |
* 2) only the couple image in sensor 2 matches |
| 2891 |
id=icp |
| 2892 |
ncp_match(ip)=ncp_match(ip)+1 |
| 2893 |
cp_match(ip,ncp_match(ip))=id |
| 2894 |
else |
| 2895 |
* 3) both couple images match |
| 2896 |
id=icp |
| 2897 |
do is=1,2 |
| 2898 |
id=-id |
| 2899 |
ncp_match(ip)=ncp_match(ip)+1 |
| 2900 |
cp_match(ip,ncp_match(ip))=id |
| 2901 |
enddo |
| 2902 |
endif |
| 2903 |
endif !end matching condition |
| 2904 |
enddo !end loop on couples |
| 2905 |
|
| 2906 |
nplused=0 |
| 2907 |
do ip=1,nplanes |
| 2908 |
nplused=nplused+ hit_plane(ip) |
| 2909 |
enddo |
| 2910 |
|
| 2911 |
|
| 2912 |
if(DEBUG.EQ.1)then |
| 2913 |
print*,'Combination ',iyz,ixz |
| 2914 |
$ ,' db ',ptcloud_yz(iyz) |
| 2915 |
$ ,' tr ',ptcloud_xz(ixz) |
| 2916 |
$ ,' -----> # matching couples ',ncp_ok |
| 2917 |
endif |
| 2918 |
|
| 2919 |
c if(nplused.lt.nplxz_min)goto 888 !next combination |
| 2920 |
if(nplused.lt.nplyz_min)goto 888 !next combination |
| 2921 |
if(ncp_ok.lt.ncpok)goto 888 !next combination |
| 2922 |
|
| 2923 |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 2924 |
c$$$ print*,'Configurazione cluster XZ' |
| 2925 |
c$$$ print*,'1 -- ',(clx(1,i),i=1,ncp_plane(1)) |
| 2926 |
c$$$ print*,'2 -- ',(clx(2,i),i=1,ncp_plane(1)) |
| 2927 |
c$$$ print*,'3 -- ',(clx(3,i),i=1,ncp_plane(1)) |
| 2928 |
c$$$ print*,'4 -- ',(clx(4,i),i=1,ncp_plane(1)) |
| 2929 |
c$$$ print*,'5 -- ',(clx(5,i),i=1,ncp_plane(1)) |
| 2930 |
c$$$ print*,'6 -- ',(clx(6,i),i=1,ncp_plane(1)) |
| 2931 |
c$$$ print*,'Configurazione cluster YZ' |
| 2932 |
c$$$ print*,'1 -- ',(cly(1,i),i=1,ncp_plane(1)) |
| 2933 |
c$$$ print*,'2 -- ',(cly(2,i),i=1,ncp_plane(1)) |
| 2934 |
c$$$ print*,'3 -- ',(cly(3,i),i=1,ncp_plane(1)) |
| 2935 |
c$$$ print*,'4 -- ',(cly(4,i),i=1,ncp_plane(1)) |
| 2936 |
c$$$ print*,'5 -- ',(cly(5,i),i=1,ncp_plane(1)) |
| 2937 |
c$$$ print*,'6 -- ',(cly(6,i),i=1,ncp_plane(1)) |
| 2938 |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 2939 |
|
| 2940 |
* -------> INITIAL GUESS <------- |
| 2941 |
cccc SBAGLIATO |
| 2942 |
c$$$ AL_INI(1) = dreal(alfaxz1_av(ixz)) |
| 2943 |
c$$$ AL_INI(2) = dreal(alfayz1_av(iyz)) |
| 2944 |
c$$$ AL_INI(4) = PIGR + datan(dreal(alfayz2_av(iyz)) |
| 2945 |
c$$$ $ /dreal(alfaxz2_av(ixz))) |
| 2946 |
c$$$ tath = -dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
| 2947 |
c$$$ AL_INI(3) = tath/sqrt(1+tath**2) |
| 2948 |
c$$$ AL_INI(5) = (1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
| 2949 |
cccc GIUSTO (ma si sua guess()) |
| 2950 |
c$$$ AL_INI(1) = dreal(alfaxz1_av(ixz)) |
| 2951 |
c$$$ AL_INI(2) = dreal(alfayz1_av(iyz)) |
| 2952 |
c$$$ tath = -dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
| 2953 |
c$$$ AL_INI(3) = tath/sqrt(1+tath**2) |
| 2954 |
c$$$ IF(alfaxz2_av(ixz).NE.0)THEN |
| 2955 |
c$$$ AL_INI(4) = PIGR + datan(dreal(alfayz2_av(iyz)) |
| 2956 |
c$$$ $ /dreal(alfaxz2_av(ixz))) |
| 2957 |
c$$$ ELSE |
| 2958 |
c$$$ AL_INI(4) = acos(-1.)/2 |
| 2959 |
c$$$ IF(alfayz2_av(iyz).LT.0)AL_INI(4) = AL_INI(4)+acos(-1.) |
| 2960 |
c$$$ ENDIF |
| 2961 |
c$$$ IF(alfaxz2_av(ixz).LT.0)AL_INI(4)= acos(-1.)+ AL_INI(4) |
| 2962 |
c$$$ AL_INI(4) = -acos(-1.) + AL_INI(4) !from incidence direction to tracking rs |
| 2963 |
c$$$ |
| 2964 |
c$$$ AL_INI(5) = (1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
| 2965 |
c$$$ |
| 2966 |
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
| 2967 |
|
| 2968 |
if(DEBUG.EQ.1)then |
| 2969 |
print*,'track candidate', ntracks+1 |
| 2970 |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
| 2971 |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
| 2972 |
print*,'3 >>> ',(cp_match(4,i),i=1,ncp_match(4)) |
| 2973 |
print*,'4 >>> ',(cp_match(3,i),i=1,ncp_match(3)) |
| 2974 |
print*,'5 >>> ',(cp_match(2,i),i=1,ncp_match(2)) |
| 2975 |
print*,'6 >>> ',(cp_match(1,i),i=1,ncp_match(1)) |
| 2976 |
endif |
| 2977 |
|
| 2978 |
do icp1=1,max(1,ncp_match(1)) |
| 2979 |
hit_plane(1)=icp1 |
| 2980 |
if(ncp_match(1).eq.0)hit_plane(1)=0 !-icp1 |
| 2981 |
|
| 2982 |
do icp2=1,max(1,ncp_match(2)) |
| 2983 |
hit_plane(2)=icp2 |
| 2984 |
if(ncp_match(2).eq.0)hit_plane(2)=0 !-icp2 |
| 2985 |
|
| 2986 |
do icp3=1,max(1,ncp_match(3)) |
| 2987 |
hit_plane(3)=icp3 |
| 2988 |
if(ncp_match(3).eq.0)hit_plane(3)=0 !-icp3 |
| 2989 |
|
| 2990 |
do icp4=1,max(1,ncp_match(4)) |
| 2991 |
hit_plane(4)=icp4 |
| 2992 |
if(ncp_match(4).eq.0)hit_plane(4)=0 !-icp4 |
| 2993 |
|
| 2994 |
do icp5=1,max(1,ncp_match(5)) |
| 2995 |
hit_plane(5)=icp5 |
| 2996 |
if(ncp_match(5).eq.0)hit_plane(5)=0 !-icp5 |
| 2997 |
|
| 2998 |
do icp6=1,max(1,ncp_match(6)) |
| 2999 |
hit_plane(6)=icp6 |
| 3000 |
if(ncp_match(6).eq.0)hit_plane(6)=0 !-icp6 |
| 3001 |
|
| 3002 |
* --------------------------------------- |
| 3003 |
* check if this group of couples has been |
| 3004 |
* already fitted |
| 3005 |
* --------------------------------------- |
| 3006 |
do ica=1,ntracks |
| 3007 |
isthesame=1 |
| 3008 |
do ip=1,NPLANES |
| 3009 |
if(hit_plane(ip).ne.0)then |
| 3010 |
if( CP_STORE(nplanes-ip+1,ica) |
| 3011 |
$ .ne. |
| 3012 |
$ cp_match(ip,hit_plane(ip)) ) |
| 3013 |
$ isthesame=0 |
| 3014 |
else |
| 3015 |
if( CP_STORE(nplanes-ip+1,ica) |
| 3016 |
$ .ne. |
| 3017 |
$ 0 ) |
| 3018 |
$ isthesame=0 |
| 3019 |
endif |
| 3020 |
enddo |
| 3021 |
if(isthesame.eq.1)then |
| 3022 |
if(DEBUG.eq.1) |
| 3023 |
$ print*,'(already fitted)' |
| 3024 |
goto 666 !jump to next combination |
| 3025 |
endif |
| 3026 |
enddo |
| 3027 |
|
| 3028 |
call track_init !init TRACK common |
| 3029 |
|
| 3030 |
do ip=1,nplanes !loop on planes (bottom to top) |
| 3031 |
if(hit_plane(ip).ne.0)then |
| 3032 |
id=cp_match(ip,hit_plane(ip)) |
| 3033 |
is=is_cp(id) |
| 3034 |
icp=icp_cp(id) |
| 3035 |
if(ip_cp(id).ne.ip) |
| 3036 |
$ print*,'OKKIO!!' |
| 3037 |
$ ,'id ',id,is,icp |
| 3038 |
$ ,ip_cp(id),ip |
| 3039 |
icx=clx(ip,icp) |
| 3040 |
icy=cly(ip,icp) |
| 3041 |
* ************************* |
| 3042 |
c call xyz_PAM(icx,icy,is, |
| 3043 |
c $ 'COG2','COG2',0.,0.) |
| 3044 |
c call xyz_PAM(icx,icy,is, !(1) |
| 3045 |
c $ PFAdef,PFAdef,0.,0.) !(1) |
| 3046 |
call xyz_PAM(icx,icy,is, !(1) |
| 3047 |
$ PFAdef,PFAdef,0.,0.,0.,0.) |
| 3048 |
* ************************* |
| 3049 |
* ----------------------------- |
| 3050 |
xgood(nplanes-ip+1)=1. |
| 3051 |
ygood(nplanes-ip+1)=1. |
| 3052 |
xm(nplanes-ip+1)=xPAM |
| 3053 |
ym(nplanes-ip+1)=yPAM |
| 3054 |
zm(nplanes-ip+1)=zPAM |
| 3055 |
resx(nplanes-ip+1)=resxPAM |
| 3056 |
resy(nplanes-ip+1)=resyPAM |
| 3057 |
* ----------------------------- |
| 3058 |
endif |
| 3059 |
enddo !end loop on planes |
| 3060 |
* ********************************************************** |
| 3061 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
| 3062 |
* ********************************************************** |
| 3063 |
cccc scommentare se si usa al_ini della nuvola |
| 3064 |
c$$$ do i=1,5 |
| 3065 |
c$$$ AL(i)=AL_INI(i) |
| 3066 |
c$$$ enddo |
| 3067 |
call guess() |
| 3068 |
do i=1,5 |
| 3069 |
AL_INI(i)=AL(i) |
| 3070 |
enddo |
| 3071 |
ifail=0 !error flag in chi^2 computation |
| 3072 |
jstep=0 !number of minimization steps |
| 3073 |
iprint=0 |
| 3074 |
c if(DEBUG.EQ.1)iprint=1 |
| 3075 |
if(DEBUG.EQ.1)iprint=2 |
| 3076 |
call mini2(jstep,ifail,iprint) |
| 3077 |
if(ifail.ne.0) then |
| 3078 |
if(DEBUG.EQ.1)then |
| 3079 |
print *, |
| 3080 |
$ '*** MINIMIZATION FAILURE *** ' |
| 3081 |
$ //'(clouds_to_ctrack)' |
| 3082 |
print*,'initial guess: ' |
| 3083 |
|
| 3084 |
print*,'AL_INI(1) = ',AL_INI(1) |
| 3085 |
print*,'AL_INI(2) = ',AL_INI(2) |
| 3086 |
print*,'AL_INI(3) = ',AL_INI(3) |
| 3087 |
print*,'AL_INI(4) = ',AL_INI(4) |
| 3088 |
print*,'AL_INI(5) = ',AL_INI(5) |
| 3089 |
endif |
| 3090 |
c chi2=-chi2 |
| 3091 |
endif |
| 3092 |
* ********************************************************** |
| 3093 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
| 3094 |
* ********************************************************** |
| 3095 |
|
| 3096 |
if(chi2.le.0.)goto 666 |
| 3097 |
|
| 3098 |
* -------------------------- |
| 3099 |
* STORE candidate TRACK INFO |
| 3100 |
* -------------------------- |
| 3101 |
if(ntracks.eq.NTRACKSMAX)then |
| 3102 |
|
| 3103 |
if(verbose.eq.1)print*, |
| 3104 |
$ '** warning ** number of candidate tracks '// |
| 3105 |
$ ' exceeds vector dimension ' |
| 3106 |
$ ,'( ',NTRACKSMAX,' )' |
| 3107 |
c good2=.false. |
| 3108 |
c goto 880 !fill ntp and go to next event |
| 3109 |
do iv=1,nviews |
| 3110 |
c mask_view(iv) = 7 |
| 3111 |
mask_view(iv) = mask_view(iv) + 2**6 |
| 3112 |
enddo |
| 3113 |
iflag=1 |
| 3114 |
return |
| 3115 |
endif |
| 3116 |
|
| 3117 |
ntracks = ntracks + 1 |
| 3118 |
|
| 3119 |
do ip=1,nplanes !top to bottom |
| 3120 |
|
| 3121 |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
| 3122 |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
| 3123 |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
| 3124 |
XM_STORE(ip,ntracks)=sngl(xm(ip)) |
| 3125 |
YM_STORE(ip,ntracks)=sngl(ym(ip)) |
| 3126 |
ZM_STORE(ip,ntracks)=sngl(zm(ip)) |
| 3127 |
RESX_STORE(ip,ntracks)=sngl(resx(ip)) |
| 3128 |
RESY_STORE(ip,ntracks)=sngl(resy(ip)) |
| 3129 |
XV_STORE(ip,ntracks)=sngl(xv(ip)) |
| 3130 |
YV_STORE(ip,ntracks)=sngl(yv(ip)) |
| 3131 |
ZV_STORE(ip,ntracks)=sngl(zv(ip)) |
| 3132 |
AXV_STORE(ip,ntracks)=sngl(axv(ip)) |
| 3133 |
AYV_STORE(ip,ntracks)=sngl(ayv(ip)) |
| 3134 |
XGOOD_STORE(ip,ntracks)=sngl(xgood(ip)) |
| 3135 |
YGOOD_STORE(ip,ntracks)=sngl(ygood(ip)) |
| 3136 |
* NB! hit_plane is defined from bottom to top |
| 3137 |
if(hit_plane(ip).ne.0)then |
| 3138 |
CP_STORE(nplanes-ip+1,ntracks)= |
| 3139 |
$ cp_match(ip,hit_plane(ip)) |
| 3140 |
SENSOR_STORE(nplanes-ip+1,ntracks) |
| 3141 |
$ = is_cp(cp_match(ip,hit_plane(ip))) |
| 3142 |
LADDER_STORE(nplanes-ip+1,ntracks) |
| 3143 |
$ = LADDER( |
| 3144 |
$ clx(ip,icp_cp( |
| 3145 |
$ cp_match(ip,hit_plane(ip) |
| 3146 |
$ )))); |
| 3147 |
else |
| 3148 |
CP_STORE(nplanes-ip+1,ntracks)=0 |
| 3149 |
SENSOR_STORE(nplanes-ip+1,ntracks)=0 |
| 3150 |
LADDER_STORE(nplanes-ip+1,ntracks)=0 |
| 3151 |
endif |
| 3152 |
BX_STORE(ip,ntracks)=0!I dont need it now |
| 3153 |
BY_STORE(ip,ntracks)=0!I dont need it now |
| 3154 |
CLS_STORE(ip,ntracks)=0 |
| 3155 |
do i=1,5 |
| 3156 |
AL_STORE(i,ntracks)=sngl(AL(i)) |
| 3157 |
enddo |
| 3158 |
enddo |
| 3159 |
|
| 3160 |
RCHI2_STORE(ntracks)=chi2 |
| 3161 |
|
| 3162 |
* -------------------------------- |
| 3163 |
* STORE candidate TRACK INFO - end |
| 3164 |
* -------------------------------- |
| 3165 |
|
| 3166 |
666 continue |
| 3167 |
enddo !end loop on cp in plane 6 |
| 3168 |
enddo !end loop on cp in plane 5 |
| 3169 |
enddo !end loop on cp in plane 4 |
| 3170 |
enddo !end loop on cp in plane 3 |
| 3171 |
enddo !end loop on cp in plane 2 |
| 3172 |
enddo !end loop on cp in plane 1 |
| 3173 |
|
| 3174 |
888 continue |
| 3175 |
enddo !end loop on XZ couds |
| 3176 |
enddo !end loop on YZ couds |
| 3177 |
|
| 3178 |
if(ntracks.eq.0)then |
| 3179 |
iflag=1 |
| 3180 |
return |
| 3181 |
endif |
| 3182 |
|
| 3183 |
c$$$ if(DEBUG.EQ.1)then |
| 3184 |
c$$$ print*,'****** TRACK CANDIDATES ***********' |
| 3185 |
c$$$ print*,'# R. chi2 RIG' |
| 3186 |
c$$$ do i=1,ntracks |
| 3187 |
c$$$ print*,i,' --- ',rchi2_store(i),' --- ' |
| 3188 |
c$$$ $ ,1./abs(AL_STORE(5,i)) |
| 3189 |
c$$$ enddo |
| 3190 |
c$$$ print*,'***********************************' |
| 3191 |
c$$$ endif |
| 3192 |
if(DEBUG.EQ.1)then |
| 3193 |
print*,'****** TRACK CANDIDATES *****************' |
| 3194 |
print*,'# R. chi2 RIG ndof' |
| 3195 |
do i=1,ntracks |
| 3196 |
ndof=0 !(1) |
| 3197 |
do ii=1,nplanes !(1) |
| 3198 |
ndof=ndof !(1) |
| 3199 |
$ +int(xgood_store(ii,i)) !(1) |
| 3200 |
$ +int(ygood_store(ii,i)) !(1) |
| 3201 |
enddo !(1) |
| 3202 |
print*,i,' --- ',rchi2_store(i),' --- ' |
| 3203 |
$ ,1./abs(AL_STORE(5,i)),' --- ',ndof |
| 3204 |
enddo |
| 3205 |
print*,'*****************************************' |
| 3206 |
endif |
| 3207 |
|
| 3208 |
|
| 3209 |
return |
| 3210 |
end |
| 3211 |
|
| 3212 |
|
| 3213 |
*************************************************** |
| 3214 |
* * |
| 3215 |
* * |
| 3216 |
* * |
| 3217 |
* * |
| 3218 |
* * |
| 3219 |
* * |
| 3220 |
************************************************** |
| 3221 |
|
| 3222 |
subroutine refine_track(ibest) |
| 3223 |
|
| 3224 |
|
| 3225 |
include 'commontracker.f' |
| 3226 |
include 'level1.f' |
| 3227 |
include 'common_momanhough.f' |
| 3228 |
include 'common_xyzPAM.f' |
| 3229 |
include 'common_mini_2.f' |
| 3230 |
include 'common_mech.f' |
| 3231 |
include 'calib.f' |
| 3232 |
|
| 3233 |
* flag to chose PFA |
| 3234 |
character*10 PFA |
| 3235 |
common/FINALPFA/PFA |
| 3236 |
|
| 3237 |
real k(6) |
| 3238 |
DATA k/1.099730,0.418900,0.220939,0.220907,0.418771,1.100674/ |
| 3239 |
|
| 3240 |
real xp,yp,zp |
| 3241 |
real xyzp(3),bxyz(3) |
| 3242 |
equivalence (xp,xyzp(1)),(yp,xyzp(2)),(zp,xyzp(3)) |
| 3243 |
|
| 3244 |
if(DEBUG.EQ.1)print*,'refine_track:' |
| 3245 |
* ================================================= |
| 3246 |
* new estimate of positions using ETA algorithm |
| 3247 |
* and |
| 3248 |
* search for new couples and single clusters to add |
| 3249 |
* ================================================= |
| 3250 |
call track_init |
| 3251 |
do ip=1,nplanes !loop on planes |
| 3252 |
|
| 3253 |
xP=XV_STORE(nplanes-ip+1,ibest) |
| 3254 |
yP=YV_STORE(nplanes-ip+1,ibest) |
| 3255 |
zP=ZV_STORE(nplanes-ip+1,ibest) |
| 3256 |
call gufld(xyzp,bxyz) |
| 3257 |
BX_STORE(nplanes-ip+1,ibest)=bxyz(1) |
| 3258 |
BY_STORE(nplanes-ip+1,ibest)=bxyz(2) |
| 3259 |
c$$$ bxyz(1)=0 |
| 3260 |
c$$$ bxyz(2)=0 |
| 3261 |
c$$$ bxyz(3)=0 |
| 3262 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
| 3263 |
* ------------------------------------------------- |
| 3264 |
* If the plane has been already included, it just |
| 3265 |
* computes again the coordinates of the x-y couple |
| 3266 |
* using improved PFAs |
| 3267 |
* ------------------------------------------------- |
| 3268 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
| 3269 |
if(XGOOD_STORE(nplanes-ip+1,ibest).eq.1..and. |
| 3270 |
$ YGOOD_STORE(nplanes-ip+1,ibest).eq.1. )then |
| 3271 |
|
| 3272 |
id=CP_STORE(nplanes-ip+1,ibest) |
| 3273 |
|
| 3274 |
is=is_cp(id) |
| 3275 |
icp=icp_cp(id) |
| 3276 |
if(ip_cp(id).ne.ip) |
| 3277 |
$ print*,'OKKIO!!' |
| 3278 |
$ ,'id ',id,is,icp |
| 3279 |
$ ,ip_cp(id),ip |
| 3280 |
icx=clx(ip,icp) |
| 3281 |
icy=cly(ip,icp) |
| 3282 |
c call xyz_PAM(icx,icy,is, |
| 3283 |
c $ PFA,PFA, |
| 3284 |
c $ AXV_STORE(nplanes-ip+1,ibest), |
| 3285 |
c $ AYV_STORE(nplanes-ip+1,ibest)) |
| 3286 |
call xyz_PAM(icx,icy,is, |
| 3287 |
$ PFA,PFA, |
| 3288 |
$ AXV_STORE(nplanes-ip+1,ibest), |
| 3289 |
$ AYV_STORE(nplanes-ip+1,ibest), |
| 3290 |
$ bxyz(1), |
| 3291 |
$ bxyz(2) |
| 3292 |
$ ) |
| 3293 |
|
| 3294 |
xm(nplanes-ip+1) = xPAM |
| 3295 |
ym(nplanes-ip+1) = yPAM |
| 3296 |
zm(nplanes-ip+1) = zPAM |
| 3297 |
xgood(nplanes-ip+1) = 1 |
| 3298 |
ygood(nplanes-ip+1) = 1 |
| 3299 |
resx(nplanes-ip+1) = resxPAM |
| 3300 |
resy(nplanes-ip+1) = resyPAM |
| 3301 |
|
| 3302 |
dedxtrk_x(nplanes-ip+1)=sgnl(icx)/mip(VIEW(icx),LADDER(icx)) |
| 3303 |
dedxtrk_y(nplanes-ip+1)=sgnl(icy)/mip(VIEW(icy),LADDER(icy)) |
| 3304 |
|
| 3305 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
| 3306 |
* ------------------------------------------------- |
| 3307 |
* If the plane has NOT been already included, |
| 3308 |
* it tries to include a COUPLE or a single cluster |
| 3309 |
* ------------------------------------------------- |
| 3310 |
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
| 3311 |
else |
| 3312 |
|
| 3313 |
xgood(nplanes-ip+1)=0 |
| 3314 |
ygood(nplanes-ip+1)=0 |
| 3315 |
|
| 3316 |
* -------------------------------------------------------------- |
| 3317 |
* determine which ladder and sensor are intersected by the track |
| 3318 |
call whichsensor(ip,xP,yP,nldt,ist) |
| 3319 |
* if the track hit the plane in a dead area, go to the next plane |
| 3320 |
if(nldt.eq.0.or.ist.eq.0)goto 133 |
| 3321 |
|
| 3322 |
SENSOR_STORE(nplanes-ip+1,IBEST)=ist |
| 3323 |
LADDER_STORE(nplanes-ip+1,IBEST)=nldt |
| 3324 |
* -------------------------------------------------------------- |
| 3325 |
|
| 3326 |
if(DEBUG.EQ.1)then |
| 3327 |
print*, |
| 3328 |
$ '------ Plane ',ip,' intersected on LADDER ',nldt |
| 3329 |
$ ,' SENSOR ',ist |
| 3330 |
print*, |
| 3331 |
$ '------ coord: ',XP,YP |
| 3332 |
endif |
| 3333 |
|
| 3334 |
* =========================================== |
| 3335 |
* STEP 1 >>>>>>> try to include a new couple |
| 3336 |
* =========================================== |
| 3337 |
c if(DEBUG.EQ.1)print*,'>>>> try to include a new couple' |
| 3338 |
distmin=1000000. |
| 3339 |
xmm = 0. |
| 3340 |
ymm = 0. |
| 3341 |
zmm = 0. |
| 3342 |
rxmm = 0. |
| 3343 |
rymm = 0. |
| 3344 |
dedxmmx = 0. !(1) |
| 3345 |
dedxmmy = 0. !(1) |
| 3346 |
idm = 0 !ID of the closer couple |
| 3347 |
distance=0. |
| 3348 |
do icp=1,ncp_plane(ip) !loop on couples on plane icp |
| 3349 |
icx=clx(ip,icp) |
| 3350 |
icy=cly(ip,icp) |
| 3351 |
if(LADDER(icx).ne.nldt.or. !If the ladder number does not match |
| 3352 |
c $ cl_used(icx).eq.1.or. !or the X cluster is already used |
| 3353 |
c $ cl_used(icy).eq.1.or. !or the Y cluster is already used |
| 3354 |
$ cl_used(icx).ne.0.or. !or the X cluster is already used !(3) |
| 3355 |
$ cl_used(icy).ne.0.or. !or the Y cluster is already used !(3) |
| 3356 |
$ .false.)goto 1188 !then jump to next couple. |
| 3357 |
* |
| 3358 |
call xyz_PAM(icx,icy,ist, |
| 3359 |
$ PFA,PFA, |
| 3360 |
$ AXV_STORE(nplanes-ip+1,ibest), |
| 3361 |
$ AYV_STORE(nplanes-ip+1,ibest), |
| 3362 |
$ bxyz(1), |
| 3363 |
$ bxyz(2) |
| 3364 |
$ ) |
| 3365 |
|
| 3366 |
distance = distance_to(XP,YP) |
| 3367 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3368 |
id=id_cp(ip,icp,ist) |
| 3369 |
if(DEBUG.EQ.1)print*,'( couple ',id |
| 3370 |
$ ,' ) distance ',distance |
| 3371 |
if(distance.lt.distmin)then |
| 3372 |
xmm = xPAM |
| 3373 |
ymm = yPAM |
| 3374 |
zmm = zPAM |
| 3375 |
rxmm = resxPAM |
| 3376 |
rymm = resyPAM |
| 3377 |
distmin = distance |
| 3378 |
idm = id |
| 3379 |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
| 3380 |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
| 3381 |
c QUIQUI --> non devo moltiplicare per clinc?!?!?! |
| 3382 |
clincnewc=10*sqrt(rymm**2+rxmm**2 !QUIQUI |
| 3383 |
$ +RCHI2_STORE(ibest)*k(ip)*(cov(1,1)+cov(2,2))) !QUIQUI |
| 3384 |
endif |
| 3385 |
1188 continue |
| 3386 |
enddo !end loop on couples on plane icp |
| 3387 |
c if(distmin.le.clinc)then !QUIQUI |
| 3388 |
if(distmin.le.clincnewc)then !QUIQUI |
| 3389 |
* ----------------------------------- |
| 3390 |
xm(nplanes-ip+1) = xmm !<<< |
| 3391 |
ym(nplanes-ip+1) = ymm !<<< |
| 3392 |
zm(nplanes-ip+1) = zmm !<<< |
| 3393 |
xgood(nplanes-ip+1) = 1 !<<< |
| 3394 |
ygood(nplanes-ip+1) = 1 !<<< |
| 3395 |
resx(nplanes-ip+1)=rxmm !<<< |
| 3396 |
resy(nplanes-ip+1)=rymm !<<< |
| 3397 |
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
| 3398 |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
| 3399 |
* ----------------------------------- |
| 3400 |
CP_STORE(nplanes-ip+1,ibest)=idm |
| 3401 |
if(DEBUG.EQ.1)print*,'%%%% included couple ',idm |
| 3402 |
$ ,' (dist.= ',distmin,', cut ',clinc,' )' |
| 3403 |
goto 133 !next plane |
| 3404 |
endif |
| 3405 |
* ================================================ |
| 3406 |
* STEP 2 >>>>>>> try to include a single cluster |
| 3407 |
* either from a couple or single |
| 3408 |
* ================================================ |
| 3409 |
c if(DEBUG.EQ.1)print*,'>>>> try to include a new cluster' |
| 3410 |
distmin=1000000. |
| 3411 |
xmm_A = 0. !--------------------------- |
| 3412 |
ymm_A = 0. ! init variables that |
| 3413 |
zmm_A = 0. ! define the SINGLET |
| 3414 |
xmm_B = 0. ! |
| 3415 |
ymm_B = 0. ! |
| 3416 |
zmm_B = 0. ! |
| 3417 |
rxmm = 0. ! |
| 3418 |
rymm = 0. ! |
| 3419 |
dedxmmx = 0. !(1) |
| 3420 |
dedxmmy = 0. !(1) |
| 3421 |
iclm=0 !--------------------------- |
| 3422 |
distance=0. |
| 3423 |
|
| 3424 |
*----- clusters inside couples ------------------------------------- |
| 3425 |
do icp=1,ncp_plane(ip) !loop on cluster inside couples |
| 3426 |
icx=clx(ip,icp) |
| 3427 |
icy=cly(ip,icp) |
| 3428 |
id=id_cp(ip,icp,ist) |
| 3429 |
if(LADDER(icx).ne.nldt)goto 11882 !if the ladder number does not match |
| 3430 |
* !jump to the next couple |
| 3431 |
*----- try cluster x ----------------------------------------------- |
| 3432 |
c if(cl_used(icx).eq.1)goto 11881 !if the X cluster is already used |
| 3433 |
if(cl_used(icx).ne.0)goto 11881 !if the X cluster is already used !(3) |
| 3434 |
* !jump to the Y cluster |
| 3435 |
c call xyz_PAM(icx,0,ist, |
| 3436 |
c $ PFA,PFA, |
| 3437 |
c $ AXV_STORE(nplanes-ip+1,ibest),0.) |
| 3438 |
call xyz_PAM(icx,0,ist, |
| 3439 |
$ PFA,PFA, |
| 3440 |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
| 3441 |
$ bxyz(1), |
| 3442 |
$ bxyz(2) |
| 3443 |
$ ) |
| 3444 |
distance = distance_to(XP,YP) |
| 3445 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3446 |
if(DEBUG.EQ.1)print*,'( cl-X ',icx |
| 3447 |
$ ,' in cp ',id,' ) distance ',distance |
| 3448 |
if(distance.lt.distmin)then |
| 3449 |
xmm_A = xPAM_A |
| 3450 |
ymm_A = yPAM_A |
| 3451 |
zmm_A = zPAM_A |
| 3452 |
xmm_B = xPAM_B |
| 3453 |
ymm_B = yPAM_B |
| 3454 |
zmm_B = zPAM_B |
| 3455 |
rxmm = resxPAM |
| 3456 |
rymm = resyPAM |
| 3457 |
distmin = distance |
| 3458 |
iclm = icx |
| 3459 |
c dedxmm = sgnl(icx) !(1) |
| 3460 |
dedxmmx = sgnl(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
| 3461 |
dedxmmy = 0. !(1) |
| 3462 |
endif |
| 3463 |
11881 continue |
| 3464 |
*----- try cluster y ----------------------------------------------- |
| 3465 |
c if(cl_used(icy).eq.1)goto 11882 !if the Y cluster is already used |
| 3466 |
if(cl_used(icy).ne.0)goto 11882 !if the Y cluster is already used !(3) |
| 3467 |
* !jump to the next couple |
| 3468 |
c call xyz_PAM(0,icy,ist, |
| 3469 |
c $ PFA,PFA, |
| 3470 |
c $ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
| 3471 |
call xyz_PAM(0,icy,ist, |
| 3472 |
$ PFA,PFA, |
| 3473 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
| 3474 |
$ bxyz(1), |
| 3475 |
$ bxyz(2) |
| 3476 |
$ ) |
| 3477 |
distance = distance_to(XP,YP) |
| 3478 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3479 |
if(DEBUG.EQ.1)print*,'( cl-Y ',icy |
| 3480 |
$ ,' in cp ',id,' ) distance ',distance |
| 3481 |
if(distance.lt.distmin)then |
| 3482 |
xmm_A = xPAM_A |
| 3483 |
ymm_A = yPAM_A |
| 3484 |
zmm_A = zPAM_A |
| 3485 |
xmm_B = xPAM_B |
| 3486 |
ymm_B = yPAM_B |
| 3487 |
zmm_B = zPAM_B |
| 3488 |
rxmm = resxPAM |
| 3489 |
rymm = resyPAM |
| 3490 |
distmin = distance |
| 3491 |
iclm = icy |
| 3492 |
c dedxmm = sgnl(icy) !(1) |
| 3493 |
dedxmmx = 0. !(1) |
| 3494 |
dedxmmy = sgnl(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
| 3495 |
endif |
| 3496 |
11882 continue |
| 3497 |
enddo !end loop on cluster inside couples |
| 3498 |
*----- single clusters ----------------------------------------------- |
| 3499 |
c print*,'## ncls(',ip,') ',ncls(ip) |
| 3500 |
do ic=1,ncls(ip) !loop on single clusters |
| 3501 |
icl=cls(ip,ic) |
| 3502 |
c if(cl_used(icl).eq.1.or. !if the cluster is already used |
| 3503 |
if(cl_used(icl).ne.0.or. !if the cluster is already used !(3) |
| 3504 |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
| 3505 |
$ .false.)goto 18882 !jump to the next singlet |
| 3506 |
if(mod(VIEW(icl),2).eq.0)then!<---- X view |
| 3507 |
call xyz_PAM(icl,0,ist, |
| 3508 |
$ PFA,PFA, |
| 3509 |
$ AXV_STORE(nplanes-ip+1,ibest),0., |
| 3510 |
$ bxyz(1), |
| 3511 |
$ bxyz(2) |
| 3512 |
$ ) |
| 3513 |
else !<---- Y view |
| 3514 |
call xyz_PAM(0,icl,ist, |
| 3515 |
$ PFA,PFA, |
| 3516 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest), |
| 3517 |
$ bxyz(1), |
| 3518 |
$ bxyz(2) |
| 3519 |
$ ) |
| 3520 |
endif |
| 3521 |
|
| 3522 |
distance = distance_to(XP,YP) |
| 3523 |
c distance = distance / RCHI2_STORE(ibest)!<<< MS !QUIQUI |
| 3524 |
if(DEBUG.EQ.1)print*,'( cl-s ',icl |
| 3525 |
$ ,' ) distance ',distance |
| 3526 |
if(distance.lt.distmin)then |
| 3527 |
c if(DEBUG.EQ.1)print*,'YES' |
| 3528 |
xmm_A = xPAM_A |
| 3529 |
ymm_A = yPAM_A |
| 3530 |
zmm_A = zPAM_A |
| 3531 |
xmm_B = xPAM_B |
| 3532 |
ymm_B = yPAM_B |
| 3533 |
zmm_B = zPAM_B |
| 3534 |
rxmm = resxPAM |
| 3535 |
rymm = resyPAM |
| 3536 |
distmin = distance |
| 3537 |
iclm = icl |
| 3538 |
if(mod(VIEW(icl),2).eq.0)then !<---- X view |
| 3539 |
dedxmmx = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 3540 |
dedxmmy = 0. |
| 3541 |
else !<---- Y view |
| 3542 |
dedxmmx = 0. |
| 3543 |
dedxmmy = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 3544 |
endif |
| 3545 |
endif |
| 3546 |
18882 continue |
| 3547 |
enddo !end loop on single clusters |
| 3548 |
c print*,'## distmin ', distmin,' clinc ',clinc |
| 3549 |
|
| 3550 |
c QUIQUI------------ |
| 3551 |
c anche qui: non ci vuole clinc??? |
| 3552 |
if(iclm.ne.0)then |
| 3553 |
if(mod(VIEW(iclm),2).eq.0)then |
| 3554 |
clincnew= |
| 3555 |
$ 20* |
| 3556 |
$ sqrt(rxmm**2+RCHI2_STORE(ibest)*k(ip)*cov(1,1)) |
| 3557 |
else if(mod(VIEW(iclm),2).ne.0)then |
| 3558 |
clincnew= |
| 3559 |
$ 10* |
| 3560 |
$ sqrt(rymm**2+RCHI2_STORE(ibest)*k(ip)*cov(2,2)) |
| 3561 |
endif |
| 3562 |
c QUIQUI------------ |
| 3563 |
|
| 3564 |
if(distmin.le.clincnew)then !QUIQUI |
| 3565 |
c if(distmin.le.clinc)then !QUIQUI |
| 3566 |
|
| 3567 |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
| 3568 |
* ---------------------------- |
| 3569 |
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 3570 |
if(mod(VIEW(iclm),2).eq.0)then |
| 3571 |
XGOOD(nplanes-ip+1)=1. |
| 3572 |
resx(nplanes-ip+1)=rxmm |
| 3573 |
if(DEBUG.EQ.1)print*,'%%%% included X-cl ',iclm |
| 3574 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
| 3575 |
$ ,', dist.= ',distmin |
| 3576 |
$ ,', cut ',clinc,' )' |
| 3577 |
else |
| 3578 |
YGOOD(nplanes-ip+1)=1. |
| 3579 |
resy(nplanes-ip+1)=rymm |
| 3580 |
if(DEBUG.EQ.1)print*,'%%%% included Y-cl ',iclm |
| 3581 |
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
| 3582 |
$ ,', dist.= ', distmin |
| 3583 |
$ ,', cut ',clinc,' )' |
| 3584 |
endif |
| 3585 |
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
| 3586 |
* ---------------------------- |
| 3587 |
xm_A(nplanes-ip+1) = xmm_A |
| 3588 |
ym_A(nplanes-ip+1) = ymm_A |
| 3589 |
xm_B(nplanes-ip+1) = xmm_B |
| 3590 |
ym_B(nplanes-ip+1) = ymm_B |
| 3591 |
zm(nplanes-ip+1) = (zmm_A+zmm_B)/2. |
| 3592 |
dedxtrk_x(nplanes-ip+1) = dedxmmx !<<< |
| 3593 |
dedxtrk_y(nplanes-ip+1) = dedxmmy !<<< |
| 3594 |
* ---------------------------- |
| 3595 |
endif |
| 3596 |
endif |
| 3597 |
endif |
| 3598 |
133 continue |
| 3599 |
enddo !end loop on planes |
| 3600 |
|
| 3601 |
|
| 3602 |
|
| 3603 |
return |
| 3604 |
end |
| 3605 |
|
| 3606 |
*************************************************** |
| 3607 |
* * |
| 3608 |
* * |
| 3609 |
* * |
| 3610 |
* * |
| 3611 |
* * |
| 3612 |
* * |
| 3613 |
************************************************** |
| 3614 |
* |
| 3615 |
subroutine clean_XYclouds(ibest,iflag) |
| 3616 |
|
| 3617 |
include 'commontracker.f' |
| 3618 |
include 'level1.f' |
| 3619 |
include 'common_momanhough.f' |
| 3620 |
include 'level2.f' |
| 3621 |
|
| 3622 |
if(DEBUG.EQ.1)print*,'clean_XYclouds:' |
| 3623 |
|
| 3624 |
do ip=1,nplanes !loop on planes |
| 3625 |
|
| 3626 |
id=CP_STORE(nplanes-ip+1,ibest) |
| 3627 |
icl=CLS_STORE(nplanes-ip+1,ibest) |
| 3628 |
if(id.ne.0.or.icl.ne.0)then |
| 3629 |
if(id.ne.0)then |
| 3630 |
iclx=clx(ip,icp_cp(id)) |
| 3631 |
icly=cly(ip,icp_cp(id)) |
| 3632 |
c$$$ cl_used(iclx)=ntrk !tag used clusters |
| 3633 |
c$$$ cl_used(icly)=ntrk !tag used clusters |
| 3634 |
elseif(icl.ne.0)then |
| 3635 |
c$$$ cl_used(icl)=ntrk !tag used clusters |
| 3636 |
endif |
| 3637 |
|
| 3638 |
* ----------------------------- |
| 3639 |
* remove the couple from clouds |
| 3640 |
* remove also vitual couples containing the |
| 3641 |
* selected clusters |
| 3642 |
* ----------------------------- |
| 3643 |
do icp=1,ncp_plane(ip) |
| 3644 |
if( |
| 3645 |
$ clx(ip,icp).eq.iclx |
| 3646 |
$ .or. |
| 3647 |
$ clx(ip,icp).eq.icl |
| 3648 |
$ .or. |
| 3649 |
$ cly(ip,icp).eq.icly |
| 3650 |
$ .or. |
| 3651 |
$ cly(ip,icp).eq.icl |
| 3652 |
$ )then |
| 3653 |
id=id_cp(ip,icp,1) |
| 3654 |
if(DEBUG.EQ.1)then |
| 3655 |
print*,ip,' <<< cp ',id |
| 3656 |
$ ,' ( cl-x ' |
| 3657 |
$ ,clx(ip,icp) |
| 3658 |
$ ,' cl-y ' |
| 3659 |
$ ,cly(ip,icp),' ) --> removed' |
| 3660 |
endif |
| 3661 |
* ----------------------------- |
| 3662 |
* remove the couple from clouds |
| 3663 |
do iyz=1,nclouds_yz |
| 3664 |
if(cpcloud_yz(iyz,abs(id)).ne.0)then |
| 3665 |
ptcloud_yz(iyz)=ptcloud_yz(iyz)-1 |
| 3666 |
cpcloud_yz(iyz,abs(id))=0 |
| 3667 |
endif |
| 3668 |
enddo |
| 3669 |
do ixz=1,nclouds_xz |
| 3670 |
if(cpcloud_xz(ixz,abs(id)).ne.0)then |
| 3671 |
ptcloud_xz(ixz)=ptcloud_xz(ixz)-1 |
| 3672 |
cpcloud_xz(ixz,abs(id))=0 |
| 3673 |
endif |
| 3674 |
enddo |
| 3675 |
* ----------------------------- |
| 3676 |
endif |
| 3677 |
enddo |
| 3678 |
|
| 3679 |
endif |
| 3680 |
enddo !end loop on planes |
| 3681 |
|
| 3682 |
return |
| 3683 |
end |
| 3684 |
|
| 3685 |
|
| 3686 |
|
| 3687 |
|
| 3688 |
|
| 3689 |
|
| 3690 |
* **************************************************** |
| 3691 |
|
| 3692 |
subroutine init_level2 |
| 3693 |
|
| 3694 |
include 'commontracker.f' |
| 3695 |
include 'level1.f' |
| 3696 |
include 'common_momanhough.f' |
| 3697 |
include 'level2.f' |
| 3698 |
|
| 3699 |
* --------------------------------- |
| 3700 |
* variables initialized from level1 |
| 3701 |
* --------------------------------- |
| 3702 |
do i=1,nviews |
| 3703 |
good2(i)=good1(i) |
| 3704 |
do j=1,nva1_view |
| 3705 |
vkflag(i,j)=1 |
| 3706 |
if(cnnev(i,j).le.0)then |
| 3707 |
vkflag(i,j)=cnnev(i,j) |
| 3708 |
endif |
| 3709 |
enddo |
| 3710 |
enddo |
| 3711 |
* ---------------- |
| 3712 |
* level2 variables |
| 3713 |
* ---------------- |
| 3714 |
NTRK = 0 |
| 3715 |
do it=1,NTRKMAX |
| 3716 |
IMAGE(IT)=0 |
| 3717 |
CHI2_nt(IT) = -100000. |
| 3718 |
do ip=1,nplanes |
| 3719 |
XM_nt(IP,IT) = 0 |
| 3720 |
YM_nt(IP,IT) = 0 |
| 3721 |
ZM_nt(IP,IT) = 0 |
| 3722 |
RESX_nt(IP,IT) = 0 |
| 3723 |
RESY_nt(IP,IT) = 0 |
| 3724 |
TAILX_nt(IP,IT) = 0 |
| 3725 |
TAILY_nt(IP,IT) = 0 |
| 3726 |
XBAD(IP,IT) = 0 |
| 3727 |
YBAD(IP,IT) = 0 |
| 3728 |
XGOOD_nt(IP,IT) = 0 |
| 3729 |
YGOOD_nt(IP,IT) = 0 |
| 3730 |
LS(IP,IT) = 0 |
| 3731 |
DEDX_X(IP,IT) = 0 |
| 3732 |
DEDX_Y(IP,IT) = 0 |
| 3733 |
CLTRX(IP,IT) = 0 |
| 3734 |
CLTRY(IP,IT) = 0 |
| 3735 |
enddo |
| 3736 |
do ipa=1,5 |
| 3737 |
AL_nt(IPA,IT) = 0 |
| 3738 |
do ipaa=1,5 |
| 3739 |
coval(ipa,ipaa,IT)=0 |
| 3740 |
enddo |
| 3741 |
enddo |
| 3742 |
enddo |
| 3743 |
nclsx=0 |
| 3744 |
nclsy=0 |
| 3745 |
do ip=1,NSINGMAX |
| 3746 |
planex(ip)=0 |
| 3747 |
xs(1,ip)=0 |
| 3748 |
xs(2,ip)=0 |
| 3749 |
sgnlxs(ip)=0 |
| 3750 |
planey(ip)=0 |
| 3751 |
ys(1,ip)=0 |
| 3752 |
ys(2,ip)=0 |
| 3753 |
sgnlys(ip)=0 |
| 3754 |
enddo |
| 3755 |
end |
| 3756 |
|
| 3757 |
|
| 3758 |
************************************************************ |
| 3759 |
* |
| 3760 |
* |
| 3761 |
* |
| 3762 |
* |
| 3763 |
* |
| 3764 |
* |
| 3765 |
* |
| 3766 |
************************************************************ |
| 3767 |
|
| 3768 |
|
| 3769 |
subroutine init_hough |
| 3770 |
|
| 3771 |
include 'commontracker.f' |
| 3772 |
include 'level1.f' |
| 3773 |
include 'common_momanhough.f' |
| 3774 |
include 'common_hough.f' |
| 3775 |
include 'level2.f' |
| 3776 |
|
| 3777 |
ntrpt_nt=0 |
| 3778 |
ndblt_nt=0 |
| 3779 |
NCLOUDS_XZ_nt=0 |
| 3780 |
NCLOUDS_YZ_nt=0 |
| 3781 |
do idb=1,ndblt_max_nt |
| 3782 |
db_cloud_nt(idb)=0 |
| 3783 |
alfayz1_nt(idb)=0 |
| 3784 |
alfayz2_nt(idb)=0 |
| 3785 |
enddo |
| 3786 |
do itr=1,ntrpt_max_nt |
| 3787 |
tr_cloud_nt(itr)=0 |
| 3788 |
alfaxz1_nt(itr)=0 |
| 3789 |
alfaxz2_nt(itr)=0 |
| 3790 |
alfaxz3_nt(itr)=0 |
| 3791 |
enddo |
| 3792 |
do idb=1,ncloyz_max |
| 3793 |
ptcloud_yz_nt(idb)=0 |
| 3794 |
alfayz1_av_nt(idb)=0 |
| 3795 |
alfayz2_av_nt(idb)=0 |
| 3796 |
enddo |
| 3797 |
do itr=1,ncloxz_max |
| 3798 |
ptcloud_xz_nt(itr)=0 |
| 3799 |
alfaxz1_av_nt(itr)=0 |
| 3800 |
alfaxz2_av_nt(itr)=0 |
| 3801 |
alfaxz3_av_nt(itr)=0 |
| 3802 |
enddo |
| 3803 |
|
| 3804 |
ntrpt=0 |
| 3805 |
ndblt=0 |
| 3806 |
NCLOUDS_XZ=0 |
| 3807 |
NCLOUDS_YZ=0 |
| 3808 |
do idb=1,ndblt_max |
| 3809 |
db_cloud(idb)=0 |
| 3810 |
cpyz1(idb)=0 |
| 3811 |
cpyz2(idb)=0 |
| 3812 |
alfayz1(idb)=0 |
| 3813 |
alfayz2(idb)=0 |
| 3814 |
enddo |
| 3815 |
do itr=1,ntrpt_max |
| 3816 |
tr_cloud(itr)=0 |
| 3817 |
cpxz1(itr)=0 |
| 3818 |
cpxz2(itr)=0 |
| 3819 |
cpxz3(itr)=0 |
| 3820 |
alfaxz1(itr)=0 |
| 3821 |
alfaxz2(itr)=0 |
| 3822 |
alfaxz3(itr)=0 |
| 3823 |
enddo |
| 3824 |
do idb=1,ncloyz_max |
| 3825 |
ptcloud_yz(idb)=0 |
| 3826 |
alfayz1_av(idb)=0 |
| 3827 |
alfayz2_av(idb)=0 |
| 3828 |
do idbb=1,ncouplemaxtot |
| 3829 |
cpcloud_yz(idb,idbb)=0 |
| 3830 |
enddo |
| 3831 |
enddo |
| 3832 |
do itr=1,ncloxz_max |
| 3833 |
ptcloud_xz(itr)=0 |
| 3834 |
alfaxz1_av(itr)=0 |
| 3835 |
alfaxz2_av(itr)=0 |
| 3836 |
alfaxz3_av(itr)=0 |
| 3837 |
do itrr=1,ncouplemaxtot |
| 3838 |
cpcloud_xz(itr,itrr)=0 |
| 3839 |
enddo |
| 3840 |
enddo |
| 3841 |
end |
| 3842 |
************************************************************ |
| 3843 |
* |
| 3844 |
* |
| 3845 |
* |
| 3846 |
* |
| 3847 |
* |
| 3848 |
* |
| 3849 |
* |
| 3850 |
************************************************************ |
| 3851 |
|
| 3852 |
|
| 3853 |
subroutine fill_level2_tracks(ntr) |
| 3854 |
|
| 3855 |
* ------------------------------------------------------- |
| 3856 |
* This routine fills the ntr-th element of the variables |
| 3857 |
* inside the level2_tracks common, which correspond |
| 3858 |
* to the ntr-th track info. |
| 3859 |
* ------------------------------------------------------- |
| 3860 |
|
| 3861 |
|
| 3862 |
include 'commontracker.f' |
| 3863 |
include 'level1.f' |
| 3864 |
include 'common_momanhough.f' |
| 3865 |
include 'level2.f' |
| 3866 |
include 'common_mini_2.f' |
| 3867 |
include 'calib.f' |
| 3868 |
|
| 3869 |
character*10 PFA |
| 3870 |
common/FINALPFA/PFA |
| 3871 |
|
| 3872 |
real sinth,phi,pig |
| 3873 |
integer ssensor,sladder |
| 3874 |
pig=acos(-1.) |
| 3875 |
|
| 3876 |
* ------------------------------------- |
| 3877 |
chi2_nt(ntr) = sngl(chi2) |
| 3878 |
nstep_nt(ntr) = nstep |
| 3879 |
* ------------------------------------- |
| 3880 |
phi = al(4) |
| 3881 |
sinth = al(3) |
| 3882 |
if(sinth.lt.0)then |
| 3883 |
sinth = -sinth |
| 3884 |
phi = phi + pig |
| 3885 |
endif |
| 3886 |
npig = aint(phi/(2*pig)) |
| 3887 |
phi = phi - npig*2*pig |
| 3888 |
if(phi.lt.0) |
| 3889 |
$ phi = phi + 2*pig |
| 3890 |
al(4) = phi |
| 3891 |
al(3) = sinth |
| 3892 |
do i=1,5 |
| 3893 |
al_nt(i,ntr) = sngl(al(i)) |
| 3894 |
do j=1,5 |
| 3895 |
coval(i,j,ntr) = sngl(cov(i,j)) |
| 3896 |
enddo |
| 3897 |
enddo |
| 3898 |
* ------------------------------------- |
| 3899 |
do ip=1,nplanes ! loop on planes |
| 3900 |
xgood_nt(ip,ntr) = int(xgood(ip)) |
| 3901 |
ygood_nt(ip,ntr) = int(ygood(ip)) |
| 3902 |
xm_nt(ip,ntr) = sngl(xm(ip)) |
| 3903 |
ym_nt(ip,ntr) = sngl(ym(ip)) |
| 3904 |
zm_nt(ip,ntr) = sngl(zm(ip)) |
| 3905 |
RESX_nt(IP,ntr) = sngl(resx(ip)) |
| 3906 |
RESY_nt(IP,ntr) = sngl(resy(ip)) |
| 3907 |
TAILX_nt(IP,ntr) = 0. |
| 3908 |
TAILY_nt(IP,ntr) = 0. |
| 3909 |
xv_nt(ip,ntr) = sngl(xv(ip)) |
| 3910 |
yv_nt(ip,ntr) = sngl(yv(ip)) |
| 3911 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
| 3912 |
axv_nt(ip,ntr) = sngl(axv(ip)) |
| 3913 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
| 3914 |
|
| 3915 |
factor = sqrt( |
| 3916 |
$ tan( acos(-1.) * sngl(axv(ip)) /180. )**2 + |
| 3917 |
$ tan( acos(-1.) * sngl(ayv(ip)) /180. )**2 + |
| 3918 |
$ 1. ) |
| 3919 |
|
| 3920 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)/factor) |
| 3921 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)/factor) |
| 3922 |
|
| 3923 |
ax = axv_nt(ip,ntr) |
| 3924 |
ay = ayv_nt(ip,ntr) |
| 3925 |
bfx = BX_STORE(ip,IDCAND) |
| 3926 |
bfy = BY_STORE(ip,IDCAND) |
| 3927 |
if(ip.eq.6) ax = -1. * axv_nt(ip,ntr) |
| 3928 |
if(ip.eq.6) bfy = -1. * BY_STORE(ip,IDCAND) |
| 3929 |
tgtemp = tan(ax*acos(-1.)/180.) + pmuH_h*bfy*0.00001 |
| 3930 |
angx = 180.*atan(tgtemp)/acos(-1.) |
| 3931 |
tgtemp = tan(ay*acos(-1.)/180.)+pmuH_e*bfx*0.00001 |
| 3932 |
angy = 180.*atan(tgtemp)/acos(-1.) |
| 3933 |
|
| 3934 |
c print*,'* ',ip,bfx,bfy,angx,angy |
| 3935 |
|
| 3936 |
id = CP_STORE(ip,IDCAND) ! couple id |
| 3937 |
icl = CLS_STORE(ip,IDCAND) |
| 3938 |
ssensor = -1 |
| 3939 |
sladder = -1 |
| 3940 |
ssensor = SENSOR_STORE(ip,IDCAND) |
| 3941 |
sladder = LADDER_STORE(ip,IDCAND) |
| 3942 |
if(ip.eq.6.and.ssensor.ne.0)ssensor = 3 - ssensor !notazione paolo x align |
| 3943 |
LS(IP,ntr) = ssensor+10*sladder |
| 3944 |
|
| 3945 |
if(id.ne.0)then |
| 3946 |
c >>> is a couple |
| 3947 |
cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) |
| 3948 |
cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) |
| 3949 |
|
| 3950 |
cl_used(cltrx(ip,ntr)) = 1 !tag used clusters |
| 3951 |
cl_used(cltry(ip,ntr)) = 1 !tag used clusters |
| 3952 |
|
| 3953 |
c$$$ nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) |
| 3954 |
c$$$ nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) |
| 3955 |
c$$$ xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) |
| 3956 |
c$$$ ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) |
| 3957 |
xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) |
| 3958 |
ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) |
| 3959 |
|
| 3960 |
|
| 3961 |
if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) |
| 3962 |
$ dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
| 3963 |
if(nsatstrips(cly(nplanes-ip+1,icp_cp(id))).gt.0) |
| 3964 |
$ dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
| 3965 |
|
| 3966 |
elseif(icl.ne.0)then |
| 3967 |
|
| 3968 |
cl_used(icl) = 1 !tag used clusters |
| 3969 |
|
| 3970 |
if(mod(VIEW(icl),2).eq.0)then |
| 3971 |
cltrx(ip,ntr)=icl |
| 3972 |
c$$$ nnnnn = npfastrips(icl,PFA,angx) |
| 3973 |
c$$$ xbad(ip,ntr) = nbadstrips(nnnnn,icl) |
| 3974 |
xbad(ip,ntr) = nbadstrips(4,icl) |
| 3975 |
|
| 3976 |
if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) |
| 3977 |
elseif(mod(VIEW(icl),2).eq.1)then |
| 3978 |
cltry(ip,ntr)=icl |
| 3979 |
c$$$ nnnnn = npfastrips(icl,PFA,angy) |
| 3980 |
c$$$ ybad(ip,ntr) = nbadstrips(nnnnn,icl) |
| 3981 |
ybad(ip,ntr) = nbadstrips(4,icl) |
| 3982 |
if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) |
| 3983 |
endif |
| 3984 |
|
| 3985 |
endif |
| 3986 |
|
| 3987 |
enddo |
| 3988 |
|
| 3989 |
if(DEBUG.eq.1)then |
| 3990 |
print*,'> STORING TRACK ',ntr |
| 3991 |
print*,'clusters: ' |
| 3992 |
do ip=1,6 |
| 3993 |
print*,'> ',ip,' -- ',cltrx(ip,ntr),cltry(ip,ntr) |
| 3994 |
enddo |
| 3995 |
endif |
| 3996 |
|
| 3997 |
c$$$ print*,(xgood(i),i=1,6) |
| 3998 |
c$$$ print*,(ygood(i),i=1,6) |
| 3999 |
c$$$ print*,(ls(i,ntr),i=1,6) |
| 4000 |
c$$$ print*,(dedx_x(i,ntr),i=1,6) |
| 4001 |
c$$$ print*,(dedx_y(i,ntr),i=1,6) |
| 4002 |
c$$$ print*,'-----------------------' |
| 4003 |
|
| 4004 |
end |
| 4005 |
|
| 4006 |
subroutine fill_level2_siglets |
| 4007 |
|
| 4008 |
* ------------------------------------------------------- |
| 4009 |
* This routine fills the elements of the variables |
| 4010 |
* inside the level2_singletsx and level2_singletsy commons, |
| 4011 |
* which store info on clusters outside the tracks |
| 4012 |
* ------------------------------------------------------- |
| 4013 |
|
| 4014 |
include 'commontracker.f' |
| 4015 |
include 'calib.f' |
| 4016 |
include 'level1.f' |
| 4017 |
include 'common_momanhough.f' |
| 4018 |
include 'level2.f' |
| 4019 |
include 'common_xyzPAM.f' |
| 4020 |
|
| 4021 |
* count #cluster per plane not associated to any track |
| 4022 |
nclsx = 0 |
| 4023 |
nclsy = 0 |
| 4024 |
|
| 4025 |
do iv = 1,nviews |
| 4026 |
c if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) |
| 4027 |
good2(iv) = good2(iv) + mask_view(iv)*2**8 |
| 4028 |
enddo |
| 4029 |
|
| 4030 |
if(DEBUG.eq.1)then |
| 4031 |
print*,'> STORING SINGLETS ' |
| 4032 |
endif |
| 4033 |
|
| 4034 |
do icl=1,nclstr1 |
| 4035 |
|
| 4036 |
ip=nplanes-npl(VIEW(icl))+1 |
| 4037 |
|
| 4038 |
if(cl_used(icl).eq.0)then !cluster not included in any track |
| 4039 |
if(mod(VIEW(icl),2).eq.0)then !=== X views |
| 4040 |
nclsx = nclsx + 1 |
| 4041 |
planex(nclsx) = ip |
| 4042 |
sgnlxs(nclsx) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 4043 |
if(nsatstrips(icl).gt.0)sgnlxs(nclsx)=-sgnlxs(nclsx) |
| 4044 |
clsx(nclsx) = icl |
| 4045 |
do is=1,2 |
| 4046 |
c call xyz_PAM(icl,0,is,'COG1',' ',0.,0.) |
| 4047 |
c call xyz_PAM(icl,0,is,PFAdef,' ',0.,0.) |
| 4048 |
call xyz_PAM(icl,0,is,PFAdef,' ',0.,0.,0.,0.) |
| 4049 |
xs(is,nclsx) = (xPAM_A+xPAM_B)/2 |
| 4050 |
enddo |
| 4051 |
c$$$ print*,'nclsx ',nclsx |
| 4052 |
c$$$ print*,'planex(nclsx) ',planex(nclsx) |
| 4053 |
c$$$ print*,'sgnlxs(nclsx) ',sgnlxs(nclsx) |
| 4054 |
c$$$ print*,'xs(1,nclsx) ',xs(1,nclsx) |
| 4055 |
c$$$ print*,'xs(2,nclsx) ',xs(2,nclsx) |
| 4056 |
else !=== Y views |
| 4057 |
nclsy = nclsy + 1 |
| 4058 |
planey(nclsy) = ip |
| 4059 |
sgnlys(nclsy) = sgnl(icl)/mip(VIEW(icl),LADDER(icl)) |
| 4060 |
if(nsatstrips(icl).gt.0)sgnlys(nclsy)=-sgnlys(nclsy) |
| 4061 |
clsy(nclsy) = icl |
| 4062 |
do is=1,2 |
| 4063 |
c call xyz_PAM(0,icl,is,' ','COG1',0.,0.) |
| 4064 |
c call xyz_PAM(0,icl,is,' ',PFAdef,0.,0.) |
| 4065 |
call xyz_PAM(0,icl,is,' ',PFAdef,0.,0.,0.,0.) |
| 4066 |
ys(is,nclsy) = (yPAM_A+yPAM_B)/2 |
| 4067 |
enddo |
| 4068 |
c$$$ print*,'nclsy ',nclsy |
| 4069 |
c$$$ print*,'planey(nclsy) ',planey(nclsy) |
| 4070 |
c$$$ print*,'sgnlys(nclsy) ',sgnlys(nclsy) |
| 4071 |
c$$$ print*,'ys(1,nclsy) ',ys(1,nclsy) |
| 4072 |
c$$$ print*,'ys(2,nclsy) ',ys(2,nclsy) |
| 4073 |
endif |
| 4074 |
endif |
| 4075 |
|
| 4076 |
***** LO METTO QUI PERCHE` NON SO DOVE METTERLO |
| 4077 |
whichtrack(icl) = cl_used(icl) |
| 4078 |
* -------------------------------------------------- |
| 4079 |
* per non perdere la testa... |
| 4080 |
* whichtrack(icl) e` una variabile del common level1 |
| 4081 |
* che serve solo per sapere quali cluster sono stati |
| 4082 |
* associati ad una traccia, e permettere di salvare |
| 4083 |
* solo questi nell'albero di uscita |
| 4084 |
* -------------------------------------------------- |
| 4085 |
|
| 4086 |
|
| 4087 |
c$$$ print*,' cl ',icl,' --> ',cl_used(icl) |
| 4088 |
c$$$ |
| 4089 |
c$$$ if( cl_used(icl).ne.0 )then |
| 4090 |
c$$$ if( |
| 4091 |
c$$$ $ mod(VIEW(icl),2).eq.0.and. |
| 4092 |
c$$$ $ cltrx(ip,whichtrack(icl)).ne.icl ) |
| 4093 |
c$$$ $ print*,'**WARNING** cltrx(',ip,',',whichtrack(icl) |
| 4094 |
c$$$ $ ,')=',cltrx(ip,whichtrack(icl)),'.ne.',icl |
| 4095 |
c$$$ if( |
| 4096 |
c$$$ $ mod(VIEW(icl),2).eq.1.and. |
| 4097 |
c$$$ $ cltry(ip,whichtrack(icl)).ne.icl ) |
| 4098 |
c$$$ $ print*,'**WARNING** cltry(',ip,',',whichtrack(icl) |
| 4099 |
c$$$ $ ,')=',cltry(ip,whichtrack(icl)),'.ne.',icl |
| 4100 |
c$$$ endif |
| 4101 |
|
| 4102 |
|
| 4103 |
enddo |
| 4104 |
end |
| 4105 |
|
| 4106 |
*************************************************** |
| 4107 |
* * |
| 4108 |
* * |
| 4109 |
* * |
| 4110 |
* * |
| 4111 |
* * |
| 4112 |
* * |
| 4113 |
************************************************** |
| 4114 |
|
| 4115 |
subroutine fill_hough |
| 4116 |
|
| 4117 |
* ------------------------------------------------------- |
| 4118 |
* This routine fills the variables related to the hough |
| 4119 |
* transform, for the debig n-tuple |
| 4120 |
* ------------------------------------------------------- |
| 4121 |
|
| 4122 |
include 'commontracker.f' |
| 4123 |
include 'level1.f' |
| 4124 |
include 'common_momanhough.f' |
| 4125 |
include 'common_hough.f' |
| 4126 |
include 'level2.f' |
| 4127 |
|
| 4128 |
if(.false. |
| 4129 |
$ .or.ntrpt.gt.ntrpt_max_nt |
| 4130 |
$ .or.ndblt.gt.ndblt_max_nt |
| 4131 |
$ .or.NCLOUDS_XZ.gt.ncloxz_max |
| 4132 |
$ .or.NCLOUDS_yZ.gt.ncloyz_max |
| 4133 |
$ )then |
| 4134 |
ntrpt_nt=0 |
| 4135 |
ndblt_nt=0 |
| 4136 |
NCLOUDS_XZ_nt=0 |
| 4137 |
NCLOUDS_YZ_nt=0 |
| 4138 |
else |
| 4139 |
ndblt_nt=ndblt |
| 4140 |
ntrpt_nt=ntrpt |
| 4141 |
if(ndblt.ne.0)then |
| 4142 |
do id=1,ndblt |
| 4143 |
alfayz1_nt(id)=alfayz1(id) !Y0 |
| 4144 |
alfayz2_nt(id)=alfayz2(id) !tg theta-yz |
| 4145 |
enddo |
| 4146 |
endif |
| 4147 |
if(ndblt.ne.0)then |
| 4148 |
do it=1,ntrpt |
| 4149 |
alfaxz1_nt(it)=alfaxz1(it) !X0 |
| 4150 |
alfaxz2_nt(it)=alfaxz2(it) !tg theta-xz |
| 4151 |
alfaxz3_nt(it)=alfaxz3(it) !1/r |
| 4152 |
enddo |
| 4153 |
endif |
| 4154 |
nclouds_yz_nt=nclouds_yz |
| 4155 |
nclouds_xz_nt=nclouds_xz |
| 4156 |
if(nclouds_yz.ne.0)then |
| 4157 |
nnn=0 |
| 4158 |
do iyz=1,nclouds_yz |
| 4159 |
ptcloud_yz_nt(iyz)=ptcloud_yz(iyz) |
| 4160 |
alfayz1_av_nt(iyz)=alfayz1_av(iyz) |
| 4161 |
alfayz2_av_nt(iyz)=alfayz2_av(iyz) |
| 4162 |
nnn=nnn+ptcloud_yz(iyz) |
| 4163 |
enddo |
| 4164 |
do ipt=1,nnn |
| 4165 |
db_cloud_nt(ipt)=db_cloud(ipt) |
| 4166 |
enddo |
| 4167 |
endif |
| 4168 |
if(nclouds_xz.ne.0)then |
| 4169 |
nnn=0 |
| 4170 |
do ixz=1,nclouds_xz |
| 4171 |
ptcloud_xz_nt(ixz)=ptcloud_xz(ixz) |
| 4172 |
alfaxz1_av_nt(ixz)=alfaxz1_av(ixz) |
| 4173 |
alfaxz2_av_nt(ixz)=alfaxz2_av(ixz) |
| 4174 |
alfaxz3_av_nt(ixz)=alfaxz3_av(ixz) |
| 4175 |
nnn=nnn+ptcloud_xz(ixz) |
| 4176 |
enddo |
| 4177 |
do ipt=1,nnn |
| 4178 |
tr_cloud_nt(ipt)=tr_cloud(ipt) |
| 4179 |
enddo |
| 4180 |
endif |
| 4181 |
endif |
| 4182 |
end |
| 4183 |
|