| 6 | 
 C     Author: Vannuccini Elena | 
 C     Author: Vannuccini Elena | 
| 7 | 
 C     Date: 2004/2005 | 
 C     Date: 2004/2005 | 
| 8 | 
 C | 
 C | 
| 9 | 
  | 
  | 
| 10 | 
  | 
 c      include 'level1.f' | 
| 11 | 
 c+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- | 
 c+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- | 
| 12 | 
 c     SPEP 1                          CLUSTERS ----> COUPLES and SINGLETS | 
 c     SPEP 1                          CLUSTERS ----> COUPLES and SINGLETS | 
| 13 | 
 c+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- | 
 c+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- | 
| 18 | 
 c     * charge correlation | 
 c     * charge correlation | 
| 19 | 
 c      | 
 c      | 
| 20 | 
 c------------------------------------------------------------------------ | 
 c------------------------------------------------------------------------ | 
| 21 | 
 *     cut on maximum number of cluster allowed for track finding | 
  | 
| 22 | 
       parameter (nclstrmax_level2=10*nplanes) | 
 *     maximum (total) number of STORED clusters | 
| 23 | 
 c      parameter (nclstrmax_level2=5*nplanes) | 
       parameter (nclstrmax_level2 = nclstrmax) ! same as level1 | 
| 24 | 
 *     ----------------------------------------------------------- | 
  | 
| 25 | 
 *     maximum number of couples per plane and total  | 
 *     ----------------------------------------------------------- | 
| 26 | 
 *     (only to dimension the vectors) | 
 *     maximum number of cluster (per view) required to perform | 
| 27 | 
       parameter (ncouplemax=(nclstrmax_level2/nplanes)**2) | 
 *     track serching with full Hough transform | 
| 28 | 
       parameter (ncouplemaxtot=ncouplemax*nplanes) | 
 *     (singlets recovered during track refinement) | 
| 29 | 
  | 
       parameter (nclusterlimit=6)  | 
| 30 | 
  | 
 *     ----------------------------------------------------------- | 
| 31 | 
  | 
 *     maximum number of couples (per plane) required to perform | 
| 32 | 
  | 
 *     track serching with full Hough transform | 
| 33 | 
  | 
 *     (couples recovered during track refinement) | 
| 34 | 
  | 
       parameter (ncouplelimit=8) | 
| 35 | 
  | 
  | 
| 36 | 
  | 
 *     ----------------------------------------------------------- | 
| 37 | 
  | 
 *     maximum number of STORED couples, per plane and total  | 
| 38 | 
  | 
 *     (to dimension the vectors) | 
| 39 | 
  | 
 c      parameter (ncouplemax=2*(nclstrmax_level2/nplanes)**2) | 
| 40 | 
  | 
 c      parameter (ncouplemaxtot=ncouplemax*nplanes) | 
| 41 | 
  | 
        parameter (ncouplemax    = nclusterlimit*nclusterlimit) | 
| 42 | 
  | 
        parameter (ncouplemaxtot = ncouplemax*nplanes) | 
| 43 | 
 *     ----------------------------------------------------------- | 
 *     ----------------------------------------------------------- | 
| 44 | 
 *     maximum number of STORED couples | 
 *     maximum number of STORED couples | 
| 45 | 
 *     (if the identified couples exceeds this number the  | 
 *     (if the identified couples exceeds this number the  | 
| 46 | 
 *     track identification is not performed and the event is  | 
 *     track identification is not performed and the event is  | 
| 47 | 
 *     tagged as not good) | 
 *     tagged as not good) | 
| 48 | 
 c      parameter (ncp_max=10*nplanes) | 
 c      parameter (ncp_max=10*nplanes) | 
| 49 | 
       parameter (ncp_max=20*nplanes) | 
 c      parameter (ncp_max=10*nplanes) | 
| 50 | 
 c      parameter (ncp_max=ncouplemaxtot) | 
 c      parameter (ncp_max        = ncouplemaxtot) | 
| 51 | 
  | 
  | 
| 52 | 
  | 
  | 
| 53 | 
  | 
  | 
| 54 | 
  | 
 *     ----------------------------------------------------------- | 
| 55 | 
  | 
 *     mask of views | 
| 56 | 
  | 
 *     0 = ok | 
