| 1 | 
mocchiut | 
1.1 | 
************************************************************************* | 
| 2 | 
  | 
  | 
*      | 
| 3 | 
  | 
  | 
*     Subroutine read_B.f | 
| 4 | 
  | 
  | 
*      | 
| 5 | 
  | 
  | 
*     it calls the subroutines which read the magnetic field maps for | 
| 6 | 
  | 
  | 
*     the PAMELA spectrometer | 
| 7 | 
  | 
  | 
*      | 
| 8 | 
  | 
  | 
*     needs: | 
| 9 | 
  | 
  | 
*     - ./read_B_inner.f inner map reading subroutine | 
| 10 | 
  | 
  | 
*     - ./read_B_outer.f outer map reading subroutine | 
| 11 | 
  | 
  | 
*      | 
| 12 | 
  | 
  | 
*     to be called before ./inter_B.f (interpolation subroutine) | 
| 13 | 
  | 
  | 
*      | 
| 14 | 
  | 
  | 
************************************************************************* | 
| 15 | 
  | 
  | 
 | 
| 16 | 
pam-fi | 
1.6 | 
c$$$      subroutine readB(cpath) | 
| 17 | 
  | 
  | 
c$$$      include 'common_c2f.f' | 
| 18 | 
  | 
  | 
c$$$ | 
| 19 | 
  | 
  | 
c$$$      LOGICAL DEBUG | 
| 20 | 
  | 
  | 
c$$$      LOGICAL VERBOSE | 
| 21 | 
  | 
  | 
c$$$      LOGICAL WARNING | 
| 22 | 
  | 
  | 
c$$$      COMMON/DBG/DEBUG,VERBOSE,WARNING | 
| 23 | 
  | 
  | 
c$$$      SAVE/DBG/ | 
| 24 | 
  | 
  | 
c$$$ | 
| 25 | 
  | 
  | 
c$$$      character*256 cpath | 
| 26 | 
  | 
  | 
c$$$      character*256 ppath | 
| 27 | 
  | 
  | 
c$$$ | 
| 28 | 
  | 
  | 
c$$$       | 
| 29 | 
  | 
  | 
c$$$      b_error=0 | 
| 30 | 
  | 
  | 
c$$$      ppath='' | 
| 31 | 
  | 
  | 
c$$$ | 
| 32 | 
  | 
  | 
c$$$      la=256 | 
| 33 | 
  | 
  | 
c$$$      do i=1,256 | 
| 34 | 
  | 
  | 
c$$$         if(cpath(i:i).eq.'/')la=i | 
| 35 | 
  | 
  | 
c$$$      enddo | 
| 36 | 
  | 
  | 
c$$$      ppath=cpath(1:la) | 
| 37 | 
  | 
  | 
c$$$ | 
| 38 | 
  | 
  | 
c$$$      b_path    = ppath | 
| 39 | 
  | 
  | 
c$$$      b_pathlen = la | 
| 40 | 
  | 
  | 
c$$$ | 
| 41 | 
  | 
  | 
c$$$      if(DEBUG)print*,'Field loaded: ',b_loaded | 
| 42 | 
  | 
  | 
c$$$      if(b_loaded.eq.0)then | 
| 43 | 
  | 
  | 
c$$$ | 
| 44 | 
  | 
  | 
c$$$c     call the subroutine which reads the maps of the measurements taken | 
| 45 | 
  | 
  | 
c$$$c     inside the magnetic cavity       | 
| 46 | 
  | 
  | 
c$$$         call readBinner(ppath) | 
| 47 | 
  | 
  | 
c$$$         if(b_error.eq.1)return | 
| 48 | 
  | 
  | 
c$$$ | 
| 49 | 
  | 
  | 
c$$$c     call the subroutine which reads the maps of the measurements taken | 
| 50 | 
  | 
  | 
c$$$c     outside the magnetic cavity | 
| 51 | 
  | 
  | 
c$$$         call readBouter(ppath)    | 
| 52 | 
  | 
  | 
c$$$         if(b_error.eq.1)return | 
| 53 | 
  | 
  | 
c$$$ | 
| 54 | 
  | 
  | 
c$$$         b_loaded  = 1 | 
| 55 | 
  | 
  | 
c$$$      endif | 
| 56 | 
  | 
  | 
c$$$ | 
| 57 | 
  | 
  | 
c$$$      return | 
| 58 | 
  | 
  | 
c$$$      end | 
| 59 | 
  | 
  | 
      subroutine readB | 
| 60 | 
mocchiut | 
1.1 | 
      include 'common_c2f.f' | 
| 61 | 
pam-fi | 
1.2 | 
 | 
| 62 | 
  | 
  | 
      LOGICAL DEBUG | 
| 63 | 
  | 
  | 
      LOGICAL VERBOSE | 
| 64 | 
  | 
  | 
      LOGICAL WARNING | 
| 65 | 
  | 
  | 
      COMMON/DBG/DEBUG,VERBOSE,WARNING | 
| 66 | 
  | 
  | 
      SAVE/DBG/ | 
| 67 | 
  | 
  | 
 | 
| 68 | 
pam-fi | 
1.6 | 
c$$$      character*256 cpath | 
| 69 | 
pam-fi | 
1.4 | 
      character*256 ppath | 
| 70 | 
mocchiut | 
1.1 | 
 | 
| 71 | 
  | 
  | 
       | 
| 72 | 
pam-fi | 
1.6 | 
      c2f_error=0 | 
| 73 | 
mocchiut | 
1.1 | 
 | 
| 74 | 
pam-fi | 
1.6 | 
      ppath=c2f_path(1:c2f_pathlen) | 
| 75 | 
mocchiut | 
1.1 | 
 | 
| 76 | 
  | 
  | 
 | 
| 77 | 
pam-fi | 
1.7 | 
c      VERBOSE=.true. | 
| 78 | 
mocchiut | 
1.1 | 
 | 
| 79 | 
  | 
  | 
c     call the subroutine which reads the maps of the measurements taken | 
| 80 | 
  | 
  | 
c     inside the magnetic cavity       | 
| 81 | 
pam-fi | 
1.6 | 
      call readBinner(ppath) | 
| 82 | 
  | 
  | 
      if(c2f_error.eq.1)return | 
| 83 | 
  | 
  | 
       | 
| 84 | 
mocchiut | 
1.1 | 
c     call the subroutine which reads the maps of the measurements taken | 
| 85 | 
  | 
  | 
