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 
8 #include <string> //STL
9 #include <set>
10 
11 #include "DCCDataParser.h"
12 
13 
14 /*----------------------------------------------------------*/
15 /* DCC DATA FIELD */
16 /* define data fields from the ECAL raw data format */
17 /* a data field has a name, a word position, a bit position */
18 /* and a mask (number of bits) */
19 /* Note: this class is defined inline */
20 /*----------------------------------------------------------*/
22 public :
26  DCCTBDataField(std::string name, uint32_t wordPosition, uint32_t bitPosition, uint32_t mask){
28  }
29 
33  void setName(std::string namestr) { name_.clear(); name_ = namestr; }
34  std::string name() { return name_; }
35  void setWordPosition(uint32_t wordpos) { wordPosition_ = wordpos; }
36  uint32_t wordPosition() { return wordPosition_; }
37  void setBitPosition(uint32_t bitpos) { bitPosition_ = bitpos; }
38  uint32_t bitPosition() { return bitPosition_; }
39  void setMask(uint32_t maskvalue) { mask_=maskvalue; }
40  uint32_t mask() { return mask_; }
41 
46 
47 protected :
49  uint32_t wordPosition_;
50  uint32_t bitPosition_;
51  uint32_t mask_;
52 };
53 
54 
55 
56 /*----------------------------------------------------------*/
57 /* DCC DATA FIELD COMPARATOR */
58 /* compares data fields positions */
59 /*----------------------------------------------------------*/
61 
62 public :
63 
68  bool value(false);
69 
70  if (d1->wordPosition() < d2->wordPosition()){
71  value=true;
72  }
73  else if(d1->wordPosition() == d2->wordPosition()){
74  if(d1->bitPosition() > d2->bitPosition()) {
75  value=true;
76  }
77  }
78 
79  return value;
80  }
81 };
82 
83 
84 
85 /*----------------------------------------------------------*/
86 /* DCC DATA MAPPER */
87 /* maps the data according to ECAL raw data format specs. */
88 /*----------------------------------------------------------*/
90 public:
91 
92  DCCTBDataMapper(DCCTBDataParser * myParser );
93  ~DCCTBDataMapper();
94 
98  void buildDCCFields();
99  void buildTCCFields();
100  void buildSRPFields();
101  void buildTowerFields();
102  void buildXtalFields();
103  void buildTrailerFields();
104 
108  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *dccFields() { return dccFields_; }
109  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *emptyEventFields() { return emptyEventFields_; }
110  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc68Fields() { return tcc68Fields_; }
111  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc32Fields() { return tcc32Fields_; }
112  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc16Fields() { return tcc16Fields_; }
113  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp68Fields() { return srp68Fields_; }
114  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp32Fields() { return srp32Fields_; }
115  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp16Fields() { return srp16Fields_; }
116  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *towerFields() { return towerFields_; }
117  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *xtalFields() { return xtalFields_; }
118  std::set<DCCTBDataField *, DCCTBDataFieldComparator> *trailerFields() { return trailerFields_; }
119 
120 protected:
122  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * dccFields_;
123  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * emptyEventFields_;
124  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * tcc68Fields_;
125  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * tcc32Fields_;
126  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * tcc16Fields_;
127 
128  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * srp68Fields_;
129  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * srp32Fields_;
130  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * srp16Fields_;
131 
132  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * towerFields_;
133  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * xtalFields_;
134  std::set<DCCTBDataField *, DCCTBDataFieldComparator> * trailerFields_;
135 
136 public:
137 
138  //HEADER data fields (each 32 bits is separated by a space in the enum)
139  enum DCCFIELDS{
140  H_WPOSITION = 0, H_BPOSITION = 3, H_MASK = 0x1,
141  FOV_WPOSITION = 0, FOV_BPOSITION = 4, FOV_MASK = 0xF,
142  DCCID_WPOSITION = 0, DCCID_BPOSITION = 8, DCCID_MASK = 0xFFF,
143  DCCBX_WPOSITION = 0, DCCBX_BPOSITION = 20, DCCBX_MASK = 0xFFF,
144 
145  DCCL1_WPOSITION = 1, DCCL1_BPOSITION = 0, DCCL1_MASK = 0xFFFFFF,
146  TRIGGERTYPE_WPOSITION = 1, TRIGGERTYPE_BPOSITION = 24, TRIGGERTYPE_MASK = 0xF,
147  BOE_WPOSITION = 1, BOE_BPOSITION = 28, BOE_MASK = 0xF,
148 
149  EVENTLENGTH_WPOSITION = 2, EVENTLENGTH_BPOSITION = 0, EVENTLENGTH_MASK = 0xFFFFFF,
150  DCCERRORS_WPOSITION = 2, DCCERRORS_BPOSITION = 24, DCCERRORS_MASK = 0xFF,
151 
152  RNUMB_WPOSITION = 3, RNUMB_BPOSITION = 0, RNUMB_MASK = 0xFFFFFF,
153  HD_WPOSITION = 3, HD_BPOSITION = 24, HD_MASK = 0xFF,
154 
155  RUNTYPE_WPOSITION = 4, RUNTYPE_BPOSITION = 0, RUNTYPE_MASK = 0xFFFFFFFF,
156 
157  DETAILEDTT_WPOSITION = 5, DETAILEDTT_BPOSITION = 0, DETAILEDTT_MASK = 0xFFFF,
158 
159  ORBITCOUNTER_WPOSITION = 6, ORBITCOUNTER_BPOSITION = 0, ORBITCOUNTER_MASK = 0xFFFFFFFF,
160 
161  SR_WPOSITION = 7, SR_BPOSITION = 0, SR_MASK = 0x1,
162  ZS_WPOSITION = 7, ZS_BPOSITION = 1, ZS_MASK = 0x1,
163  TZS_WPOSITION = 7, TZS_BPOSITION = 2, TZS_MASK = 0x1,
164  SR_CHSTATUS_WPOSITION = 7, SR_CHSTATUS_BPOSITION = 4, SR_CHSTATUS_MASK = 0xF,
165  TCC_CHSTATUS_WPOSITION = 7, TCC_CHSTATUS_BPOSITION = 8, TCC_CHSTATUS_MASK = 0xF,
166 
167  FE_CHSTATUS_WPOSITION = 8, CHSTATUS_BPOSITION = 0, FE_CHSTATUS_MASK = 0xF
168  };
169 
170 
171  //TCC block data fields
172  enum TCCFIELDS{
173  TCCID_WPOSITION = 0, TCCID_BPOSITION = 0, TCCID_MASK = 0xFF,
174  TCCBX_WPOSITION = 0, TCCBX_BPOSITION = 16, TCCBX_MASK = 0xFFF,
175  TCCE0_WPOSITION = 0, TCCE0_BPOSITION = 28, TCCE0_MASK = 0x1,
176 
177  TCCL1_WPOSITION = 1, TCCL1_BPOSITION = 0, TCCL1_MASK = 0xFFF,
178  TCCE1_WPOSITION = 1, TCCE1_BPOSITION = 12, TCCE1_MASK = 0x1,
179  NTT_WPOSITION = 1, NTT_BPOSITION = 16, NTT_MASK = 0x7F,
180  TCCTSAMP_WPOSITION = 1, TCCTSAMP_BPOSITION = 23, TCCTSAMP_MASK = 0xF,
181  TCCLE0_WPOSITION = 1, TCCLE0_BPOSITION = 27, TCCLE0_MASK = 0x1,
182  TCCLE1_WPOSITION = 1, TCCLE1_BPOSITION = 28, TCCLE1_MASK = 0x1,
183 
184  TPG_WPOSITION = 2, TPG_BPOSITION = 0, TPG_MASK = 0x1FF,
185  TTF_WPOSITION = 2, TTF_BPOSITION = 9, TTF_MASK = 0x7
186  };
187 
188  //SR block data fields
189  enum SRPFIELDS{
190  SRPID_WPOSITION = 0, SRPID_BPOSITION = 0, SRPID_MASK = 0xFF,
191  SRPBX_WPOSITION = 0, SRPBX_BPOSITION = 16, SRPBX_MASK = 0xFFF,
192  SRPE0_WPOSITION = 0, SRPE0_BPOSITION = 28, SRPE0_MASK = 0x1,
193 
194  SRPL1_WPOSITION = 1, SRPL1_BPOSITION = 0, SRPL1_MASK = 0xFFF,
195  SRPE1_WPOSITION = 1, SRPE1_BPOSITION = 12, SRPE1_MASK = 0x1,
196  NSRF_WPOSITION = 1, NSRF_BPOSITION = 16, NSRF_MASK = 0x7F,
197  SRPLE0_WPOSITION = 1, SRPLE0_BPOSITION = 27, SRPLE0_MASK = 0x1,
198  SRPLE1_WPOSITION = 1, SRPLE1_BPOSITION = 28, SRPLE1_MASK = 0x1,
199 
200  SRF_WPOSITION = 2, SRF_BPOSITION = 0, SRF_MASK = 0x3,
201  SRPBOFFSET = 16
202  };
203 
204  //TOWER block data fields
206  TOWERID_WPOSITION = 0, TOWERID_BPOSITION = 0, TOWERID_MASK = 0x7F, //FEID remask?? --> the 8th bit is in use
207  XSAMP_WPOSITION = 0, XSAMP_BPOSITION = 8, XSAMP_MASK = 0x7F,
208  TOWERBX_WPOSITION = 0, TOWERBX_BPOSITION = 16, TOWERBX_MASK = 0xFFF,
209  TOWERE0_WPOSITION = 0, TOWERE0_BPOSITION = 28, TOWERE0_MASK = 0x1,
210 
211  TOWERL1_WPOSITION = 1, TOWERL1_BPOSITION = 0, TOWERL1_MASK = 0xFFF,
212  TOWERE1_WPOSITION = 1, TOWERE1_BPOSITION = 12, TOWERE1_MASK = 0x1,
213  TOWERLENGTH_WPOSITION = 1, TOWERLENGTH_BPOSITION = 16, TOWERLENGTH_MASK = 0x1FF
214  };
215 
216  //CRYSTAL data fields
218  STRIPID_WPOSITION = 0, STRIPID_BPOSITION = 0, STRIPID_MASK = 0x7,
219  XTALID_WPOSITION = 0, XTALID_BPOSITION = 4, XTALID_MASK = 0x7,
220  M_WPOSITION = 0, M_BPOSITION = 8, M_MASK = 0x1,
221  SMF_WPOSITION = 0, SMF_BPOSITION = 9, SMF_MASK = 0x1,
222  GMF_WPOSITION = 0, GMF_BPOSITION = 10, GMF_MASK = 0x1,
223  XTAL_TZS_WPOSITION = 0, XTAL_TZS_BPOSITION = 16, XTAL_TZS_MASK = 0x1,
224  XTAL_GDECISION_WPOSITION = 0, XTAL_GDECISION_BPOSITION = 17, XTAL_GDECISION_MASK = 0x1,
225  ADC_WPOSITION = 0, ADC_BPOSITION = 0, ADC_MASK = 0x3FFF,
226  ADCBOFFSET = 16
227  };
228 
229  //TRAILER data fields
231  T_WPOSITION = 0, T_BPOSITION = 3, T_MASK = 0x1,
232  ESTAT_WPOSITION = 0, ESTAT_BPOSITION = 8, ESTAT_MASK = 0xF,
233 
234  TTS_WPOSITION = 0, TTS_BPOSITION = 4, TTS_MASK = 0xF,
235 
236  CRC_WPOSITION = 0, CRC_BPOSITION = 16, CRC_MASK = 0xFFFF,
237  TLENGTH_WPOSITION = 1, TLENGTH_BPOSITION = 0, TLENGTH_MASK = 0xFFFFFF,
238  EOE_WPOSITION = 1, EOE_BPOSITION = 28, EOE_MASK = 0xF
239  };
240 
241 };
242 
243 #endif
void setBitPosition(uint32_t bitpos)
Definition: DCCDataMapper.h:37
void setName(std::string namestr)
Definition: DCCDataMapper.h:33
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:34
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:51
bool operator()(DCCTBDataField *d1, DCCTBDataField *d2)
Definition: DCCDataMapper.h:67
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields()
uint32_t bitPosition()
Definition: DCCDataMapper.h:38
void setMask(uint32_t maskvalue)
Definition: DCCDataMapper.h:39
uint32_t mask()
Definition: DCCDataMapper.h:40
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc32Fields()
uint32_t bitPosition_
Definition: DCCDataMapper.h:50
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp16Fields()
uint32_t wordPosition()
Definition: DCCDataMapper.h:36
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp68Fields()
DCCTBDataField(std::string name, uint32_t wordPosition, uint32_t bitPosition, uint32_t mask)
Definition: DCCDataMapper.h:26
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * trailerFields()
std::string name_
Definition: DCCDataMapper.h:45
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:35
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields_
uint32_t wordPosition_
Definition: DCCDataMapper.h:49