| 9 | 
  | 
  | 
| 10 | 
       c2f_error = 0  | 
       c2f_error = 0  | 
| 11 | 
  | 
  | 
| 12 | 
       if(C2F_DEBUG.eq.1)print *                    | 
 c      if(C2F_DEBUG.eq.1)print *                    | 
| 13 | 
  | 
       if(verbose)print *                    | 
| 14 | 
      $     ,c2f_path(1:c2f_pathlen)//'trk-maskvk.dat'  | 
      $     ,c2f_path(1:c2f_pathlen)//'trk-maskvk.dat'  | 
| 15 | 
       open(10, | 
       open(10, | 
| 16 | 
      $     FILE=c2f_path(1:c2f_pathlen)//'trk-maskvk.dat' !<<<< C2F | 
      $     FILE=c2f_path(1:c2f_pathlen)//'trk-maskvk.dat' !<<<< C2F | 
| 18 | 
      $     ,IOSTAT=iostat | 
      $     ,IOSTAT=iostat | 
| 19 | 
      $     ) | 
      $     ) | 
| 20 | 
       if(iostat.ne.0)then | 
       if(iostat.ne.0)then | 
| 21 | 
          if(C2F_DEBUG.eq.1) | 
 c         if(C2F_DEBUG.eq.1) | 
| 22 | 
  | 
          if(debug) | 
| 23 | 
      $        print*,'READVKMASK: *** Error opening file ***' | 
      $        print*,'READVKMASK: *** Error opening file ***' | 
| 24 | 
          c2f_error = 1 | 
          c2f_error = 1 | 
| 25 | 
          return | 
          return | 
| 30 | 
      $        ) | 
      $        ) | 
| 31 | 
      $        (mask_vk(iv,i),i=1,24) | 
      $        (mask_vk(iv,i),i=1,24) | 
| 32 | 
          if(iostat.ne.0)then | 
          if(iostat.ne.0)then | 
| 33 | 
             if(C2F_DEBUG.eq.1) | 
 c            if(C2F_DEBUG.eq.1) | 
| 34 | 
  | 
             if(debug) | 
| 35 | 
      $           print*,'READVKMASK: *** Error reading file ***' | 
      $           print*,'READVKMASK: *** Error reading file ***' | 
| 36 | 
             c2f_error = 1 | 
             c2f_error = 1 | 
| 37 | 
             goto 1000 | 
             goto 1000 | 
| 56 | 
  201  format('trk-LADDER',i1,'-mip.dat') | 
  201  format('trk-LADDER',i1,'-mip.dat') | 
| 57 | 
       do ilad=1,nladders_view          | 
       do ilad=1,nladders_view          | 
| 58 | 
          write(fname_param,201)ilad | 
          write(fname_param,201)ilad | 
| 59 | 
          if(C2F_DEBUG.eq.1)print *               | 
 c         if(C2F_DEBUG.eq.1)print *               | 
| 60 | 
  | 
          if(VERBOSE)print *               | 
| 61 | 
      $        ,c2f_path(1:c2f_pathlen)!<<<< C2F | 
      $        ,c2f_path(1:c2f_pathlen)!<<<< C2F | 
| 62 | 
      $        //fname_param(1:LNBLNK(fname_param)) | 
      $        //fname_param(1:LNBLNK(fname_param)) | 
| 63 | 
          open(10, | 
          open(10, | 
| 67 | 
      $        ,IOSTAT=iostat | 
      $        ,IOSTAT=iostat | 
| 68 | 
      $        ) | 
      $        ) | 
| 69 | 
          if(iostat.ne.0)then | 
          if(iostat.ne.0)then | 
| 70 | 
             if(C2F_DEBUG.eq.1)print* | 
 c            if(C2F_DEBUG.eq.1)print* | 
| 71 | 
  | 
             if(DEBUG)print* | 
| 72 | 
      $           ,'READMIPPARAM: *** Error opening file *** ' | 
      $           ,'READMIPPARAM: *** Error opening file *** ' | 
| 73 | 
             c2f_error = 1 | 
             c2f_error = 1 | 