c     outside the magnetic cavity | 
| 86 | 
pam-fi | 
1.6 | 
      call readBouter(ppath)    | 
| 87 | 
  | 
  | 
      if(c2f_error.eq.1)return | 
| 88 | 
mocchiut | 
1.1 | 
 | 
| 89 | 
  | 
  | 
 | 
| 90 | 
  | 
  | 
      return | 
| 91 | 
  | 
  | 
      end | 
| 92 | 
  | 
  | 
 | 
| 93 | 
  | 
  | 
************************************************************ | 
| 94 | 
  | 
  | 
 | 
| 95 | 
  | 
  | 
 | 
| 96 | 
  | 
  | 
************************************************************************* | 
| 97 | 
  | 
  | 
*      | 
| 98 | 
  | 
  | 
*     Subroutine readBinner | 
| 99 | 
  | 
  | 
*      | 
| 100 | 
  | 
  | 
*     it reads from rz files the two magnetic field maps taken inside the | 
| 101 | 
  | 
  | 
*     spectrometer cavity and fills the variables in common_B_inner.f | 
| 102 | 
  | 
  | 
*      | 
| 103 | 
  | 
  | 
*     needs: | 
| 104 | 
  | 
  | 
*     - common_B.f common file for the inner magnetic field map | 
| 105 | 
  | 
  | 
*     - .rz map files in ./ containing coordinates of measured points, Bx, By | 
| 106 | 
  | 
  | 
*     and Bz components + errors | 
| 107 | 
  | 
  | 
*      | 
| 108 | 
  | 
  | 
*     output variables: (see common_B_inner.f) | 
| 109 | 
  | 
  | 
*     - px#(nx,3)         with #=1,2 for the 2 maps | 
| 110 | 
  | 
  | 
*     - py#(ny,3) | 
| 111 | 
  | 
  | 
*     - pz#(nz,3) | 
| 112 | 
  | 
  | 
*     - b#(nx,ny,nz,3) | 
| 113 | 
  | 
  | 
*      | 
| 114 | 
  | 
  | 
************************************************************************* | 
| 115 | 
  | 
  | 
 | 
| 116 | 
  | 
  | 
      subroutine readBinner(path) | 
| 117 | 
  | 
  | 
 | 
| 118 | 
  | 
  | 
c     implicit double precision (a-h,o-z) | 
| 119 | 
  | 
  | 
      include 'common_B.f' | 
| 120 | 
  | 
  | 
      include 'common_c2f.f' | 
| 121 | 
pam-fi | 
1.2 | 
 | 
| 122 | 
  | 
  | 
      LOGICAL DEBUG | 
| 123 | 
  | 
  | 
      LOGICAL VERBOSE | 
| 124 | 
  | 
  | 
      LOGICAL WARNING | 
| 125 | 
  | 
  | 
      COMMON/DBG/DEBUG,VERBOSE,WARNING | 
| 126 | 
  | 
  | 
      SAVE/DBG/ | 
| 127 | 
  | 
  | 
 | 
| 128 | 
pam-fi | 
1.5 | 
      character*256 path | 
| 129 | 
mocchiut | 
1.1 | 
       | 
| 130 | 
  | 
  | 
C | 
| 131 | 
  | 
  | 
      REAL hmemor(10000000) | 
| 132 | 
  | 
  | 
      integer Iquest(100)     | 
| 133 | 
  | 
  | 
      COMMON /pawc/hmemor | 
| 134 | 
  | 
  | 
      save /pawc/ | 
| 135 | 
  | 
  | 
C | 
| 136 | 
  | 
  | 
      Common /QUEST/ Iquest | 
| 137 | 
  | 
  | 
      save /quest/ | 
| 138 | 
  | 
  | 
      | 
| 139 | 
  | 
  | 
 | 
| 140 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 141 | 
  | 
  | 
c      | 
| 142 | 
  | 
  | 
c     local variables | 
| 143 | 
  | 
  | 
c      | 
| 144 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 145 | 
  | 
  | 
 | 
| 146 | 
  | 
  | 
      character*64 Bmap_file    !magnetic field file name | 
| 147 | 
  | 
  | 
      parameter (lun_Bmap_file=66) !magnetic field map file id number | 
| 148 | 
  | 
  | 
 | 
| 149 | 
  | 
  | 
      parameter (ntpl_Bmap=20)  !ntuple identifier | 
| 150 | 
  | 
  | 
 | 
| 151 | 
  | 
  | 
      REAL PFX(3),FX,DFX,       !Bx field component coordinates in m, value and error in T | 
| 152 | 
  | 
  | 
     $     PFY(3),FY,DFY | 
| 153 | 
  | 
  | 
     $     ,PFZ(3),FZ,DFZ | 
| 154 | 
  | 
  | 
      INTEGER INDEX(3)          !point index | 
| 155 | 
  | 
  | 
 | 
| 156 | 
  | 
  | 
      COMMON /PAWCR4/ INDEX,PFX,FX,DFX,PFY,FY,DFY,PFZ,FZ,DFZ | 
| 157 | 
  | 
  | 
 | 
| 158 | 
  | 
  | 
    | 
| 159 | 
  | 
  | 
      CALL HLIMIT(10000000) | 
| 160 | 
  | 
  | 
C     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 
| 161 | 
  | 
  | 
C     largest RZ file: IQUEST(10) records x LREC words x 4 byte | 
| 162 | 
  | 
  | 
C     with the following settings: 65000 x 4096 x 4 = 1G | 
| 163 | 
  | 
  | 
C     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  | 
| 164 | 
  | 
  | 
       | 
| 165 | 
  | 
  | 
c     permette di ottenere ntuple funzionanti nonostante | 
| 166 | 
  | 
  | 
c     il messaggio dei 64K di RZOUT | 
| 167 | 
  | 
  | 
      Iquest(10) = 512000 | 
| 168 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 169 | 
  | 
  | 
c      | 
| 170 | 
  | 
  | 
c     *** FIRST MAP *** | 
| 171 | 
  | 
  | 
c      | 
| 172 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 173 | 
  | 
  | 
 | 
| 174 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 175 | 
  | 
  | 
c      | 
| 176 | 
  | 
  | 
c     initialization and map file opening | 
| 177 | 
  | 
  | 
c      | 
| 178 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 179 | 
  | 
  | 
 | 
| 180 | 
  | 
  | 
c     print*,' ' | 
| 181 | 
  | 
  | 
