(file) Return to h_tracks_cal.f CVS log (file) (dir) Up to [HallC] / Analyzer / HTRACKING

  1 cdaq  1.1 *=======================================================================
  2                 subroutine h_tracks_cal(abort,errmsg)
  3           *=======================================================================
  4           *-
  5           *-      Purpose: Associates clusters with detector tracks which are inside
  6           *-               the calorimeter fiducial volume. A track and a cluster
  7           *-               are considered as matched if the distance in X projection
  8           *-               between these two is less than half the block width.
  9           *-
 10           *-      Input Banks: HMS_CLUSTERS_CAL, HMS_FOCAL_PLANE,HMS_GEOMETRY_CAL
 11           *-
 12           *-      Output Bank: HMS_TRACK_CAL
 13           *-
 14           *-      Created: 15 Mar 1994      Tsolak A. Amatuni
 15           *-      Modified 25 Mar 1994      DFG
 16           *-                                Change name of print routine
 17 cdaq  1.2 * $Log: h_tracks_cal.f,v $
 18 saw   1.6 * Revision 1.5  1996/01/16 22:00:40  cdaq
 19           * (JRA) Add hdebugcalcpeds flag
 20           *
 21 cdaq  1.5 * Revision 1.4  1995/08/30 17:34:24  cdaq
 22           * (JRA) Use off-track blocks to accumulate pedestal data
 23           *
 24 cdaq  1.4 * Revision 1.3  1995/05/22  19:39:31  cdaq
 25           * (SAW) Split gen_data_data_structures into gen, hms, sos, and coin parts"
 26           *
 27 cdaq  1.3 * Revision 1.2  1994/10/11  19:24:54  cdaq
 28           * (SAW) Formatting changes
 29           *
 30 cdaq  1.2 * Revision 1.1  1994/04/13  17:33:38  cdaq
 31           * Initial revision
 32           *
 33 cdaq  1.1 *-----------------------------------------------------------------------
 34           *
 35           *
 36                 implicit none
 37                 save
 38           *
 39                 logical abort
 40                 character*(*) errmsg
 41                 character*12 here
 42                 parameter (here='H_TRACKS_CAL')
 43           *
 44 cdaq  1.4       integer*4 hit,blk
 45                 real*4 xblk
 46           
 47 cdaq  1.1       integer*4 nt      !Track number
 48                 integer*4 nc      !Cluster number
 49                 real*4 xf         !X position of track on calorimeter front surface
 50                 real*4 xb         !X position of track on calorimeter back  surface
 51                 real*4 yf         !Y position of track on calorimeter front surface
 52                 real*4 yb         !Y position of track on calorimeter back  surface
 53                 real*4 dz_f       !Distance along Z axis between focal plane and
 54                 real*4 dz_b       !calorimeter front(f) and back(b) surfaces
 55                 real*4 delta_x    !Distance between track & cluster in X projection
 56           *
 57 cdaq  1.3       include 'hms_data_structures.cmn'
 58 cdaq  1.1       include 'hms_calorimeter.cmn'
 59 cdaq  1.5       include 'hms_tracking.cmn'
 60 cdaq  1.1 *
 61           *
 62                 hntracks_cal=0
 63                 if(hntracks_fp.le.0) go to 100   !Return
 64           *
 65           *-----Compute impact point coordinates on the 
 66           *-----calorimeter front and back surfaces
 67                 do nt=1,hntracks_fp
 68 cdaq  1.2         dz_f=hcal_zmin-hz_fp(nt)
 69                   dz_b=hcal_zmax-hz_fp(nt)
 70 cdaq  1.1 *
 71 cdaq  1.2         xf=hx_fp(nt)+hxp_fp(nt)*dz_f
 72                   xb=hx_fp(nt)+hxp_fp(nt)*dz_b
 73 cdaq  1.1 *
 74 cdaq  1.2         yf=hy_fp(nt)+hyp_fp(nt)*dz_f
 75                   yb=hy_fp(nt)+hyp_fp(nt)*dz_b
 76 cdaq  1.1 *
 77 cdaq  1.2         hcluster_track(nt)   =-1        !Track is outside the fiducial volume
 78                   htrack_xc(nt)        = xf
 79                   htrack_yc(nt)        = yf
 80           *
 81           *-------Is the track inside the fiducial volume?
 82                   if(xf.le.hcal_fv_xmax  .and.  xf.ge.hcal_fv_xmin  .and.
 83 saw   1.6      &       xb.le.hcal_fv_xmax  .and.  xb.ge.hcal_fv_xmin  .and.
 84 cdaq  1.2      &       yf.le.hcal_fv_ymax  .and.  yf.ge.hcal_fv_ymin  .and.
 85                &       yb.le.hcal_fv_ymax  .and.  yb.ge.hcal_fv_ymin) then
 86           *
 87                     hcluster_track(nt)=0          !Track is inside the fiducial volume
 88                     if(hnclusters_cal.gt.0) then
 89           *
 90           *------------Search for a cluster matching this track
 91                       do nc=1,hnclusters_cal
 92                         delta_x=abs(xf-hcluster_xc(nc))
 93                         if(delta_x.le.(0.5*hcal_block_xsize + hcal_slop)) then
 94                           hcluster_track(nt)=nc   !Track matches cluster #nc
 95                           hntracks_cal      =hntracks_cal+1
 96                         endif                     !End ... if matched
 97                       enddo                       !End loop over clusters
 98                     endif                         !End ... if inside fiducial volume
 99                   endif                           !End ... if number of clusters > 0
100                 enddo                             !End loop over detector tracks
101 cdaq  1.1 *
102 cdaq  1.4 
103 cdaq  1.5       if (hdebugcalcpeds.ne.0) then
104                   if(hntracks_fp.eq.1) then       !use blocks not on track to find pedestal
105                     do hit=1,hcal_tot_hits
106                       blk=hcal_row(hit)+hmax_cal_rows*(hcal_column(hit)-1)
107                       xblk=hcal_block_xc(blk)
108                       if (abs(xf-xblk).ge.20. .and. abs(xb-xblk).ge.20.) then !blk not hit
109                         if (hcal_zero_num(blk).le.2000) then !avoid overflow in sum**2
110                           hcal_zero_sum(blk)=hcal_zero_sum(blk)+hcal_adc(hit)
111                           hcal_zero_sum2(blk)=hcal_zero_sum2(blk)
112                $               +hcal_adc(hit)*hcal_adc(hit)
113                           hcal_zero_num(blk)=hcal_zero_num(blk)+1
114                         endif
115 cdaq  1.4             endif
116 cdaq  1.5           enddo
117                   endif
118 cdaq  1.4       endif
119           
120 cdaq  1.1   100 continue
121                 if(hdbg_tracks_cal.gt.0) call h_prt_cal_tracks
122           *
123                 return
124                 end

Analyzer/Replay: Mark Jones, Documents: Stephen Wood
Powered by
ViewCVS 0.9.2-cvsgraph-1.4.0