8 #include "daqFormats.h"
9 #include "rtsSystems.h"
11 #include "evpSupport.h"
13 #define SWAP32(bk,x) ((bk->bh.byte_order==0x4030201)?(bk->x):swap32(bk->x))
15 using namespace OLDEVP;
21 int OLDEVP::scReader(
char *m)
30 if(m == NULL)
return EVP_DATA_ERR ;
32 datap = (
struct DATAP *)m ;
35 len = SWAP32(datap,det[EXT_ID].len) ;
36 if(len == 0)
return EVP_NO_DET;
37 assert(len>0&&len<99999);
39 off = SWAP32(datap,det[EXT_ID].off);
40 if(off == 0)
return EVP_NO_DET;
42 datapx = (
struct DATAPX *)((u_int *)m+off);
45 assert(checkBank(datapx->bh.bank_type,CHAR_DATAPX) == 0);
47 len = SWAP32(datapx,det[SC_ID-10].len);
48 if(len == 0)
return EVP_NO_DET ;
50 off = SWAP32(datapx,det[SC_ID-10].off);
51 if(off == 0)
return EVP_NO_DET;
55 scd = (
struct SCD *)(((u_int *)datapx)+off) ;
56 if(checkBank((
char *)scd,
"SCD") < 0) assert(0);
58 if(scd->bh.token == 0) {
62 int sz = SWAP32(scd,bh.length);
65 ((u_int)len >
sizeof(
SCD))) {
74 sc.time = SWAP32(scd,time);
75 int mag = SWAP32(scd,mag_field);
76 sc.mag_field= *((
float*)&mag);
77 for(
int i=0;i<16;i++) {
78 sc.rich_scalers[i] = SWAP32(scd,rich_scalers[i]);
81 sc.timelag = SWAP32(datap,time) - sc.time;
83 int alag = sc.timelag > 0 ? sc.timelag : -sc.timelag;
85 if(alag > 5) sc.valid = 0;