/[PAMELA software]/tracker/ground/source/common/functions.f
ViewVC logotype

Diff of /tracker/ground/source/common/functions.f

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

revision 1.1.1.1 by pam-fi, Wed Mar 8 15:00:39 2006 UTC revision 1.2 by pam-fi, Mon Mar 20 19:43:33 2006 UTC
# Line 207  c$$$      return Line 207  c$$$      return
207  c$$$      end  c$$$      end
208    
209    
210  c------------------------------------------------------------------------  c$$$c------------------------------------------------------------------------
211    c$$$
212  c     NB: le coordinate in mech_pos.dat sono calcolate a partire da alcuni dati  c$$$c     NB: le coordinate in mech_pos.dat sono calcolate a partire da alcuni dati
213  c     contenuti in commontracker.f. forse si puo' evitare mech_pos.dat e mettere  c$$$c     contenuti in commontracker.f. forse si puo' evitare mech_pos.dat e mettere
214  c     tutto in commontracker.f  c$$$c     tutto in commontracker.f
215    c$$$
216    c$$$
217        subroutine mech_sensor      c$$$      subroutine mech_sensor    
218  c     !it reads sensors coordinates (in PAMELA reference  c$$$c     !it reads sensors coordinates (in PAMELA reference
219  c     ! frame) from a text file and it uses them to fill  c$$$c     ! frame) from a text file and it uses them to fill
220  c     ! x/y/z_mech_sensor variables, taking into account  c$$$c     ! x/y/z_mech_sensor variables, taking into account
221  c     ! last plane inversion  c$$$c     ! last plane inversion
222    c$$$
223        include './commontracker.f'  c$$$      include './commontracker.f'
224        include './common_tracks.f'  c$$$      include './common_tracks.f'
225    c$$$
226        real xvec(nladders_view),yvec(2),zvec(nplanes)  c$$$      real xvec(nladders_view),yvec(2),zvec(nplanes)
227    c$$$
228        integer id                !file identifier  c$$$      integer id                !file identifier
229        logical od                !.true. if the specified unit is connected to a file  c$$$      logical od                !.true. if the specified unit is connected to a file
230    c$$$
231        do id=20,100,1            !opens the file using a free file id  c$$$      do id=20,100,1            !opens the file using a free file id
232          inquire (id, opened=od)  c$$$        inquire (id, opened=od)
233          if(.not.od) goto 666  c$$$        if(.not.od) goto 666
234        enddo        c$$$      enddo      
235   666  continue  c$$$ 666  continue
236    c$$$
237  c      open(id,FILE='../common/mech_pos.dat') !sensors centres coordinates in mm in  c$$$c      open(id,FILE='../common/mech_pos.dat') !sensors centres coordinates in mm in
238  c      open(id,FILE='source/common/mech_pos.dat')  c$$$c      open(id,FILE='source/common/mech_pos.dat')
239  c      call system('cp $TRK_GRND/source/common/mech_pos.dat .')  c$$$c      call system('cp $TRK_GRND/source/common/mech_pos.dat .')
240        print *,'Opening file: mech_pos.dat'  c$$$      print *,'Opening file: mech_pos.dat'
241        open(id,FILE='./bin-aux/mech_pos.dat',IOSTAT=iostat)  c$$$      open(id,FILE='./bin-aux/mech_pos.dat',IOSTAT=iostat)
242  c     !sensors centres coordinates in mm in  c$$$c     !sensors centres coordinates in mm in
243  c     ! PAMELA reference frame:  c$$$c     ! PAMELA reference frame:
244  c     ! the first plane is the one with lowest Z (the one  c$$$c     ! the first plane is the one with lowest Z (the one
245  c     ! nearest the calorimeter)  c$$$c     ! nearest the calorimeter)
246  c     ! the first ladder is the one with lowest X (the  c$$$c     ! the first ladder is the one with lowest X (the
247  c     ! one on which the first X strip is)  c$$$c     ! one on which the first X strip is)
248  c     ! the first sensor is the one with lowest Y (the  c$$$c     ! the first sensor is the one with lowest Y (the
249  c     ! one on which the first Y strip is) for planes  c$$$c     ! one on which the first Y strip is) for planes
250  c     ! 2..6. for plane 1 the first sensor has higher Y  c$$$c     ! 2..6. for plane 1 the first sensor has higher Y
251          c$$$      
252        if(iostat.ne.0)then  c$$$      if(iostat.ne.0)then
253           print*,'MECH_SENSOR: *** Error in opening file ***'  c$$$         print*,'MECH_SENSOR: *** Error in opening file ***'
254           return  c$$$         return
255        endif  c$$$      endif
256    c$$$
257        read(id,*) xvec  c$$$      read(id,*) xvec
258        read(id,*) yvec  c$$$      read(id,*) yvec
259        read(id,*) zvec  c$$$      read(id,*) zvec
260    c$$$
261        do i=1,nplanes  c$$$      do i=1,nplanes
262          do j=1,nladders_view  c$$$        do j=1,nladders_view
           do k=1,2  
             x_mech_sensor(i,j,k)=xvec(j)  
             y_mech_sensor(i,j,k)=yvec(k)  
             z_mech_sensor(i,j,k)=zvec(i)  
             if(i.eq.1) then     !y coordinates of first plane (11th view) are  
               y_mech_sensor(i,j,k)=-yvec(k) ! exchanged due to last plane inversion  
             endif                
           enddo  
         enddo  
       enddo  
   
       close(id)  
 c      call system('rm -f mech_pos.dat')  
   
 c$$$                                ! *** INIZIO DEBUG ***  
 c$$$      do i=1,6  
 c$$$c        do j=1,3  