| 74 | 
             return | 
             return | 
| 100 | 
  201  format('charge-l',i1,'.dat') | 
  201  format('charge-l',i1,'.dat') | 
| 101 | 
       do ilad=1,nladders_view          | 
       do ilad=1,nladders_view          | 
| 102 | 
          write(fname_param,201)ilad | 
          write(fname_param,201)ilad | 
| 103 | 
          if(C2F_DEBUG.eq.1)print *  | 
 c         if(C2F_DEBUG.eq.1)print *  | 
| 104 | 
  | 
          if(VERBOSE)print *  | 
| 105 | 
      $        ,c2f_path(1:c2f_pathlen)!<<<< C2F | 
      $        ,c2f_path(1:c2f_pathlen)!<<<< C2F | 
| 106 | 
      $        //fname_param(1:LNBLNK(fname_param)) | 
      $        //fname_param(1:LNBLNK(fname_param)) | 
| 107 | 
          open(10, | 
          open(10, | 
| 149 | 
        | 
        | 
| 150 | 
       c2f_error = 0 | 
       c2f_error = 0 | 
| 151 | 
            | 
            | 
| 152 | 
 ******retrieve ANGULAR BINNING info | 
 *     ====================================================== | 
| 153 | 
  | 
 *     read ANGULAR BINNING info | 
| 154 | 
  | 
 *     ====================================================== | 
| 155 | 
       fname_binning='binning.dat' | 
       fname_binning='binning.dat' | 
| 156 | 
       if(C2F_DEBUG.eq.1) | 
 c      if(C2F_DEBUG.eq.1) | 
| 157 | 
  | 
       if(VERBOSE) | 
| 158 | 
      $     print *                    | 
      $     print *                    | 
| 159 | 
      $     ,c2f_path(1:c2f_pathlen)     !<<<< C2F | 
      $     ,c2f_path(1:c2f_pathlen)     !<<<< C2F | 
| 160 | 
      $     //fname_binning(1:LNBLNK(fname_binning)) | 
      $     //fname_binning(1:LNBLNK(fname_binning)) | 
| 165 | 
      $     ,IOSTAT=iostat | 
      $     ,IOSTAT=iostat | 
| 166 | 
      $     ) | 
      $     ) | 
| 167 | 
       if(iostat.ne.0)then | 
       if(iostat.ne.0)then | 
| 168 | 
          if(C2F_DEBUG.eq.1)  | 
 c         if(C2F_DEBUG.eq.1)  | 
| 169 | 
  | 
          if(DEBUG)  | 
| 170 | 
      $        print*,'READETAPARAM: *** Error in opening file *** ' | 
      $        print*,'READETAPARAM: *** Error in opening file *** ' | 
| 171 | 
          c2f_error = 1 | 
          c2f_error = 1 | 
| 172 | 
          return | 
          return | 
| 190 | 
        | 
        | 
| 191 | 
  | 
  | 
| 192 | 
  | 
  | 
| 193 | 
  | 
 *     ====================================================== | 
| 194 | 
  | 
 *     read eta2-eta3-eta4 parameters | 
| 195 | 
  | 
 *     ====================================================== | 
| 196 | 
       do ieta=2,4               !loop on eta 2,3,4         | 
       do ieta=2,4               !loop on eta 2,3,4         | 
 | 
 ******retrieve correction parameters | 
  | 
| 197 | 
  200     format(' Opening eta',i1,' files...') | 
  200     format(' Opening eta',i1,' files...') | 
| 198 | 
          if(C2F_DEBUG.eq.1)write(*,200)ieta | 
 c         if(C2F_DEBUG.eq.1)write(*,200)ieta | 
| 199 | 
  | 
          if(VERBOSE)write(*,200)ieta | 
| 200 | 
  | 
  | 
| 201 | 
  201     format('eta',i1,'-bin',i1,'-l',i1,'.dat') | 
  201     format('eta',i1,'-bin',i1,'-l',i1,'.dat') | 
| 202 | 
  202     format('eta',i1,'-bin',i2,'-l',i1,'.dat') | 
  202     format('eta',i1,'-bin',i2,'-l',i1,'.dat') | 