c     print*,' ' | 
| 182 | 
  | 
  | 
 | 
| 183 | 
  | 
  | 
      Bmap_file='measure_n3_290302.rz' | 
| 184 | 
  | 
  | 
       | 
| 185 | 
  | 
  | 
c     opens magnetic field map first file | 
| 186 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1)print *                  | 
| 187 | 
  | 
  | 
      if(VERBOSE)print *                  | 
| 188 | 
mocchiut | 
1.1 | 
     $     ,path(1:LNBLNK(path))//Bmap_file | 
| 189 | 
  | 
  | 
      call HROPEN | 
| 190 | 
  | 
  | 
     $     (lun_Bmap_file,'Bmap' | 
| 191 | 
  | 
  | 
     $     ,path(1:LNBLNK(path))//Bmap_file | 
| 192 | 
  | 
  | 
     $     ,'P',1024,istat)  | 
| 193 | 
  | 
  | 
      if(istat.ne.0) goto 21 | 
| 194 | 
  | 
  | 
 | 
| 195 | 
  | 
  | 
 | 
| 196 | 
  | 
  | 
      call HRIN(ntpl_Bmap,9999,0) !puts B map ntuple in memory | 
| 197 | 
  | 
  | 
 | 
| 198 | 
  | 
  | 
c     call HPRNTU(ntpl_Bmap) | 
| 199 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,' ',0,'$CLEAR') | 
| 200 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'INDEX',index,'$SET') | 
| 201 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BX',pfx,'$SET') | 
| 202 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BY',pfy,'$SET') | 
| 203 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BZ',pfz,'$SET') | 
| 204 | 
  | 
  | 
 | 
| 205 | 
  | 
  | 
 | 
| 206 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 207 | 
  | 
  | 
c      | 
| 208 | 
  | 
  | 
c     reads events and fills variables | 
| 209 | 
  | 
  | 
c      | 
| 210 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 211 | 
  | 
  | 
 | 
| 212 | 
  | 
  | 
      call HNOENT(ntpl_Bmap,iemax) !number of events | 
| 213 | 
  | 
  | 
 | 
| 214 | 
  | 
  | 
c     initializes measurement grid edges | 
| 215 | 
  | 
  | 
      do ic=1,3 | 
| 216 | 
  | 
  | 
        px1max(ic)=0. | 
| 217 | 
  | 
  | 
        px1min(ic)=0. | 
| 218 | 
  | 
  | 
        py1max(ic)=0. | 
| 219 | 
  | 
  | 
        py1min(ic)=0. | 
| 220 | 
  | 
  | 
        pz1max(ic)=0. | 
| 221 | 
  | 
  | 
        pz1min(ic)=0. | 
| 222 | 
  | 
  | 
      enddo | 
| 223 | 
  | 
  | 
 | 
| 224 | 
  | 
  | 
 | 
| 225 | 
  | 
  | 
      do iev=1,iemax            !event loop | 
| 226 | 
  | 
  | 
 | 
| 227 | 
  | 
  | 
        call HGNT(ntpl_Bmap,iev,ierr) !reads event | 
| 228 | 
  | 
  | 
        if(ierr.ne.0) goto 22 | 
| 229 | 
  | 
  | 
 | 
| 230 | 
  | 
  | 
c     the output consists of matrices for coordinates, B components values  | 
| 231 | 
  | 
  | 
c     and errors: | 
| 232 | 
  | 
  | 
c     e.g. px1(4,2) = X coordinate of the point with index = 4 along X,  | 
| 233 | 
  | 
  | 
c     in which By (=2) component has been measured | 
| 234 | 
  | 
  | 
c     e.g. b1(3,23,4,1) = Bx (=1) component value, measured in the point with | 
| 235 | 
  | 
  | 
c     indexes = 3,23,4 along X, Y and Z | 
| 236 | 
  | 
  | 
 | 
| 237 | 
  | 
  | 
c     Bx component | 
| 238 | 
  | 
  | 
        px1(index(1),1) = pfx(1) | 
| 239 | 
  | 
  | 
        if(px1(index(1),1).lt.px1min(1)) px1min(1)=px1(index(1),1) | 
| 240 | 
  | 
  | 
        if(px1(index(1),1).gt.px1max(1)) px1max(1)=px1(index(1),1) | 
| 241 | 
  | 
  | 
        py1(index(2),1) = pfx(2) | 
| 242 | 
  | 
  | 
        if(py1(index(2),1).lt.py1min(1)) py1min(1)=py1(index(2),1) | 
| 243 | 
  | 
  | 
        if(py1(index(2),1).gt.py1max(1)) py1max(1)=py1(index(2),1) | 
| 244 | 
  | 
  | 
        pz1(index(3),1) = pfx(3) | 
| 245 | 
  | 
  | 
        if(pz1(index(3),1).lt.pz1min(1)) pz1min(1)=pz1(index(3),1) | 
| 246 | 
  | 
  | 
        if(pz1(index(3),1).gt.pz1max(1)) pz1max(1)=pz1(index(3),1) | 
| 247 | 
  | 
  | 
 | 
| 248 | 
  | 
  | 
        b1(index(1),index(2),index(3),1) = fx | 
| 249 | 
  | 
  | 
 | 
| 250 | 
  | 
  | 
 | 
| 251 | 
  | 
  | 
c     By component | 
| 252 | 
  | 
  | 
        px1(index(1),2) = pfy(1) | 
| 253 | 
  | 
  | 
        if(px1(index(1),2).lt.px1min(2)) px1min(2)=px1(index(1),2) | 
| 254 | 
  | 
  | 
        if(px1(index(1),2).gt.px1max(2)) px1max(2)=px1(index(1),2) | 
| 255 | 
  | 
  | 
        py1(index(2),2) = pfy(2) | 
| 256 | 
  | 
  | 
        if(py1(index(2),2).lt.py1min(2)) py1min(2)=py1(index(2),2) | 
| 257 | 
  | 
  | 
        if(py1(index(2),2).gt.py1max(2)) py1max(2)=py1(index(2),2) | 
| 258 | 
  | 
  | 
        pz1(index(3),2) = pfy(3) | 
| 259 | 
  | 
  | 
        if(pz1(index(3),2).lt.pz1min(2)) pz1min(2)=pz1(index(3),2) | 
| 260 | 
  | 
  | 
        if(pz1(index(3),2).gt.pz1max(2)) pz1max(2)=pz1(index(3),2) | 
