/[PAMELA software]/DarthVader/ToFLevel2/src/rdtofcal.for
ViewVC logotype

Diff of /DarthVader/ToFLevel2/src/rdtofcal.for

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by pam-de, Fri Oct 20 12:22:18 2006 UTC revision 1.6 by mocchiut, Tue Aug 4 14:56:57 2009 UTC
# Line 1  Line 1 
1  C------------------------------------------------  C------------------------------------------------
2        FUNCTION RDTOFCAL(calname)        REAL FUNCTION RDTOFCAL(calname,cnlen)
3  C------------------------------------------------  C------------------------------------------------
4    
5        include 'input_tof.txt'        include 'input_tof.txt'
6    
7  c----- HBOOK  c----- HBOOK
8        INTEGER HMEM        INTEGER HMEM
9    c      REAL RDTOFCAL
10        parameter (NWPAWC=8500000)        parameter (NWPAWC=8500000)
11        common/PAWC/HMEM(NWPAWC)        common/PAWC/HMEM(NWPAWC)
12    
# Line 15  c     local variables Line 16  c     local variables
16  c------------------------------------------------------------------------  c------------------------------------------------------------------------
17        character*250 calname        character*250 calname
18        character*250 calname1        character*250 calname1
19        character ch  c      character ch
20        character*2 ch2  c      character*2 ch2
21          integer cnlen
22  c------------------------------------------------------------------  c------------------------------------------------------------------
23    
24        COMMON/QUEST/IQUEST(100)        COMMON/QUEST/IQUEST(100)
# Line 35  c     HBOOK initialization Line 37  c     HBOOK initialization
37  c  c
38  c------------------------------------------------------------------------  c------------------------------------------------------------------------
39    
40          RDTOFCAL = 0.
41        call HLIMIT(NWPAWC)        call HLIMIT(NWPAWC)
42    
43  c------------------------------------------------------------------------  c------------------------------------------------------------------------
44  c---------------    open ToF calib rz file  c---------------    open ToF calib rz file
45  c------------------------------------------------------------------------  c------------------------------------------------------------------------
46    
47         do ii=1,250  c       do ii=1,250
48  c         ch=calname(ii:ii)  c         ch=calname(ii:ii)
          ch2=calname(ii:ii+1)  
 c         write(*,*) ii,ch  
49  c         if (ch.eq.'.') goto 100  c         if (ch.eq.'.') goto 100
50           if (ch2.eq.'rz') goto 100  c       enddo  
51         enddo    c100   continue
 100   continue  
52  c      calname1 = calname(1:ii)//'rz'  c      calname1 = calname(1:ii)//'rz'
        calname1 = calname(1:ii+1)  
53    
54  c      print*,'__________ opening TOF calib rz file __________'  c      do ii=1,250
55  c      print*,calname  cc         ch=calname(ii:ii)
56  c      print*,calname1  c         ch2=calname(ii:ii+1)
57    cc         write(*,*) ii,ch
58    cc         if (ch.eq.'.') goto 100
59    c         if (ch2.eq.'rz') goto 100
60    c       enddo
61    c100   continue
62    c      calname1 = calname(1:ii)//'rz'
63    c       calname1 = calname(1:ii+1)
64    
65          calname1 = calname(1:cnlen)
66    
67    
68    
69    
70         CALL HROPEN(59,'TOF K1A',calname1,'QP',4096,istat)         CALL HROPEN(59,'TOFK1131',calname1,'QP',4096,istat)
71    
72          if (istat.ne.0) then  ! check if HROPEN was OK          if (istat.ne.0) then  ! check if HROPEN was OK
73                write(*,*) 'Can''t open correct ToF calibration File !!!'                write(*,*) 'Can''t open correct ToF calibration File !!!'
74          stop          stop
75          endif          endif
76    
 c        print*,' reading TOF CALIB n-tuple...'  
   
77          call HRIN(ntp_tofcalib,9999,0)          call HRIN(ntp_tofcalib,9999,0)
78    
79          call HBNAME(ntp_tofcalib,' ',0,'$CLEAR')          call HBNAME(ntp_tofcalib,' ',0,'$CLEAR')
80    
81          call HBNAME(ntp_tofcalib,'TOFKA',k_s11s31,'$SET')          call HBNAME(ntp_tofcalib,'TOFK1131',k_s11s31,'$SET')
82          call HBNAME(ntp_tofcalib,'TOFKB',k_s12s32,'$SET')          call HBNAME(ntp_tofcalib,'TOFK1132',k_s11s32,'$SET')
83          call HBNAME(ntp_tofcalib,'TOFKC',k_s21s31,'$SET')          call HBNAME(ntp_tofcalib,'TOFK1231',k_s12s31,'$SET')
84          call HBNAME(ntp_tofcalib,'TOFKD',k_s22s32,'$SET')          call HBNAME(ntp_tofcalib,'TOFK1232',k_s12s32,'$SET')
85    
86            call HBNAME(ntp_tofcalib,'TOFK2131',k_s21s31,'$SET')
87            call HBNAME(ntp_tofcalib,'TOFK2132',k_s21s32,'$SET')
88            call HBNAME(ntp_tofcalib,'TOFK2231',k_s22s31,'$SET')
89            call HBNAME(ntp_tofcalib,'TOFK2232',k_s22s32,'$SET')
90    
91            call HBNAME(ntp_tofcalib,'TOFK1121',k_s11s21,'$SET')
92            call HBNAME(ntp_tofcalib,'TOFK1122',k_s11s22,'$SET')
93            call HBNAME(ntp_tofcalib,'TOFK1221',k_s12s21,'$SET')
94            call HBNAME(ntp_tofcalib,'TOFK1222',k_s12s22,'$SET')
95    
96    C--------------
97    
98          call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET')          call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET')
99          call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET')          call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET')
# Line 98  c        print*,' reading TOF CALIB n-tu Line 119  c        print*,' reading TOF CALIB n-tu
119  c        call HPRNTU(ntp_tofcalib)  c        call HPRNTU(ntp_tofcalib)
120    
121          call HNOENT(ntp_tofcalib,iemax_cal)          call HNOENT(ntp_tofcalib,iemax_cal)
 c        write(*,*) 'Number of Events CALIB ',iemax_cal  
122    
123          do iev=1,iemax_cal          do iev=1,iemax_cal
124             call HGNT(ntp_tofcalib,iev,ierr) !reads an event             call HGNT(ntp_tofcalib,iev,ierr) !reads an event
 c           write(34,*)iev,k1_s11s31,y_coor_lin11,tw11  
125          enddo          enddo
126    
127          call hrout(ntp_tofcalib,icycle,' ')          call hrout(ntp_tofcalib,icycle,' ')
128          call hrend('TOF K1A')          call hrend('TOFK1131')
129          close(0)          close(0)
130    
131           return          return
132          end          end
133    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23