/[PAMELA software]/yoda/techmodel/forroutines/tracker/readraw/trkunpack.f
ViewVC logotype

Diff of /yoda/techmodel/forroutines/tracker/readraw/trkunpack.f

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

revision 6.0 by kusanagi, Tue Feb 7 17:11:11 2006 UTC revision 6.3 by kusanagi, Mon Jun 26 14:41:24 2006 UTC
# Line 3  Line 3 
3  *     10/9/2005 modified by david fedele to read buffer-data  *     10/9/2005 modified by david fedele to read buffer-data
4  *     instead raw-data-file  *     instead raw-data-file
5  *     29/11/2005 modified by david fedele to include crc control  *     29/11/2005 modified by david fedele to include crc control
6    *     24/06/2006 modified by elena vannuccini
7  *************************************************************************  *************************************************************************
8    
9        subroutine trkeventpkt(YODAflag,buffer,length_buffer,curpos        subroutine trkeventpkt(YODAflag,buffer,length_buffer,curpos)
      $     )  
10    
11        include '../common/commontracker.f'        include '../common/commontracker.f'
12        include '../common/common_readraw.f'        include '../common/common_readraw.f'
13        include '../common/level0.f'        include '../common/level0.f'
14    
15          logical ALARMS
16          integer runerror          !readevent error flag
17          integer*1 crctemp
18    
19    *     -------------------
20    *     initializations
21  *     ---------------------------------------------------  *     ---------------------------------------------------
22  *     the general flag YODAflag contains information  *     the general flag YODAflag contains information
23  *     about the integrity of the DSP packets.  *     about the integrity of the DSP packets.
# Line 19  Line 25 
25  *     If some packets are missing or the crc check fails,  *     If some packets are missing or the crc check fails,
26  *     YODAflag is asserted  *     YODAflag is asserted
27  *     ---------------------------------------------------  *     ---------------------------------------------------
   
       integer YODAflag  
   
         
       logical ALARMS  
   
         
       integer runerror          !readevent error flag  
   
       parameter (MAXBUFFLEN=z'172c8')  
       integer*4 length_buffer  
       integer*1 buffer(MAXBUFFLEN)  
       integer curpos            !current position in buffer  
       integer startcrc  
       integer stopcrc  
       integer*1 crctemp  
   
 *     -------------------  
 *     initializations  
28        YODAflag=1                !bad by default        YODAflag=1                !bad by default
29        call initlevel0        call initlevel0
30        ALARMS=.false.        ALARMS=.false.
# Line 47  Line 34 
34        crctemp=0                      crctemp=0              
35  *     -------------------  *     -------------------
36    
37    *     ===================================
38          if(length_buffer.gt.MAXBUFFLEN)then
39             print*,'trkeventpkt: buffer() size must be at least '
40         $        ,length_buffer,' !!!!'
41             goto 2222
42          endif
43    *     ===================================
44          
45          
46        do iview=1,nviews         !loop on DSPs        do iview=1,nviews         !loop on DSPs
47           call searchtrkheader(runerror,buffer,length_buffer,curpos,           call searchtrkheader(runerror,buffer,length_buffer,curpos,
48       $        startcrc)       $        startcrc)
# Line 119  Line 115 
115        include '../common/commontracker.f'        include '../common/commontracker.f'
116        include '../common/common_readraw.f'        include '../common/common_readraw.f'
117        include '../common/trk_calib_parameters.f'        include '../common/trk_calib_parameters.f'
118        
119          logical ALARMs
120          integer runerror          !readevent error flag
121          integer*1 crctemp
122    
123    *     -------------------
124    *     initializations
125  *     ---------------------------------------------------  *     ---------------------------------------------------
126  *     the general flag YODAflag contains information  *     the general flag YODAflag contains information
127  *     about the integrity of the DSP packets.  *     about the integrity of the DSP packets.
# Line 127  Line 129 
129  *     If some packets are missing or the crc check fails,  *     If some packets are missing or the crc check fails,
130  *     YODAflag is asserted  *     YODAflag is asserted
131  *     ---------------------------------------------------  *     ---------------------------------------------------
       
       integer YODAflag  
   
       logical ALARMs  
   
       integer runerror          !readevent error flag  
       parameter (MAXBUFFLEN=z'172c8')  
       integer*4 length_buffer  
       integer*1 buffer(MAXBUFFLEN)  
       integer curpos            !current position in buffer  
       integer startcrc  
       integer stopcrc  
       integer*1 crctemp  
   
 *     -------------------  
 *     initializations  
132        YODAflag = 1              !bad by default        YODAflag = 1              !bad by default
133        call initcalib        call initcalib
134        ALARMS=.false.        ALARMS=.false.
# Line 225  C....................................... Line 211  C.......................................
211        include '../common/commontracker.f'        include '../common/commontracker.f'
212        include '../common/common_readraw.f'        include '../common/common_readraw.f'
213    
       parameter (MAXBUFFLEN=z'172c8')  
       integer*4 length_buffer  
       integer*1 buffer(MAXBUFFLEN)  
       integer curpos            !current position in buffer  
       integer startcrc  
   
