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

Annotation of /calo/unpacking/readev2.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Mon Dec 5 16:23:22 2005 UTC (18 years, 11 months ago) by mocchiut
Branch: MAIN, unpacking
CVS Tags: start, v1r00, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Imported sources

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 *len, unsigned short *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    
35     *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1;
36     printf ("%d \n", header);
37    
38     *error = read(*fd,&header,sizeof(long)) == sizeof(long) ? 0 : -1;
39     printf ("%d \n", header);
40    
41     /* while (!(*error) && (header != 0xfafede00)) {
42     /* header >>= 8;
43     /* len = len + 1;
44     /* *error = read(*fd,hdr+3,sizeof(char)) == sizeof(char) ? 0 : -1;
45     /* }
46     /* if (*error) return; /* file read error searching the header: exit */
47    
48     /* read the event number */
49     /* *error = read(*fd,evnum,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the event number: exit */
50    
51     /* read the system time */
52     /* *error = read(*fd,systime,sizeof(long)) == sizeof(long) ? 0 : -1; if (*error) return; /* error reading the system time: exit */
53     /* read the event length */
54     header >>= 8;
55     *error = read(*fd,len,sizeof(long)) == sizeof(long) ? 0 : -1;
56     if (*error) return; /* error reading the event length: exit */
57    
58    
59     /* read the packet */
60     /* *error = read(*fd,data,sizeof(char)*(*len)) == sizeof(char)*(*len) ? 0 : -1;
61     /* if (*error) return; /* error reading the event length: exit */
62     /* swab(data,data,*len);
63     /* *error = 0;
64     }
65    
66    
67    
68    
69    
70    
71    
72    
73    
74    

  ViewVC Help
Powered by ViewVC 1.1.23