263  c$$$          do k=1,2  c$$$          do k=1,2
264  c$$$            j=1  c$$$            x_mech_sensor(i,j,k)=xvec(j)
265  c$$$c            print*,x_mech_sensor(1,j,k)  c$$$            y_mech_sensor(i,j,k)=yvec(k)
266  c$$$            print*,y_mech_sensor(i,j,k)  c$$$            z_mech_sensor(i,j,k)=zvec(i)
267  c$$$c            print*,z_mech_sensor(i,j,k)  c$$$            if(i.eq.1) then     !y coordinates of first plane (11th view) are
268    c$$$              y_mech_sensor(i,j,k)=-yvec(k) ! exchanged due to last plane inversion
269    c$$$            endif              
270  c$$$          enddo  c$$$          enddo
271  c$$$c        enddo  c$$$        enddo
 c$$$        print*,' '  
272  c$$$      enddo  c$$$      enddo
273  c$$$                                ! *** FINE DEBUG ***  c$$$
274    c$$$      close(id)
275          c$$$c      call system('rm -f mech_pos.dat')
276        return  c$$$
277        end  c$$$c$$$                                ! *** INIZIO DEBUG ***
278    c$$$c$$$      do i=1,6
279    c$$$c$$$c        do j=1,3
280    c$$$c$$$          do k=1,2
281    c$$$c$$$            j=1
282    c$$$c$$$c            print*,x_mech_sensor(1,j,k)
283    c$$$c$$$            print*,y_mech_sensor(i,j,k)
284    c$$$c$$$c            print*,z_mech_sensor(i,j,k)
285    c$$$c$$$          enddo
286    c$$$c$$$c        enddo
287    c$$$c$$$        print*,' '
288    c$$$c$$$      enddo
289    c$$$c$$$                                ! *** FINE DEBUG ***
290    c$$$
291    c$$$      
292    c$$$      return
293    c$$$      end
294    c$$$
295    
296  c------------------------------------------------------------------------  c------------------------------------------------------------------------
297    

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

  ViewVC Help
Powered by ViewVC 1.1.23