50 const std::vector<edm::InputTag> &m_technicalTriggersInputTags,
61 m_candJetCounts(nullptr),
62 m_candHfBitCounts(nullptr),
63 m_candHfRingEtSums(nullptr),
80 for (std::vector<edm::InputTag>::const_iterator it = m_technicalTriggersInputTags.begin();
81 it != m_technicalTriggersInputTags.end();
102 const int nrL1CenJet,
103 const int nrL1ForJet,
104 const int nrL1TauJet,
105 const int numberTechnicalTriggers) {
120 const int iBxInEvent,
121 const bool receiveNoIsoEG,
122 const int nrL1NoIsoEG,
123 const bool receiveIsoEG,
125 const bool receiveCenJet,
126 const int nrL1CenJet,
127 const bool receiveForJet,
128 const int nrL1ForJet,
129 const bool receiveTauJet,
130 const int nrL1TauJet,
131 const bool receiveETM,
132 const bool receiveETT,
133 const bool receiveHTT,
134 const bool receiveHTM,
135 const bool receiveJetCounts,
136 const bool receiveHfBitCounts,
137 const bool receiveHfRingEtSums) {
146 std::ostringstream warningsStream;
149 if (receiveNoIsoEG) {
152 iEvent.getByLabel(caloGctInputTag.
label(),
"nonIsoEm", emCands);
155 if (warningEnabled) {
156 warningsStream <<
"\nWarning: L1GctEmCandCollection with input label " << caloGctInputTag.
label()
157 <<
" and instance \"nonIsoEm\" \n"
158 <<
"requested in configuration, but not found in the event.\n"
162 for (L1GctEmCandCollection::const_iterator it = emCands->begin(); it != emCands->end(); it++) {
163 if ((*it).bx() == iBxInEvent) {
164 (*m_candL1NoIsoEG).push_back(&(*it));
174 iEvent.getByLabel(caloGctInputTag.
label(),
"isoEm", isoEmCands);
177 if (warningEnabled) {
178 warningsStream <<
"\nWarning: L1GctEmCandCollection with input label " << caloGctInputTag.
label()
179 <<
" and instance \"isoEm\" \n"
180 <<
"requested in configuration, but not found in the event.\n"
184 for (L1GctEmCandCollection::const_iterator it = isoEmCands->begin(); it != isoEmCands->end(); it++) {
185 if ((*it).bx() == iBxInEvent) {
186 (*m_candL1IsoEG).push_back(&(*it));
196 iEvent.getByLabel(caloGctInputTag.
label(),
"cenJets", cenJets);
199 if (warningEnabled) {
200 warningsStream <<
"\nWarning: L1GctJetCandCollection with input label " << caloGctInputTag.
label()
201 <<
" and instance \"cenJets\" \n"
202 <<
"requested in configuration, but not found in the event.\n"
206 for (L1GctJetCandCollection::const_iterator it = cenJets->begin(); it != cenJets->end(); it++) {
207 if ((*it).bx() == iBxInEvent) {
208 (*m_candL1CenJet).push_back(&(*it));
218 iEvent.getByLabel(caloGctInputTag.
label(),
"forJets", forJets);
221 if (warningEnabled) {
222 warningsStream <<
"\nWarning: L1GctJetCandCollection with input label " << caloGctInputTag.
label()
223 <<
" and instance \"forJets\" \n"
224 <<
"requested in configuration, but not found in the event.\n"
228 for (L1GctJetCandCollection::const_iterator it = forJets->begin(); it != forJets->end(); it++) {
229 if ((*it).bx() == iBxInEvent) {
230 (*m_candL1ForJet).push_back(&(*it));
240 iEvent.getByLabel(caloGctInputTag.
label(),
"tauJets", tauJets);
243 if (warningEnabled) {
244 warningsStream <<
"\nWarning: L1GctJetCandCollection with input label " << caloGctInputTag.
label()
245 <<
" and instance \"tauJets\" \n"
246 <<
"requested in configuration, but not found in the event.\n"
250 for (L1GctJetCandCollection::const_iterator it = tauJets->begin(); it != tauJets->end(); it++) {
251 if ((*it).bx() == iBxInEvent) {
252 (*m_candL1TauJet).push_back(&(*it));
262 iEvent.getByLabel(caloGctInputTag, missEtColl);
265 if (warningEnabled) {
266 warningsStream <<
"\nWarning: L1GctEtMissCollection with input tag " << caloGctInputTag
267 <<
"\nrequested in configuration, but not found in the event.\n"
271 for (L1GctEtMissCollection::const_iterator it = missEtColl->begin(); it != missEtColl->end(); it++) {
272 if ((*it).bx() == iBxInEvent) {
283 iEvent.getByLabel(caloGctInputTag, sumEtColl);
286 if (warningEnabled) {
287 warningsStream <<
"\nWarning: L1GctEtTotalCollection with input tag " << caloGctInputTag
288 <<
"\nrequested in configuration, but not found in the event.\n"
292 for (L1GctEtTotalCollection::const_iterator it = sumEtColl->begin(); it != sumEtColl->end(); it++) {
293 if ((*it).bx() == iBxInEvent) {
304 iEvent.getByLabel(caloGctInputTag, sumHtColl);
307 if (warningEnabled) {
308 warningsStream <<
"\nWarning: L1GctEtHadCollection with input tag " << caloGctInputTag
309 <<
"\nrequested in configuration, but not found in the event.\n"
313 for (L1GctEtHadCollection::const_iterator it = sumHtColl->begin(); it != sumHtColl->end(); it++) {
314 if ((*it).bx() == iBxInEvent) {
325 iEvent.getByLabel(caloGctInputTag, missHtColl);
328 if (warningEnabled) {
329 warningsStream <<
"\nWarning: L1GctHtMissCollection with input tag " << caloGctInputTag
330 <<
"\nrequested in configuration, but not found in the event.\n"
334 for (L1GctHtMissCollection::const_iterator it = missHtColl->begin(); it != missHtColl->end(); it++) {
335 if ((*it).bx() == iBxInEvent) {
344 if (receiveJetCounts) {
346 iEvent.getByLabel(caloGctInputTag, jetCountColl);
349 if (warningEnabled) {
350 warningsStream <<
"\nWarning: L1GctJetCountsCollection with input tag " << caloGctInputTag
351 <<
"\nrequested in configuration, but not found in the event.\n"
355 for (L1GctJetCountsCollection::const_iterator it = jetCountColl->begin(); it != jetCountColl->end(); it++) {
356 if ((*it).bx() == iBxInEvent) {
365 if (receiveHfBitCounts) {
367 iEvent.getByLabel(caloGctInputTag, hfBitCountsColl);
369 if (!hfBitCountsColl.
isValid()) {
370 if (warningEnabled) {
371 warningsStream <<
"\nWarning: L1GctHFBitCountsCollection with input tag " << caloGctInputTag
372 <<
"\nrequested in configuration, but not found in the event.\n"
376 for (L1GctHFBitCountsCollection::const_iterator it = hfBitCountsColl->begin(); it != hfBitCountsColl->end();
378 if ((*it).bx() == iBxInEvent) {
388 if (receiveHfRingEtSums) {
390 iEvent.getByLabel(caloGctInputTag, hfRingEtSums);
393 if (warningEnabled) {
394 warningsStream <<
"\nWarning: L1GctHFRingEtSumsCollection with input tag " << caloGctInputTag
395 <<
"\nrequested in configuration, but not found in the event.\n"
399 for (L1GctHFRingEtSumsCollection::const_iterator it = hfRingEtSums->begin(); it != hfRingEtSums->end(); it++) {
400 if ((*it).bx() == iBxInEvent) {
410 if (warningsStream.tellp() > 0) {
416 LogDebug(
"L1GlobalTrigger") <<
"\n**** L1GlobalTriggerPSB receiving calorimeter data for BxInEvent "
418 << iBxInEvent <<
"\n from " << caloGctInputTag <<
"\n"
428 const int iBxInEvent,
429 const bool receiveCastor,
430 const bool readFromPsb) {
473 const int iBxInEvent,
474 const bool receiveBptx,
475 const bool readFromPsb) {}
481 const std::vector<edm::InputTag> &externalInputTags,
482 const int iBxInEvent,
483 const bool receiveExternal,
484 const bool readFromPsb) {}
490 const std::vector<edm::InputTag> &technicalTriggersInputTags,
491 const int iBxInEvent,
492 const bool receiveTechTr,
493 const int nrL1TechTr) {
494 std::ostringstream warningsStream;
505 for (std::vector<edm::InputTag>::const_iterator it = technicalTriggersInputTags.begin();
506 it != technicalTriggersInputTags.end();
509 iEvent.getByLabel((*it), techTrigRecord);
511 if (!techTrigRecord.
isValid()) {
512 if (warningEnabled) {
513 warningsStream <<
"\nWarning: L1GtTechnicalTriggerRecord with input tag " << (*it)
514 <<
"\nrequested in configuration, but not found in the event.\n"
518 const std::vector<L1GtTechnicalTrigger> &ttVec = techTrigRecord->
gtTechnicalTrigger();
519 size_t ttVecSize = ttVec.size();
521 for (
size_t iTT = 0; iTT < ttVecSize; ++iTT) {
523 int ttBxInEvent = ttBxRecord.
bxInEvent();
525 if (ttBxInEvent == iBxInEvent) {
532 LogTrace(
"L1GlobalTrigger") <<
"Add for BxInEvent " << iBxInEvent <<
" the technical trigger produced by "
534 <<
" , bit number " << ttBitNumber <<
" and result " << ttResult << std::endl;
543 if (warningsStream.tellp() > 0) {
549 LogDebug(
"L1GlobalTrigger") <<
"\n**** L1GlobalTriggerPSB receiving technical triggers: " << std::endl;
554 std::ostringstream myCout;
559 myCout << (*ritBit ?
'1' :
'0');
561 if ((((iBit + 1) % 16) == (sizeW64 % 16)) && (iBit != 63)) {
568 LogTrace(
"L1GlobalTrigger") << myCout.str() <<
"\n" << std::endl;
574 const uint16_t &activeBoardsGtDaq,
575 const int recordLength0,
576 const int recordLength1,
577 const unsigned int altNrBxBoardDaq,
578 const std::vector<L1GtBoard> &boardMaps,
579 const int iBxInEvent,
583 int bxCross =
iEvent.bunchCrossing();
584 uint16_t bxCrossHw = 0;
585 if ((bxCross & 0xFFF) == bxCross) {
586 bxCrossHw = static_cast<uint16_t>(bxCross);
590 LogDebug(
"L1GlobalTrigger") <<
"\nBunch cross number [hex] = " << std::hex << bxCross
591 <<
"\n larger than 12 bits. Set to 0! \n"
596 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
601 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
602 int iPosition = itBoard->gtPositionDaqRecord();
604 int iActiveBit = itBoard->gtBitDaqActiveBoards();
605 bool activeBoard =
false;
606 bool writeBoard =
false;
610 if (iActiveBit >= 0) {
611 activeBoard = activeBoardsGtDaq & (1 << iActiveBit);
613 int altNrBxBoard = (altNrBxBoardDaq & (1 << iActiveBit)) >> iActiveBit;
615 if (altNrBxBoard == 1) {
616 recLength = recordLength1;
618 recLength = recordLength0;
621 int lowBxInEvent = (recLength + 1) / 2 - recLength;
622 int uppBxInEvent = (recLength + 1) / 2 - 1;
624 if ((iBxInEvent >= lowBxInEvent) && (iBxInEvent <= uppBxInEvent)) {
644 if (activeBoard && writeBoard && (itBoard->gtBoardType() ==
PSB)) {
648 psbWordValue.
setBoardId(itBoard->gtBoardId());
654 uint16_t bxNrValue = bxCrossHw;
655 psbWordValue.
setBxNr(bxNrValue);
662 uint16_t localBxNrValue = bxCrossHw;
670 std::vector<L1GtPsbQuad> quadInPsb = itBoard->gtQuadInPsb();
671 int nrCables = quadInPsb.size();
673 uint16_t aDataVal = 0;
674 uint16_t bDataVal = 0;
677 for (std::vector<L1GtPsbQuad>::const_iterator itQuad = quadInPsb.begin(); itQuad != quadInPsb.end(); ++itQuad) {
680 int iAB = (nrCables - iCable - 1) * nrObjRow;
692 int bitsPerWord = 16;
701 for (
int i = 0;
i < bitsPerWord; ++
i) {
708 aDataVal = aDataVal | (bitVal <<
i);
711 psbWordValue.
setAData(aDataVal, iAB + iPair);
716 for (
int i = 0;
i < bitsPerWord; ++
i) {
723 bDataVal = bDataVal | (bitVal <<
i);
726 psbWordValue.
setBData(bDataVal, iAB + iPair);
732 for (
int i = 0;
i < bitsPerWord; ++
i) {
739 aDataVal = aDataVal | (bitVal <<
i);
742 psbWordValue.
setAData(aDataVal, iAB + iPair);
746 for (
int i = 0;
i < bitsPerWord; ++
i) {
753 bDataVal = bDataVal | (bitVal <<
i);
756 psbWordValue.
setBData(bDataVal, iAB + iPair);
769 for (
int iPair = 0; iPair < nrObjRow; ++iPair) {
770 if (iPair < recL1NoIsoEG) {
771 aDataVal = (static_cast<const L1GctEmCand *>((*
m_candL1NoIsoEG)[iPair]))->raw();
775 psbWordValue.
setAData(aDataVal, iAB + iPair);
777 if ((iPair + nrObjRow) < recL1NoIsoEG) {
778 bDataVal = (static_cast<const L1GctEmCand *>((*
m_candL1NoIsoEG)[iPair + nrObjRow]))->raw();
782 psbWordValue.
setBData(bDataVal, iAB + iPair);
796 for (
int iPair = 0; iPair < nrObjRow; ++iPair) {
797 if (iPair < recL1IsoEG) {
798 aDataVal = (static_cast<const L1GctEmCand *>((*
m_candL1IsoEG)[iPair]))->raw();
802 psbWordValue.
setAData(aDataVal, iAB + iPair);
804 if ((iPair + nrObjRow) < recL1IsoEG) {
805 bDataVal = (static_cast<const L1GctEmCand *>((*
m_candL1IsoEG)[iPair + nrObjRow]))->raw();
809 psbWordValue.
setBData(bDataVal, iAB + iPair);
824 for (
int iPair = 0; iPair < nrObjRow; ++iPair) {
825 if (iPair < recL1CenJet) {
826 aDataVal = (static_cast<const L1GctJetCand *>((*
m_candL1CenJet)[iPair]))->raw();
830 psbWordValue.
setAData(aDataVal, iAB + iPair);
832 if ((iPair + nrObjRow) < recL1CenJet) {
833 bDataVal = (static_cast<const L1GctJetCand *>((*
m_candL1CenJet)[iPair + nrObjRow]))->raw();
837 psbWordValue.
setBData(bDataVal, iAB + iPair);
851 for (
int iPair = 0; iPair < nrObjRow; ++iPair) {
852 if (iPair < recL1ForJet) {
853 aDataVal = (static_cast<const L1GctJetCand *>((*
m_candL1ForJet)[iPair]))->raw();
857 psbWordValue.
setAData(aDataVal, iAB + iPair);
859 if ((iPair + nrObjRow) < recL1ForJet) {
860 bDataVal = (static_cast<const L1GctJetCand *>((*
m_candL1ForJet)[iPair + nrObjRow]))->raw();
864 psbWordValue.
setBData(bDataVal, iAB + iPair);
879 for (
int iPair = 0; iPair < nrObjRow; ++iPair) {
880 if (iPair < recL1TauJet) {
881 aDataVal = (static_cast<const L1GctJetCand *>((*
m_candL1TauJet)[iPair]))->raw();
885 psbWordValue.
setAData(aDataVal, iAB + iPair);
887 if ((iPair + nrObjRow) < recL1TauJet) {
888 bDataVal = (static_cast<const L1GctJetCand *>((*
m_candL1TauJet)[iPair + nrObjRow]))->raw();
892 psbWordValue.
setBData(bDataVal, iAB + iPair);
923 psbWordValue.
setAData(aDataVal, iAB + iPair);
930 psbWordValue.
setBData(bDataVal, iAB + iPair);
953 psbWordValue.
setAData(aDataVal, iAB + iPair);
966 psbWordValue.
setBData(bDataVal, iAB + iPair);
989 int jetCountsBits = 5;
990 int countsPerWord = 3;
1000 for (
int i = 0;
i < countsPerWord; ++
i) {
1007 for (
int i = 0;
i < countsPerWord; ++
i) {
1013 psbWordValue.
setAData(aDataVal, iAB + iPair);
1014 psbWordValue.
setBData(bDataVal, iAB + iPair);
1022 for (
int i = 0;
i < countsPerWord; ++
i) {
1029 for (
int i = 0;
i < countsPerWord; ++
i) {
1035 psbWordValue.
setAData(aDataVal, iAB + iPair);
1036 psbWordValue.
setBData(bDataVal, iAB + iPair);
1056 int nHfBitCounts = hfBitCounts.
nCounts();
1059 int nHfRingEtSums = hfRingEtSums.
nSums();
1067 int hfPerWord =
sizeof(aDataVal) * 8 / hfBits;
1075 bool aDataFlag =
true;
1076 bool bDataFlag =
false;
1079 for (
int i = 0;
i < nHfBitCounts; ++
i) {
1081 if (iHf < hfPerWord) {
1097 if (iHf < hfPerWord) {
1113 iHf = nHfBitCounts % hfPerWord;
1120 if (aDataFlag && bDataFlag) {
1122 <<
"\n HfBitCounts collection filled aData and bData [" << (iAB + iPair) <<
"]"
1123 <<
"\n HfRingEtSums collection has no space to be written" << std::endl;
1127 for (
int i = 0;
i < nHfRingEtSums; ++
i) {
1129 if (iHf < hfPerWord) {
1145 if (iHf < hfPerWord) {
1161 iHf = nHfRingEtSums % hfPerWord;
1168 psbWordValue.
setAData(aDataVal, iAB + iPair);
1169 psbWordValue.
setBData(bDataVal, iAB + iPair);
1178 if (aDataFlag && bDataFlag) {
1179 LogTrace(
"L1GlobalTrigger") <<
"\n aData and bData [" << (iAB + iPair) <<
"] full"
1180 <<
"\n HfRingEtSums collection has not enough space to be "
1236 LogTrace(
"L1GlobalTrigger") <<
"\nL1GlobalTrigger: GCT data [hex] received by PSBs for BxInEvent = " << iBxInEvent
1240 std::vector<const L1GctCand *>::const_iterator iterConst;
1242 LogTrace(
"L1GlobalTrigger") <<
" GCT NoIsoEG " << std::endl;
1244 LogTrace(
"L1GlobalTrigger") << std::hex <<
"Rank = " << (*iterConst)->rank()
1245 <<
" Eta index = " << (*iterConst)->etaIndex()
1246 <<
" Phi index = " << (*iterConst)->phiIndex() <<
std::dec << std::endl;
1249 LogTrace(
"L1GlobalTrigger") <<
" GCT IsoEG " << std::endl;
1251 LogTrace(
"L1GlobalTrigger") << std::hex <<
"Rank = " << (*iterConst)->rank()
1252 <<
" Eta index = " << (*iterConst)->etaIndex()
1253 <<
" Phi index = " << (*iterConst)->phiIndex() <<
std::dec << std::endl;
1256 LogTrace(
"L1GlobalTrigger") <<
" GCT CenJet " << std::endl;
1258 LogTrace(
"L1GlobalTrigger") << std::hex <<
"Rank = " << (*iterConst)->rank()
1259 <<
" Eta index = " << (*iterConst)->etaIndex()
1260 <<
" Phi index = " << (*iterConst)->phiIndex() <<
std::dec << std::endl;
1263 LogTrace(
"L1GlobalTrigger") <<
" GCT ForJet " << std::endl;
1265 LogTrace(
"L1GlobalTrigger") << std::hex <<
"Rank = " << (*iterConst)->rank()
1266 <<
" Eta index = " << (*iterConst)->etaIndex()
1267 <<
" Phi index = " << (*iterConst)->phiIndex() <<
std::dec << std::endl;
1270 LogTrace(
"L1GlobalTrigger") <<
" GCT TauJet " << std::endl;
1272 LogTrace(
"L1GlobalTrigger") << std::hex <<
"Rank = " << (*iterConst)->rank()
1273 <<
" Eta index = " << (*iterConst)->etaIndex()
1274 <<
" Phi index = " << (*iterConst)->phiIndex() <<
std::dec << std::endl;
1277 LogTrace(
"L1GlobalTrigger") <<
" GCT ETM " << std::endl;
1284 LogTrace(
"L1GlobalTrigger") <<
" GCT ETT " << std::endl;
1289 LogTrace(
"L1GlobalTrigger") <<
" GCT HTT " << std::endl;
1294 LogTrace(
"L1GlobalTrigger") <<
" GCT HTM " << std::endl;
1301 LogTrace(
"L1GlobalTrigger") <<
" GCT JetCounts " << std::endl;
1303 LogTrace(
"L1GlobalTrigger") << (*m_candJetCounts) << std::endl;
1306 LogTrace(
"L1GlobalTrigger") <<
" GCT HfBitCounts " << std::endl;
1308 LogTrace(
"L1GlobalTrigger") << (*m_candHfBitCounts) << std::endl;
1311 LogTrace(
"L1GlobalTrigger") <<
" GCT HfRingEtSums " << std::endl;
1313 LogTrace(
"L1GlobalTrigger") << (*m_candHfRingEtSums) << std::endl;