test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 );
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,
144 
148 
151 
153  HD_WPOSITION = 3, HD_BPOSITION = 24, HD_MASK = 0xFF,
154 
156 
158 
160 
166 
168  };
169 
170 
171  //TCC block data fields
172  enum TCCFIELDS{
176 
183 
186  };
187 
188  //SR block data fields
189  enum SRPFIELDS{
193 
199 
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
210 
214  };
215 
216  //CRYSTAL data fields
220  M_WPOSITION = 0, M_BPOSITION = 8, M_MASK = 0x1,
227  };
228 
229  //TRAILER data fields
231  T_WPOSITION = 0, T_BPOSITION = 3, T_MASK = 0x1,
233 
235 
236  CRC_WPOSITION = 0, CRC_BPOSITION = 16, CRC_MASK = 0xFFFF,
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_
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: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