| 261 | 
  | 
  | 
 | 
| 262 | 
  | 
  | 
        b1(index(1),index(2),index(3),2) = fy | 
| 263 | 
  | 
  | 
 | 
| 264 | 
  | 
  | 
 | 
| 265 | 
  | 
  | 
c     Bz component | 
| 266 | 
  | 
  | 
        px1(index(1),3) = pfz(1) | 
| 267 | 
  | 
  | 
        if(px1(index(1),3).lt.px1min(3)) px1min(3)=px1(index(1),3) | 
| 268 | 
  | 
  | 
        if(px1(index(1),3).gt.px1max(3)) px1max(3)=px1(index(1),3) | 
| 269 | 
  | 
  | 
        py1(index(2),3) = pfz(2) | 
| 270 | 
  | 
  | 
        if(py1(index(2),3).lt.py1min(3)) py1min(3)=py1(index(2),3) | 
| 271 | 
  | 
  | 
        if(py1(index(2),3).gt.py1max(3)) py1max(3)=py1(index(2),3) | 
| 272 | 
  | 
  | 
        pz1(index(3),3) = pfz(3) | 
| 273 | 
  | 
  | 
        if(pz1(index(3),3).lt.pz1min(3)) pz1min(3)=pz1(index(3),3) | 
| 274 | 
  | 
  | 
        if(pz1(index(3),3).gt.pz1max(3)) pz1max(3)=pz1(index(3),3) | 
| 275 | 
  | 
  | 
 | 
| 276 | 
  | 
  | 
        b1(index(1),index(2),index(3),3) = fz | 
| 277 | 
  | 
  | 
 | 
| 278 | 
  | 
  | 
      enddo | 
| 279 | 
  | 
  | 
 | 
| 280 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 281 | 
  | 
  | 
c      | 
| 282 | 
  | 
  | 
c     closes files | 
| 283 | 
  | 
  | 
c      | 
| 284 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 285 | 
  | 
  | 
 | 
| 286 | 
  | 
  | 
      call HREND('Bmap') | 
| 287 | 
  | 
  | 
      close(lun_Bmap_file) | 
| 288 | 
  | 
  | 
c$$$  cmd2='rm -f ' | 
| 289 | 
  | 
  | 
c$$$  $     //Bmap_file(1:LNBLNK(Bmap_file)) | 
| 290 | 
  | 
  | 
c$$$  call system(cmd2) | 
| 291 | 
  | 
  | 
c$$$   | 
| 292 | 
  | 
  | 
 | 
| 293 | 
  | 
  | 
 | 
| 294 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 295 | 
  | 
  | 
c      | 
| 296 | 
  | 
  | 
c     *** SECOND MAP *** | 
| 297 | 
  | 
  | 
c      | 
| 298 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 299 | 
  | 
  | 
 | 
| 300 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 301 | 
  | 
  | 
c      | 
| 302 | 
  | 
  | 
c     initialization and map file opening | 
| 303 | 
  | 
  | 
c      | 
| 304 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 305 | 
  | 
  | 
 | 
| 306 | 
  | 
  | 
c     print*,' ' | 
| 307 | 
  | 
  | 
c     print*,' ' | 
| 308 | 
  | 
  | 
 | 
| 309 | 
  | 
  | 
      Bmap_file='measure_n4_110402_corrected.rz' | 
| 310 | 
  | 
  | 
c     opens magnetic field map first file | 
| 311 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1)print *                   !,'Opening file: ' | 
| 312 | 
  | 
  | 
      if(VERBOSE)print *                   !,'Opening file: ' | 
| 313 | 
mocchiut | 
1.1 | 
     $     ,path(1:LNBLNK(path))//Bmap_file | 
| 314 | 
  | 
  | 
      call HROPEN | 
| 315 | 
  | 
  | 
     $     (lun_Bmap_file,'Bmap' | 
| 316 | 
  | 
  | 
     $     ,path(1:LNBLNK(path))//Bmap_file | 
| 317 | 
  | 
  | 
     $     ,'P',1024,istat)  | 
| 318 | 
  | 
  | 
      if(istat.ne.0) goto 21 | 
| 319 | 
  | 
  | 
 | 
| 320 | 
  | 
  | 
 | 
| 321 | 
  | 
  | 
      call HRIN(ntpl_Bmap,9999,0) !puts B map ntuple in memory | 
| 322 | 
  | 
  | 
 | 
| 323 | 
  | 
  | 
c     call HPRNTU(ntpl_Bmap) | 
| 324 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,' ',0,'$CLEAR') | 
| 325 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'INDEX',index,'$SET') | 
| 326 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BX',pfx,'$SET') | 
| 327 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BY',pfy,'$SET') | 
| 328 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BZ',pfz,'$SET') | 
| 329 | 
  | 
  | 
 | 
| 330 | 
  | 
  | 
 | 
| 331 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 332 | 
  | 
  | 
c      | 
| 333 | 
  | 
  | 
c     reads events and fills variables | 
| 334 | 
  | 
  | 
c      | 
| 335 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 336 | 
  | 
  | 
 | 
| 337 | 
  | 
  | 
      call HNOENT(ntpl_Bmap,iemax) !number of events | 
| 338 | 
  | 
  | 
 | 
| 339 | 
  | 
  | 
c      print*,'iemax ',iemax | 
| 340 | 
  | 
  | 
 | 
| 341 | 
  | 
  | 
      do ic=1,3                 !grid edges | 
| 342 | 
  | 
  | 
        px2max(ic)=0. | 
| 343 | 
  | 
  | 
        px2min(ic)=0. | 
| 344 | 
  | 
  | 
        py2max(ic)=0. | 
| 345 | 
  | 
  | 
        py2min(ic)=0. | 
| 346 | 
  | 
  | 
        pz2max(ic)=0. | 
| 347 | 
  | 
  | 
        pz2min(ic)=0. | 
| 348 | 
  | 
  | 
      enddo | 
| 349 | 
  | 
  | 
 | 
| 350 | 
  | 
  | 
 | 
| 351 | 
  | 
  | 
      do iev=1,iemax            !event loop | 
| 352 | 
  | 
  | 
 | 
| 353 | 
  | 
  | 
        call HGNT(ntpl_Bmap,iev,ierr) !reads event | 
| 354 | 
  | 
  | 
        if(ierr.ne.0) goto 22 | 
| 355 | 
  | 
  | 
 | 
| 356 | 
  | 
  | 
