File indexing completed on 2024-04-06 12:04:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "DataFormats/L1GlobalTrigger/interface/L1TcsWord.h"
0017
0018
0019 #include <iomanip>
0020
0021
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0024
0025
0026
0027
0028
0029
0030 L1TcsWord::L1TcsWord() {
0031 m_boardId = 0;
0032 m_bxNr = 0;
0033 m_daqNr = 0;
0034 m_triggerType = 0;
0035 m_status = 0;
0036 m_luminositySegmentNr = 0;
0037 m_partRunNr = 0;
0038 m_assignedPartitions = 0;
0039 m_partTrigNr = 0;
0040 m_eventNr = 0;
0041 m_orbitNr = 0;
0042 }
0043
0044
0045 L1TcsWord::L1TcsWord(cms_uint16_t boardIdValue,
0046 cms_uint16_t bxNrValue,
0047 cms_uint16_t daqNrValue,
0048 cms_uint16_t triggerTypeValue,
0049 cms_uint16_t statusValue,
0050 cms_uint16_t luminositySegmentNrValue,
0051 cms_uint32_t partRunNrValue,
0052 cms_uint32_t assignedPartitionsValue,
0053 cms_uint32_t partTrigNrValue,
0054 cms_uint32_t eventNrValue,
0055 cms_uint64_t orbitNrValue) {
0056 m_boardId = boardIdValue;
0057 m_bxNr = bxNrValue;
0058 m_daqNr = daqNrValue;
0059 m_triggerType = triggerTypeValue;
0060 m_status = statusValue;
0061 m_luminositySegmentNr = luminositySegmentNrValue;
0062 m_partRunNr = partRunNrValue;
0063 m_assignedPartitions = assignedPartitionsValue;
0064 m_partTrigNr = partTrigNrValue;
0065 m_eventNr = eventNrValue;
0066 m_orbitNr = orbitNrValue;
0067 }
0068
0069
0070 L1TcsWord::~L1TcsWord() {
0071
0072 }
0073
0074
0075 bool L1TcsWord::operator==(const L1TcsWord& result) const {
0076 if (m_boardId != result.m_boardId) {
0077 return false;
0078 }
0079
0080 if (m_bxNr != result.m_bxNr) {
0081 return false;
0082 }
0083
0084 if (m_daqNr != result.m_daqNr) {
0085 return false;
0086 }
0087
0088 if (m_triggerType != result.m_triggerType) {
0089 return false;
0090 }
0091
0092 if (m_status != result.m_status) {
0093 return false;
0094 }
0095
0096 if (m_luminositySegmentNr != result.m_luminositySegmentNr) {
0097 return false;
0098 }
0099
0100 if (m_partRunNr != result.m_partRunNr) {
0101 return false;
0102 }
0103
0104 if (m_assignedPartitions != result.m_assignedPartitions) {
0105 return false;
0106 }
0107
0108 if (m_partTrigNr != result.m_partTrigNr) {
0109 return false;
0110 }
0111
0112 if (m_eventNr != result.m_eventNr) {
0113 return false;
0114 }
0115
0116 if (m_orbitNr != result.m_orbitNr) {
0117 return false;
0118 }
0119
0120
0121 return true;
0122 }
0123
0124
0125 bool L1TcsWord::operator!=(const L1TcsWord& result) const { return !(result == *this); }
0126
0127
0128
0129
0130 void L1TcsWord::setBoardId(const cms_uint64_t& word64) { m_boardId = (word64 & BoardIdMask) >> BoardIdShift; }
0131
0132
0133
0134 void L1TcsWord::setBoardIdWord64(cms_uint64_t& word64, int iWord) {
0135 if (iWord == BoardIdWord) {
0136 word64 = word64 | (static_cast<cms_uint64_t>(m_boardId) << BoardIdShift);
0137 }
0138 }
0139
0140
0141 void L1TcsWord::setBxNr(const cms_uint64_t& word64) { m_bxNr = (word64 & BxNrMask) >> BxNrShift; }
0142
0143
0144
0145 void L1TcsWord::setBxNrWord64(cms_uint64_t& word64, int iWord) {
0146 if (iWord == BxNrWord) {
0147 word64 = word64 | (static_cast<cms_uint64_t>(m_bxNr) << BxNrShift);
0148 }
0149 }
0150
0151
0152 void L1TcsWord::setDaqNr(const cms_uint64_t& word64) { m_daqNr = (word64 & DaqNrMask) >> DaqNrShift; }
0153
0154
0155
0156 void L1TcsWord::setDaqNrWord64(cms_uint64_t& word64, int iWord) {
0157 if (iWord == DaqNrWord) {
0158 word64 = word64 | (static_cast<cms_uint64_t>(m_daqNr) << DaqNrShift);
0159 }
0160 }
0161
0162
0163 void L1TcsWord::setTriggerType(const cms_uint64_t& word64) {
0164 m_triggerType = (word64 & TriggerTypeMask) >> TriggerTypeShift;
0165 }
0166
0167
0168
0169 void L1TcsWord::setTriggerTypeWord64(cms_uint64_t& word64, int iWord) {
0170 if (iWord == TriggerTypeWord) {
0171 word64 = word64 | (static_cast<cms_uint64_t>(m_triggerType) << TriggerTypeShift);
0172 }
0173 }
0174
0175
0176 void L1TcsWord::setStatus(const cms_uint64_t& word64) { m_status = (word64 & StatusMask) >> StatusShift; }
0177
0178
0179
0180 void L1TcsWord::setStatusWord64(cms_uint64_t& word64, int iWord) {
0181 if (iWord == StatusWord) {
0182 word64 = word64 | (static_cast<cms_uint64_t>(m_status) << StatusShift);
0183 }
0184 }
0185
0186
0187 void L1TcsWord::setLuminositySegmentNr(const cms_uint64_t& word64) {
0188 m_luminositySegmentNr = (word64 & LuminositySegmentNrMask) >> LuminositySegmentNrShift;
0189 }
0190
0191
0192
0193 void L1TcsWord::setLuminositySegmentNrWord64(cms_uint64_t& word64, int iWord) {
0194 if (iWord == LuminositySegmentNrWord) {
0195 word64 = word64 | (static_cast<cms_uint64_t>(m_luminositySegmentNr) << LuminositySegmentNrShift);
0196 }
0197 }
0198
0199
0200 void L1TcsWord::setPartRunNr(const cms_uint64_t& word64) { m_partRunNr = (word64 & PartRunNrMask) >> PartRunNrShift; }
0201
0202
0203
0204 void L1TcsWord::setPartRunNrWord64(cms_uint64_t& word64, int iWord) {
0205 if (iWord == PartRunNrWord) {
0206 word64 = word64 | (static_cast<cms_uint64_t>(m_partRunNr) << PartRunNrShift);
0207 }
0208 }
0209
0210
0211 void L1TcsWord::setAssignedPartitions(const cms_uint64_t& word64) {
0212 m_assignedPartitions = (word64 & AssignedPartitionsMask) >> AssignedPartitionsShift;
0213 }
0214
0215
0216
0217 void L1TcsWord::setAssignedPartitionsWord64(cms_uint64_t& word64, int iWord) {
0218 if (iWord == AssignedPartitionsWord) {
0219 word64 = word64 | (static_cast<cms_uint64_t>(m_assignedPartitions) << AssignedPartitionsShift);
0220 }
0221 }
0222
0223
0224 void L1TcsWord::setPartTrigNr(const cms_uint64_t& word64) {
0225 m_partTrigNr = (word64 & PartTrigNrMask) >> PartTrigNrShift;
0226 }
0227
0228
0229
0230 void L1TcsWord::setPartTrigNrWord64(cms_uint64_t& word64, int iWord) {
0231 if (iWord == PartTrigNrWord) {
0232 word64 = word64 | (static_cast<cms_uint64_t>(m_partTrigNr) << PartTrigNrShift);
0233 }
0234 }
0235
0236
0237 void L1TcsWord::setEventNr(const cms_uint64_t& word64) { m_eventNr = (word64 & EventNrMask) >> EventNrShift; }
0238
0239
0240
0241 void L1TcsWord::setEventNrWord64(cms_uint64_t& word64, int iWord) {
0242 if (iWord == EventNrWord) {
0243 word64 = word64 | (static_cast<cms_uint64_t>(m_eventNr) << EventNrShift);
0244 }
0245 }
0246
0247
0248 void L1TcsWord::setOrbitNrFrom(const cms_uint64_t& word64) { m_orbitNr = (word64 & OrbitNrMask) >> OrbitNrShift; }
0249
0250
0251
0252 void L1TcsWord::setOrbitNrWord64(cms_uint64_t& word64, int iWord) {
0253 if (iWord == OrbitNrWord) {
0254 word64 = word64 | (static_cast<cms_uint64_t>(m_orbitNr) << OrbitNrShift);
0255 }
0256 }
0257
0258
0259 void L1TcsWord::reset() {
0260 m_boardId = 0;
0261 m_bxNr = 0;
0262 m_daqNr = 0;
0263 m_triggerType = 0;
0264 m_status = 0;
0265 m_luminositySegmentNr = 0;
0266 m_partRunNr = 0;
0267 m_assignedPartitions = 0;
0268 m_partTrigNr = 0;
0269 m_eventNr = 0;
0270 m_orbitNr = 0;
0271 }
0272
0273
0274 void L1TcsWord::print(std::ostream& myCout) const {
0275 myCout << "\n L1TcsWord::print \n" << std::endl;
0276
0277 int iWord = 0;
0278
0279 myCout << "\n Word " << iWord << std::endl;
0280
0281 myCout << " Board Id: " << std::hex << " hex: "
0282 << " " << std::setw(4) << std::setfill('0') << m_boardId << std::setfill(' ') << std::dec
0283 << " dec: " << m_boardId << std::endl;
0284
0285 myCout << " BxNr: " << std::hex << " hex: "
0286 << " " << std::setw(3) << std::setfill('0') << m_bxNr << std::setfill(' ') << std::dec
0287 << " dec: " << m_bxNr << std::endl;
0288
0289 myCout << " DaqNr: " << std::hex << " hex: "
0290 << " " << std::setw(1) << m_daqNr << std::dec << " dec: " << m_daqNr << std::endl;
0291
0292 myCout << " TriggerType: " << std::hex << " hex: "
0293 << " " << std::setw(1) << m_triggerType << std::dec << " dec: " << m_triggerType << std::endl;
0294
0295 myCout << " Status: " << std::hex << " hex: "
0296 << " " << std::setw(1) << m_status << std::dec << " dec: " << m_status << std::endl;
0297
0298 myCout << " LuminositySegmentNr: " << std::hex << " hex: "
0299 << " " << std::setw(4) << m_luminositySegmentNr << std::dec << " dec: " << m_luminositySegmentNr
0300 << std::endl;
0301
0302 iWord++;
0303 myCout << "\n Word " << iWord << std::endl;
0304
0305 myCout << " PartRunNr: " << std::hex << " hex: "
0306 << " " << std::setw(8) << std::setfill('0') << m_partRunNr << std::setfill(' ') << std::dec
0307 << " dec: " << m_partRunNr << std::endl;
0308
0309 myCout << " AssignedPartitions: " << std::hex << " hex: "
0310 << " " << std::setw(8) << std::setfill('0') << m_assignedPartitions << std::setfill(' ') << std::dec
0311 << " dec: " << m_assignedPartitions << std::endl;
0312
0313 iWord++;
0314 myCout << "\n Word " << iWord << std::endl;
0315
0316 myCout << " PartTrigNr: " << std::hex << " hex: "
0317 << " " << std::setw(8) << std::setfill('0') << m_partTrigNr << std::setfill(' ') << std::dec
0318 << " dec: " << m_partTrigNr << std::endl;
0319
0320 myCout << " EventNr: " << std::hex << " hex: "
0321 << " " << std::setw(8) << std::setfill('0') << m_eventNr << std::setfill(' ') << std::dec
0322 << " dec: " << m_eventNr << std::endl;
0323
0324 iWord++;
0325 myCout << "\n Word " << iWord << std::endl;
0326
0327 myCout << " OrbitNr: " << std::hex << " hex: "
0328 << "" << std::setw(12) << std::setfill('0') << m_orbitNr << std::setfill(' ') << std::dec
0329 << " dec: " << m_orbitNr << std::endl;
0330
0331 iWord++;
0332 myCout << "\n Word " << iWord << std::endl;
0333
0334 myCout << " Empty word " << std::endl;
0335 }
0336
0337
0338
0339 void L1TcsWord::unpack(const unsigned char* tcsPtr) {
0340 LogDebug("L1GtTcsWord") << "\nUnpacking TCS block.\n" << std::endl;
0341
0342 const cms_uint64_t* payload = reinterpret_cast<cms_uint64_t const*>(tcsPtr);
0343
0344 setBoardId(payload[BoardIdWord]);
0345 setBxNr(payload[BxNrWord]);
0346 setDaqNr(payload[DaqNrWord]);
0347 setTriggerType(payload[TriggerTypeWord]);
0348 setStatus(payload[StatusWord]);
0349 setLuminositySegmentNr(payload[LuminositySegmentNrWord]);
0350
0351 setPartRunNr(payload[PartRunNrWord]);
0352 setAssignedPartitions(payload[AssignedPartitionsWord]);
0353
0354 setPartTrigNr(payload[PartTrigNrWord]);
0355 setEventNr(payload[EventNrWord]);
0356
0357 setOrbitNrFrom(payload[OrbitNrWord]);
0358
0359 if (edm::isDebugEnabled()) {
0360 for (int iWord = 0; iWord < BlockSize; ++iWord) {
0361 LogTrace("L1GtTcsWord") << std::setw(4) << iWord << " " << std::hex << std::setfill('0') << std::setw(16)
0362 << payload[iWord] << std::dec << std::setfill(' ') << std::endl;
0363 }
0364 }
0365 }
0366
0367
0368
0369
0370
0371
0372 const int L1TcsWord::BlockSize = 5;
0373
0374
0375
0376
0377 const int L1TcsWord::BoardIdWord = 0;
0378 const int L1TcsWord::BxNrWord = 0;
0379 const int L1TcsWord::DaqNrWord = 0;
0380 const int L1TcsWord::TriggerTypeWord = 0;
0381 const int L1TcsWord::StatusWord = 0;
0382 const int L1TcsWord::LuminositySegmentNrWord = 0;
0383
0384
0385 const cms_uint64_t L1TcsWord::BoardIdMask = 0xFFFF000000000000ULL;
0386 const cms_uint64_t L1TcsWord::BxNrMask = 0x00000FFF00000000ULL;
0387 const cms_uint64_t L1TcsWord::DaqNrMask = 0x000000000F000000ULL;
0388 const cms_uint64_t L1TcsWord::TriggerTypeMask = 0x0000000000F00000ULL;
0389 const cms_uint64_t L1TcsWord::StatusMask = 0x00000000000F0000ULL;
0390 const cms_uint64_t L1TcsWord::LuminositySegmentNrMask = 0x000000000000FFFFULL;
0391
0392
0393 const int L1TcsWord::BoardIdShift = 48;
0394 const int L1TcsWord::BxNrShift = 32;
0395 const int L1TcsWord::DaqNrShift = 24;
0396 const int L1TcsWord::TriggerTypeShift = 20;
0397 const int L1TcsWord::StatusShift = 16;
0398 const int L1TcsWord::LuminositySegmentNrShift = 0;
0399
0400
0401
0402 const int L1TcsWord::PartRunNrWord = 1;
0403 const int L1TcsWord::AssignedPartitionsWord = 1;
0404
0405 const cms_uint64_t L1TcsWord::PartRunNrMask = 0xFFFFFFFF00000000ULL;
0406 const cms_uint64_t L1TcsWord::AssignedPartitionsMask = 0x00000000FFFFFFFFULL;
0407
0408 const int L1TcsWord::PartRunNrShift = 32;
0409 const int L1TcsWord::AssignedPartitionsShift = 0;
0410
0411
0412
0413 const int L1TcsWord::PartTrigNrWord = 2;
0414 const int L1TcsWord::EventNrWord = 2;
0415
0416 const cms_uint64_t L1TcsWord::PartTrigNrMask = 0xFFFFFFFF00000000ULL;
0417 const cms_uint64_t L1TcsWord::EventNrMask = 0x00000000FFFFFFFFULL;
0418
0419 const int L1TcsWord::PartTrigNrShift = 32;
0420 const int L1TcsWord::EventNrShift = 0;
0421
0422
0423
0424 const int L1TcsWord::OrbitNrWord = 3;
0425
0426 const cms_uint64_t L1TcsWord::OrbitNrMask = 0x0000FFFFFFFFFFFFULL;
0427
0428 const int L1TcsWord::OrbitNrShift = 0;
0429
0430
0431
0432