| 212 | 
      $              ,IOSTAT=iostat | 
      $              ,IOSTAT=iostat | 
| 213 | 
      $              ) | 
      $              ) | 
| 214 | 
                if(iostat.ne.0)then | 
                if(iostat.ne.0)then | 
| 215 | 
                   if(C2F_DEBUG.eq.1) | 
 c                  if(C2F_DEBUG.eq.1) | 
| 216 | 
  | 
                   if(DEBUG) | 
| 217 | 
      $                 print*,'READETAPARAM: ** Error opening file ** ' | 
      $                 print*,'READETAPARAM: ** Error opening file ** ' | 
| 218 | 
      $                 ,c2f_path(1:c2f_pathlen) | 
      $                 ,c2f_path(1:c2f_pathlen) | 
| 219 | 
      $                 //fname_param(1:LNBLNK(fname_param)) | 
      $                 //fname_param(1:LNBLNK(fname_param)) | 
| 220 | 
                   c2f_error = 1 | 
                   c2f_error = 1 | 
| 221 | 
                   return | 
 c                  return | 
| 222 | 
  | 
                   goto 2001 | 
| 223 | 
                endif | 
                endif | 
| 224 | 
                netaval=0 | 
                netaval=0 | 
| 225 | 
                do ival=1,netavalmax | 
                do ival=1,netavalmax | 
| 240 | 
      $                 (feta4(ival,iv,ilad,iang),iv=1,nviews) | 
      $                 (feta4(ival,iv,ilad,iang),iv=1,nviews) | 
| 241 | 
                   if(iostat.ne.0)then | 
                   if(iostat.ne.0)then | 
| 242 | 
                      if(netaval.eq.0)then | 
                      if(netaval.eq.0)then | 
| 243 | 
                         if(C2F_DEBUG.eq.1)print*,'READETAPARAM: ' | 
 c                        if(C2F_DEBUG.eq.1)print*,'READETAPARAM: ' | 
| 244 | 
  | 
                         if(DEBUG)print*,'READETAPARAM: ' | 
| 245 | 
      $                       //'*** Error reading file *** ' | 
      $                       //'*** Error reading file *** ' | 
| 246 | 
      $                       ,c2f_path(1:c2f_pathlen) | 
      $                       ,c2f_path(1:c2f_pathlen) | 
| 247 | 
      $                       //fname_param(1:LNBLNK(fname_param)) | 
      $                       //fname_param(1:LNBLNK(fname_param)) | 
| 253 | 
                   netaval=netaval+1 | 
                   netaval=netaval+1 | 
| 254 | 
                enddo | 
                enddo | 
| 255 | 
  2000          close(10) | 
  2000          close(10) | 
| 256 | 
  | 
  2001          continue | 
| 257 | 
 *               print*,'... done' | 
 *               print*,'... done' | 
| 258 | 
             enddo | 
             enddo | 
| 259 | 
          enddo | 
          enddo | 
| 260 | 
  | 
  | 
| 261 | 
       enddo                     !end loop on eta 2,3,4 | 
       enddo                     !end loop on eta 2,3,4 | 
| 262 | 
  | 
  | 
| 263 | 
  | 
 *     ====================================================== | 
| 264 | 
  | 
 *     read landi correction | 
| 265 | 
  | 
 *     ====================================================== | 
| 266 | 
  | 
       if(VERBOSE)print*,' Opening landi-correction files...' | 
| 267 | 
  | 
  | 
| 268 | 
  | 
  301  format('lcorr-l',i1,'.dat') | 
| 269 | 
  | 
       do ilad=1,nladders_view | 
| 270 | 
  | 
           | 
| 271 | 
  | 
          write(fname_param,301)ilad | 
| 272 | 
  | 
          open(10, | 
| 273 | 
  | 
      $        FILE=c2f_path(1:c2f_pathlen)  | 
| 274 | 
  | 
      $        //fname_param(1:LNBLNK(fname_param)) | 
| 275 | 
  | 
      $        ,STATUS='OLD' | 
| 276 | 
  | 
      $        ,IOSTAT=iostat | 
| 277 | 
  | 
      $        ) | 
