File indexing completed on 2024-09-07 04:36:10
0001
0002
0003
0004 #ifndef DCCTBDATAMAPPER_HH
0005 #define DCCTBDATAMAPPER_HH
0006
0007 #include <string> //STL
0008 #include <set>
0009
0010 #include "DCCDataParser.h"
0011
0012
0013
0014
0015
0016
0017
0018
0019 class DCCTBDataField {
0020 public:
0021
0022
0023
0024 DCCTBDataField(std::string name, uint32_t wordPosition, uint32_t bitPosition, uint32_t mask) {
0025 name_ = name;
0026 wordPosition_ = wordPosition;
0027 bitPosition_ = bitPosition;
0028 mask_ = mask;
0029 }
0030
0031
0032
0033
0034 void setName(std::string namestr) {
0035 name_.clear();
0036 name_ = namestr;
0037 }
0038 std::string name() { return name_; }
0039 void setWordPosition(uint32_t wordpos) { wordPosition_ = wordpos; }
0040 uint32_t wordPosition() { return wordPosition_; }
0041 void setBitPosition(uint32_t bitpos) { bitPosition_ = bitpos; }
0042 uint32_t bitPosition() { return bitPosition_; }
0043 void setMask(uint32_t maskvalue) { mask_ = maskvalue; }
0044 uint32_t mask() { return mask_; }
0045
0046
0047
0048
0049 ~DCCTBDataField() {}
0050
0051 protected:
0052 std::string name_;
0053 uint32_t wordPosition_;
0054 uint32_t bitPosition_;
0055 uint32_t mask_;
0056 };
0057
0058
0059
0060
0061
0062 class DCCTBDataFieldComparator {
0063 public:
0064
0065
0066
0067 bool operator()(DCCTBDataField *d1, DCCTBDataField *d2) const {
0068 bool value(false);
0069
0070 if (d1->wordPosition() < d2->wordPosition()) {
0071 value = true;
0072 } else if (d1->wordPosition() == d2->wordPosition()) {
0073 if (d1->bitPosition() > d2->bitPosition()) {
0074 value = true;
0075 }
0076 }
0077
0078 return value;
0079 }
0080 };
0081
0082
0083
0084
0085
0086 class DCCTBDataMapper {
0087 public:
0088 DCCTBDataMapper(DCCTBDataParser *myParser);
0089 ~DCCTBDataMapper();
0090
0091
0092
0093
0094 void buildDCCFields();
0095 void buildTCCFields();
0096 void buildSRPFields();
0097 void buildTowerFields();
0098 void buildXtalFields();
0099 void buildTrailerFields();
0100
0101
0102
0103
0104 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *dccFields() { return dccFields_; }
0105 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *emptyEventFields() { return emptyEventFields_; }
0106 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc68Fields() { return tcc68Fields_; }
0107 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc32Fields() { return tcc32Fields_; }
0108 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc16Fields() { return tcc16Fields_; }
0109 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp68Fields() { return srp68Fields_; }
0110 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp32Fields() { return srp32Fields_; }
0111 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp16Fields() { return srp16Fields_; }
0112 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *towerFields() { return towerFields_; }
0113 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *xtalFields() { return xtalFields_; }
0114 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *trailerFields() { return trailerFields_; }
0115
0116 protected:
0117 DCCTBDataParser *parser_;
0118 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *dccFields_;
0119 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *emptyEventFields_;
0120 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc68Fields_;
0121 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc32Fields_;
0122 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *tcc16Fields_;
0123
0124 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp68Fields_;
0125 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp32Fields_;
0126 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *srp16Fields_;
0127
0128 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *towerFields_;
0129 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *xtalFields_;
0130 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *trailerFields_;
0131
0132 public:
0133
0134 enum DCCFIELDS {
0135 H_WPOSITION = 0,
0136 H_BPOSITION = 3,
0137 H_MASK = 0x1,
0138 FOV_WPOSITION = 0,
0139 FOV_BPOSITION = 4,
0140 FOV_MASK = 0xF,
0141 DCCID_WPOSITION = 0,
0142 DCCID_BPOSITION = 8,
0143 DCCID_MASK = 0xFFF,
0144 DCCBX_WPOSITION = 0,
0145 DCCBX_BPOSITION = 20,
0146 DCCBX_MASK = 0xFFF,
0147
0148 DCCL1_WPOSITION = 1,
0149 DCCL1_BPOSITION = 0,
0150 DCCL1_MASK = 0xFFFFFF,
0151 TRIGGERTYPE_WPOSITION = 1,
0152 TRIGGERTYPE_BPOSITION = 24,
0153 TRIGGERTYPE_MASK = 0xF,
0154 BOE_WPOSITION = 1,
0155 BOE_BPOSITION = 28,
0156 BOE_MASK = 0xF,
0157
0158 EVENTLENGTH_WPOSITION = 2,
0159 EVENTLENGTH_BPOSITION = 0,
0160 EVENTLENGTH_MASK = 0xFFFFFF,
0161 DCCERRORS_WPOSITION = 2,
0162 DCCERRORS_BPOSITION = 24,
0163 DCCERRORS_MASK = 0xFF,
0164
0165 RNUMB_WPOSITION = 3,
0166 RNUMB_BPOSITION = 0,
0167 RNUMB_MASK = 0xFFFFFF,
0168 HD_WPOSITION = 3,
0169 HD_BPOSITION = 24,
0170 HD_MASK = 0xFF,
0171
0172 RUNTYPE_WPOSITION = 4,
0173 RUNTYPE_BPOSITION = 0,
0174 RUNTYPE_MASK = 0xFFFFFFFF,
0175
0176 DETAILEDTT_WPOSITION = 5,
0177 DETAILEDTT_BPOSITION = 0,
0178 DETAILEDTT_MASK = 0xFFFF,
0179
0180 ORBITCOUNTER_WPOSITION = 6,
0181 ORBITCOUNTER_BPOSITION = 0,
0182 ORBITCOUNTER_MASK = 0xFFFFFFFF,
0183
0184 SR_WPOSITION = 7,
0185 SR_BPOSITION = 0,
0186 SR_MASK = 0x1,
0187 ZS_WPOSITION = 7,
0188 ZS_BPOSITION = 1,
0189 ZS_MASK = 0x1,
0190 TZS_WPOSITION = 7,
0191 TZS_BPOSITION = 2,
0192 TZS_MASK = 0x1,
0193 SR_CHSTATUS_WPOSITION = 7,
0194 SR_CHSTATUS_BPOSITION = 4,
0195 SR_CHSTATUS_MASK = 0xF,
0196 TCC_CHSTATUS_WPOSITION = 7,
0197 TCC_CHSTATUS_BPOSITION = 8,
0198 TCC_CHSTATUS_MASK = 0xF,
0199
0200 FE_CHSTATUS_WPOSITION = 8,
0201 CHSTATUS_BPOSITION = 0,
0202 FE_CHSTATUS_MASK = 0xF
0203 };
0204
0205
0206 enum TCCFIELDS {
0207 TCCID_WPOSITION = 0,
0208 TCCID_BPOSITION = 0,
0209 TCCID_MASK = 0xFF,
0210 TCCBX_WPOSITION = 0,
0211 TCCBX_BPOSITION = 16,
0212 TCCBX_MASK = 0xFFF,
0213 TCCE0_WPOSITION = 0,
0214 TCCE0_BPOSITION = 28,
0215 TCCE0_MASK = 0x1,
0216
0217 TCCL1_WPOSITION = 1,
0218 TCCL1_BPOSITION = 0,
0219 TCCL1_MASK = 0xFFF,
0220 TCCE1_WPOSITION = 1,
0221 TCCE1_BPOSITION = 12,
0222 TCCE1_MASK = 0x1,
0223 NTT_WPOSITION = 1,
0224 NTT_BPOSITION = 16,
0225 NTT_MASK = 0x7F,
0226 TCCTSAMP_WPOSITION = 1,
0227 TCCTSAMP_BPOSITION = 23,
0228 TCCTSAMP_MASK = 0xF,
0229 TCCLE0_WPOSITION = 1,
0230 TCCLE0_BPOSITION = 27,
0231 TCCLE0_MASK = 0x1,
0232 TCCLE1_WPOSITION = 1,
0233 TCCLE1_BPOSITION = 28,
0234 TCCLE1_MASK = 0x1,
0235
0236 TPG_WPOSITION = 2,
0237 TPG_BPOSITION = 0,
0238 TPG_MASK = 0x1FF,
0239 TTF_WPOSITION = 2,
0240 TTF_BPOSITION = 9,
0241 TTF_MASK = 0x7
0242 };
0243
0244
0245 enum SRPFIELDS {
0246 SRPID_WPOSITION = 0,
0247 SRPID_BPOSITION = 0,
0248 SRPID_MASK = 0xFF,
0249 SRPBX_WPOSITION = 0,
0250 SRPBX_BPOSITION = 16,
0251 SRPBX_MASK = 0xFFF,
0252 SRPE0_WPOSITION = 0,
0253 SRPE0_BPOSITION = 28,
0254 SRPE0_MASK = 0x1,
0255
0256 SRPL1_WPOSITION = 1,
0257 SRPL1_BPOSITION = 0,
0258 SRPL1_MASK = 0xFFF,
0259 SRPE1_WPOSITION = 1,
0260 SRPE1_BPOSITION = 12,
0261 SRPE1_MASK = 0x1,
0262 NSRF_WPOSITION = 1,
0263 NSRF_BPOSITION = 16,
0264 NSRF_MASK = 0x7F,
0265 SRPLE0_WPOSITION = 1,
0266 SRPLE0_BPOSITION = 27,
0267 SRPLE0_MASK = 0x1,
0268 SRPLE1_WPOSITION = 1,
0269 SRPLE1_BPOSITION = 28,
0270 SRPLE1_MASK = 0x1,
0271
0272 SRF_WPOSITION = 2,
0273 SRF_BPOSITION = 0,
0274 SRF_MASK = 0x3,
0275 SRPBOFFSET = 16
0276 };
0277
0278
0279 enum TOWERFIELDS {
0280 TOWERID_WPOSITION = 0,
0281 TOWERID_BPOSITION = 0,
0282 TOWERID_MASK = 0x7F,
0283 XSAMP_WPOSITION = 0,
0284 XSAMP_BPOSITION = 8,
0285 XSAMP_MASK = 0x7F,
0286 TOWERBX_WPOSITION = 0,
0287 TOWERBX_BPOSITION = 16,
0288 TOWERBX_MASK = 0xFFF,
0289 TOWERE0_WPOSITION = 0,
0290 TOWERE0_BPOSITION = 28,
0291 TOWERE0_MASK = 0x1,
0292
0293 TOWERL1_WPOSITION = 1,
0294 TOWERL1_BPOSITION = 0,
0295 TOWERL1_MASK = 0xFFF,
0296 TOWERE1_WPOSITION = 1,
0297 TOWERE1_BPOSITION = 12,
0298 TOWERE1_MASK = 0x1,
0299 TOWERLENGTH_WPOSITION = 1,
0300 TOWERLENGTH_BPOSITION = 16,
0301 TOWERLENGTH_MASK = 0x1FF
0302 };
0303
0304
0305 enum XTALFIELDS {
0306 STRIPID_WPOSITION = 0,
0307 STRIPID_BPOSITION = 0,
0308 STRIPID_MASK = 0x7,
0309 XTALID_WPOSITION = 0,
0310 XTALID_BPOSITION = 4,
0311 XTALID_MASK = 0x7,
0312 M_WPOSITION = 0,
0313 M_BPOSITION = 8,
0314 M_MASK = 0x1,
0315 SMF_WPOSITION = 0,
0316 SMF_BPOSITION = 9,
0317 SMF_MASK = 0x1,
0318 GMF_WPOSITION = 0,
0319 GMF_BPOSITION = 10,
0320 GMF_MASK = 0x1,
0321 XTAL_TZS_WPOSITION = 0,
0322 XTAL_TZS_BPOSITION = 16,
0323 XTAL_TZS_MASK = 0x1,
0324 XTAL_GDECISION_WPOSITION = 0,
0325 XTAL_GDECISION_BPOSITION = 17,
0326 XTAL_GDECISION_MASK = 0x1,
0327 ADC_WPOSITION = 0,
0328 ADC_BPOSITION = 0,
0329 ADC_MASK = 0x3FFF,
0330 ADCBOFFSET = 16
0331 };
0332
0333
0334 enum TRAILERFIELDS {
0335 T_WPOSITION = 0,
0336 T_BPOSITION = 3,
0337 T_MASK = 0x1,
0338 ESTAT_WPOSITION = 0,
0339 ESTAT_BPOSITION = 8,
0340 ESTAT_MASK = 0xF,
0341
0342 TTS_WPOSITION = 0,
0343 TTS_BPOSITION = 4,
0344 TTS_MASK = 0xF,
0345
0346 CRC_WPOSITION = 0,
0347 CRC_BPOSITION = 16,
0348 CRC_MASK = 0xFFFF,
0349 TLENGTH_WPOSITION = 1,
0350 TLENGTH_BPOSITION = 0,
0351 TLENGTH_MASK = 0xFFFFFF,
0352 EOE_WPOSITION = 1,
0353 EOE_BPOSITION = 28,
0354 EOE_MASK = 0xF
0355 };
0356 };
0357
0358 #endif