| 57 | 
  | 
 *     1 = n.clusters > nclusterlimit      | 
| 58 | 
  | 
 *     8 = n.couples  > ncouplelimit | 
| 59 | 
  | 
 *     2 = n.couples  > ncouplemax | 
| 60 | 
  | 
 *     3 = n.doublets > ndblt_max | 
| 61 | 
  | 
 *     4 = n.triplets > ntrpt_max | 
| 62 | 
  | 
 *     5 = n.clouds yz > ncloyz_max | 
| 63 | 
  | 
 *     6 = n.clouds xz > ncloxz_max | 
| 64 | 
  | 
 *     7 = n.track candidates > NTRACKSMAX | 
| 65 | 
  | 
       integer mask_view(nviews) | 
| 66 | 
  | 
       common/maskview/mask_view | 
| 67 | 
  | 
  | 
| 68 | 
  | 
  | 
| 69 | 
 *     ----------------------------------------------------------- | 
 *     ----------------------------------------------------------- | 
| 70 | 
 *     --- CLUSTERS ---------------------------------------------- | 
 *     --- CLUSTERS ---------------------------------------------- | 
| 80 | 
 *     mask for clusters associated to a track | 
 *     mask for clusters associated to a track | 
| 81 | 
 *      1 = used | 
 *      1 = used | 
| 82 | 
 *      0 = not used | 
 *      0 = not used | 
| 83 | 
       integer cl_used(nclstrmax_level2)  | 
       integer cl_used(nclstrmax_level2) | 
| 84 | 
  | 
       integer ncl_view(nviews)  !n.clusters per plane | 
| 85 | 
 *     ----------------------------------------------------------- | 
 *     ----------------------------------------------------------- | 
| 86 | 
       common/clusters/cl_good,cl_used | 
       common/clusters/cl_good,cl_used,ncl_view | 
| 87 | 
  | 
  | 
| 88 | 
 *     ----------------------------------------------------------- | 
 *     ----------------------------------------------------------- | 
| 89 | 
 *     --- COUPLES ----------------------------------------------- | 
 *     --- COUPLES ----------------------------------------------- | 
| 251 | 
 c | 
 c | 
| 252 | 
 c------------------------------------------------------------------------       | 
 c------------------------------------------------------------------------       | 
| 253 | 
  | 
  | 
| 254 | 
  | 
 *     ----------------------------------------------------- | 
| 255 | 
  | 
 *     default p.f.a.  | 
| 256 | 
  | 
 *     used to fit track candidates | 
| 257 | 
  | 
 *     ----------------------------------------------------- | 
| 258 | 
       character*5 PFAdef | 
       character*5 PFAdef | 
| 259 | 
 c      common/PFAdefault/PFAdef | 
       parameter (PFAdef='COG1') | 
| 260 | 
       parameter (PFAdef='COG') | 
  | 
 | 
        | 
  | 
| 261 | 
 c------------------------------------------------------------------------ | 
 c------------------------------------------------------------------------ | 
| 262 | 
 c     variable related to track selection and fitting | 
 c     variable related to track selection and fitting | 
| 263 | 
 c------------------------------------------------------------------------ | 
 c------------------------------------------------------------------------ | 
| 295 | 
  | 
  | 
| 296 | 
  | 
  | 
| 297 | 
  | 
  | 
| 298 | 
  | 
 c------------------------------------------------------------------------ | 
| 299 | 
  | 
 c     CUTS and other parameters | 
| 300 | 
  | 
 c------------------------------------------------------------------------ | 
| 301 | 
  | 
       PARAMETER (PIGR=3.14)     !159265359)!(1) | 
| 302 | 
  | 
 *     ----------------------------------------------------- | 
| 303 | 
  | 
 *     cuts on cluster signal | 
| 304 | 
  | 
 *     ----------------------------------------------------- | 
| 305 | 
  | 
       parameter (dedx_x_min=0.) | 
| 306 | 
  | 
       parameter (dedx_y_min=0.) | 
| 307 | 
  | 
 *     ----------------------------------------------------- | 
| 308 | 
  | 
 *     number of GOOD strips around MAXS | 
| 309 | 
  | 
 *     (NB this cut has been removed in track fitting but  | 
| 310 | 
  | 
 *     not in calibration) | 