214        integer runerror          !readevent error flag        integer runerror          !readevent error flag
215    
216  c--------------------------------------------------  c--------------------------------------------------
# Line 324  c--------------------------------------- Line 304  c---------------------------------------
304        include '../common/commontracker.f'        include '../common/commontracker.f'
305        include '../common/common_readraw.f'        include '../common/common_readraw.f'
306    
       parameter (MAXBUFFLEN=z'172c8')  
       integer*4 length_buffer  
       integer*1 buffer(MAXBUFFLEN)  
       integer curpos            !current position in buffer  
       integer startcrc  
       integer stopcrc  
307        integer*1 crctemp        integer*1 crctemp
308        integer*1 crc_trail        integer*1 crc_trail
309    
# Line 452  ',crcte Line 426  ',crcte
426        include '../common/common_readraw.f'        include '../common/common_readraw.f'
427        include '../common/level0.f'        include '../common/level0.f'
428    
       parameter (MAXBUFFLEN=z'172c8')  
       integer*4 length_buffer  
       integer*1 buffer(MAXBUFFLEN)  
       integer curpos            !current position in buffer  
       integer startcrc  
       integer stopcrc  
429        integer*1 crctemp        integer*1 crctemp
430        integer*1 crcdat        integer*1 crcdat
431    
432        integer runerror          !readevent error flag        integer runerror          !readevent error flag
433        integer l_tra  c      integer l_tra
434    
435        integer bid1_dat,bid2_dat,bid3_dat,bid4_dat,bid5_dat,bid6_dat        integer bid1_dat,bid2_dat,bid3_dat,bid4_dat,bid5_dat,bid6_dat
436       $     ,bid7_dat,bid_dat_sum       $     ,bid7_dat,bid_dat_sum
# Line 500  C     ---------------------------------- Line 468  C     ----------------------------------
468        signcluster_dat(3) = iand(header(12),z'03ff')        signcluster_dat(3) = iand(header(12),z'03ff')
469        fc_dat = ishft(iand(header(13),z'0300'),-8)        fc_dat = ishft(iand(header(13),z'0300'),-8)
470        compressiontime_dat = iand(header(13),z'00ff')        compressiontime_dat = iand(header(13),z'00ff')
471        fl5_dat = ishft(iand(header(14),z'0300'),-8)  c      fl5_dat = ishft(iand(header(14),z'0300'),-8)
472        fl4_dat = ishft(iand(header(14),z'0300'),-6)  c      fl4_dat = ishft(iand(header(14),z'0300'),-6)
473        fl3_dat = ishft(iand(header(14),z'0300'),-4)  c      fl3_dat = ishft(iand(header(14),z'0300'),-4)
474        fl2_dat = ishft(iand(header(14),z'0300'),-2)  c      fl2_dat = ishft(iand(header(14),z'0300'),-2)
475        fl1_dat = iand(header(14),z'0300')  c      fl1_dat = iand(header(14),z'0300')
476        fl6_dat = ishft(iand(header(15),z'0300'),-8)  c      fl6_dat = ishft(iand(header(15),z'0300'),-8)
477          fl5_dat = iand(ishft(header(14),-8),z'0003')
478          fl4_dat = iand(ishft(header(14),-6),z'0003')
479          fl3_dat = iand(ishft(header(14),-4),z'0003')
480          fl2_dat = iand(ishft(header(14),-2),z'0003')
481          fl1_dat = iand(header(14),z'0003')
482          fl6_dat = iand(ishft(header(15),-8),z'0003')
483        checksum_dat = iand(header(15),z'00ff')        checksum_dat = iand(header(15),z'00ff')
484    
485  c-----------------------------------------------------------  c-----------------------------------------------------------
# Line 518  C--------------------------------------- Line 492  C---------------------------------------
492        if(l_tra.eq.0)then        if(l_tra.eq.0)then
493           goto 18                !empty buffer           goto 18                !empty buffer
494        endif        endif
495              
496          if(l_tra.gt.MAXBTRALEN .or.(curpos+l_tra-1).ge.MAXBUFFLEN )then
497             print*,'unpackdata: '
498         $        ,'tracker buffer length l_tra ',l_tra
499         $        ,' exceeds tracker buffer dimensions '
500             print*,'(packet corrupted)'
501             runerror=1
502             goto 50
503          endif
504        call dunpacker(l_tra,b_tra,runerror,buffer,length_buffer,curpos)        call dunpacker(l_tra,b_tra,runerror,buffer,length_buffer,curpos)
505        if(runerror.eq.1.or.runerror.eq.-1) then                          if(runerror.eq.1.or.runerror.eq.-1) then
506           goto 50                !go to end           goto 50                !go to end
507        endif        endif
508    

Legend:
Removed from v.6.0  
changed lines
  Added in v.6.3

  ViewVC Help
Powered by ViewVC 1.1.23