/[PAMELA software]/calo/unpacking/readev1.c
ViewVC logotype

Annotation of /calo/unpacking/readev1.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Dec 5 16:23:22 2005 UTC (19 years ago) by mocchiut
Branch point for: MAIN, unpacking
File MIME type: text/plain
Initial revision

1 mocchiut 1.1 /***************************************************************
2     *
3     * routine read_ev: routine to extract an event information
4     * from file acquired with Pamela acquisition programs
5     *
6     * June 2002
7     *
8     ***************************************************************/
9     /*
10     * include needed system headers
11     */
12     #include <stdio.h> /* include standard i/o library */
13     #include <stdlib.h> /* include standard library */
14     #include <string.h> /* include string library */
15     #include <unistd.h> /* include unix standard library */
16     #include <sys/types.h> /* */
17     #include <sys/stat.h> /* */
18     #include <fcntl.h> /* */
19     #include <errno.h> /* error simbol definitions */
20     #include <time.h> /* system time definitions */
21     #include <math.h> /* math library */
22    
23     void readev_(long *data, int *error, int *fd)
24     {
25     long header;
26     const char *hdr = (char *)&header;
27    
28     *error = 0;
29    
30     /* search the header */
31    
32     *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1;
33     printf ("%d \n", header);
34     *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1;
35     /* header >>= 32;*/
36     /* len = 0; */
37     /*printf ("%d \n", header); */
38     while (!(*error) && (header != 0x00defefa)) {
39     printf ("%d \n", header);
40     *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1;
41     }
42     if (*error) return; /* file read error searching the header: exit */
43    
44     /* read the event number */
45     /* *error = read(*fd,evnum,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the event number: exit */
46    
47     /* read the system time */
48     /* *error = read(*fd,systime,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the system time: exit */
49    
50     /* read the event length */
51     /* *error = read(*fd,len,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the event length: exit */
52    
53     /* read the packet */
54     /* *error = read(*fd,data,sizeof(char)*(*len)) == sizeof(char)*(*len) ? 0 : -1;*/
55     /* if (*error) return; /* error reading the event length: exit */
56     /* swab(data,data,*len);*/
57     /* *error = 0;*/
58    
59     }
60    
61    
62    
63    
64    
65    
66    
67    
68    
69    

  ViewVC Help
Powered by ViewVC 1.1.23