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:
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:
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 {
137  H_MASK = 0x1,
140  FOV_MASK = 0xF,
143  DCCID_MASK = 0xFFF,
146  DCCBX_MASK = 0xFFF,
147 
150  DCCL1_MASK = 0xFFFFFF,
156  BOE_MASK = 0xF,
157 
160  EVENTLENGTH_MASK = 0xFFFFFF,
164 
167  RNUMB_MASK = 0xFFFFFF,
170  HD_MASK = 0xFF,
171 
174  RUNTYPE_MASK = 0xFFFFFFFF,
175 
178  DETAILEDTT_MASK = 0xFFFF,
179 
182  ORBITCOUNTER_MASK = 0xFFFFFFFF,
183 
186  SR_MASK = 0x1,
189  ZS_MASK = 0x1,
192  TZS_MASK = 0x1,
199 
203  };
204 
205  //TCC block data fields
206  enum TCCFIELDS {
209  TCCID_MASK = 0xFF,
212  TCCBX_MASK = 0xFFF,
215  TCCE0_MASK = 0x1,
216 
219  TCCL1_MASK = 0xFFF,
222  TCCE1_MASK = 0x1,
225  NTT_MASK = 0x7F,
231  TCCLE0_MASK = 0x1,
234  TCCLE1_MASK = 0x1,
235 
238  TPG_MASK = 0x1FF,
241  TTF_MASK = 0x7
242  };
243 
244  //SR block data fields
245  enum SRPFIELDS {
248  SRPID_MASK = 0xFF,
251  SRPBX_MASK = 0xFFF,
254  SRPE0_MASK = 0x1,
255 
258  SRPL1_MASK = 0xFFF,
261  SRPE1_MASK = 0x1,
264  NSRF_MASK = 0x7F,
267  SRPLE0_MASK = 0x1,
270  SRPLE1_MASK = 0x1,
271 
274  SRF_MASK = 0x3,
276  };
277 
278  //TOWER block data fields
279  enum TOWERFIELDS {
282  TOWERID_MASK = 0x7F, //FEID remask?? --> the 8th bit is in use
285  XSAMP_MASK = 0x7F,
288  TOWERBX_MASK = 0xFFF,
292 
295  TOWERL1_MASK = 0xFFF,
302  };
303 
304  //CRYSTAL data fields
305  enum XTALFIELDS {
311  XTALID_MASK = 0x7,
314  M_MASK = 0x1,
317  SMF_MASK = 0x1,
320  GMF_MASK = 0x1,
329  ADC_MASK = 0x3FFF,
331  };
332 
333  //TRAILER data fields
337  T_MASK = 0x1,
340  ESTAT_MASK = 0xF,
341 
344  TTS_MASK = 0xF,
345 
348  CRC_MASK = 0xFFFF,
351  TLENGTH_MASK = 0xFFFFFF,
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
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * trailerFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc16Fields_
DCCTBDataMapper(DCCTBDataParser *myParser)
Definition: DCCDataMapper.cc:7
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp16Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc32Fields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * emptyEventFields_
void buildTrailerFields()
uint32_t mask_
Definition: DCCDataMapper.h:55
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields()
Definition: value.py:1
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_
bool operator()(DCCTBDataField *d1, DCCTBDataField *d2) const
Definition: DCCDataMapper.h:67
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()
static constexpr float d1
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