c     the output consists of matrices for coordinates, B components values  | 
| 357 | 
  | 
  | 
c     and errors: | 
| 358 | 
  | 
  | 
c     e.g. px(4,2) = X coordinate of the point with index = 4 along X,  | 
| 359 | 
  | 
  | 
c     in which By (=2) component has been measured | 
| 360 | 
  | 
  | 
c     e.g. b(3,23,4,1) = Bx (=1) component value, measured in the point with | 
| 361 | 
  | 
  | 
c     indexes = 3,23,4 along X, Y and Z | 
| 362 | 
  | 
  | 
 | 
| 363 | 
  | 
  | 
c     Bx component | 
| 364 | 
  | 
  | 
        px2(index(1),1) = pfx(1) | 
| 365 | 
  | 
  | 
        if(px2(index(1),1).lt.px2min(1)) px2min(1)=px2(index(1),1) | 
| 366 | 
  | 
  | 
        if(px2(index(1),1).gt.px2max(1)) px2max(1)=px2(index(1),1) | 
| 367 | 
  | 
  | 
        py2(index(2),1) = pfx(2) | 
| 368 | 
  | 
  | 
        if(py2(index(2),1).lt.py2min(1)) py2min(1)=py2(index(2),1) | 
| 369 | 
  | 
  | 
        if(py2(index(2),1).gt.py2max(1)) py2max(1)=py2(index(2),1) | 
| 370 | 
  | 
  | 
        pz2(index(3),1) = pfx(3) | 
| 371 | 
  | 
  | 
        if(pz2(index(3),1).lt.pz2min(1)) pz2min(1)=pz2(index(3),1) | 
| 372 | 
  | 
  | 
        if(pz2(index(3),1).gt.pz2max(1)) pz2max(1)=pz2(index(3),1) | 
| 373 | 
  | 
  | 
 | 
| 374 | 
  | 
  | 
        b2(index(1),index(2),index(3),1) = fx | 
| 375 | 
  | 
  | 
 | 
| 376 | 
  | 
  | 
 | 
| 377 | 
  | 
  | 
c     By component | 
| 378 | 
  | 
  | 
        px2(index(1),2) = pfy(1) | 
| 379 | 
  | 
  | 
        if(px2(index(1),2).lt.px2min(2)) px2min(2)=px2(index(1),2) | 
| 380 | 
  | 
  | 
        if(px2(index(1),2).gt.px2max(2)) px2max(2)=px2(index(1),2) | 
| 381 | 
  | 
  | 
        py2(index(2),2) = pfy(2) | 
| 382 | 
  | 
  | 
        if(py2(index(2),2).lt.py2min(2)) py2min(2)=py2(index(2),2) | 
| 383 | 
  | 
  | 
        if(py2(index(2),2).gt.py2max(2)) py2max(2)=py2(index(2),2) | 
| 384 | 
  | 
  | 
        pz2(index(3),2) = pfy(3) | 
| 385 | 
  | 
  | 
        if(pz2(index(3),2).lt.pz2min(2)) pz2min(2)=pz2(index(3),2) | 
| 386 | 
  | 
  | 
        if(pz2(index(3),2).gt.pz2max(2)) pz2max(2)=pz2(index(3),2) | 
| 387 | 
  | 
  | 
 | 
| 388 | 
  | 
  | 
        b2(index(1),index(2),index(3),2) = fy | 
| 389 | 
  | 
  | 
 | 
| 390 | 
  | 
  | 
 | 
| 391 | 
  | 
  | 
c     Bz component | 
| 392 | 
  | 
  | 
        px2(index(1),3) = pfz(1) | 
| 393 | 
  | 
  | 
        if(px2(index(1),3).lt.px2min(3)) px2min(3)=px2(index(1),3) | 
| 394 | 
  | 
  | 
        if(px2(index(1),3).gt.px2max(3)) px2max(3)=px2(index(1),3) | 
| 395 | 
  | 
  | 
        py2(index(2),3) = pfz(2) | 
| 396 | 
  | 
  | 
        if(py2(index(2),3).lt.py2min(3)) py2min(3)=py2(index(2),3) | 
| 397 | 
  | 
  | 
        if(py2(index(2),3).gt.py2max(3)) py2max(3)=py2(index(2),3) | 
| 398 | 
  | 
  | 
        pz2(index(3),3) = pfz(3) | 
| 399 | 
  | 
  | 
        if(pz2(index(3),3).lt.pz2min(3)) pz2min(3)=pz2(index(3),3) | 
| 400 | 
  | 
  | 
        if(pz2(index(3),3).gt.pz2max(3)) pz2max(3)=pz2(index(3),3) | 
| 401 | 
  | 
  | 
 | 
| 402 | 
  | 
  | 
        b2(index(1),index(2),index(3),3) = fz | 
| 403 | 
  | 
  | 
 | 
| 404 | 
  | 
  | 
      enddo | 
| 405 | 
  | 
  | 
 | 
| 406 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 407 | 
  | 
  | 
c      | 
| 408 | 
  | 
  | 
c     closes files | 
| 409 | 
  | 
  | 
c      | 
| 410 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 411 | 
  | 
  | 
       | 
| 412 | 
  | 
  | 
      call HREND('Bmap') | 
| 413 | 
  | 
  | 
      close(lun_Bmap_file) | 
| 414 | 
  | 
  | 
 | 
| 415 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 416 | 
  | 
  | 
c      | 
| 417 | 
  | 
  | 
c     no error exit | 
| 418 | 
  | 
  | 
c      | 
| 419 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 420 | 
  | 
  | 
 | 
| 421 | 
  | 
  | 
      goto 9000                 !happy ending | 
| 422 | 
  | 
  | 
 | 
| 423 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 424 | 
  | 
  | 
c      | 
| 425 | 
  | 
  | 
c     magnetic field map file opening error | 
| 426 | 
  | 
  | 
c      | 
| 427 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 428 | 
  | 
  | 
       | 
| 429 | 
  | 
  | 
 21   continue | 
| 430 | 
  | 
  | 
       | 
| 431 | 
pam-fi | 
1.6 | 
      c2f_error = 1 | 
| 432 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1) | 
| 433 | 
  | 
  | 
      if(DEBUG) | 
| 434 | 
mocchiut | 
1.1 | 
     $     print* | 
| 435 | 
  | 
  | 
     $     ,'read_B_inner: ERROR OPENING MAGNETIC FIELD MAP FILE: ' | 
