12 #ifndef EztEmcRawData_hh
13 #define EztEmcRawData_hh
20 enum { MAXEMCDATABANK=60};
21 enum { WRDCNT=0,ERRFLG=1,TOKEN=2,CRATE=3};
22 enum { bitCrateID=1<<0, bitToken=1<<1, bitLenCount=1<<2, bitTrigComm=1<<3,
23 bitErrFlag=1<<4, bitN256=1<<5, bitGhost=1<<6, bitCrateOff=1<<7,
30 const UShort_t* header(
int)
const;
31 const UShort_t*
data(
int)
const;
33 const int sizeHeader(
int)
const;
34 const int sizeData(
int)
const;
36 const int getNBlocks()
const {
return MAXEMCDATABANK;}
37 void createBank(
int,
int,
int);
39 void setHeader(
int,
unsigned short*);
40 void setData(
int,
unsigned short*);
42 const UShort_t getCorruption(
int ib)
const {
return mCorrupt[ib];}
43 void setCorruption(
int ib, UShort_t x) {mCorrupt[ib]=x;}
44 bool isCrateVoid(
int ib)
const {
return sizeData(ib)<=0; }
46 static UShort_t getErrFlag(
const UShort_t* hd) {
47 return hd[ERRFLG] & 0x0FFF; }
48 static UShort_t getLenCount(
const UShort_t* hd) {
49 return hd[WRDCNT] & 0x0FFF; }
50 static UShort_t getToken(
const UShort_t* hd) {
51 return hd[TOKEN] & 0x0FFF; }
52 static UShort_t getTrigComm(
const UShort_t* hd) {
53 return (hd[CRATE] / 0x0100) &0x000F ; }
54 static UShort_t getCrateID(
const UShort_t* hd) {
55 return hd[CRATE] & 0x00FF ; }
57 UShort_t getErrFlag(
int ib)
const {
return getErrFlag(header(ib)); }
58 UShort_t getLenCount(
int ib)
const {
return getLenCount(header(ib)); }
59 UShort_t getToken(
int ib)
const {
return getToken(header(ib)); }
60 UShort_t getTrigComm(
int ib)
const {
return getTrigComm(header(ib)); }
61 UShort_t getCrateID(
int ib)
const {
return getCrateID(header(ib)); }
65 bool doHeadCorruptionTest(
int token,
int lenCount,
int firstCrId,
int errFlag=0) ;
67 bool doTowerHeadCorruptionTest(
int token) {
69 return doHeadCorruptionTest(token,0xa4,1); }
71 bool doMapmtHeadCorruptionTest(
int token) {
73 return doHeadCorruptionTest(token,0xc4,64); }
75 bool purgeCrateOFF(
int ib);
76 void tagHeadValid(
int ib,
int token,
int crId,
int len,
int trigComm,
int errFlag,
int dbg=0);
79 static bool isCrateOFF(
const UShort_t* hd);
80 static UShort_t isHeadValid(
const UShort_t* hd,
int token,
int crId,
int len,
int trigComm,
int errFlag,
int dbg=0);
82 void print(
int ib,
int flag);
83 void print(
int flag=0);
84 static void print(
const UShort_t* hd,
const UShort_t* d=0,
int nd=0);
87 TArrayS mHeader[MAXEMCDATABANK];
88 TArrayS mData[MAXEMCDATABANK];
89 UShort_t mCorrupt[MAXEMCDATABANK];