24 #include <boost/cstdint.hpp> 90 : m_muGmtInputTag(parSet.getParameter<
edm::InputTag>(
"GmtInputTag")),
91 m_caloGctInputTag(parSet.getParameter<
edm::InputTag>(
"GctInputTag")),
92 m_castorInputTag(parSet.getParameter<
edm::InputTag>(
"CastorInputTag")),
93 m_technicalTriggersInputTags(
94 parSet.getParameter<
std::vector<
edm::InputTag>>(
95 "TechnicalTriggersInputTags")),
96 m_produceL1GtDaqRecord(parSet.getParameter<
bool>(
"ProduceL1GtDaqRecord")),
97 m_produceL1GtEvmRecord(parSet.getParameter<
bool>(
"ProduceL1GtEvmRecord")),
98 m_produceL1GtObjectMapRecord(
99 parSet.getParameter<
bool>(
"ProduceL1GtObjectMapRecord")),
100 m_writePsbL1GtDaqRecord(
101 parSet.getParameter<
bool>(
"WritePsbL1GtDaqRecord")),
102 m_readTechnicalTriggerRecords(
103 parSet.getParameter<
bool>(
"ReadTechnicalTriggerRecords")),
104 m_emulateBxInEvent(parSet.getParameter<
int>(
"EmulateBxInEvent")),
105 m_recordLength(parSet.getParameter<
std::vector<
int>>(
"RecordLength")),
106 m_alternativeNrBxBoardDaq(
107 parSet.getParameter<unsigned
int>(
"AlternativeNrBxBoardDaq")),
108 m_alternativeNrBxBoardEvm(
109 parSet.getParameter<unsigned
int>(
"AlternativeNrBxBoardEvm")),
110 m_psBstLengthBytes(parSet.getParameter<
int>(
"BstLengthBytes")),
111 m_algorithmTriggersUnprescaled(
112 parSet.getParameter<
bool>(
"AlgorithmTriggersUnprescaled")),
113 m_algorithmTriggersUnmasked(
114 parSet.getParameter<
bool>(
"AlgorithmTriggersUnmasked")),
115 m_technicalTriggersUnprescaled(
116 parSet.getParameter<
bool>(
"TechnicalTriggersUnprescaled")),
117 m_technicalTriggersUnmasked(
118 parSet.getParameter<
bool>(
"TechnicalTriggersUnmasked")),
119 m_technicalTriggersVetoUnmasked(
120 parSet.getParameter<
bool>(
"TechnicalTriggersVetoUnmasked")),
121 m_verbosity(parSet.getUntrackedParameter<
int>(
"Verbosity", 0)),
128 LogDebug(
"L1GlobalTrigger") << std::endl;
131 <<
"\nInput tag for muon collection from GMT: " 133 <<
"\nInput tag for calorimeter collections from GCT: " 135 <<
"\nInput tag for CASTOR record: " 137 <<
"\nInput tag for technical triggers: " << std::endl;
140 for (std::vector<edm::InputTag>::const_iterator it =
143 LogTrace(
"L1GlobalTrigger") <<
"\n " << (*it) << std::endl;
147 <<
"\nProduce the L1 GT DAQ readout record: " 149 <<
"\nProduce the L1 GT EVM readout record: " 151 <<
"\nProduce the L1 GT Object Map record: " 153 <<
"\nWrite Psb content to L1 GT DAQ Record: " 155 <<
"\nRead technical trigger records: " 157 <<
"\nNumber of BxInEvent to be emulated: " 159 <<
"\nNumber of BXs corresponding to alternative 0: " 161 <<
"\nNumber of BXs corresponding to alternative 1: " 163 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
165 <<
"\nAlternative for number of BX in GT EVM record: 0x" << std::hex
167 <<
"\nLength of BST message [bytes]: " 169 <<
"\nRun algorithm triggers unprescaled: " 171 <<
"\nRun algorithm triggers unmasked (all enabled): " 173 <<
"\nRun technical triggers unprescaled: " 175 <<
"\nRun technical triggers unmasked (all enabled): " 177 <<
"\nRun technical triggers veto unmasked (no veto): " 187 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: " 189 <<
"\n The number must be an odd number!\n" 194 int requiredRecordLength =
203 <<
"\nWARNING: Number of bunch crossing required to be emulated ( " 205 <<
"\n Number of BXs corresponding to alternative 0: " 207 <<
"\n Number of BXs corresponding to alternative 1: " 217 produces<L1GlobalTriggerReadoutRecord>();
221 produces<L1GlobalTriggerEvmReadoutRecord>();
225 produces<L1GlobalTriggerObjectMapRecord>();
308 unsigned long long l1GtStableParCacheID =
359 unsigned long long l1GtParCacheID =
392 if ((recordLength0 < 0) || (recordLength1 < 0)) {
404 <<
"\nTotal number of BX to emulate in the GT readout record: " 406 <<
"[" << minBxInEvent <<
", " << maxBxInEvent <<
"] BX\n" 407 <<
"\nNumber of BX for alternative 0: " << recordLength0
408 <<
"\nNumber of BX for alternative 1: " << recordLength1
409 <<
"\nActive boards in L1 GT DAQ record (hex format) = " << std::hex
412 <<
"\nActive boards in L1 GT EVM record (hex format) = " << std::hex
421 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
423 unsigned long long l1GtBMCacheID =
441 unsigned long long l1GtPfAlgoCacheID =
455 unsigned long long l1GtPfTechCacheID =
472 unsigned long long l1GtTmAlgoCacheID =
486 unsigned long long l1GtTmTechCacheID =
500 unsigned long long l1GtTmVetoAlgoCacheID =
514 unsigned long long l1GtTmVetoTechCacheID =
536 int daqNrGtfeBoards = 0;
538 int daqNrFdlBoards = 0;
539 int daqNrPsbBoards = 0;
540 int daqNrGmtBoards = 0;
541 int daqNrTcsBoards = 0;
542 int daqNrTimBoards = 0;
545 bool receiveMu =
false;
546 bool receiveNoIsoEG =
false;
547 bool receiveIsoEG =
false;
548 bool receiveCenJet =
false;
549 bool receiveForJet =
false;
550 bool receiveTauJet =
false;
551 bool receiveETM =
false;
552 bool receiveETT =
false;
553 bool receiveHTT =
false;
554 bool receiveHTM =
false;
555 bool receiveJetCounts =
false;
556 bool receiveHfBitCounts =
false;
557 bool receiveHfRingEtSums =
false;
559 bool receiveExternal =
false;
561 bool receiveTechTr =
false;
563 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end();
566 int iPosition = itBoard->gtPositionDaqRecord();
569 int iActiveBit = itBoard->gtBitDaqActiveBoards();
570 bool activeBoard =
false;
572 if (iActiveBit >= 0) {
579 if ((iActiveBit < 0) || activeBoard) {
581 switch (itBoard->gtBoardType()) {
597 std::vector<L1GtPsbQuad> quadInPsb = itBoard->gtQuadInPsb();
598 for (std::vector<L1GtPsbQuad>::const_iterator itQuad =
600 itQuad != quadInPsb.end(); ++itQuad) {
605 receiveTechTr =
true;
610 receiveNoIsoEG =
true;
620 receiveCenJet =
true;
625 receiveForJet =
true;
630 receiveTauJet =
true;
643 receiveJetCounts =
true;
658 receiveExternal =
true;
663 receiveHfBitCounts =
true;
664 receiveHfRingEtSums =
true;
708 std::unique_ptr<L1GlobalTriggerReadoutRecord> gtDaqReadoutRecord(
713 std::unique_ptr<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord(
718 std::unique_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
727 boost::uint16_t bxCrossHw = 0;
728 if ((bxCross & 0xFFF) == bxCross) {
729 bxCrossHw =
static_cast<boost::uint16_t
>(bxCross);
735 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
736 <<
"\n larger than 12 bits. Set to 0! \n" 743 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end();
746 int iPosition = itBoard->gtPositionDaqRecord();
749 int iActiveBit = itBoard->gtBitDaqActiveBoards();
750 bool activeBoard =
false;
752 if (iActiveBit >= 0) {
759 if ((iActiveBit < 0) || activeBoard) {
761 switch (itBoard->gtBoardType()) {
766 gtfeWordValue.
setBoardId(itBoard->gtBoardId());
771 static_cast<boost::uint16_t>(recordLength0));
774 static_cast<boost::uint16_t>(recordLength1));
777 gtfeWordValue.
setBxNr(bxCrossHw);
790 static_cast<boost::uint32_t>(iEvent.
id().
event()));
794 gtDaqReadoutRecord->setGtfeWord(gtfeWordValue);
821 int evmNrFdlBoards = 0;
827 int bstLengthBytes = 0;
841 <<
"\n Length of BST message (in bytes): " << bstLengthBytes <<
"\n" 845 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end();
848 int iPosition = itBoard->gtPositionEvmRecord();
851 int iActiveBit = itBoard->gtBitEvmActiveBoards();
852 bool activeBoard =
false;
854 if (iActiveBit >= 0) {
861 if ((iActiveBit < 0) || activeBoard) {
863 switch (itBoard->gtBoardType()) {
868 gtfeWordValue.
setBoardId(itBoard->gtBoardId());
873 static_cast<boost::uint16_t>(recordLength0));
876 static_cast<boost::uint16_t>(recordLength1));
879 gtfeWordValue.
setBxNr(bxCrossHw);
892 static_cast<boost::uint32_t>(iEvent.
id().
event()));
905 boost::uint16_t bstSourceVal = 0xDDDD;
910 gtEvmReadoutRecord->setGtfeWord(gtfeWordValue);
923 tcsWordValue.
setBoardId(itBoard->gtBoardId());
926 tcsWordValue.
setBxNr(bxCrossHw);
928 boost::uint16_t trigType = 0x5;
937 static_cast<boost::uint32_t>(iEvent.
id().
event()));
941 static_cast<boost::uint64_t>(iEvent.
orbitNumber()));
945 gtEvmReadoutRecord->setTcsWord(tcsWordValue);
967 int pfAlgoSetIndex = 0;
968 const std::vector<int> &prescaleFactorsAlgoTrig =
969 (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
971 int pfTechSetIndex = 0;
972 const std::vector<int> &prescaleFactorsTechTrig =
973 (*m_prescaleFactorsTechTrig).at(pfTechSetIndex);
978 for (
int iBxInEvent = minBxInEvent; iBxInEvent <= maxBxInEvent;
991 receiveHTT, receiveHTM, receiveJetCounts, receiveHfBitCounts,
992 receiveHfRingEtSums);
997 iBxInEvent, receiveTechTr,
1001 if (receiveExternal) {
1008 iBxInEvent, gtDaqReadoutRecord.get());
1040 m_gtFDL->
run(iEvent, prescaleFactorsAlgoTrig, prescaleFactorsTechTrig,
1053 boardMaps, gtDaqReadoutRecord.get());
1059 boardMaps, gtEvmReadoutRecord.get());
1088 <<
"\nWarning: L1MuGMTReadoutCollection with input tag " 1090 <<
"\nrequested in configuration, but not found in the event.\n" 1095 gtDaqReadoutRecord->setMuCollectionRefProd(gmtRcHandle);
1101 std::ostringstream myCoutStream;
1102 gtDaqReadoutRecord->print(myCoutStream);
1104 <<
"\n The following L1 GT DAQ readout record was produced:\n" 1105 << myCoutStream.str() <<
"\n" 1108 myCoutStream.str(
"");
1109 myCoutStream.clear();
1111 gtEvmReadoutRecord->print(myCoutStream);
1113 <<
"\n The following L1 GT EVM readout record was produced:\n" 1114 << myCoutStream.str() <<
"\n" 1117 myCoutStream.str(
"");
1118 myCoutStream.clear();
1120 const std::vector<L1GlobalTriggerObjectMap> objMapVec =
1121 gtObjectMapRecord->gtObjectMap();
1123 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator it =
1125 it != objMapVec.end(); ++it) {
1127 (*it).print(myCoutStream);
1131 <<
"Test gtObjectMapRecord in L1GlobalTrigger \n\n" 1132 << myCoutStream.str() <<
"\n\n" 1135 myCoutStream.str(
"");
1136 myCoutStream.clear();
unsigned int gtNumberL1TauJet() const
get / set the number of L1 tau jets received by GT
const std::vector< edm::InputTag > m_technicalTriggersInputTags
input tag for technical triggers
EventNumber_t event() const
const L1GtTriggerMask * m_l1GtTmVetoTech
void init(const int nrL1Mu, const int numberPhysTriggers)
initialize the class (mainly reserve)
const L1GtTriggerMask * m_l1GtTmVetoAlgo
const std::vector< int > m_recordLength
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned long long m_l1GtParCacheID
const L1GtStableParameters * m_l1GtStablePar
cached stuff
std::vector< unsigned int > m_triggerMaskVetoAlgoTrig
void setBxNr(cms_uint16_t bxNrValue)
const edm::InputTag m_caloGctInputTag
input tag for calorimeter collections from GCT
void setBstSource(const cms_uint16_t bstSourceVal)
const boost::uint16_t gtDaqActiveBoards() const
get / set the active boards for L1 GT DAQ record
const int gtTotalBxInEvent() const
get / set the total Bx's in the event
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
const bool m_readTechnicalTriggerRecords
logical flag to read the technical trigger records
std::vector< unsigned int > m_triggerMaskAlgoTrig
void setBxNr(const cms_uint16_t bxNrValue)
const unsigned int gtBstLengthBytes() const
get / set length of BST message (in bytes) for L1 GT EVM record
const bool m_technicalTriggersVetoUnmasked
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
void receiveGctObjectData(edm::Event &iEvent, const edm::InputTag &caloGctInputTag, const int iBxInEvent, const bool receiveNoIsoEG, const int nrL1NoIsoEG, const bool receiveIsoEG, const int nrL1IsoEG, const bool receiveCenJet, const int nrL1CenJet, const bool receiveForJet, const int nrL1ForJet, const bool receiveTauJet, const int nrL1TauJet, const bool receiveETM, const bool receiveETT, const bool receiveHTT, const bool receiveHTM, const bool receiveJetCounts, const bool receiveHfBitCounts, const bool receiveHfRingEtSums)
receive Global Calorimeter Trigger objects
const bool m_produceL1GtObjectMapRecord
logical flag to produce the L1 GT object map record
const bool m_writePsbL1GtDaqRecord
logical flag to write the PSB content in the L1 GT DAQ record
unsigned long long m_l1GtStableParCacheID
void setRecordLength(cms_uint16_t recordLengthValue)
const bool m_produceL1GtDaqRecord
logical flag to produce the L1 GT DAQ readout record
void setLuminositySegmentNr(const cms_uint16_t luminositySegmentNrValue)
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
unsigned int m_numberPhysTriggers
number of physics triggers
L1GlobalTrigger(const edm::ParameterSet &)
unsigned int gtNumberL1CenJet() const
get / set the number of L1 central jets received by GT
L1GlobalTriggerGTL * m_gtGTL
unsigned int m_bstLengthBytes
length of BST record (in bytes) from event setup
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
std::vector< unsigned int > m_triggerMaskVetoTechTrig
const bool m_produceL1GtEvmRecord
logical flag to produce the L1 GT EVM readout record
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
void fillEvmFdlBlock(const int iBxInEvent, const boost::uint16_t &activeBoardsGtEvm, const int recordLength0, const int recordLength1, const unsigned int altNrBxBoardEvm, const std::vector< L1GtBoard > &boardMaps, L1GlobalTriggerEvmReadoutRecord *gtEvmReadoutRecord)
fill the FDL block in the L1 GT EVM record for iBxInEvent
const bool m_algorithmTriggersUnmasked
void setAltNrBxBoard(cms_uint16_t altNrBxBoardValue)
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
void setTotalTriggerNr(cms_uint32_t totalTriggerNrValue)
unsigned int gtIfMuEtaNumberBits() const
get / set the number of bits for eta of muon objects
const L1GtTriggerMask * m_l1GtTmTech
#define DEFINE_FWK_MODULE(type)
const bool m_technicalTriggersUnmasked
void setVerbosity(const int verbosity)
unsigned int gtNumberL1ForJet() const
get / set the number of L1 forward jets received by GT
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
boost::uint16_t m_activeBoardsGtEvm
unsigned long long m_l1GtPfTechCacheID
void receiveTechnicalTriggers(edm::Event &iEvent, const std::vector< edm::InputTag > &technicalTriggersInputTags, const int iBxInEvent, const bool receiveTechTr, const int nrL1TechTr)
receive technical trigger
const unsigned int m_alternativeNrBxBoardEvm
L1GlobalTriggerFDL * m_gtFDL
const bool m_algorithmTriggersUnprescaled
const bool m_isDebugEnabled
const L1GtParameters * m_l1GtPar
parameters
std::vector< unsigned int > m_triggerMaskTechTrig
void run(edm::Event &iEvent, const edm::EventSetup &evSetup, const L1GlobalTriggerPSB *ptrGtPSB, const bool produceL1GtObjectMapRecord, const int iBxInEvent, L1GlobalTriggerObjectMapRecord *gtObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1NoIsoEG, const int nrL1IsoEG, const int nrL1CenJet, const int nrL1ForJet, const int nrL1TauJet, const int nrL1JetCounts, const int ifMuEtaNumberBits, const int ifCaloEtaNumberBits)
run the GTL
const L1GtPrescaleFactors * m_l1GtPfTech
unsigned long long m_l1GtTmAlgoCacheID
void setRecordLength1(cms_uint16_t recordLengthValue)
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int gtNumberL1NoIsoEG() const
get / set the number of L1 e/gamma objects received by GT
unsigned int gtNumberL1JetCounts() const
get / set the number of L1 jet counts received by GT
const int m_verbosity
verbosity level
void setBoardId(cms_uint16_t boardIdValue)
set BoardId from a BoardId value
void setBoardId(const cms_uint16_t boardIdValue)
set BoardId from a BoardId value
boost::uint16_t m_activeBoardsGtDaq
active boards in L1 GT DAQ record and in L1 GT EVM record
unsigned int gtIfCaloEtaNumberBits() const
get / set the number of bits for eta of calorimeter objects
~L1GlobalTrigger() override
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
void produce(edm::Event &, const edm::EventSetup &) override
void setActiveBoards(cms_uint16_t activeBoardsValue)
const boost::uint16_t gtEvmActiveBoards() const
get / set the active boards for L1 GT EVM record
unsigned long long m_l1GtTmVetoTechCacheID
void receiveGmtObjectData(edm::Event &, const edm::InputTag &, const int iBxInEvent, const bool receiveMu, const int nrL1Mu)
receive data from Global Muon Trigger
void fillPsbBlock(edm::Event &iEvent, const boost::uint16_t &activeBoardsGtDaq, const int recordLength0, const int recordLength1, const unsigned int altNrBxBoardDaq, const std::vector< L1GtBoard > &boardMaps, const int iBxInEvent, L1GlobalTriggerReadoutRecord *gtDaqReadoutRecord)
fill the content of active PSB boards
unsigned long long m_l1GtBMCacheID
L1GlobalTriggerPSB * m_gtPSB
const edm::InputTag m_muGmtInputTag
input tag for muon collection from GMT
int m_ifCaloEtaNumberBits
const bool m_technicalTriggersUnprescaled
const int m_psBstLengthBytes
length of BST record (in bytes) from parameter set
void run(edm::Event &iEvent, const std::vector< int > &prescaleFactorsAlgoTrig, const std::vector< int > &prescaleFactorsTechTrig, const std::vector< unsigned int > &triggerMaskAlgoTrig, const std::vector< unsigned int > &triggerMaskTechTrig, const std::vector< unsigned int > &triggerMaskVetoAlgoTrig, const std::vector< unsigned int > &triggerMaskVetoTechTrig, const std::vector< L1GtBoard > &boardMaps, const int totalBxInEvent, const int iBxInEvent, const unsigned int numberPhysTriggers, const unsigned int numberTechnicalTriggers, const unsigned int numberDaqPartitions, const L1GlobalTriggerGTL *ptrGTL, const L1GlobalTriggerPSB *ptrPSB, const int pfAlgoSetIndex, const int pfTechSetIndex, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked, const bool technicalTriggersUnprescaled, const bool technicalTriggersUnmasked, const bool technicalTriggersVetoUnmasked)
run the FDL
const std::vector< L1GtBoard > & gtBoardMaps() const
get / set / print the L1 GT board map
const unsigned int m_alternativeNrBxBoardDaq
void setGpsTime(const cms_uint64_t)
void setTriggerType(const cms_uint16_t triggerTypeValue)
int m_totalBxInEvent
total number of Bx's in the event coming from EventSetup
unsigned int m_numberTechnicalTriggers
number of technical triggers
void setEventNr(const cms_uint32_t eventNrValue)
void setVerbosity(const int verbosity)
const L1GtBoardMaps * m_l1GtBM
board maps - cache only the record
unsigned long long m_l1GtTmTechCacheID
unsigned int m_numberDaqPartitions
number of DAQ partitions
T const * product() const
void init(const int nrL1NoIsoEG, const int nrL1IsoEG, const int nrL1CenJet, const int nrL1ForJet, const int nrL1TauJet, const int numberTechnicalTriggers)
initialize the class (mainly reserve)
unsigned int gtNumberL1IsoEG() const
get / set the number of L1 isolated e/gamma objects received by GT
void fillDaqFdlBlock(const int iBxInEvent, const boost::uint16_t &activeBoardsGtDaq, const int recordLength0, const int recordLength1, const unsigned int altNrBxBoardDaq, const std::vector< L1GtBoard > &boardMaps, L1GlobalTriggerReadoutRecord *gtDaqReadoutRecord)
fill the FDL block in the L1 GT DAQ record for iBxInEvent
const edm::InputTag m_castorInputTag
input tag for CASTOR record
TimeValue_t value() const
void setOrbitNr(const cms_uint64_t orbitNrValue)
edm::Timestamp time() const
unsigned long long m_l1GtTmVetoAlgoCacheID
unsigned int gtNumberL1Mu() const
get / set the number of L1 muons received by GT
unsigned long long m_l1GtPfAlgoCacheID