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>();
285 unsigned long long l1GtStableParCacheID =
370 if ((recordLength0 < 0) || (recordLength1 < 0) ) {
385 <<
"\nTotal number of BX to emulate in the GT readout record: "
388 <<
"\nNumber of BX for alternative 0: " << recordLength0
389 <<
"\nNumber of BX for alternative 1: " << recordLength1
390 <<
"\nActive boards in L1 GT DAQ record (hex format) = " << std::hex
393 <<
"\nActive boards in L1 GT EVM record (hex format) = " << std::hex
402 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
422 unsigned long long l1GtPfAlgoCacheID =
437 unsigned long long l1GtPfTechCacheID =
456 unsigned long long l1GtTmAlgoCacheID =
472 unsigned long long l1GtTmTechCacheID =
487 unsigned long long l1GtTmVetoAlgoCacheID =
503 unsigned long long l1GtTmVetoTechCacheID =
526 int daqNrGtfeBoards = 0;
528 int daqNrFdlBoards = 0;
529 int daqNrPsbBoards = 0;
530 int daqNrGmtBoards = 0;
531 int daqNrTcsBoards = 0;
532 int daqNrTimBoards = 0;
535 bool receiveMu =
false;
536 bool receiveNoIsoEG =
false;
537 bool receiveIsoEG =
false;
538 bool receiveCenJet =
false;
539 bool receiveForJet =
false;
540 bool receiveTauJet =
false;
541 bool receiveETM =
false;
542 bool receiveETT =
false;
543 bool receiveHTT =
false;
544 bool receiveHTM =
false;
545 bool receiveJetCounts =
false;
546 bool receiveHfBitCounts =
false;
547 bool receiveHfRingEtSums =
false;
549 bool receiveExternal =
false;
551 bool receiveTechTr =
false;
554 itBoard = boardMaps.begin();
555 itBoard != boardMaps.end(); ++itBoard) {
557 int iPosition = itBoard->gtPositionDaqRecord();
560 int iActiveBit = itBoard->gtBitDaqActiveBoards();
561 bool activeBoard =
false;
563 if (iActiveBit >= 0) {
569 if ((iActiveBit < 0) || activeBoard) {
571 switch (itBoard->gtBoardType()) {
587 std::vector<L1GtPsbQuad> quadInPsb = itBoard->gtQuadInPsb();
588 for (std::vector<L1GtPsbQuad>::const_iterator
589 itQuad = quadInPsb.begin();
590 itQuad != quadInPsb.end(); ++itQuad) {
595 receiveTechTr =
true;
600 receiveNoIsoEG =
true;
610 receiveCenJet =
true;
615 receiveForJet =
true;
620 receiveTauJet =
true;
633 receiveJetCounts =
true;
648 receiveExternal =
true;
653 receiveHfBitCounts =
true;
654 receiveHfRingEtSums =
true;
700 std::auto_ptr<L1GlobalTriggerReadoutRecord> gtDaqReadoutRecord(
706 std::auto_ptr<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord(
711 std::auto_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
721 boost::uint16_t bxCrossHw = 0;
722 if ((bxCross & 0xFFF) == bxCross) {
723 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
730 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
731 <<
"\n larger than 12 bits. Set to 0! \n" << std::dec
740 itBoard = boardMaps.begin();
741 itBoard != boardMaps.end(); ++itBoard) {
743 int iPosition = itBoard->gtPositionDaqRecord();
746 int iActiveBit = itBoard->gtBitDaqActiveBoards();
747 bool activeBoard =
false;
749 if (iActiveBit >= 0) {
755 if ((iActiveBit < 0) || activeBoard) {
757 switch (itBoard->gtBoardType()) {
762 gtfeWordValue.
setBoardId( itBoard->gtBoardId() );
767 static_cast<boost::uint16_t>(recordLength0));
770 static_cast<boost::uint16_t>(recordLength1));
773 gtfeWordValue.
setBxNr(bxCrossHw);
786 static_cast<boost::uint32_t>(iEvent.
id().
event()));
790 gtDaqReadoutRecord->setGtfeWord(gtfeWordValue);
819 int evmNrFdlBoards = 0;
825 int bstLengthBytes = 0;
839 <<
"\n Length of BST message (in bytes): "
840 << bstLengthBytes <<
"\n"
845 itBoard = boardMaps.begin();
846 itBoard != boardMaps.end(); ++itBoard) {
848 int iPosition = itBoard->gtPositionEvmRecord();
851 int iActiveBit = itBoard->gtBitEvmActiveBoards();
852 bool activeBoard =
false;
854 if (iActiveBit >= 0) {
860 if ((iActiveBit < 0) || activeBoard) {
862 switch (itBoard->gtBoardType()) {
867 gtfeWordValue.
setBoardId(itBoard->gtBoardId() );
872 static_cast<boost::uint16_t>(recordLength0));
875 static_cast<boost::uint16_t>(recordLength1));
878 gtfeWordValue.
setBxNr(bxCrossHw);
891 static_cast<boost::uint32_t>(iEvent.
id().
event()));
904 boost::uint16_t bstSourceVal = 0xDDDD;
909 gtEvmReadoutRecord->setGtfeWord(gtfeWordValue);
922 tcsWordValue.
setBoardId( itBoard->gtBoardId() );
925 tcsWordValue.
setBxNr(bxCrossHw);
927 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);
969 int pfAlgoSetIndex = 0;
970 const std::vector<int>& prescaleFactorsAlgoTrig =
971 (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
973 int pfTechSetIndex = 0;
974 const std::vector<int>& prescaleFactorsTechTrig =
975 (*m_prescaleFactorsTechTrig).at(pfTechSetIndex);
980 for (
int iBxInEvent = minBxInEvent; iBxInEvent <= maxBxInEvent;
996 receiveETM, receiveETT, receiveHTT, receiveHTM,
999 receiveHfRingEtSums);
1008 if (receiveExternal) {
1055 prescaleFactorsAlgoTrig, prescaleFactorsTechTrig,
1074 boardMaps, gtDaqReadoutRecord);
1081 boardMaps, gtEvmReadoutRecord);
1114 <<
"\nWarning: L1MuGMTReadoutCollection with input tag " <<
m_muGmtInputTag
1115 <<
"\nrequested in configuration, but not found in the event.\n"
1120 gtDaqReadoutRecord->setMuCollectionRefProd(gmtRcHandle);
1128 std::ostringstream myCoutStream;
1129 gtDaqReadoutRecord->print(myCoutStream);
1131 <<
"\n The following L1 GT DAQ readout record was produced:\n"
1132 << myCoutStream.str() <<
"\n"
1135 myCoutStream.str(
"");
1136 myCoutStream.clear();
1138 gtEvmReadoutRecord->print(myCoutStream);
1140 <<
"\n The following L1 GT EVM readout record was produced:\n"
1141 << myCoutStream.str() <<
"\n"
1144 myCoutStream.str(
"");
1145 myCoutStream.clear();
1147 const std::vector<L1GlobalTriggerObjectMap> objMapVec =
1148 gtObjectMapRecord->gtObjectMap();
1150 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
1151 it = objMapVec.begin(); it != objMapVec.end(); ++it) {
1153 (*it).print(myCoutStream);
1159 <<
"Test gtObjectMapRecord in L1GlobalTrigger \n\n" << myCoutStream.str() <<
"\n\n"
1162 myCoutStream.str(
"");
1163 myCoutStream.clear();
1170 iEvent.
put( gtDaqReadoutRecord );
1174 iEvent.
put( gtEvmReadoutRecord );
1178 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)
const T & max(const T &a, const T &b)
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
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