| 436 | 
  | 
  | 
     $     ,Bmap_file | 
| 437 | 
  | 
  | 
       | 
| 438 | 
  | 
  | 
      goto 9000                 !the end | 
| 439 | 
  | 
  | 
 | 
| 440 | 
  | 
  | 
 | 
| 441 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 442 | 
  | 
  | 
c      | 
| 443 | 
  | 
  | 
c     ntuple event reading error | 
| 444 | 
  | 
  | 
c      | 
| 445 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 446 | 
  | 
  | 
       | 
| 447 | 
  | 
  | 
 22   continue | 
| 448 | 
  | 
  | 
       | 
| 449 | 
pam-fi | 
1.6 | 
      c2f_error = 1 | 
| 450 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1) | 
| 451 | 
  | 
  | 
      if(DEBUG) | 
| 452 | 
mocchiut | 
1.1 | 
     $     print*,'read_B_inner: ERROR WHILE READING NTUPLE, at entry | 
| 453 | 
  | 
  | 
     $     : ',iev | 
| 454 | 
  | 
  | 
       | 
| 455 | 
  | 
  | 
      goto 9000                 !the end | 
| 456 | 
  | 
  | 
 | 
| 457 | 
  | 
  | 
 | 
| 458 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 459 | 
  | 
  | 
c      | 
| 460 | 
  | 
  | 
c     exit | 
| 461 | 
  | 
  | 
c      | 
| 462 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 463 | 
  | 
  | 
 | 
| 464 | 
  | 
  | 
 9000 continue | 
| 465 | 
  | 
  | 
 | 
| 466 | 
  | 
  | 
      return | 
| 467 | 
  | 
  | 
      end | 
| 468 | 
  | 
  | 
************************************************************************* | 
| 469 | 
  | 
  | 
*      | 
| 470 | 
  | 
  | 
*     Subroutine readBouter | 
| 471 | 
  | 
  | 
*      | 
| 472 | 
  | 
  | 
*     it reads from rz files the two magnetic field maps taken inside the | 
| 473 | 
  | 
  | 
*     spectrometer cavity and fills the variables in common_B_inner.f | 
| 474 | 
  | 
  | 
*      | 
| 475 | 
  | 
  | 
*     needs: | 
| 476 | 
  | 
  | 
*     - common_B_outer.f common file for the outer magnetic field map | 
| 477 | 
  | 
  | 
*     - .rz map files in ./ containing coordinates of measured points, Bx, By | 
| 478 | 
  | 
  | 
*     and Bz components + errors | 
| 479 | 
  | 
  | 
*      | 
| 480 | 
  | 
  | 
*     output variables: (see common_B_outer.f) | 
| 481 | 
  | 
  | 
*     - pxo(nx,3)         | 
| 482 | 
  | 
  | 
*     - pyo(ny,3) | 
| 483 | 
  | 
  | 
*     - pzo(nz,3) | 
| 484 | 
  | 
  | 
*     - bo(nx,ny,nz,3) | 
| 485 | 
  | 
  | 
*      | 
| 486 | 
  | 
  | 
************************************************************************* | 
| 487 | 
  | 
  | 
 | 
| 488 | 
  | 
  | 
      subroutine readBouter(path) | 
| 489 | 
  | 
  | 
 | 
| 490 | 
  | 
  | 
c     implicit double precision (a-h,o-z) | 
| 491 | 
  | 
  | 
      include 'common_B.f' | 
| 492 | 
  | 
  | 
      include 'common_c2f.f' | 
| 493 | 
  | 
  | 
C | 
| 494 | 
pam-fi | 
1.2 | 
      LOGICAL DEBUG | 
| 495 | 
  | 
  | 
      LOGICAL VERBOSE | 
| 496 | 
  | 
  | 
      LOGICAL WARNING | 
| 497 | 
  | 
  | 
      COMMON/DBG/DEBUG,VERBOSE,WARNING | 
| 498 | 
  | 
  | 
      SAVE/DBG/ | 
| 499 | 
  | 
  | 
 | 
| 500 | 
pam-fi | 
1.5 | 
      character*256 path | 
| 501 | 
mocchiut | 
1.1 | 
 | 
| 502 | 
  | 
  | 
      REAL hmemor(10000000) | 
| 503 | 
  | 
  | 
      integer Iquest(100)     | 
| 504 | 
  | 
  | 
      COMMON /pawc/hmemor | 
| 505 | 
  | 
  | 
      save /pawc/ | 
| 506 | 
  | 
  | 
C | 
| 507 | 
  | 
  | 
      Common /QUEST/ Iquest | 
| 508 | 
  | 
  | 
      save /quest/ | 
| 509 | 
  | 
  | 
      | 
| 510 | 
  | 
  | 
 | 
| 511 | 
  | 
  | 
 | 
| 512 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 513 | 
  | 
  | 
c      | 
| 514 | 
  | 
  | 
c     local variables | 
| 515 | 
  | 
  | 
c      | 
| 516 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 517 | 
  | 
  | 
 | 
| 518 | 
  | 
  | 
      character*64 Bmap_file    !magnetic field file name | 
| 519 | 
  | 
  | 
      parameter (lun_Bmap_file=66) !magnetic field map file id number | 
| 520 | 
  | 
  | 
 | 
| 521 | 
  | 
  | 
      parameter (ntpl_Bmap=20)  !ntuple identifier | 
| 522 | 
  | 
  | 
 | 
| 523 | 
  | 
  | 
      REAL PFX(3),FX,DFX,       !Bx field component coordinates in m, value and error in T | 
| 524 | 
  | 
  | 
     $     PFY(3),FY,DFY | 
| 525 | 
  | 
  | 
     $     ,PFZ(3),FZ,DFZ | 
| 526 | 
  | 
  | 
      INTEGER INDEX(3)          !point index | 
| 527 | 
  | 
  | 
 | 
| 528 | 
  | 
  | 
      COMMON /PAWCR4/ INDEX,PFX,FX,DFX,PFY,FY,DFY,PFZ,FZ,DFZ | 
| 529 | 
  | 
  | 
 | 
| 530 | 
  | 
  | 
    | 
| 531 | 
  | 
  | 
c      print*,'Calling HLIMIT' | 
| 532 | 
  | 
  | 
      CALL HLIMIT(10000000) | 
| 533 | 
  | 
  | 
C     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 
| 534 | 
  | 
  | 
