26 #include <boost/cstdint.hpp>
92 m_muGmtInputTag(parSet.getParameter<edm::InputTag> (
"GmtInputTag")),
93 m_caloGctInputTag(parSet.getParameter<edm::InputTag> (
"GctInputTag")),
94 m_castorInputTag(parSet.getParameter<edm::InputTag> (
"CastorInputTag")),
95 m_technicalTriggersInputTags(parSet.getParameter<std::vector<edm::InputTag> > (
96 "TechnicalTriggersInputTags")),
97 m_produceL1GtDaqRecord(parSet.getParameter<bool> (
"ProduceL1GtDaqRecord")),
98 m_produceL1GtEvmRecord(parSet.getParameter<bool> (
"ProduceL1GtEvmRecord")),
99 m_produceL1GtObjectMapRecord(parSet.getParameter<bool> (
"ProduceL1GtObjectMapRecord")),
100 m_writePsbL1GtDaqRecord(parSet.getParameter<bool> (
"WritePsbL1GtDaqRecord")),
101 m_readTechnicalTriggerRecords(parSet.getParameter<bool> (
"ReadTechnicalTriggerRecords")),
102 m_emulateBxInEvent(parSet.getParameter<int> (
"EmulateBxInEvent")),
103 m_recordLength(parSet.getParameter<std::vector<int> > (
"RecordLength")),
104 m_alternativeNrBxBoardDaq(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardDaq")),
105 m_alternativeNrBxBoardEvm(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardEvm")),
106 m_psBstLengthBytes(parSet.getParameter<int> (
"BstLengthBytes")),
107 m_verbosity(parSet.getUntrackedParameter<int>(
"Verbosity", 0)),
119 <<
"\nInput tag for technical triggers: "
125 LogTrace(
"L1GlobalTrigger") <<
"\n " << ( *it ) << std::endl;
138 <<
"\nNumber of BXs corresponding to alternative 0: " <<
m_recordLength.at(0)
139 <<
"\nNumber of BXs corresponding to alternative 1: " <<
m_recordLength.at(1)
141 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
143 <<
"\nAlternative for number of BX in GT EVM record: 0x" << std::hex
157 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: "
170 <<
"\nWARNING: Number of bunch crossing required to be emulated ( "
172 <<
"\n Number of BXs corresponding to alternative 0: " <<
m_recordLength.at(0)
173 <<
"\n Number of BXs corresponding to alternative 1: " <<
m_recordLength.at(1)
174 <<
"\nEmulating " << requiredRecordLength <<
" BX!"
183 produces<L1GlobalTriggerReadoutRecord>();
187 produces<L1GlobalTriggerEvmReadoutRecord>();
191 produces<L1GlobalTriggerObjectMapRecord>();
273 unsigned long long l1GtStableParCacheID =
358 if ((recordLength0 < 0) || (recordLength1 < 0) ) {
373 <<
"\nTotal number of BX to emulate in the GT readout record: "
376 <<
"\nNumber of BX for alternative 0: " << recordLength0
377 <<
"\nNumber of BX for alternative 1: " << recordLength1
378 <<
"\nActive boards in L1 GT DAQ record (hex format) = " << std::hex
381 <<
"\nActive boards in L1 GT EVM record (hex format) = " << std::hex
390 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
410 unsigned long long l1GtPfAlgoCacheID =
425 unsigned long long l1GtPfTechCacheID =
444 unsigned long long l1GtTmAlgoCacheID =
460 unsigned long long l1GtTmTechCacheID =
475 unsigned long long l1GtTmVetoAlgoCacheID =
491 unsigned long long l1GtTmVetoTechCacheID =
514 int daqNrGtfeBoards = 0;
516 int daqNrFdlBoards = 0;
517 int daqNrPsbBoards = 0;
518 int daqNrGmtBoards = 0;
519 int daqNrTcsBoards = 0;
520 int daqNrTimBoards = 0;
523 bool receiveMu =
false;
524 bool receiveNoIsoEG =
false;
525 bool receiveIsoEG =
false;
526 bool receiveCenJet =
false;
527 bool receiveForJet =
false;
528 bool receiveTauJet =
false;
529 bool receiveETM =
false;
530 bool receiveETT =
false;
531 bool receiveHTT =
false;
532 bool receiveHTM =
false;
533 bool receiveJetCounts =
false;
534 bool receiveHfBitCounts =
false;
535 bool receiveHfRingEtSums =
false;
537 bool receiveCastor =
false;
538 bool receiveBptx =
false;
539 bool receiveExternal =
false;
541 bool receiveTechTr =
false;
544 itBoard = boardMaps.begin();
545 itBoard != boardMaps.end(); ++itBoard) {
547 int iPosition = itBoard->gtPositionDaqRecord();
550 int iActiveBit = itBoard->gtBitDaqActiveBoards();
551 bool activeBoard =
false;
553 if (iActiveBit >= 0) {
559 if ((iActiveBit < 0) || activeBoard) {
561 switch (itBoard->gtBoardType()) {
577 std::vector<L1GtPsbQuad> quadInPsb = itBoard->gtQuadInPsb();
578 for (std::vector<L1GtPsbQuad>::const_iterator
579 itQuad = quadInPsb.begin();
580 itQuad != quadInPsb.end(); ++itQuad) {
585 receiveTechTr =
true;
590 receiveNoIsoEG =
true;
600 receiveCenJet =
true;
605 receiveForJet =
true;
610 receiveTauJet =
true;
623 receiveJetCounts =
true;
628 receiveCastor =
true;
638 receiveExternal =
true;
643 receiveHfBitCounts =
true;
644 receiveHfRingEtSums =
true;
690 std::auto_ptr<L1GlobalTriggerReadoutRecord> gtDaqReadoutRecord(
696 std::auto_ptr<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord(
701 std::auto_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
711 boost::uint16_t bxCrossHw = 0;
712 if ((bxCross & 0xFFF) == bxCross) {
713 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
720 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
721 <<
"\n larger than 12 bits. Set to 0! \n" << std::dec
730 itBoard = boardMaps.begin();
731 itBoard != boardMaps.end(); ++itBoard) {
733 int iPosition = itBoard->gtPositionDaqRecord();
736 int iActiveBit = itBoard->gtBitDaqActiveBoards();
737 bool activeBoard =
false;
739 if (iActiveBit >= 0) {
745 if ((iActiveBit < 0) || activeBoard) {
747 switch (itBoard->gtBoardType()) {
752 gtfeWordValue.
setBoardId( itBoard->gtBoardId() );
757 static_cast<boost::uint16_t>(recordLength0));
760 static_cast<boost::uint16_t>(recordLength1));
763 gtfeWordValue.
setBxNr(bxCrossHw);
776 static_cast<boost::uint32_t>(iEvent.
id().
event()));
780 gtDaqReadoutRecord->setGtfeWord(gtfeWordValue);
809 int evmNrFdlBoards = 0;
815 int bstLengthBytes = 0;
829 <<
"\n Length of BST message (in bytes): "
830 << bstLengthBytes <<
"\n"
835 itBoard = boardMaps.begin();
836 itBoard != boardMaps.end(); ++itBoard) {
838 int iPosition = itBoard->gtPositionEvmRecord();
841 int iActiveBit = itBoard->gtBitEvmActiveBoards();
842 bool activeBoard =
false;
844 if (iActiveBit >= 0) {
850 if ((iActiveBit < 0) || activeBoard) {
852 switch (itBoard->gtBoardType()) {
857 gtfeWordValue.
setBoardId(itBoard->gtBoardId() );
862 static_cast<boost::uint16_t>(recordLength0));
865 static_cast<boost::uint16_t>(recordLength1));
868 gtfeWordValue.
setBxNr(bxCrossHw);
881 static_cast<boost::uint32_t>(iEvent.
id().
event()));
894 boost::uint16_t bstSourceVal = 0xDDDD;
899 gtEvmReadoutRecord->setGtfeWord(gtfeWordValue);
912 tcsWordValue.
setBoardId( itBoard->gtBoardId() );
915 tcsWordValue.
setBxNr(bxCrossHw);
917 boost::uint16_t trigType = 0x5;
927 static_cast<boost::uint32_t>(iEvent.
id().
event()));
931 static_cast<boost::uint64_t>(iEvent.
orbitNumber()) );
935 gtEvmReadoutRecord->setTcsWord(tcsWordValue);
959 int pfAlgoSetIndex = 0;
960 const std::vector<int>& prescaleFactorsAlgoTrig =
961 (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
963 int pfTechSetIndex = 0;
964 const std::vector<int>& prescaleFactorsTechTrig =
965 (*m_prescaleFactorsTechTrig).at(pfTechSetIndex);
970 for (
int iBxInEvent = minBxInEvent; iBxInEvent <= maxBxInEvent;
986 receiveETM, receiveETT, receiveHTT, receiveHTM,
989 receiveHfRingEtSums);
1040 prescaleFactorsAlgoTrig, prescaleFactorsTechTrig,
1053 boardMaps, gtDaqReadoutRecord);
1060 boardMaps, gtEvmReadoutRecord);
1093 <<
"\nWarning: L1MuGMTReadoutCollection with input tag " <<
m_muGmtInputTag
1094 <<
"\nrequested in configuration, but not found in the event.\n"
1099 gtDaqReadoutRecord->setMuCollectionRefProd(gmtRcHandle);
1107 std::ostringstream myCoutStream;
1108 gtDaqReadoutRecord->print(myCoutStream);
1110 <<
"\n The following L1 GT DAQ readout record was produced:\n"
1111 << myCoutStream.str() <<
"\n"
1114 myCoutStream.str(
"");
1115 myCoutStream.clear();
1117 gtEvmReadoutRecord->print(myCoutStream);
1119 <<
"\n The following L1 GT EVM readout record was produced:\n"
1120 << myCoutStream.str() <<
"\n"
1123 myCoutStream.str(
"");
1124 myCoutStream.clear();
1126 const std::vector<L1GlobalTriggerObjectMap> objMapVec =
1127 gtObjectMapRecord->gtObjectMap();
1129 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
1130 it = objMapVec.begin(); it != objMapVec.end(); ++it) {
1132 (*it).print(myCoutStream);
1138 <<
"Test gtObjectMapRecord in L1GlobalTrigger \n\n" << myCoutStream.str() <<
"\n\n"
1141 myCoutStream.str(
"");
1142 myCoutStream.clear();
1149 iEvent.
put( gtDaqReadoutRecord );
1153 iEvent.
put( gtEvmReadoutRecord );
1157 iEvent.
put( gtObjectMapRecord );
unsigned int gtNumberL1TauJet() const
get / set the number of L1 tau jets received by GT
EventNumber_t event() const
void setBstSource(const boost::uint16_t bstSourceVal)
void setTriggerType(const boost::uint16_t triggerTypeValue)
const L1GtTriggerMask * m_l1GtTmVetoTech
void setBxNr(const boost::uint16_t bxNrValue)
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
std::vector< int > m_recordLength
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
std::vector< unsigned int > m_triggerMaskAlgoTrig
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 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)
run the FDL
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
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
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
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
void setRecordLength1(boost::uint16_t recordLengthValue)
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
void setActiveBoards(boost::uint16_t activeBoardsValue)
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.
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 &)
void setBoardId(const boost::uint16_t boardIdValue)
set BoardId from a BoardId value
unsigned int m_alternativeNrBxBoardDaq
int m_verbosity
verbosity level
L1GlobalTriggerFDL * m_gtFDL
const L1GtParameters * m_l1GtPar
parameters
std::vector< unsigned int > m_triggerMaskTechTrig
void setAltNrBxBoard(boost::uint16_t altNrBxBoardValue)
void setGpsTime(const boost::uint64_t)
const L1GtPrescaleFactors * m_l1GtPfTech
unsigned long long m_l1GtTmAlgoCacheID
std::vector< edm::InputTag > m_technicalTriggersInputTags
input tag for technical triggers
unsigned int m_alternativeNrBxBoardEvm
unsigned long long TimeValue_t
void setBxNr(boost::uint16_t bxNrValue)
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
void setEventNr(const boost::uint32_t eventNrValue)
unsigned int gtNumberL1JetCounts() const
get / set the number of L1 jet counts received by GT
bool m_produceL1GtObjectMapRecord
logical flag to produce the L1 GT object map record
boost::uint16_t m_activeBoardsGtDaq
active boards in L1 GT DAQ record and in L1 GT EVM record
TimeValue_t value() const
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
void setBoardId(boost::uint16_t boardIdValue)
set BoardId from a BoardId value
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
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_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
const std::vector< L1GtBoard > & gtBoardMaps() const
get / set / print the L1 GT board map
void setTotalTriggerNr(boost::uint32_t totalTriggerNrValue)
int m_totalBxInEvent
total number of Bx's in the event coming from EventSetup
unsigned int m_numberTechnicalTriggers
number of technical triggers
void setVerbosity(const int verbosity)
void setRecordLength(boost::uint16_t recordLengthValue)
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
void setLuminositySegmentNr(const boost::uint16_t luminositySegmentNrValue)
int m_psBstLengthBytes
length of BST record (in bytes) from parameter set
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
void setOrbitNr(const boost::uint64_t orbitNrValue)