| 311 | 
  | 
 *     ----------------------------------------------------- | 
| 312 | 
  | 
       parameter (ngoodstr=2)    | 
| 313 | 
  | 
 *     ----------------------------------------------------- | 
| 314 | 
  | 
 *     first cuts on the parameters determined with  | 
| 315 | 
  | 
 *     the hough transform, in order to exclude from the  | 
| 316 | 
  | 
 *     analysis non physical dublets and triplets | 
| 317 | 
  | 
 *     (out of the geometrical acceptance of the apparatus) | 
| 318 | 
  | 
 *     ----------------------------------------------------- | 
| 319 | 
  | 
 *     geometrical acceptance whit 6 planes                | 
| 320 | 
  | 
 c$$$      parameter (alfyz1_max=8.7)  !Y0  (real acc+1cm)     | 
| 321 | 
  | 
 c$$$      parameter (alfyz2_max=0.47) !tg theta-yz (18+7deg)  | 
| 322 | 
  | 
 c$$$      parameter (alfxz1_max=9.5)  !X0  (real acc+1cm)     | 
| 323 | 
  | 
 c$$$      parameter (alfxz2_max=0.47) !tg theta-xz (18+7deg)  | 
| 324 | 
  | 
  | 
| 325 | 
  | 
 c$$$*     geometrical acceptance whit the last 5 planes       | 
| 326 | 
  | 
 c$$$      parameter (alfyz1_max=12.4) !Y0  (real acc+1cm)    | 
| 327 | 
  | 
 c$$$      parameter (alfyz2_max=0.55) !tg theta-yz (22+7deg)  | 
| 328 | 
  | 
 c$$$      parameter (alfxz1_max=13.7) !X0  (real acc+1cm)     | 
| 329 | 
  | 
 c$$$      parameter (alfxz2_max=0.55) !tg theta-xz (22+7deg)  | 
| 330 | 
  | 
 c$$$ | 
| 331 | 
  | 
 c$$$*     geometrical acceptance whit the last 4 planes       | 
| 332 | 
  | 
 c$$$      parameter (alfyz1_max=18.6) !Y0  (real acc+1cm)    | 
| 333 | 
  | 
 c$$$      parameter (alfyz2_max=0.70) !tg theta-yz (28+7deg) | 
| 334 | 
  | 
 c$$$      parameter (alfxz1_max=20.6) !X0  (real acc+1cm)    | 
| 335 | 
  | 
 c$$$      parameter (alfxz2_max=0.70) !tg theta-xz (28+7deg) | 
| 336 | 
  | 
 c$$$ | 
| 337 | 
  | 
 *     geometrical acceptance whit the last 3 planes      | 
| 338 | 
  | 
       parameter (alfyz1_max=31.0) !Y0  (real acc+1cm)    | 
| 339 | 
  | 
       parameter (alfyz2_max=1.04) !tg theta-yz (39+7deg)  | 
| 340 | 
  | 
       parameter (alfxz1_max=34.4) !X0  (real acc+1cm)    | 
| 341 | 
  | 
       parameter (alfxz2_max=1.04) !tg theta-xz (39+7deg)  | 
| 342 | 
  | 
 *     ----------------------------------------------------- | 
| 343 | 
  | 
 *     cut on the position of the circle center: | 
| 344 | 
  | 
 *     center inside the spectrometer volume is not physical | 
| 345 | 
  | 
 *     ==> THE TRIPLET IS REJECTED | 
| 346 | 
  | 
 *     ----------------------------------------------------- | 
| 347 | 
  | 
       parameter (xclimit=8.)    !cm | 
| 348 | 
  | 
 *     ----------------------------------------------------- | 
| 349 | 
  | 
 *     Parameter normalization constants, needed to evaluate | 
| 350 | 
  | 
 *     distances in parameter space | 
| 351 | 
  | 
 *     ----------------------------------------------------- | 
| 352 | 
  | 
       parameter (Dalfaxz3=1.) | 
| 353 | 
  | 
       parameter (Dalfayz1=0.8864e-1)  | 
| 354 | 
  | 
       parameter (Dalfayz2=0.6204e-3)  | 
| 355 | 
  | 
       parameter (Dalfaxz1=0.2909e-1)  | 
