24 #include <boost/cstdint.hpp>
91 m_muGmtInputTag(parSet.getParameter<edm::
InputTag> (
"GmtInputTag")),
92 m_caloGctInputTag(parSet.getParameter<edm::
InputTag> (
"GctInputTag")),
93 m_castorInputTag(parSet.getParameter<edm::
InputTag> (
"CastorInputTag")),
94 m_technicalTriggersInputTags(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(parSet.getParameter<bool> (
"ProduceL1GtObjectMapRecord")),
99 m_writePsbL1GtDaqRecord(parSet.getParameter<bool> (
"WritePsbL1GtDaqRecord")),
100 m_readTechnicalTriggerRecords(parSet.getParameter<bool> (
"ReadTechnicalTriggerRecords")),
101 m_emulateBxInEvent(parSet.getParameter<int> (
"EmulateBxInEvent")),
102 m_recordLength(parSet.getParameter<std::vector<int> > (
"RecordLength")),
103 m_alternativeNrBxBoardDaq(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardDaq")),
104 m_alternativeNrBxBoardEvm(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardEvm")),
105 m_psBstLengthBytes(parSet.getParameter<int> (
"BstLengthBytes")),
106 m_algorithmTriggersUnprescaled(parSet.getParameter<bool> (
"AlgorithmTriggersUnprescaled")),
107 m_algorithmTriggersUnmasked(parSet.getParameter<bool> (
"AlgorithmTriggersUnmasked")),
108 m_technicalTriggersUnprescaled(parSet.getParameter<bool> (
"TechnicalTriggersUnprescaled")),
109 m_technicalTriggersUnmasked(parSet.getParameter<bool> (
"TechnicalTriggersUnmasked")),
110 m_technicalTriggersVetoUnmasked(parSet.getParameter<bool> (
"TechnicalTriggersVetoUnmasked")),
111 m_verbosity(parSet.getUntrackedParameter<int>(
"Verbosity", 0)),
119 LogDebug(
"L1GlobalTrigger") << std::endl;
125 <<
"\nInput tag for technical triggers: "
131 LogTrace(
"L1GlobalTrigger") <<
"\n " << ( *it ) << std::endl;
144 <<
"\nNumber of BXs corresponding to alternative 0: " <<
m_recordLength.at(0)
145 <<
"\nNumber of BXs corresponding to alternative 1: " <<
m_recordLength.at(1)
147 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
149 <<
"\nAlternative for number of BX in GT EVM record: 0x" << std::hex
170 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: "
183 <<
"\nWARNING: Number of bunch crossing required to be emulated ( "
185 <<
"\n Number of BXs corresponding to alternative 0: " <<
m_recordLength.at(0)
186 <<
"\n Number of BXs corresponding to alternative 1: " <<
m_recordLength.at(1)
187 <<
"\nEmulating " << requiredRecordLength <<
" BX!"
196 produces<L1GlobalTriggerReadoutRecord>();
200 produces<L1GlobalTriggerEvmReadoutRecord>();
204 produces<L1GlobalTriggerObjectMapRecord>();
287 unsigned long long l1GtStableParCacheID =
372 if ((recordLength0 < 0) || (recordLength1 < 0) ) {
387 <<
"\nTotal number of BX to emulate in the GT readout record: "
390 <<
"\nNumber of BX for alternative 0: " << recordLength0
391 <<
"\nNumber of BX for alternative 1: " << recordLength1
392 <<
"\nActive boards in L1 GT DAQ record (hex format) = " << std::hex
395 <<
"\nActive boards in L1 GT EVM record (hex format) = " << std::hex
404 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
424 unsigned long long l1GtPfAlgoCacheID =
439 unsigned long long l1GtPfTechCacheID =
458 unsigned long long l1GtTmAlgoCacheID =
474 unsigned long long l1GtTmTechCacheID =
489 unsigned long long l1GtTmVetoAlgoCacheID =
505 unsigned long long l1GtTmVetoTechCacheID =
528 int daqNrGtfeBoards = 0;
530 int daqNrFdlBoards = 0;
531 int daqNrPsbBoards = 0;
532 int daqNrGmtBoards = 0;
533 int daqNrTcsBoards = 0;
534 int daqNrTimBoards = 0;
537 bool receiveMu =
false;
538 bool receiveNoIsoEG =
false;
539 bool receiveIsoEG =
false;
540 bool receiveCenJet =
false;
541 bool receiveForJet =
false;
542 bool receiveTauJet =
false;
543 bool receiveETM =
false;
544 bool receiveETT =
false;
545 bool receiveHTT =
false;
546 bool receiveHTM =
false;
547 bool receiveJetCounts =
false;
548 bool receiveHfBitCounts =
false;
549 bool receiveHfRingEtSums =
false;
551 bool receiveExternal =
false;
553 bool receiveTechTr =
false;
556 itBoard = boardMaps.begin();
557 itBoard != boardMaps.end(); ++itBoard) {
559 int iPosition = itBoard->gtPositionDaqRecord();
562 int iActiveBit = itBoard->gtBitDaqActiveBoards();
563 bool activeBoard =
false;
565 if (iActiveBit >= 0) {
571 if ((iActiveBit < 0) || activeBoard) {
573 switch (itBoard->gtBoardType()) {
589 std::vector<L1GtPsbQuad> quadInPsb = itBoard->gtQuadInPsb();
590 for (std::vector<L1GtPsbQuad>::const_iterator
591 itQuad = quadInPsb.begin();
592 itQuad != quadInPsb.end(); ++itQuad) {
597 receiveTechTr =
true;
602 receiveNoIsoEG =
true;
612 receiveCenJet =
true;
617 receiveForJet =
true;
622 receiveTauJet =
true;
635 receiveJetCounts =
true;
650 receiveExternal =
true;
655 receiveHfBitCounts =
true;
656 receiveHfRingEtSums =
true;
702 std::unique_ptr<L1GlobalTriggerReadoutRecord> gtDaqReadoutRecord(
708 std::unique_ptr<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord(
713 std::unique_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
723 boost::uint16_t bxCrossHw = 0;
724 if ((bxCross & 0xFFF) == bxCross) {
725 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
732 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
733 <<
"\n larger than 12 bits. Set to 0! \n" <<
std::dec
742 itBoard = boardMaps.begin();
743 itBoard != boardMaps.end(); ++itBoard) {
745 int iPosition = itBoard->gtPositionDaqRecord();
748 int iActiveBit = itBoard->gtBitDaqActiveBoards();
749 bool activeBoard =
false;
751 if (iActiveBit >= 0) {
757 if ((iActiveBit < 0) || activeBoard) {
759 switch (itBoard->gtBoardType()) {
764 gtfeWordValue.
setBoardId( itBoard->gtBoardId() );
769 static_cast<boost::uint16_t>(recordLength0));
772 static_cast<boost::uint16_t>(recordLength1));
775 gtfeWordValue.
setBxNr(bxCrossHw);
788 static_cast<boost::uint32_t>(iEvent.
id().
event()));
792 gtDaqReadoutRecord->setGtfeWord(gtfeWordValue);
821 int evmNrFdlBoards = 0;
827 int bstLengthBytes = 0;
841 <<
"\n Length of BST message (in bytes): "
842 << bstLengthBytes <<
"\n"
847 itBoard = boardMaps.begin();
848 itBoard != boardMaps.end(); ++itBoard) {
850 int iPosition = itBoard->gtPositionEvmRecord();
853 int iActiveBit = itBoard->gtBitEvmActiveBoards();
854 bool activeBoard =
false;
856 if (iActiveBit >= 0) {
862 if ((iActiveBit < 0) || activeBoard) {
864 switch (itBoard->gtBoardType()) {
869 gtfeWordValue.
setBoardId(itBoard->gtBoardId() );
874 static_cast<boost::uint16_t>(recordLength0));
877 static_cast<boost::uint16_t>(recordLength1));
880 gtfeWordValue.
setBxNr(bxCrossHw);
893 static_cast<boost::uint32_t>(iEvent.
id().
event()));
906 boost::uint16_t bstSourceVal = 0xDDDD;
911 gtEvmReadoutRecord->setGtfeWord(gtfeWordValue);
924 tcsWordValue.
setBoardId( itBoard->gtBoardId() );
927 tcsWordValue.
setBxNr(bxCrossHw);
929 boost::uint16_t trigType = 0x5;
939 static_cast<boost::uint32_t>(iEvent.
id().
event()));
943 static_cast<boost::uint64_t>(iEvent.
orbitNumber()) );
947 gtEvmReadoutRecord->setTcsWord(tcsWordValue);
971 int pfAlgoSetIndex = 0;
972 const std::vector<int>& prescaleFactorsAlgoTrig =
973 (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
975 int pfTechSetIndex = 0;
976 const std::vector<int>& prescaleFactorsTechTrig =
977 (*m_prescaleFactorsTechTrig).at(pfTechSetIndex);
982 for (
int iBxInEvent = minBxInEvent; iBxInEvent <= maxBxInEvent;
998 receiveETM, receiveETT, receiveHTT, receiveHTM,
1001 receiveHfRingEtSums);
1010 if (receiveExternal) {
1057 prescaleFactorsAlgoTrig, prescaleFactorsTechTrig,
1076 boardMaps, gtDaqReadoutRecord.get());
1083 boardMaps, gtEvmReadoutRecord.get());
1116 <<
"\nWarning: L1MuGMTReadoutCollection with input tag " <<
m_muGmtInputTag
1117 <<
"\nrequested in configuration, but not found in the event.\n"
1122 gtDaqReadoutRecord->setMuCollectionRefProd(gmtRcHandle);
1130 std::ostringstream myCoutStream;
1131 gtDaqReadoutRecord->print(myCoutStream);
1133 <<
"\n The following L1 GT DAQ readout record was produced:\n"
1134 << myCoutStream.str() <<
"\n"
1137 myCoutStream.str(
"");
1138 myCoutStream.clear();
1140 gtEvmReadoutRecord->print(myCoutStream);
1142 <<
"\n The following L1 GT EVM readout record was produced:\n"
1143 << myCoutStream.str() <<
"\n"
1146 myCoutStream.str(
"");
1147 myCoutStream.clear();
1149 const std::vector<L1GlobalTriggerObjectMap> objMapVec =
1150 gtObjectMapRecord->gtObjectMap();
1152 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
1153 it = objMapVec.begin(); it != objMapVec.end(); ++it) {
1155 (*it).print(myCoutStream);
1161 <<
"Test gtObjectMapRecord in L1GlobalTrigger \n\n" << myCoutStream.str() <<
"\n\n"
1164 myCoutStream.str(
"");
1165 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
#define DEFINE_FWK_MODULE(type)
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
const bool m_technicalTriggersUnmasked
void setVerbosity(const int verbosity)
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
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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
virtual void produce(edm::Event &, const edm::EventSetup &)
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
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
void setActiveBoards(cms_uint16_t activeBoardsValue)
const boost::uint16_t gtEvmActiveBoards() const
get / set the active boards for L1 GT EVM record
T const * product() const
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
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