| 278 | 
  | 
          if(iostat.ne.0)then | 
| 279 | 
  | 
             if(.true.) | 
| 280 | 
  | 
      $           print*,'READETAPARAM: ** Error opening file ** ' | 
| 281 | 
  | 
      $           ,c2f_path(1:c2f_pathlen) | 
| 282 | 
  | 
      $           //fname_param(1:LNBLNK(fname_param)) | 
| 283 | 
  | 
 c            c2f_error = 1 !tolto solo temporaneamente | 
| 284 | 
  | 
 c     return | 
| 285 | 
  | 
             goto 3001 | 
| 286 | 
  | 
          endif | 
| 287 | 
  | 
           | 
| 288 | 
  | 
          do iang=1,nangbin | 
| 289 | 
  | 
              | 
| 290 | 
  | 
             read(10,*,IOSTAT=iostat) | 
| 291 | 
  | 
      $           ii,aal,aar,(fcorr(iv,ilad,iang),iv=1,nviews) | 
| 292 | 
  | 
              | 
| 293 | 
  | 
             write(*,*) | 
| 294 | 
  | 
      $           ii,aal,aar,(fcorr(iv,ilad,iang),iv=1,nviews) | 
| 295 | 
  | 
  | 
| 296 | 
  | 
             if(ii.ne.iang)print*,'parametri eta incasinati' | 
| 297 | 
  | 
             if(aal.ne.angl(iang))print*,'parametri eta incasinati' | 
| 298 | 
  | 
             if(aar.ne.angr(iang))print*,'parametri eta incasinati' | 
| 299 | 
  | 
              | 
| 300 | 
  | 
             if(iostat.ne.0)then | 
| 301 | 
  | 
                if(.true.) | 
| 302 | 
  | 
      $              print*,'READETAPARAM: ' | 
| 303 | 
  | 
      $              //'*** Error reading file *** ' | 
| 304 | 
  | 
      $              ,c2f_path(1:c2f_pathlen) | 
| 305 | 
  | 
      $              //fname_param(1:LNBLNK(fname_param)) | 
| 306 | 
  | 
                c2f_error = 1  | 
| 307 | 
  | 
                goto 3000          | 
| 308 | 
  | 
             endif | 
| 309 | 
  | 
           | 
| 310 | 
  | 
          enddo                  !end loop on angular bins | 
| 311 | 
  | 
  3000    close(10) | 
| 312 | 
  | 
  3001    continue | 
| 313 | 
  | 
           | 
| 314 | 
  | 
       enddo                     ! end loop on ladders | 
| 315 | 
  | 
  | 
| 316 | 
       return | 
       return | 
| 317 | 
       end | 
       end | 
| 344 | 
          do is=1,2 | 
          do is=1,2 | 
| 345 | 
  | 
  | 
| 346 | 
             write(fname_param,100)ilad,is | 
             write(fname_param,100)ilad,is | 
| 347 | 
             if(C2F_DEBUG.eq.1)print * | 
 c            if(C2F_DEBUG.eq.1)print * | 
| 348 | 
  | 
             if(VERBOSE)print * | 
| 349 | 
      $           ,c2f_path(1:c2f_pathlen) | 
      $           ,c2f_path(1:c2f_pathlen) | 
| 350 | 
      $           //fname_param | 
      $           //fname_param | 
| 351 | 
  | 
  | 
| 421 | 
  | 
  | 
| 422 | 
           c2f_error = 0 | 
           c2f_error = 0 | 
| 423 | 
            | 
            | 
| 424 | 
       if(C2F_DEBUG.eq.1)print * | 
 c      if(C2F_DEBUG.eq.1)print * | 
| 425 | 
  | 
       if(VERBOSE)print * | 
| 426 | 
      $     ,c2f_path(1:c2f_pathlen)//'mech_pos.dat' | 
      $     ,c2f_path(1:c2f_pathlen)//'mech_pos.dat' | 
| 427 | 
       open(10 | 
       open(10 | 
| 428 | 
      $     ,FILE= | 
      $     ,FILE= |