49 m_firstEvLumiSegment(
true),
76 const std::vector<int>& prescaleFactorsAlgoTrig,
77 const std::vector<int>& prescaleFactorsTechTrig,
78 const std::vector<unsigned int>& triggerMaskAlgoTrig,
79 const std::vector<unsigned int>& triggerMaskTechTrig,
80 const std::vector<unsigned int>& triggerMaskVetoAlgoTrig,
81 const std::vector<unsigned int>& triggerMaskVetoTechTrig,
82 const std::vector<L1GtBoard>& boardMaps,
83 const int totalBxInEvent,
85 const unsigned int numberPhysTriggers,
const unsigned int numberTechnicalTriggers,
86 const unsigned int numberDaqPartitions,
89 const int pfAlgoSetIndex,
90 const int pfTechSetIndex,
91 const bool algorithmTriggersUnprescaled,
92 const bool algorithmTriggersUnmasked,
93 const bool technicalTriggersUnprescaled,
94 const bool technicalTriggersUnmasked,
95 const bool technicalTriggersVetoUnmasked
100 const unsigned int numberPhysTriggersSet =
104 std::bitset<numberPhysTriggersSet> gtlDecisionWord = ptrGTL->
getAlgorithmOR();
109 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
111 bool bitValue = gtlDecisionWord.test( iBit );
112 algoDecisionWord[ iBit ] = bitValue;
122 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
130 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
142 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
147 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
159 int inBxInEvent = totalBxInEvent/2 + iBxInEvent;
161 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
163 if ((!algorithmTriggersUnprescaled) && (prescaleFactorsAlgoTrig.at(iBit) != 1)) {
165 bool bitValue = algoDecisionWord.at( iBit );
173 prescaleFactorsAlgoTrig.at(iBit);
183 algoDecisionWord[iBit] =
false;;
205 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
207 if ((!technicalTriggersUnprescaled) && (prescaleFactorsTechTrig.at(iBit) != 1)) {
209 bool bitValue = techDecisionWord.at( iBit );
217 prescaleFactorsTechTrig.at(iBit);
227 techDecisionWord[iBit] =
false;
245 boost::uint16_t finalOrValue = 0;
247 for (
unsigned int iDaq = 0; iDaq < numberDaqPartitions; ++iDaq) {
249 bool daqPartitionFinalOR =
false;
254 bool vetoTechTrig =
false;
257 if (!technicalTriggersVetoUnmasked) {
259 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
261 int triggerMaskVetoTechTrigBit = triggerMaskVetoTechTrig[iBit]
269 if (triggerMaskVetoTechTrigBit && techDecisionWord[iBit]) {
271 daqPartitionFinalOR =
false;
289 bool algoFinalOr =
false;
291 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
293 bool iBitDecision =
false;
295 int triggerMaskAlgoTrigBit = -1;
297 if (algorithmTriggersUnmasked) {
298 triggerMaskAlgoTrigBit = 0;
300 triggerMaskAlgoTrigBit = triggerMaskAlgoTrig[iBit] & (1
310 if (triggerMaskAlgoTrigBit) {
311 iBitDecision =
false;
317 iBitDecision = algoDecisionWord[iBit];
320 algoFinalOr = algoFinalOr || iBitDecision;
326 bool techFinalOr =
false;
328 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
330 bool iBitDecision =
false;
332 int triggerMaskTechTrigBit = -1;
334 if (technicalTriggersUnmasked) {
335 triggerMaskTechTrigBit = 0;
337 triggerMaskTechTrigBit = triggerMaskTechTrig[iBit] & (1
345 if (triggerMaskTechTrigBit) {
347 iBitDecision =
false;
353 iBitDecision = techDecisionWord[iBit];
356 techFinalOr = techFinalOr || iBitDecision;
359 daqPartitionFinalOR = algoFinalOr || techFinalOr;
363 daqPartitionFinalOR =
false;
368 boost::uint16_t daqPartitionFinalORValue =
369 static_cast<boost::uint16_t
>(daqPartitionFinalOR);
371 finalOrValue = finalOrValue | (daqPartitionFinalORValue << iDaq);
378 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
380 itBoard = boardMaps.begin();
381 itBoard != boardMaps.end(); ++itBoard) {
384 if ((itBoard->gtBoardType() ==
FDL)) {
396 boost::uint16_t bxCrossHw = 0;
397 if ((bxCross & 0xFFF) == bxCross) {
398 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
404 <<
"\nBunch cross number [hex] = "
405 << std::hex << bxCross
406 <<
"\n larger than 12 bits. Set to 0! \n"
415 static_cast<boost::uint32_t>(iEvent.
id().
event()) );
450 const boost::uint16_t& activeBoardsGtDaq,
const int recordLength0,
451 const int recordLength1,
const unsigned int altNrBxBoardDaq,
452 const std::vector<L1GtBoard>& boardMaps,
453 std::auto_ptr<L1GlobalTriggerReadoutRecord>& gtDaqReadoutRecord)
456 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
458 itBoard = boardMaps.begin();
459 itBoard != boardMaps.end(); ++itBoard) {
461 int iPosition = itBoard->gtPositionDaqRecord();
464 int iActiveBit = itBoard->gtBitDaqActiveBoards();
465 bool activeBoard =
false;
466 bool writeBoard =
false;
470 if (iActiveBit >= 0) {
471 activeBoard = activeBoardsGtDaq & ( 1 << iActiveBit );
473 int altNrBxBoard = (altNrBxBoardDaq & ( 1 << iActiveBit )) >> iActiveBit;
475 if (altNrBxBoard == 1) {
476 recLength = recordLength1;
478 recLength = recordLength0;
481 int lowBxInEvent = (recLength + 1)/2 - recLength;
482 int uppBxInEvent = (recLength + 1)/2 - 1;
484 if ((iBxInEvent >= lowBxInEvent) && (iBxInEvent <= uppBxInEvent)) {
490 if (activeBoard && writeBoard && (itBoard->gtBoardType() ==
FDL)) {
506 const boost::uint16_t& activeBoardsGtEvm,
const int recordLength0,
507 const int recordLength1,
const unsigned int altNrBxBoardEvm,
508 const std::vector<L1GtBoard>& boardMaps,
509 std::auto_ptr<L1GlobalTriggerEvmReadoutRecord>& gtEvmReadoutRecord)
512 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
514 itBoard = boardMaps.begin();
515 itBoard != boardMaps.end(); ++itBoard) {
517 int iPosition = itBoard->gtPositionEvmRecord();
520 int iActiveBit = itBoard->gtBitEvmActiveBoards();
521 bool activeBoard =
false;
523 if (iActiveBit >= 0) {
524 activeBoard = activeBoardsGtEvm & (1 << iActiveBit);
527 if (activeBoard && (itBoard->gtBoardType() ==
FDL)) {
EventNumber_t event() const
void setBoardId(const cms_uint16_t &boardIdValue)
set BoardId from a BoardId value
void setFinalOR(const cms_uint16_t &finalORValue)
L1GtFdlWord * m_gtFdlWord
int bunchCrossing() const
void setEventNr(const cms_uint32_t &eventNrValue)
edm::LuminosityBlockNumber_t luminosityBlock() const
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
void setGtDecisionWord(const DecisionWord >DecisionWordValue)
void setLocalBxNr(const cms_uint16_t &localBxNrValue)
void setGtTechnicalTriggerWord(const TechnicalTriggerWord >TechnicalTriggerWordValue)
const std::vector< bool > * getGtTechnicalTriggers() const
pointer to technical trigger bits
void setLumiSegmentNr(const cms_uint16_t &lumiSegmentNrValue)
std::vector< std::vector< int > > m_prescaleCounterAlgoTrig
prescale counters: NumberPhysTriggers counters per bunch cross in event
std::vector< bool > DecisionWord
typedefs
int m_verbosity
verbosity level
void reset()
reset the content of a L1GtFdlWord
static const unsigned int NumberPhysTriggers
L1GlobalTriggerFDL()
constructor
void setGtPrescaleFactorIndexAlgo(const cms_uint16_t >PrescaleFactorIndexAlgoValue)
void setGtPrescaleFactorIndexTech(const cms_uint16_t >PrescaleFactorIndexTechValue)
virtual ~L1GlobalTriggerFDL()
destructor
const std::bitset< L1GlobalTriggerReadoutSetup::NumberPhysTriggers > & getAlgorithmOR() const
return algorithm OR decision
bool m_firstEvLumiSegment
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
void setOrbitNr(const cms_uint32_t &orbitNrValue)
void setBxInEvent(const int bxInEventValue)
std::vector< std::vector< int > > m_prescaleCounterTechTrig
prescale counters: technical trigger counters per bunch cross in event
void setBxNr(const cms_uint16_t &bxNrValue)
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