CMS 3D CMS Logo

DCCDataMapper.h
Go to the documentation of this file.
1 // Date : 30/05/2005
2 // Author : N.Almeida (LIP)
3 
4 #ifndef DCCTBDATAMAPPER_HH
5 #define DCCTBDATAMAPPER_HH
6 
7 #include <string> //STL
8 #include <set>
9 
10 #include "DCCDataParser.h"
11 
12 /*----------------------------------------------------------*/
13 /* DCC DATA FIELD */
14 /* define data fields from the ECAL raw data format */
15 /* a data field has a name, a word position, a bit position */
16 /* and a mask (number of bits) */
17 /* Note: this class is defined inline */
18 /*----------------------------------------------------------*/
20 public:
24  DCCTBDataField(std::string name, uint32_t wordPosition, uint32_t bitPosition, uint32_t mask) {
25  name_ = name;
28  mask_ = mask;
29  }
30 
34  void setName(std::string namestr) {
35  name_.clear();
36  name_ = namestr;
37  }
38  std::string name() { return name_; }
39  void setWordPosition(uint32_t wordpos) { wordPosition_ = wordpos; }
40  uint32_t wordPosition() { return wordPosition_; }
41  void setBitPosition(uint32_t bitpos) { bitPosition_ = bitpos; }
42  uint32_t bitPosition() { return bitPosition_; }
43  void setMask(uint32_t maskvalue) { mask_ = maskvalue; }
44  uint32_t mask() { return mask_; }
45 
50 
51 protected:
53  uint32_t wordPosition_;
54  uint32_t bitPosition_;
55  uint32_t mask_;
56 };
57 
58 /*----------------------------------------------------------*/
59 /* DCC DATA FIELD COMPARATOR */
60 /* compares data fields positions */
61 /*----------------------------------------------------------*/
63 public:
67  bool operator()(DCCTBDataField *d1, DCCTBDataField *d2) const {
68  bool value(false);
69 
70  if (d1->wordPosition() < d2->wordPosition()) {
71  value = true;
72  } else if (d1->wordPosition() == d2->wordPosition()) {
73  if (d1->bitPosition() > d2->bitPosition()) {
74  value = true;
75  }
76  }
77 
78  return value;
79  }
80 };
81 
82 /*----------------------------------------------------------*/
83 /* DCC DATA MAPPER */
84 /* maps the data according to ECAL raw data format specs. */
85 /*----------------------------------------------------------*/
87 public:
89  ~DCCTBDataMapper();
90 
94  void buildDCCFields();
95  void buildTCCFields();
96  void buildSRPFields();
97  void buildTowerFields();
98  void buildXtalFields();
99  void buildTrailerFields();
100 
104  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *dccFields() { return dccFields_; }
105  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *emptyEventFields() { return emptyEventFields_; }
106  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc68Fields() { return tcc68Fields_; }
107  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc32Fields() { return tcc32Fields_; }
108  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc16Fields() { return tcc16Fields_; }
109  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp68Fields() { return srp68Fields_; }
110  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp32Fields() { return srp32Fields_; }
111  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp16Fields() { return srp16Fields_; }
112  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *towerFields() { return towerFields_; }
113  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *xtalFields() { return xtalFields_; }
114  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *trailerFields() { return trailerFields_; }
115 
116 protected:
118  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *dccFields_;
119  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *emptyEventFields_;
120  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc68Fields_;
121  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc32Fields_;
122  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc16Fields_;
123 
124  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp68Fields_;
125  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp32Fields_;
126  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp16Fields_;
127 
128  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *towerFields_;
129  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *xtalFields_;
130  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *trailerFields_;
131 
132 public:
133  //HEADER data fields (each 32 bits is separated by a space in the enum)
134  enum DCCFIELDS {
135  H_WPOSITION = 0,
136  H_BPOSITION = 3,
137  H_MASK = 0x1,
138  FOV_WPOSITION = 0,
139  FOV_BPOSITION = 4,
140  FOV_MASK = 0xF,
141  DCCID_WPOSITION = 0,
142  DCCID_BPOSITION = 8,
143  DCCID_MASK = 0xFFF,
144  DCCBX_WPOSITION = 0,
145  DCCBX_BPOSITION = 20,
146  DCCBX_MASK = 0xFFF,
147 
148  DCCL1_WPOSITION = 1,
149  DCCL1_BPOSITION = 0,
150  DCCL1_MASK = 0xFFFFFF,
151  TRIGGERTYPE_WPOSITION = 1,
152  TRIGGERTYPE_BPOSITION = 24,
153  TRIGGERTYPE_MASK = 0xF,
154  BOE_WPOSITION = 1,
155  BOE_BPOSITION = 28,
156  BOE_MASK = 0xF,
157 
158  EVENTLENGTH_WPOSITION = 2,
159  EVENTLENGTH_BPOSITION = 0,
160  EVENTLENGTH_MASK = 0xFFFFFF,
161  DCCERRORS_WPOSITION = 2,
162  DCCERRORS_BPOSITION = 24,
163  DCCERRORS_MASK = 0xFF,
164 
165  RNUMB_WPOSITION = 3,
166  RNUMB_BPOSITION = 0,
167  RNUMB_MASK = 0xFFFFFF,
168  HD_WPOSITION = 3,
169  HD_BPOSITION = 24,
170  HD_MASK = 0xFF,
171 
172  RUNTYPE_WPOSITION = 4,
173  RUNTYPE_BPOSITION = 0,
174  RUNTYPE_MASK = 0xFFFFFFFF,
175 
176  DETAILEDTT_WPOSITION = 5,
177  DETAILEDTT_BPOSITION = 0,
178  DETAILEDTT_MASK = 0xFFFF,
179 
180  ORBITCOUNTER_WPOSITION = 6,
181  ORBITCOUNTER_BPOSITION = 0,
182  ORBITCOUNTER_MASK = 0xFFFFFFFF,
183 
184  SR_WPOSITION = 7,
185  SR_BPOSITION = 0,
186  SR_MASK = 0x1,
187  ZS_WPOSITION = 7,
188  ZS_BPOSITION = 1,
189  ZS_MASK = 0x1,
190  TZS_WPOSITION = 7,
191  TZS_BPOSITION = 2,
192  TZS_MASK = 0x1,
193  SR_CHSTATUS_WPOSITION = 7,
194  SR_CHSTATUS_BPOSITION = 4,
195  SR_CHSTATUS_MASK = 0xF,
196  TCC_CHSTATUS_WPOSITION = 7,
197  TCC_CHSTATUS_BPOSITION = 8,
198  TCC_CHSTATUS_MASK = 0xF,
199 
200  FE_CHSTATUS_WPOSITION = 8,
201  CHSTATUS_BPOSITION = 0,
202  FE_CHSTATUS_MASK = 0xF
203  };
204 
205  //TCC block data fields
206  enum TCCFIELDS {
207  TCCID_WPOSITION = 0,
208  TCCID_BPOSITION = 0,
209  TCCID_MASK = 0xFF,
210  TCCBX_WPOSITION = 0,
211  TCCBX_BPOSITION = 16,
212  TCCBX_MASK = 0xFFF,
213  TCCE0_WPOSITION = 0,
214  TCCE0_BPOSITION = 28,
215  TCCE0_MASK = 0x1,
216 
217  TCCL1_WPOSITION = 1,
218  TCCL1_BPOSITION = 0,
219  TCCL1_MASK = 0xFFF,
220  TCCE1_WPOSITION = 1,
221  TCCE1_BPOSITION = 12,
222  TCCE1_MASK = 0x1,
223  NTT_WPOSITION = 1,
224  NTT_BPOSITION = 16,
225  NTT_MASK = 0x7F,
226  TCCTSAMP_WPOSITION = 1,
227  TCCTSAMP_BPOSITION = 23,
228  TCCTSAMP_MASK = 0xF,
229  TCCLE0_WPOSITION = 1,
230  TCCLE0_BPOSITION = 27,
231  TCCLE0_MASK = 0x1,
232  TCCLE1_WPOSITION = 1,
233  TCCLE1_BPOSITION = 28,
234  TCCLE1_MASK = 0x1,
235 
236  TPG_WPOSITION = 2,
237  TPG_BPOSITION = 0,
238  TPG_MASK = 0x1FF,
239  TTF_WPOSITION = 2,
240  TTF_BPOSITION = 9,
241  TTF_MASK = 0x7
242  };
243 
244  //SR block data fields
245  enum SRPFIELDS {
246  SRPID_WPOSITION = 0,
247  SRPID_BPOSITION = 0,
248  SRPID_MASK = 0xFF,
249  SRPBX_WPOSITION = 0,
250  SRPBX_BPOSITION = 16,
251  SRPBX_MASK = 0xFFF,
252  SRPE0_WPOSITION = 0,
253  SRPE0_BPOSITION = 28,
254  SRPE0_MASK = 0x1,
255 
256  SRPL1_WPOSITION = 1,
257  SRPL1_BPOSITION = 0,
258  SRPL1_MASK = 0xFFF,
259  SRPE1_WPOSITION = 1,
260  SRPE1_BPOSITION = 12,
261  SRPE1_MASK = 0x1,
262  NSRF_WPOSITION = 1,
263  NSRF_BPOSITION = 16,
264  NSRF_MASK = 0x7F,
265  SRPLE0_WPOSITION = 1,
266  SRPLE0_BPOSITION = 27,
267  SRPLE0_MASK = 0x1,
268  SRPLE1_WPOSITION = 1,
269  SRPLE1_BPOSITION = 28,
270  SRPLE1_MASK = 0x1,
271 
272  SRF_WPOSITION = 2,
273  SRF_BPOSITION = 0,
274  SRF_MASK = 0x3,
275  SRPBOFFSET = 16
276  };
277 
278  //TOWER block data fields
279  enum TOWERFIELDS {
280  TOWERID_WPOSITION = 0,
281  TOWERID_BPOSITION = 0,
282  TOWERID_MASK = 0x7F, //FEID remask?? --> the 8th bit is in use
283  XSAMP_WPOSITION = 0,
284  XSAMP_BPOSITION = 8,
285  XSAMP_MASK = 0x7F,
286  TOWERBX_WPOSITION = 0,
287  TOWERBX_BPOSITION = 16,
288  TOWERBX_MASK = 0xFFF,
289  TOWERE0_WPOSITION = 0,
290  TOWERE0_BPOSITION = 28,
291  TOWERE0_MASK = 0x1,
292 
293  TOWERL1_WPOSITION = 1,
294  TOWERL1_BPOSITION = 0,
295  TOWERL1_MASK = 0xFFF,
296  TOWERE1_WPOSITION = 1,
297  TOWERE1_BPOSITION = 12,
298  TOWERE1_MASK = 0x1,
299  TOWERLENGTH_WPOSITION = 1,
300  TOWERLENGTH_BPOSITION = 16,
301  TOWERLENGTH_MASK = 0x1FF
302  };
303 
304  //CRYSTAL data fields
305  enum XTALFIELDS {
306  STRIPID_WPOSITION = 0,
307  STRIPID_BPOSITION = 0,
308  STRIPID_MASK = 0x7,
309  XTALID_WPOSITION = 0,
310  XTALID_BPOSITION = 4,
311  XTALID_MASK = 0x7,
312  M_WPOSITION = 0,
313  M_BPOSITION = 8,
314  M_MASK = 0x1,
315  SMF_WPOSITION = 0,
316  SMF_BPOSITION = 9,
317  SMF_MASK = 0x1,
318  GMF_WPOSITION = 0,
319  GMF_BPOSITION = 10,
320  GMF_MASK = 0x1,
321  XTAL_TZS_WPOSITION = 0,
322  XTAL_TZS_BPOSITION = 16,
323  XTAL_TZS_MASK = 0x1,
324  XTAL_GDECISION_WPOSITION = 0,
325  XTAL_GDECISION_BPOSITION = 17,
326  XTAL_GDECISION_MASK = 0x1,
327  ADC_WPOSITION = 0,
328  ADC_BPOSITION = 0,
329  ADC_MASK = 0x3FFF,
330  ADCBOFFSET = 16
331  };
332 
333  //TRAILER data fields
335  T_WPOSITION = 0,
336  T_BPOSITION = 3,
337  T_MASK = 0x1,
338  ESTAT_WPOSITION = 0,
339  ESTAT_BPOSITION = 8,
340  ESTAT_MASK = 0xF,
341 
342  TTS_WPOSITION = 0,
343  TTS_BPOSITION = 4,
344  TTS_MASK = 0xF,
345 
346  CRC_WPOSITION = 0,
347  CRC_BPOSITION = 16,
348  CRC_MASK = 0xFFFF,
349  TLENGTH_WPOSITION = 1,
350  TLENGTH_BPOSITION = 0,
351  TLENGTH_MASK = 0xFFFFFF,
352  EOE_WPOSITION = 1,
353  EOE_BPOSITION = 28,
354  EOE_MASK = 0xF
355  };
356 };
357 
358 #endif
void setBitPosition(uint32_t bitpos)
Definition: DCCDataMapper.h:41
void setName(std::string namestr)
Definition: DCCDataMapper.h:34
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * dccFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp32Fields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp32Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc68Fields_
std::string name()
Definition: DCCDataMapper.h:38
bool operator()(DCCTBDataField *d1, DCCTBDataField *d2) const
Definition: DCCDataMapper.h:67
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * trailerFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc16Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp16Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc32Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * emptyEventFields_
uint32_t mask_
Definition: DCCDataMapper.h:55
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields()
uint32_t bitPosition()
Definition: DCCDataMapper.h:42
void setMask(uint32_t maskvalue)
Definition: DCCDataMapper.h:43
uint32_t mask()
Definition: DCCDataMapper.h:44
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc32Fields()
uint32_t bitPosition_
Definition: DCCDataMapper.h:54
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp16Fields()
uint32_t wordPosition()
Definition: DCCDataMapper.h:40
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp68Fields()
DCCTBDataField(std::string name, uint32_t wordPosition, uint32_t bitPosition, uint32_t mask)
Definition: DCCDataMapper.h:24
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * trailerFields()
std::string name_
Definition: DCCDataMapper.h:49
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc16Fields()
DCCTBDataParser * parser_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp68Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * emptyEventFields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * dccFields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc68Fields()
void setWordPosition(uint32_t wordpos)
Definition: DCCDataMapper.h:39
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields_
uint32_t wordPosition_
Definition: DCCDataMapper.h:53