File indexing completed on 2024-04-06 12:04:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
0017
0018
0019 #include <iomanip>
0020 #include <bitset>
0021 #include <cstdint>
0022
0023
0024
0025 #include "FWCore/Utilities/interface/EDMException.h"
0026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0027
0028
0029 L1GlobalTriggerEvmReadoutRecord::L1GlobalTriggerEvmReadoutRecord() {
0030 m_gtfeWord = L1GtfeExtWord();
0031 m_tcsWord = L1TcsWord();
0032
0033
0034 m_gtFdlWord.reserve(1);
0035 }
0036
0037 L1GlobalTriggerEvmReadoutRecord::L1GlobalTriggerEvmReadoutRecord(int NumberBxInEvent) {
0038 m_gtfeWord = L1GtfeExtWord();
0039 m_tcsWord = L1TcsWord();
0040
0041 m_gtFdlWord.reserve(NumberBxInEvent);
0042 m_gtFdlWord.assign(NumberBxInEvent, L1GtFdlWord());
0043
0044
0045 int minBxInEvent = (NumberBxInEvent + 1) / 2 - NumberBxInEvent;
0046
0047
0048
0049
0050 for (int iFdl = 0; iFdl < NumberBxInEvent; ++iFdl) {
0051 int iBxInEvent = minBxInEvent + iFdl;
0052 m_gtFdlWord[iFdl].setBxInEvent(iBxInEvent);
0053 }
0054 }
0055
0056 L1GlobalTriggerEvmReadoutRecord::L1GlobalTriggerEvmReadoutRecord(const int numberBxInEvent, const int numberFdlBoards) {
0057
0058 m_gtfeWord = L1GtfeExtWord();
0059
0060
0061 m_tcsWord = L1TcsWord();
0062
0063
0064 if (numberFdlBoards > 0) {
0065 m_gtFdlWord.reserve(numberBxInEvent);
0066 }
0067 }
0068
0069
0070 L1GlobalTriggerEvmReadoutRecord::L1GlobalTriggerEvmReadoutRecord(const L1GlobalTriggerEvmReadoutRecord& result) {
0071 m_gtfeWord = result.m_gtfeWord;
0072 m_tcsWord = result.m_tcsWord;
0073 m_gtFdlWord = result.m_gtFdlWord;
0074 }
0075
0076
0077 L1GlobalTriggerEvmReadoutRecord::~L1GlobalTriggerEvmReadoutRecord() {
0078
0079 }
0080
0081
0082 L1GlobalTriggerEvmReadoutRecord& L1GlobalTriggerEvmReadoutRecord::operator=(
0083 const L1GlobalTriggerEvmReadoutRecord& result) {
0084 if (this != &result) {
0085 m_gtfeWord = result.m_gtfeWord;
0086 m_tcsWord = result.m_tcsWord;
0087 m_gtFdlWord = result.m_gtFdlWord;
0088 }
0089
0090 return *this;
0091 }
0092
0093
0094 bool L1GlobalTriggerEvmReadoutRecord::operator==(const L1GlobalTriggerEvmReadoutRecord& result) const {
0095 if (m_gtfeWord != result.m_gtfeWord) {
0096 return false;
0097 }
0098
0099 if (m_tcsWord != result.m_tcsWord) {
0100 return false;
0101 }
0102
0103 if (m_gtFdlWord != result.m_gtFdlWord) {
0104 return false;
0105 }
0106
0107
0108 return true;
0109 }
0110
0111
0112 bool L1GlobalTriggerEvmReadoutRecord::operator!=(const L1GlobalTriggerEvmReadoutRecord& result) const {
0113 return !(result == *this);
0114 }
0115
0116
0117
0118
0119 const bool L1GlobalTriggerEvmReadoutRecord::decision(int bxInEventValue) const {
0120 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0121 if ((*itBx).bxInEvent() == bxInEventValue) {
0122 return (*itBx).finalOR();
0123 }
0124 }
0125
0126
0127
0128 throw cms::Exception("NotFound") << "\nError: requested GtFdlWord for bx = " << bxInEventValue << " does not exist.\n"
0129 << "Can not return global decision for this bx!\n"
0130 << std::endl;
0131
0132 return false;
0133 }
0134
0135 const DecisionWord L1GlobalTriggerEvmReadoutRecord::decisionWord(int bxInEventValue) const {
0136 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0137 if ((*itBx).bxInEvent() == bxInEventValue) {
0138 return (*itBx).gtDecisionWord();
0139 }
0140 }
0141
0142
0143
0144 throw cms::Exception("NotFound") << "\nError: requested GtFdlWord for bx = " << bxInEventValue << " does not exist.\n"
0145 << "Can not return decision word for this bx!\n"
0146 << std::endl;
0147
0148 DecisionWord dW;
0149 return dW;
0150 }
0151
0152
0153 const bool L1GlobalTriggerEvmReadoutRecord::decision() const {
0154 int bxInEventL1Accept = 0;
0155 return decision(bxInEventL1Accept);
0156 }
0157
0158 const DecisionWord L1GlobalTriggerEvmReadoutRecord::decisionWord() const {
0159 int bxInEventL1Accept = 0;
0160 return decisionWord(bxInEventL1Accept);
0161 }
0162
0163
0164
0165 void L1GlobalTriggerEvmReadoutRecord::setDecision(bool t, int bxInEventValue) {
0166 for (std::vector<L1GtFdlWord>::iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0167 if ((*itBx).bxInEvent() == bxInEventValue) {
0168 (*itBx).setFinalOR(static_cast<uint16_t>(t));
0169 }
0170 }
0171
0172
0173
0174 throw cms::Exception("NotFound") << "\nError: requested GtFdlWord for bx = " << bxInEventValue << " does not exist.\n"
0175 << "Can not set global decision for this bx!\n"
0176 << std::endl;
0177 }
0178
0179 void L1GlobalTriggerEvmReadoutRecord::setDecisionWord(const DecisionWord& decisionWordValue, int bxInEventValue) {
0180 for (std::vector<L1GtFdlWord>::iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0181 if ((*itBx).bxInEvent() == bxInEventValue) {
0182 (*itBx).setGtDecisionWord(decisionWordValue);
0183 }
0184 }
0185
0186
0187
0188 throw cms::Exception("NotFound") << "\nError: requested GtFdlWord for bx = " << bxInEventValue << " does not exist.\n"
0189 << "Can not set decision word for this bx!\n"
0190 << std::endl;
0191 }
0192
0193
0194 void L1GlobalTriggerEvmReadoutRecord::setDecision(bool t) {
0195 int bxInEventL1Accept = 0;
0196 setDecision(t, bxInEventL1Accept);
0197 }
0198
0199 void L1GlobalTriggerEvmReadoutRecord::setDecisionWord(const DecisionWord& decisionWordValue) {
0200 int bxInEventL1Accept = 0;
0201 setDecisionWord(decisionWordValue, bxInEventL1Accept);
0202 }
0203
0204
0205 void L1GlobalTriggerEvmReadoutRecord::printGtDecision(std::ostream& myCout, int bxInEventValue) const {
0206 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0207 if ((*itBx).bxInEvent() == bxInEventValue) {
0208 myCout << "\nL1 Global Trigger Record: " << std::endl;
0209
0210 myCout << "\t Bunch cross " << bxInEventValue << std::endl
0211 << "\t Global Decision = " << std::setw(5) << (*itBx).globalDecision() << std::endl
0212 << "\t Decision word (bitset style) = ";
0213
0214 (*itBx).printGtDecisionWord(myCout);
0215 }
0216 }
0217
0218 myCout << std::endl;
0219 }
0220
0221 void L1GlobalTriggerEvmReadoutRecord::printGtDecision(std::ostream& myCout) const {
0222 int bxInEventL1Accept = 0;
0223 printGtDecision(myCout, bxInEventL1Accept);
0224 }
0225
0226
0227 void L1GlobalTriggerEvmReadoutRecord::printTechnicalTrigger(std::ostream& myCout, int bxInEventValue) const {
0228 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0229 if ((*itBx).bxInEvent() == bxInEventValue) {
0230 myCout << "\nL1 Global Trigger Record: " << std::endl;
0231
0232 myCout << "\t Bunch cross " << bxInEventValue << std::endl << "\t Technical Trigger word (bitset style) = ";
0233
0234 (*itBx).printGtTechnicalTriggerWord(myCout);
0235 }
0236 }
0237
0238 myCout << std::endl;
0239 }
0240
0241 void L1GlobalTriggerEvmReadoutRecord::printTechnicalTrigger(std::ostream& myCout) const {
0242 int bxInEventL1Accept = 0;
0243 printTechnicalTrigger(myCout, bxInEventL1Accept);
0244 }
0245
0246
0247
0248
0249 const L1GtfeExtWord L1GlobalTriggerEvmReadoutRecord::gtfeWord() const { return m_gtfeWord; }
0250
0251 void L1GlobalTriggerEvmReadoutRecord::setGtfeWord(const L1GtfeExtWord& gtfeWordValue) { m_gtfeWord = gtfeWordValue; }
0252
0253
0254 const L1TcsWord L1GlobalTriggerEvmReadoutRecord::tcsWord() const { return m_tcsWord; }
0255
0256 void L1GlobalTriggerEvmReadoutRecord::setTcsWord(const L1TcsWord& tcsWordValue) { m_tcsWord = tcsWordValue; }
0257
0258
0259 const L1GtFdlWord L1GlobalTriggerEvmReadoutRecord::gtFdlWord(int bxInEventValue) const {
0260 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0261 if ((*itBx).bxInEvent() == bxInEventValue) {
0262 return (*itBx);
0263 }
0264 }
0265
0266
0267
0268 throw cms::Exception("NotFound") << "\nError: requested L1GtFdlWord for bx = " << bxInEventValue
0269 << " does not exist.\n"
0270 << std::endl;
0271
0272
0273 return L1GtFdlWord();
0274 }
0275
0276 const L1GtFdlWord L1GlobalTriggerEvmReadoutRecord::gtFdlWord() const {
0277 int bxInEventL1Accept = 0;
0278 return gtFdlWord(bxInEventL1Accept);
0279 }
0280
0281 void L1GlobalTriggerEvmReadoutRecord::setGtFdlWord(const L1GtFdlWord& gtFdlWordValue, int bxInEventValue) {
0282
0283 for (std::vector<L1GtFdlWord>::iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
0284 if ((*itBx).bxInEvent() == bxInEventValue) {
0285 *itBx = gtFdlWordValue;
0286 LogDebug("L1GlobalTriggerEvmReadoutRecord") << "Replacing L1GtFdlWord for bunch bx = " << bxInEventValue << "\n"
0287 << std::endl;
0288 return;
0289 }
0290 }
0291
0292
0293
0294
0295 throw cms::Exception("NotFound") << "\nError: Cannot set L1GtFdlWord for bx = " << bxInEventValue << std::endl;
0296 }
0297
0298 void L1GlobalTriggerEvmReadoutRecord::setGtFdlWord(const L1GtFdlWord& gtFdlWordValue) {
0299
0300 m_gtFdlWord.push_back(gtFdlWordValue);
0301 }
0302
0303
0304
0305
0306 void L1GlobalTriggerEvmReadoutRecord::reset() {
0307
0308 }
0309
0310
0311 void L1GlobalTriggerEvmReadoutRecord::print(std::ostream& myCout) const {
0312 myCout << "\n L1GlobalTriggerEvmReadoutRecord::print \n" << std::endl;
0313
0314 m_gtfeWord.print(myCout);
0315
0316 m_tcsWord.print(myCout);
0317
0318 for (std::vector<L1GtFdlWord>::const_iterator itFdl = m_gtFdlWord.begin(); itFdl != m_gtFdlWord.end(); ++itFdl) {
0319 itFdl->print(myCout);
0320 }
0321 }
0322
0323
0324 std::ostream& operator<<(std::ostream& s, const L1GlobalTriggerEvmReadoutRecord& result) {
0325
0326 s << "Not available yet - sorry";
0327
0328 return s;
0329 }