C     largest RZ file: IQUEST(10) records x LREC words x 4 byte | 
| 535 | 
  | 
  | 
C     with the following settings: 65000 x 4096 x 4 = 1G | 
| 536 | 
  | 
  | 
C     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  | 
| 537 | 
  | 
  | 
       | 
| 538 | 
  | 
  | 
c     permette di ottenere ntuple funzionanti nonostante | 
| 539 | 
  | 
  | 
c     il messaggio dei 64K di RZOUT | 
| 540 | 
  | 
  | 
      Iquest(10) = 512000 | 
| 541 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 542 | 
  | 
  | 
c      | 
| 543 | 
  | 
  | 
c     *** FIRST MAP *** | 
| 544 | 
  | 
  | 
c      | 
| 545 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 546 | 
  | 
  | 
 | 
| 547 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 548 | 
  | 
  | 
c      | 
| 549 | 
  | 
  | 
c     initialization and map file opening | 
| 550 | 
  | 
  | 
c      | 
| 551 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 552 | 
  | 
  | 
 | 
| 553 | 
  | 
  | 
c     print*,' ' | 
| 554 | 
  | 
  | 
c     print*,' ' | 
| 555 | 
  | 
  | 
 | 
| 556 | 
  | 
  | 
      Bmap_file='External_top_map_n4_150402.rz' | 
| 557 | 
  | 
  | 
       | 
| 558 | 
  | 
  | 
c     opens magnetic field map first file | 
| 559 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1)print * | 
| 560 | 
  | 
  | 
      if(VERBOSE)print * | 
| 561 | 
mocchiut | 
1.1 | 
     $     ,path(1:LNBLNK(path))//Bmap_file | 
| 562 | 
  | 
  | 
      call HROPEN | 
| 563 | 
  | 
  | 
     $     (lun_Bmap_file,'Bmap' | 
| 564 | 
  | 
  | 
     $     ,path(1:LNBLNK(path))//Bmap_file | 
| 565 | 
  | 
  | 
     $     ,'P',1024,istat)  | 
| 566 | 
  | 
  | 
      if(istat.ne.0) goto 21 | 
| 567 | 
  | 
  | 
 | 
| 568 | 
  | 
  | 
 | 
| 569 | 
  | 
  | 
      call HRIN(ntpl_Bmap,9999,0) !puts B map ntuple in memory | 
| 570 | 
  | 
  | 
 | 
| 571 | 
  | 
  | 
c     call HPRNTU(ntpl_Bmap) | 
| 572 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,' ',0,'$CLEAR') | 
| 573 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'INDEX',index,'$SET') | 
| 574 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BX',pfx,'$SET') | 
| 575 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BY',pfy,'$SET') | 
| 576 | 
  | 
  | 
      call HBNAME(ntpl_Bmap,'BZ',pfz,'$SET') | 
| 577 | 
  | 
  | 
 | 
| 578 | 
  | 
  | 
 | 
| 579 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 580 | 
  | 
  | 
c      | 
| 581 | 
  | 
  | 
c     reads events and fills variables | 
| 582 | 
  | 
  | 
c      | 
| 583 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 584 | 
  | 
  | 
 | 
| 585 | 
  | 
  | 
      call HNOENT(ntpl_Bmap,iemax) !number of events | 
| 586 | 
  | 
  | 
 | 
| 587 | 
  | 
  | 
c     initializes measurement grid edges | 
| 588 | 
  | 
  | 
      do ic=1,3 | 
| 589 | 
  | 
  | 
        poxmax(ic)=0. | 
| 590 | 
  | 
  | 
        poxmin(ic)=0. | 
| 591 | 
  | 
  | 
        poymax(ic)=0. | 
| 592 | 
  | 
  | 
        poymin(ic)=0. | 
| 593 | 
  | 
  | 
        pozmax(ic)=0. | 
| 594 | 
  | 
  | 
        pozmin(ic)=0. | 
| 595 | 
  | 
  | 
      enddo | 
| 596 | 
  | 
  | 
 | 
| 597 | 
  | 
  | 
 | 
| 598 | 
  | 
  | 
      do iev=1,iemax            !event loop | 
| 599 | 
  | 
  | 
 | 
| 600 | 
  | 
  | 
        call HGNT(ntpl_Bmap,iev,ierr) !reads event | 
| 601 | 
  | 
  | 
        if(ierr.ne.0) goto 22 | 
| 602 | 
  | 
  | 
 | 
| 603 | 
  | 
  | 
c     the output consists of matrices for coordinates, B components values  | 
| 604 | 
  | 
  | 
c     and errors: | 
| 605 | 
  | 
  | 
c     e.g. px1(4,2) = X coordinate of the point with index = 4 along X,  | 
| 606 | 
  | 
  | 
c     in which By (=2) component has been measured | 
| 607 | 
  | 
  | 
c     e.g. b1(3,23,4,1) = Bx (=1) component value, measured in the point with | 
| 608 | 
  | 
  | 
c     indexes = 3,23,4 along X, Y and Z | 
| 609 | 
  | 
  | 
 | 
| 610 | 
  | 
  | 
c     Bx component | 
| 611 | 
  | 
  | 
        pox(index(1),1) = pfx(1) | 
| 612 | 
  | 
  | 
        if(pox(index(1),1).lt.poxmin(1)) poxmin(1)=pox(index(1),1) | 
| 613 | 
  | 
  | 
        if(pox(index(1),1).gt.poxmax(1)) poxmax(1)=pox(index(1),1) | 
| 614 | 
  | 
  | 
        poy(index(2),1) = pfx(2) | 
| 615 | 
  | 
  | 
        if(poy(index(2),1).lt.poymin(1)) poymin(1)=poy(index(2),1) | 
| 616 | 
  | 
  | 
        if(poy(index(2),1).gt.poymax(1)) poymax(1)=poy(index(2),1) | 
| 617 | 
  | 
  | 
        poz(index(3),1) = pfx(3) | 
| 618 | 
  | 
  | 
        if(poz(index(3),1).lt.pozmin(1)) pozmin(1)=poz(index(3),1) | 
| 619 | 
  | 
  | 
        if(poz(index(3),1).gt.pozmax(1)) pozmax(1)=poz(index(3),1) | 
| 620 | 
  | 
  | 
 | 
| 621 | 
  | 
  | 
        bo(index(1),index(2),index(3),1) = fx | 
| 622 | 
  | 
  | 
 | 
| 623 | 
  | 
  | 
 | 
