StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEfeeDataBlock.h
1 /* Hey Emacs this is -*-C++-*- */
2 #ifndef EEfeeDataBlock_h
3 #define EEfeeDataBlock_h
4 /*********************************************************************
5  * $Id: EEfeeDataBlock.h,v 1.12 2004/06/21 19:50:21 balewski Exp $
6  *********************************************************************
7  * Descripion:
8  * STAR Endcap Electromagnetic Calorimeter Raw FEE Data Block
9  *********************************************************************
10  */
11 #include "TObject.h"
12 
13 class EEfeeDataBlock :public TObject {
14 
15 public:
16  enum { WRDCNT=0,ERRFLG=1,TOKEN=2,CRATE=3};
17  static const int DefaultMaxHead;
18  static const int DefaultMaxData;
19 
20 private:
21  int MaxHead;
22  int MaxData;
23  UShort_t *head;//[MaxHead];
24  UShort_t *data;//[MaxData]
25  UChar_t sanity;// encodes all corruptions, filled in fly
26 
27 public:
30 
31  virtual ~EEfeeDataBlock();
32  void print(int flag=1);
33  void clear();
34  void set (const EEfeeDataBlock *b);
35  void setHead (const UShort_t* h );
36  void setData (int chan, UShort_t d);
37  void setDataArray(const UShort_t *d, int size);
38 
39 
40  UShort_t* getData() const { return data; };
41  UShort_t* getHead() const { return head; };
42 
43  int getDataLen() const { return MaxData; }
44  int getValidDataLen() const {return getDataLen(); } //bckwd compat.
45  int getHeadLen() const { return MaxHead; }
46 
47  UShort_t getErrFlag() const { return head[ERRFLG] & 0x0FFF; }
48  UShort_t getLenCount() const { return head[WRDCNT] & 0x0FFF; }
49  UShort_t getToken() const { return head[TOKEN] & 0x0FFF; }
50  UChar_t getTrigComm() const { return (head[CRATE] / 0x0100) &0x000F ; }
51  UChar_t getCrateID() const { return head[CRATE] & 0x00FF ; }
52  UChar_t getSanity() const { return sanity;}
53  int getNData(int thres) const;
54  void maskCrate() { sanity|=0x80;}// mark 7th (not used) bit
55  void setCrateID(UShort_t id ) { head[CRATE]= (head[CRATE]&0xFF00) + ( id& 0x00FF);}
56  int isValid() const {return !sanity;}
57  UChar_t isHeadValid(int token, int crId, int len, int trigComm, int errFlag);
58 
59  ClassDef(EEfeeDataBlock,3) // Endcap Emc event
60 };
61 #endif
62 
63 /*
64 Date: Fri, 02 Apr 2004 00:10:36 -0500
65 From: Gerard Visser <gvisser@iucf.indiana.edu>
66 To: Jan Balewski <balewski@iucf.indiana.edu>
67 Subject: Re: header
68 
69 Hi Jan,
70  First of all ALL numbers reported by ETOW and ESMD are 12-bits. DAQ
71 reads them as 16, but only the 12 least significant come over the fiber.
72 Tonko fills in the upper nibble with 0 but I don't know about any
73 guarantees.
74  The 0th word is the length count. ESMD has 192+4 words, length count is
75 196=0x0c4. ETOW has 128+4 words, length count is 132=0xa4.
76  The 1th word is the "error flags".
77  The 2nd word is the token.
78  The 3rd word is the trigger command nibble put together with the "RDO
79 ID" or "crate ID".
80  The 4th and following words are the data (ADC values).
81  See
82 http://www.iucf.indiana.edu/U/gvisser/STAR_EEMC/STAR_EEMC_DAQ_Data_Formats.pdf
83 (page 2 for instance).
84 
85  - Gerard
86 
87 */
88 
89 
90 /*
91  * $Log: EEfeeDataBlock.h,v $
92  * Revision 1.12 2004/06/21 19:50:21 balewski
93  * mre detailed monitoring of data corruption
94  *
95  * Revision 1.11 2004/04/20 21:43:53 balewski
96  * small change in data block header get now tagged
97  *
98  * Revision 1.10 2004/04/02 06:38:52 balewski
99  * *** empty log message ***
100  *
101  * Revision 1.9 2004/03/25 16:54:59 balewski
102  * cleanup of arguments
103  *
104  * Revision 1.8 2004/03/20 20:25:55 balewski
105  * *** empty log message ***
106  *
107  * Revision 1.7 2004/01/27 15:13:57 balewski
108  * it is tricky with BTOW
109  *
110  * Revision 1.6 2003/12/04 18:29:25 balewski
111  * I forgot
112  *
113  * Revision 1.5 2003/12/02 17:22:08 balewski
114  * fix after version mixup
115  *
116  * Revision 1.3 2003/11/24 05:40:55 balewski
117  * new stuff for miniDaq
118  *
119  * Revision 1.2 2003/11/20 16:01:46 balewski
120  * towars run 4
121  *
122  * Revision 1.1 2003/01/28 23:17:14 balewski
123  * start
124  *
125  * Revision 1.5 2002/12/19 22:22:56 zolnie
126  * fixed trig type bug
127  *
128  * Revision 1.4 2002/12/19 21:54:32 zolnie
129  * updates for real fee data
130  *
131  * Revision 1.3 2002/12/04 19:13:16 zolnie
132  * fixed bug in setData
133  *
134  * Revision 1.2 2002/12/03 23:48:52 zolnie
135  * changed back to var length
136  *
137  * Revision 1.1 2002/11/30 20:04:37 balewski
138  * start
139  *
140  *
141  *********************************************************************/