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(parSet.getParameter<std::vector<edm::InputTag> > (
94 "TechnicalTriggersInputTags")),
95 m_produceL1GtDaqRecord(parSet.getParameter<bool> (
"ProduceL1GtDaqRecord")),
96 m_produceL1GtEvmRecord(parSet.getParameter<bool> (
"ProduceL1GtEvmRecord")),
97 m_produceL1GtObjectMapRecord(parSet.getParameter<bool> (
"ProduceL1GtObjectMapRecord")),
98 m_writePsbL1GtDaqRecord(parSet.getParameter<bool> (
"WritePsbL1GtDaqRecord")),
99 m_readTechnicalTriggerRecords(parSet.getParameter<bool> (
"ReadTechnicalTriggerRecords")),
100 m_emulateBxInEvent(parSet.getParameter<int> (
"EmulateBxInEvent")),
101 m_recordLength(parSet.getParameter<std::vector<int> > (
"RecordLength")),
102 m_alternativeNrBxBoardDaq(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardDaq")),
103 m_alternativeNrBxBoardEvm(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardEvm")),
104 m_psBstLengthBytes(parSet.getParameter<int> (
"BstLengthBytes")),
105 m_algorithmTriggersUnprescaled(parSet.getParameter<bool> (
"AlgorithmTriggersUnprescaled")),
106 m_algorithmTriggersUnmasked(parSet.getParameter<bool> (
"AlgorithmTriggersUnmasked")),
107 m_technicalTriggersUnprescaled(parSet.getParameter<bool> (
"TechnicalTriggersUnprescaled")),
108 m_technicalTriggersUnmasked(parSet.getParameter<bool> (
"TechnicalTriggersUnmasked")),
109 m_technicalTriggersVetoUnmasked(parSet.getParameter<bool> (
"TechnicalTriggersVetoUnmasked")),
110 m_verbosity(parSet.getUntrackedParameter<int>(
"Verbosity", 0)),
118 LogDebug(
"L1GlobalTrigger") << std::endl;
124 <<
"\nInput tag for technical triggers: "
130 LogTrace(
"L1GlobalTrigger") <<
"\n " << ( *it ) << std::endl;
143 <<
"\nNumber of BXs corresponding to alternative 0: " <<
m_recordLength.at(0)
144 <<
"\nNumber of BXs corresponding to alternative 1: " <<
m_recordLength.at(1)
146 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
148 <<
"\nAlternative for number of BX in GT EVM record: 0x" << std::hex
169 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: "
182 <<
"\nWARNING: Number of bunch crossing required to be emulated ( "
184 <<
"\n Number of BXs corresponding to alternative 0: " <<
m_recordLength.at(0)
185 <<
"\n Number of BXs corresponding to alternative 1: " <<
m_recordLength.at(1)
186 <<
"\nEmulating " << requiredRecordLength <<
" BX!"
195 produces<L1GlobalTriggerReadoutRecord>();
199 produces<L1GlobalTriggerEvmReadoutRecord>();
203 produces<L1GlobalTriggerObjectMapRecord>();
286 unsigned long long l1GtStableParCacheID =
371 if ((recordLength0 < 0) || (recordLength1 < 0) ) {
386 <<
"\nTotal number of BX to emulate in the GT readout record: "
389 <<
"\nNumber of BX for alternative 0: " << recordLength0
390 <<
"\nNumber of BX for alternative 1: " << recordLength1
391 <<
"\nActive boards in L1 GT DAQ record (hex format) = " << std::hex
394 <<
"\nActive boards in L1 GT EVM record (hex format) = " << std::hex
403 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
423 unsigned long long l1GtPfAlgoCacheID =
438 unsigned long long l1GtPfTechCacheID =
457 unsigned long long l1GtTmAlgoCacheID =
473 unsigned long long l1GtTmTechCacheID =
488 unsigned long long l1GtTmVetoAlgoCacheID =
504 unsigned long long l1GtTmVetoTechCacheID =
527 int daqNrGtfeBoards = 0;
529 int daqNrFdlBoards = 0;
530 int daqNrPsbBoards = 0;
531 int daqNrGmtBoards = 0;
532 int daqNrTcsBoards = 0;
533 int daqNrTimBoards = 0;
536 bool receiveMu =
false;
537 bool receiveNoIsoEG =
false;
538 bool receiveIsoEG =
false;
539 bool receiveCenJet =
false;
540 bool receiveForJet =
false;
541 bool receiveTauJet =
false;
542 bool receiveETM =
false;
543 bool receiveETT =
false;
544 bool receiveHTT =
false;
545 bool receiveHTM =
false;
546 bool receiveJetCounts =
false;
547 bool receiveHfBitCounts =
false;
548 bool receiveHfRingEtSums =
false;
550 bool receiveExternal =
false;
552 bool receiveTechTr =
false;
555 itBoard = boardMaps.begin();
556 itBoard != boardMaps.end(); ++itBoard) {
558 int iPosition = itBoard->gtPositionDaqRecord();
561 int iActiveBit = itBoard->gtBitDaqActiveBoards();
562 bool activeBoard =
false;
564 if (iActiveBit >= 0) {
570 if ((iActiveBit < 0) || activeBoard) {
572 switch (itBoard->gtBoardType()) {
588 std::vector<L1GtPsbQuad> quadInPsb = itBoard->gtQuadInPsb();
589 for (std::vector<L1GtPsbQuad>::const_iterator
590 itQuad = quadInPsb.begin();
591 itQuad != quadInPsb.end(); ++itQuad) {
596 receiveTechTr =
true;
601 receiveNoIsoEG =
true;
611 receiveCenJet =
true;
616 receiveForJet =
true;
621 receiveTauJet =
true;
634 receiveJetCounts =
true;
649 receiveExternal =
true;
654 receiveHfBitCounts =
true;
655 receiveHfRingEtSums =
true;
701 std::auto_ptr<L1GlobalTriggerReadoutRecord> gtDaqReadoutRecord(
707 std::auto_ptr<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord(
712 std::auto_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
722 boost::uint16_t bxCrossHw = 0;
723 if ((bxCross & 0xFFF) == bxCross) {
724 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
731 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
732 <<
"\n larger than 12 bits. Set to 0! \n" << std::dec
741 itBoard = boardMaps.begin();
742 itBoard != boardMaps.end(); ++itBoard) {
744 int iPosition = itBoard->gtPositionDaqRecord();
747 int iActiveBit = itBoard->gtBitDaqActiveBoards();
748 bool activeBoard =
false;
750 if (iActiveBit >= 0) {
756 if ((iActiveBit < 0) || activeBoard) {
758 switch (itBoard->gtBoardType()) {
763 gtfeWordValue.
setBoardId( itBoard->gtBoardId() );
768 static_cast<boost::uint16_t>(recordLength0));
771 static_cast<boost::uint16_t>(recordLength1));
774 gtfeWordValue.
setBxNr(bxCrossHw);
787 static_cast<boost::uint32_t>(iEvent.
id().
event()));
791 gtDaqReadoutRecord->setGtfeWord(gtfeWordValue);
820 int evmNrFdlBoards = 0;
826 int bstLengthBytes = 0;
840 <<
"\n Length of BST message (in bytes): "
841 << bstLengthBytes <<
"\n"
846 itBoard = boardMaps.begin();
847 itBoard != boardMaps.end(); ++itBoard) {
849 int iPosition = itBoard->gtPositionEvmRecord();
852 int iActiveBit = itBoard->gtBitEvmActiveBoards();
853 bool activeBoard =
false;
855 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;
938 static_cast<boost::uint32_t>(iEvent.
id().
event()));
942 static_cast<boost::uint64_t>(iEvent.
orbitNumber()) );
946 gtEvmReadoutRecord->setTcsWord(tcsWordValue);
970 int pfAlgoSetIndex = 0;
971 const std::vector<int>& prescaleFactorsAlgoTrig =
972 (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
974 int pfTechSetIndex = 0;
975 const std::vector<int>& prescaleFactorsTechTrig =
976 (*m_prescaleFactorsTechTrig).at(pfTechSetIndex);
981 for (
int iBxInEvent = minBxInEvent; iBxInEvent <= maxBxInEvent;
997 receiveETM, receiveETT, receiveHTT, receiveHTM,
1000 receiveHfRingEtSums);
1009 if (receiveExternal) {
1056 prescaleFactorsAlgoTrig, prescaleFactorsTechTrig,
1075 boardMaps, gtDaqReadoutRecord);
1082 boardMaps, gtEvmReadoutRecord);
1115 <<
"\nWarning: L1MuGMTReadoutCollection with input tag " <<
m_muGmtInputTag
1116 <<
"\nrequested in configuration, but not found in the event.\n"
1121 gtDaqReadoutRecord->setMuCollectionRefProd(gmtRcHandle);
1129 std::ostringstream myCoutStream;
1130 gtDaqReadoutRecord->print(myCoutStream);
1132 <<
"\n The following L1 GT DAQ readout record was produced:\n"
1133 << myCoutStream.str() <<
"\n"
1136 myCoutStream.str(
"");
1137 myCoutStream.clear();
1139 gtEvmReadoutRecord->print(myCoutStream);
1141 <<
"\n The following L1 GT EVM readout record was produced:\n"
1142 << myCoutStream.str() <<
"\n"
1145 myCoutStream.str(
"");
1146 myCoutStream.clear();
1148 const std::vector<L1GlobalTriggerObjectMap> objMapVec =
1149 gtObjectMapRecord->gtObjectMap();
1151 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
1152 it = objMapVec.begin(); it != objMapVec.end(); ++it) {
1154 (*it).print(myCoutStream);
1160 <<
"Test gtObjectMapRecord in L1GlobalTrigger \n\n" << myCoutStream.str() <<
"\n\n"
1163 myCoutStream.str(
"");
1164 myCoutStream.clear();
1171 iEvent.
put( gtDaqReadoutRecord );
1175 iEvent.
put( gtEvmReadoutRecord );
1179 iEvent.
put( gtObjectMapRecord );
unsigned int gtNumberL1TauJet() const
get / set the number of L1 tau jets received by GT
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
unsigned long long m_l1GtParCacheID
const L1GtStableParameters * m_l1GtStablePar
cached stuff
void run(edm::Event &iEvent, const edm::EventSetup &evSetup, const L1GlobalTriggerPSB *ptrGtPSB, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::auto_ptr< L1GlobalTriggerObjectMapRecord > >ObjectMapRecord, 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
std::vector< unsigned int > m_triggerMaskVetoAlgoTrig
void setBxNr(cms_uint16_t bxNrValue)
void setBstSource(const cms_uint16_t bstSourceVal)
std::vector< int > m_recordLength
const boost::uint16_t gtDaqActiveBoards() const
get / set the active boards for L1 GT DAQ record
bool m_technicalTriggersVetoUnmasked
const int gtTotalBxInEvent() const
get / set the total Bx's in the event
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
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
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
bool m_technicalTriggersUnprescaled
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, std::auto_ptr< L1GlobalTriggerEvmReadoutRecord > >EvmReadoutRecord)
fill the FDL block in the L1 GT EVM record for iBxInEvent
unsigned long long m_l1GtStableParCacheID
void setRecordLength(cms_uint16_t recordLengthValue)
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
bool m_algorithmTriggersUnprescaled
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
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
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool m_algorithmTriggersUnmasked
edm::InputTag m_caloGctInputTag
input tag for calorimeter collections from GCT
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 &)
unsigned int m_alternativeNrBxBoardDaq
int m_verbosity
verbosity level
L1GlobalTriggerFDL * m_gtFDL
const L1GtParameters * m_l1GtPar
parameters
std::vector< unsigned int > m_triggerMaskTechTrig
const L1GtPrescaleFactors * m_l1GtPfTech
unsigned long long m_l1GtTmAlgoCacheID
void setRecordLength1(cms_uint16_t recordLengthValue)
std::vector< edm::InputTag > m_technicalTriggersInputTags
input tag for technical triggers
unsigned int m_alternativeNrBxBoardEvm
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool m_produceL1GtDaqRecord
logical flag to produce the L1 GT DAQ readout record
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
void setBoardId(cms_uint16_t boardIdValue)
set BoardId from a BoardId value
bool m_produceL1GtObjectMapRecord
logical flag to produce the L1 GT object map record
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
edm::InputTag m_muGmtInputTag
input tag for muon collection from GMT
bool m_produceL1GtEvmRecord
logical flag to produce the L1 GT EVM readout record
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
unsigned long long m_l1GtBMCacheID
L1GlobalTriggerPSB * m_gtPSB
bool m_technicalTriggersUnmasked
bool m_readTechnicalTriggerRecords
logical flag to read the technical trigger records
int m_ifCaloEtaNumberBits
bool m_writePsbL1GtDaqRecord
logical flag to write the PSB content in the L1 GT DAQ record
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
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 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, std::auto_ptr< L1GlobalTriggerReadoutRecord > >DaqReadoutRecord)
fill the content of active PSB boards
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)
edm::InputTag m_castorInputTag
input tag for CASTOR record
unsigned int gtNumberL1IsoEG() const
get / set the number of L1 isolated e/gamma objects received by GT
TimeValue_t value() const
int m_psBstLengthBytes
length of BST record (in bytes) from parameter set
void setOrbitNr(const cms_uint64_t orbitNrValue)
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, std::auto_ptr< L1GlobalTriggerReadoutRecord > >DaqReadoutRecord)
fill the FDL block in the L1 GT DAQ record for iBxInEvent
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