| 356 | 
  | 
       parameter (Dalfaxz2=0.2759e-2)  | 
| 357 | 
  | 
 *     ----------------------------------------------------- | 
| 358 | 
  | 
 *     Cut on normalized distances in parameter space.  | 
| 359 | 
  | 
 *     Doublets/triplets are recursively included in a cloud  | 
| 360 | 
  | 
 *     if the distance from any of the points already included | 
| 361 | 
  | 
 *     is less than this cut. | 
| 362 | 
  | 
 *     ----------------------------------------------------- | 
| 363 | 
  | 
       parameter(cutystart=0.3)    | 
| 364 | 
  | 
       parameter(cutystep=0.3)     | 
| 365 | 
  | 
       parameter(cutxstart=1.)  | 
| 366 | 
  | 
       parameter(cutxstep=1.)   | 
| 367 | 
  | 
       parameter(maxcuty=100.)  | 
| 368 | 
  | 
       parameter(maxcutx=150.)  | 
| 369 | 
  | 
  | 
| 370 | 
  | 
       parameter(nstepx=50)     !inclusion-cut increasing steps | 
| 371 | 
  | 
       parameter(nstepy=50)  | 
| 372 | 
  | 
  | 
| 373 | 
  | 
       real cutdistyz            !y0 / tg theta_yz space    | 
| 374 | 
  | 
       real cutdistxz            !x0 / tg theta_xz space    | 
| 375 | 
  | 
       common/cutdi/cutdistyz,cutdistxz | 
| 376 | 
  | 
 *     (NB deflection is not considered in the selection criteria)  | 
| 377 | 
  | 
 *     -------------------------------------------------- | 
| 378 | 
  | 
 *     cloud selection | 
| 379 | 
  | 
 *     -------------------------------------------------- | 
| 380 | 
  | 
       parameter(x_min_start=4)  | 
| 381 | 
  | 
       parameter(x_min_step=1)   | 
| 382 | 
  | 
        | 
| 383 | 
  | 
       integer ncpxz_min  | 
| 384 | 
  | 
       integer nptxz_min         !for a circle         | 
| 385 | 
  | 
       integer nplxz_min         !for a circle        | 
| 386 | 
  | 
  | 
| 387 | 
  | 
       common/cutxclouds/ncpxz_min,nptxz_min,nplxz_min  | 
| 388 | 
  | 
  | 
| 389 | 
  | 
       parameter(y_min_start=3)  | 
| 390 | 
  | 
  | 
| 391 | 
  | 
       integer ncpyz_min        | 
| 392 | 
  | 
       integer nptyz_min         !for a straight line  | 
| 393 | 
  | 
       integer nplyz_min         !for a circle         | 
| 394 | 
  | 
       common/cutyclouds/ncpyz_min,nptyz_min,nplyz_min | 
| 395 | 
  | 
 *     -------------------------------------------------- | 
| 396 | 
  | 
  | 
| 397 | 
  | 
 *     ----------------------------------------------------- | 
| 398 | 
  | 
 *     minimum number of matching couples required to combine | 
| 399 | 
  | 
 *     XZ-YZ clouds and perform the fit | 
| 400 | 
  | 
 *     ----------------------------------------------------- | 
| 401 | 
  | 
       parameter (ncpok=3)       | 
| 402 | 
  | 
  | 
| 403 | 
  | 
 *     ----------------------------------------------------- | 
| 404 | 
  | 
 *     maximum value of deflection from Hough transform | 
| 405 | 
  | 
 *     accepted in order to perform the track fit | 
| 406 | 
  | 
 *     ----------------------------------------------------- | 
| 407 | 
  | 
 c      parameter (defmax=10000.) !GV-1  | 
| 408 | 
  | 
       parameter (defmax=100.) !GV-1  | 
| 409 | 
  | 
  | 
| 410 | 
  | 
 *     ----------------------------------------------------- | 
| 411 | 
  | 
 *     cut to include new couple or single clusters in the | 
| 412 | 
  | 
 *     track fitting, after the first fit | 
| 413 | 
  | 
 *     ----------------------------------------------------- | 
| 414 | 
  | 
       parameter (clinc=3) | 
| 415 | 
  | 
  | 
| 416 | 
  | 
  | 
| 417 | 
  | 
  |