]>
Commit | Line | Data |
---|---|---|
f67e2651 | 1 | |
2 | /* implement functions special for the f2k 1.2 format */ | |
3 | #include <stdlib.h> | |
4 | ||
5 | #include "rdmc.h" | |
6 | #include "amanda.h" | |
7 | #include "f2k.h" | |
8 | ||
9 | const f2000_line_t WF_line_2004x1 = | |
10 | {"WF ", WF_LINE, COMP_STRINGWISE, rdmc_amanda_WF_2004x1 }; | |
11 | ||
12 | ||
13 | ||
14 | const f2000_event_t f2000_mevt_2004x1 = | |
15 | { RDMC_EVENT_MUON, | |
16 | { &(EM_line_1x1), | |
17 | NULL | |
18 | }, | |
19 | { | |
20 | &(TR_line_1x1), | |
21 | &(HT_line_1x2), &(CH_line_1x1), | |
22 | &(WF_line_2004x1), | |
23 | &(STATUS_line_1x1), &(US_line_1x1), | |
24 | &(FIT_block_1x1), &(FRESULT_line_1x1), | |
25 | &(TRIG_block_1x1), &(USES_line_1x1), | |
26 | &(COMMENT_line_1x1) | |
27 | , NULL | |
28 | }, | |
29 | { &(EE_line_1x1) | |
30 | , NULL}, | |
31 | rdmc_mevt_f2k_1x1, | |
32 | rdmc_wevt_f2k_1x1_2 | |
33 | }; | |
34 | ||
35 | ||
36 | const f2000_event_t * f2000_events_2004x1[] | |
37 | = { | |
38 | &f2000_mevt_2004x1, | |
39 | NULL | |
40 | }; | |
41 | ||
42 | ||
43 | int rdmc_amanda_WF_2004x1( mcfile *fp , array *a, mevt *e, void *tmp) | |
44 | { | |
45 | rdmc_f2k_buffer_t *f2k_buff = fp->info.f2000.f2k_buffer; | |
46 | char *s=f2k_buff->line_pt[f2k_buff->iline]; | |
47 | char **args=NULL; | |
48 | int nargs=0; | |
49 | int i; | |
50 | waveform wf; | |
51 | float channel; | |
52 | ||
53 | ||
54 | /* start parsing*/ | |
55 | args = rdmc_f2k_tokenize(s,&nargs); //check the parsing string | |
56 | ||
57 | if ( nargs < 8) return RDMC_ILF; // check # | |
58 | ||
59 | rdmc_init_WF(&wf); | |
60 | channel = rdmc_amanda_strtof(args[1], RDMC_NA); // fill waveform struct | |
61 | wf.om = rdmc_nint(channel); | |
62 | wf.ch = (channel - wf.om) * 100.; | |
63 | wf.id = rdmc_amanda_strtoi(args[2] ,RDMC_NA); | |
64 | wf.pa = rdmc_amanda_strtoi(args[3] ,RDMC_PARENT_NA); | |
65 | wf.ndigi = atoi(args[4]); | |
66 | wf.t_start = rdmc_amanda_strtof(args[5], RDMC_NA); | |
67 | ||
68 | wf.t_bin = rdmc_amanda_strtof(args[6], RDMC_NA); | |
69 | wf.baseline = rdmc_amanda_strtof(args[7], RDMC_WF_BASELINE_NA); | |
70 | ||
71 | if ( nargs < 8 + wf.ndigi) return RDMC_ILF; // check # | |
72 | ||
73 | if( wf.ndigi <= 0 || wf.ndigi > RDMC_MAXDIGI ) | |
74 | return RDMC_ILF; | |
75 | ||
76 | wf.digi = malloc(wf.ndigi*sizeof(float)); // fill digit. of waveform | |
77 | for (i = 0; i < wf.ndigi; i++) | |
78 | wf.digi[i] = rdmc_amanda_strtof(args[8+i], RDMC_TDC_NA); | |
79 | ||
80 | ||
81 | rdmc_add_WF(e,&wf,e->nwf); // add waveform to event | |
82 | rdmc_clear_WF(&wf); | |
83 | ||
84 | return RDMC_IO_OK; | |
85 | } /* rdmc_amanda_WF() */ | |
86 | ||
87 | // pd - end | |
88 | ||
89 | ||
90 | /**************************************************************************** | |
91 | ********************************** E O F *********************************** | |
92 | ****************************************************************************/ | |
93 | ||
94 | ||
95 |