| 624 | 
  | 
  | 
c     By component | 
| 625 | 
  | 
  | 
        pox(index(1),2) = pfy(1) | 
| 626 | 
  | 
  | 
        if(pox(index(1),2).lt.poxmin(2)) poxmin(2)=pox(index(1),2) | 
| 627 | 
  | 
  | 
        if(pox(index(1),2).gt.poxmax(2)) poxmax(2)=pox(index(1),2) | 
| 628 | 
  | 
  | 
        poy(index(2),2) = pfy(2) | 
| 629 | 
  | 
  | 
        if(poy(index(2),2).lt.poymin(2)) poymin(2)=poy(index(2),2) | 
| 630 | 
  | 
  | 
        if(poy(index(2),2).gt.poymax(2)) poymax(2)=poy(index(2),2) | 
| 631 | 
  | 
  | 
        poz(index(3),2) = pfy(3) | 
| 632 | 
  | 
  | 
        if(poz(index(3),2).lt.pozmin(2)) pozmin(2)=poz(index(3),2) | 
| 633 | 
  | 
  | 
        if(poz(index(3),2).gt.pozmax(2)) pozmax(2)=poz(index(3),2) | 
| 634 | 
  | 
  | 
 | 
| 635 | 
  | 
  | 
        bo(index(1),index(2),index(3),2) = fy | 
| 636 | 
  | 
  | 
 | 
| 637 | 
  | 
  | 
 | 
| 638 | 
  | 
  | 
c     Bz component | 
| 639 | 
  | 
  | 
        pox(index(1),3) = pfz(1) | 
| 640 | 
  | 
  | 
        if(pox(index(1),3).lt.poxmin(3)) poxmin(3)=pox(index(1),3) | 
| 641 | 
  | 
  | 
        if(pox(index(1),3).gt.poxmax(3)) poxmax(3)=pox(index(1),3) | 
| 642 | 
  | 
  | 
        poy(index(2),3) = pfz(2) | 
| 643 | 
  | 
  | 
        if(poy(index(2),3).lt.poymin(3)) poymin(3)=poy(index(2),3) | 
| 644 | 
  | 
  | 
        if(poy(index(2),3).gt.poymax(3)) poymax(3)=poy(index(2),3) | 
| 645 | 
  | 
  | 
        poz(index(3),3) = pfz(3) | 
| 646 | 
  | 
  | 
        if(poz(index(3),3).lt.pozmin(3)) pozmin(3)=poz(index(3),3) | 
| 647 | 
  | 
  | 
        if(poz(index(3),3).gt.pozmax(3)) pozmax(3)=poz(index(3),3) | 
| 648 | 
  | 
  | 
 | 
| 649 | 
  | 
  | 
        bo(index(1),index(2),index(3),3) = fz | 
| 650 | 
  | 
  | 
 | 
| 651 | 
  | 
  | 
      enddo | 
| 652 | 
  | 
  | 
 | 
| 653 | 
  | 
  | 
 | 
| 654 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 655 | 
  | 
  | 
c      | 
| 656 | 
  | 
  | 
c     closes files | 
| 657 | 
  | 
  | 
c      | 
| 658 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 659 | 
  | 
  | 
 | 
| 660 | 
  | 
  | 
      call HREND('Bmap') | 
| 661 | 
  | 
  | 
      close(lun_Bmap_file) | 
| 662 | 
  | 
  | 
 | 
| 663 | 
  | 
  | 
 | 
| 664 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 665 | 
  | 
  | 
c      | 
| 666 | 
  | 
  | 
c     no error exit | 
| 667 | 
  | 
  | 
c      | 
| 668 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 669 | 
  | 
  | 
       | 
| 670 | 
  | 
  | 
      goto 9000                 !happy ending | 
| 671 | 
  | 
  | 
 | 
| 672 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 673 | 
  | 
  | 
c      | 
| 674 | 
  | 
  | 
c     magnetic field map file opening error | 
| 675 | 
  | 
  | 
c      | 
| 676 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 677 | 
  | 
  | 
       | 
| 678 | 
  | 
  | 
 21   continue | 
| 679 | 
  | 
  | 
       | 
| 680 | 
pam-fi | 
1.6 | 
      c2f_error = 1 | 
| 681 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1) | 
| 682 | 
  | 
  | 
      if(DEBUG) | 
| 683 | 
mocchiut | 
1.1 | 
     $     print* | 
| 684 | 
  | 
  | 
     $     ,'read_B_inner: ERROR OPENING MAGNETIC FIELD MAP FILE: ' | 
| 685 | 
  | 
  | 
     $     ,Bmap_file | 
| 686 | 
  | 
  | 
       | 
| 687 | 
  | 
  | 
      goto 9000                 !the end | 
| 688 | 
  | 
  | 
 | 
| 689 | 
  | 
  | 
 | 
| 690 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 691 | 
  | 
  | 
c      | 
| 692 | 
  | 
  | 
c     ntuple event reading error | 
| 693 | 
  | 
  | 
c      | 
| 694 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 695 | 
  | 
  | 
       | 
| 696 | 
  | 
  | 
 22   continue | 
| 697 | 
  | 
  | 
       | 
| 698 | 
pam-fi | 
1.6 | 
      c2f_error  = 1 | 
| 699 | 
pam-fi | 
1.2 | 
c      if(b_debug.eq.1) | 
| 700 | 
  | 
  | 
      if(DEBUG) | 
| 701 | 
mocchiut | 
1.1 | 
     $     print* | 
| 702 | 
  | 
  | 
     $     ,'read_B_inner: ERROR WHILE READING NTUPLE, at event | 
| 703 | 
  | 
  | 
     $     : ',iev | 
| 704 | 
  | 
  | 
       | 
| 705 | 
  | 
  | 
      goto 9000                 !the end | 
| 706 | 
  | 
  | 
 | 
| 707 | 
  | 
  | 
 | 
| 708 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 709 | 
  | 
  | 
c      | 
| 710 | 
  | 
  | 
c     exit | 
| 711 | 
  | 
  | 
c      | 
| 712 | 
  | 
  | 
c------------------------------------------------------------------------ | 
| 713 | 
  | 
  | 
 | 
| 714 | 
  | 
  | 
 9000 continue | 
| 715 | 
  | 
  | 
 | 
| 716 | 
  | 
  | 
      return | 
| 717 | 
  | 
  | 
      end | 
| 718 | 
  | 
  | 
 |