#include <L1GlobalTriggerFDL.h>
Public Member Functions | |
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 | |
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 | |
L1GtFdlWord * | gtFdlWord () const |
return the GtFdlWord | |
L1GlobalTriggerFDL () | |
constructor | |
void | reset () |
clear FDL | |
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 | setVerbosity (const int verbosity) |
virtual | ~L1GlobalTriggerFDL () |
destructor | |
Private Attributes | |
bool | m_firstEv |
bool | m_firstEvLumiSegment |
bool | m_firstEvRun |
L1GtFdlWord * | m_gtFdlWord |
bool | m_isDebugEnabled |
std::vector< std::vector< int > > | m_prescaleCounterAlgoTrig |
prescale counters: NumberPhysTriggers counters per bunch cross in event | |
std::vector< std::vector< int > > | m_prescaleCounterTechTrig |
prescale counters: technical trigger counters per bunch cross in event | |
int | m_verbosity |
verbosity level |
Description: Final Decision Logic board.
Implementation: <TODO: enter implementation details>
$Date$ $Revision$
Definition at line 43 of file L1GlobalTriggerFDL.h.
L1GlobalTriggerFDL::L1GlobalTriggerFDL | ( | ) |
constructor
Definition at line 48 of file L1GlobalTriggerFDL.cc.
References m_gtFdlWord.
: // logical switches m_firstEv(true), m_firstEvLumiSegment(true), m_firstEvRun(true), m_isDebugEnabled(edm::isDebugEnabled()) { // create empty FDL word m_gtFdlWord = new L1GtFdlWord(); // can not reserve memory here for prescale counters - no access to EventSetup }
L1GlobalTriggerFDL::~L1GlobalTriggerFDL | ( | ) | [virtual] |
destructor
Definition at line 65 of file L1GlobalTriggerFDL.cc.
References m_gtFdlWord, and reset().
{ reset(); delete m_gtFdlWord; }
void L1GlobalTriggerFDL::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 > & | gtDaqReadoutRecord | ||
) |
fill the FDL block in the L1 GT DAQ record for iBxInEvent
Definition at line 451 of file L1GlobalTriggerFDL.cc.
References FDL, and m_gtFdlWord.
Referenced by L1GlobalTrigger::produce().
{ typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps; for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) { int iPosition = itBoard->gtPositionDaqRecord(); if (iPosition > 0) { int iActiveBit = itBoard->gtBitDaqActiveBoards(); bool activeBoard = false; bool writeBoard = false; int recLength = -1; if (iActiveBit >= 0) { activeBoard = activeBoardsGtDaq & ( 1 << iActiveBit ); int altNrBxBoard = (altNrBxBoardDaq & ( 1 << iActiveBit )) >> iActiveBit; if (altNrBxBoard == 1) { recLength = recordLength1; } else { recLength = recordLength0; } int lowBxInEvent = (recLength + 1)/2 - recLength; int uppBxInEvent = (recLength + 1)/2 - 1; if ((iBxInEvent >= lowBxInEvent) && (iBxInEvent <= uppBxInEvent)) { writeBoard = true; } } if (activeBoard && writeBoard && (itBoard->gtBoardType() == FDL)) { gtDaqReadoutRecord->setGtFdlWord(*m_gtFdlWord); } } } }
void L1GlobalTriggerFDL::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 > & | gtEvmReadoutRecord | ||
) |
fill the FDL block in the L1 GT EVM record for iBxInEvent
Definition at line 507 of file L1GlobalTriggerFDL.cc.
References FDL, and m_gtFdlWord.
Referenced by L1GlobalTrigger::produce().
{ typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps; for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) { int iPosition = itBoard->gtPositionEvmRecord(); if (iPosition > 0) { int iActiveBit = itBoard->gtBitEvmActiveBoards(); bool activeBoard = false; if (iActiveBit >= 0) { activeBoard = activeBoardsGtEvm & (1 << iActiveBit); } if (activeBoard && (itBoard->gtBoardType() == FDL)) { gtEvmReadoutRecord->setGtFdlWord(*m_gtFdlWord); } } } }
L1GtFdlWord* L1GlobalTriggerFDL::gtFdlWord | ( | ) | const [inline] |
return the GtFdlWord
Definition at line 97 of file L1GlobalTriggerFDL.h.
References m_gtFdlWord.
{ return m_gtFdlWord; }
void L1GlobalTriggerFDL::reset | ( | void | ) |
clear FDL
Definition at line 544 of file L1GlobalTriggerFDL.cc.
References m_gtFdlWord, and L1GtFdlWord::reset().
Referenced by L1GlobalTrigger::produce(), and ~L1GlobalTriggerFDL().
{ m_gtFdlWord->reset(); // do NOT reset the prescale counters }
void L1GlobalTriggerFDL::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
Definition at line 76 of file L1GlobalTriggerFDL.cc.
References edm::EventBase::bunchCrossing(), edm::EventID::event(), FDL, L1GlobalTriggerGTL::getAlgorithmOR(), L1GlobalTriggerPSB::getGtTechnicalTriggers(), edm::EventBase::id(), LogDebug, edm::EventBase::luminosityBlock(), m_firstEv, m_firstEvLumiSegment, m_gtFdlWord, m_prescaleCounterAlgoTrig, m_prescaleCounterTechTrig, m_verbosity, L1GlobalTriggerReadoutSetup::NumberPhysTriggers, edm::EventBase::orbitNumber(), L1GtFdlWord::setBoardId(), L1GtFdlWord::setBxInEvent(), L1GtFdlWord::setBxNr(), L1GtFdlWord::setEventNr(), L1GtFdlWord::setFinalOR(), L1GtFdlWord::setGtDecisionWord(), L1GtFdlWord::setGtPrescaleFactorIndexAlgo(), L1GtFdlWord::setGtPrescaleFactorIndexTech(), L1GtFdlWord::setGtTechnicalTriggerWord(), L1GtFdlWord::setLocalBxNr(), L1GtFdlWord::setLumiSegmentNr(), and L1GtFdlWord::setOrbitNr().
Referenced by L1GlobalTrigger::produce().
{ // FIXME get rid of bitset in GTL in order to use only EventSetup const unsigned int numberPhysTriggersSet = L1GlobalTriggerReadoutSetup::NumberPhysTriggers; // get gtlDecisionWord from GTL std::bitset<numberPhysTriggersSet> gtlDecisionWord = ptrGTL->getAlgorithmOR(); // convert decision word from std::bitset to std::vector<bool> DecisionWord algoDecisionWord(numberPhysTriggers); for (unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) { bool bitValue = gtlDecisionWord.test( iBit ); algoDecisionWord[ iBit ] = bitValue; } // prescale counters are reset at the beginning of the luminosity segment if (m_firstEv) { // prescale counters: numberPhysTriggers counters per bunch cross m_prescaleCounterAlgoTrig.reserve(numberPhysTriggers*totalBxInEvent); for (int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) { m_prescaleCounterAlgoTrig.push_back(prescaleFactorsAlgoTrig); } // prescale counters: numberTechnicalTriggers counters per bunch cross m_prescaleCounterTechTrig.reserve(numberTechnicalTriggers*totalBxInEvent); for (int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) { m_prescaleCounterTechTrig.push_back(prescaleFactorsTechTrig); } m_firstEv = false; } // TODO FIXME find the beginning of the luminosity segment if (m_firstEvLumiSegment) { m_prescaleCounterAlgoTrig.clear(); for (int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) { m_prescaleCounterAlgoTrig.push_back(prescaleFactorsAlgoTrig); } m_prescaleCounterTechTrig.clear(); for (int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) { m_prescaleCounterTechTrig.push_back(prescaleFactorsTechTrig); } m_firstEvLumiSegment = false; } // prescale the algorithm, if necessary // iBxInEvent is ... -2 -1 0 1 2 ... while counters are 0 1 2 3 4 ... int inBxInEvent = totalBxInEvent/2 + iBxInEvent; for (unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) { if ((!algorithmTriggersUnprescaled) && (prescaleFactorsAlgoTrig.at(iBit) != 1)) { bool bitValue = algoDecisionWord.at( iBit ); if (bitValue) { (m_prescaleCounterAlgoTrig.at(inBxInEvent).at(iBit))--; if (m_prescaleCounterAlgoTrig.at(inBxInEvent).at(iBit) == 0) { // bit already true in algoDecisionWord, just reset counter m_prescaleCounterAlgoTrig.at(inBxInEvent).at(iBit) = prescaleFactorsAlgoTrig.at(iBit); //LogTrace("L1GlobalTrigger") //<< "\nPrescaled algorithm: " << iBit << ". Reset counter to " //<< prescaleFactorsAlgoTrig.at(iBit) << "\n" //<< std::endl; } else { // change bit to false algoDecisionWord[iBit] = false;; //LogTrace("L1GlobalTrigger") //<< "\nPrescaled algorithm: " << iBit << ". Result set to false" //<< std::endl; } } } } // algo decision word written in the FDL readout before the trigger mask // in order to allow multiple DAQ partitions // // technical triggers // std::vector<bool> techDecisionWord = *(ptrPSB->getGtTechnicalTriggers()); // prescale the technical trigger, if necessary for (unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) { if ((!technicalTriggersUnprescaled) && (prescaleFactorsTechTrig.at(iBit) != 1)) { bool bitValue = techDecisionWord.at( iBit ); if (bitValue) { (m_prescaleCounterTechTrig.at(inBxInEvent).at(iBit))--; if (m_prescaleCounterTechTrig.at(inBxInEvent).at(iBit) == 0) { // bit already true in techDecisionWord, just reset counter m_prescaleCounterTechTrig.at(inBxInEvent).at(iBit) = prescaleFactorsTechTrig.at(iBit); //LogTrace("L1GlobalTrigger") //<< "\nPrescaled algorithm: " << iBit << ". Reset counter to " //<< prescaleFactorsTechTrig.at(iBit) << "\n" //<< std::endl; } else { // change bit to false techDecisionWord[iBit] = false; //LogTrace("L1GlobalTrigger") //<< "\nPrescaled technical trigger: " << iBit << ". Result set to false" //<< std::endl; } } } } // technical trigger decision word written in the FDL readout before the trigger mask // in order to allow multiple DAQ partitions // // compute the final decision word per DAQ partition // boost::uint16_t finalOrValue = 0; for (unsigned int iDaq = 0; iDaq < numberDaqPartitions; ++iDaq) { bool daqPartitionFinalOR = false; // starts with technical trigger veto mask to minimize computation // no algorithm trigger veto mask is implemented up to now in hardware, // therefore do not implement it here bool vetoTechTrig = false; // vetoTechTrig can change only when using trigger veto masks if (!technicalTriggersVetoUnmasked) { for (unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) { int triggerMaskVetoTechTrigBit = triggerMaskVetoTechTrig[iBit] & (1 << iDaq); //LogTrace("L1GlobalTrigger") //<< "\nTechnical trigger bit: " << iBit //<< " mask = " << triggerMaskVetoTechTrigBit //<< " DAQ partition " << iDaq //<< std::endl; if (triggerMaskVetoTechTrigBit && techDecisionWord[iBit]) { daqPartitionFinalOR = false; vetoTechTrig = true; //LogTrace("L1GlobalTrigger") //<< "\nVeto mask technical trigger: " << iBit // << ". FinalOR for DAQ partition " << iDaq << " set to false" //<< std::endl; break; } } } // apply algorithm and technical trigger masks only if no veto from technical trigger if (!vetoTechTrig) { // algorithm trigger mask bool algoFinalOr = false; for (unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) { bool iBitDecision = false; int triggerMaskAlgoTrigBit = -1; if (algorithmTriggersUnmasked) { triggerMaskAlgoTrigBit = 0; } else { triggerMaskAlgoTrigBit = triggerMaskAlgoTrig[iBit] & (1 << iDaq); } //LogTrace("L1GlobalTrigger") //<< "\nAlgorithm trigger bit: " << iBit //<< " mask = " << triggerMaskAlgoTrigBit //<< " DAQ partition " << iDaq //<< std::endl; if (triggerMaskAlgoTrigBit) { iBitDecision = false; //LogTrace("L1GlobalTrigger") //<< "\nMasked algorithm trigger: " << iBit << ". Result set to false" //<< std::endl; } else { iBitDecision = algoDecisionWord[iBit]; } algoFinalOr = algoFinalOr || iBitDecision; } // set the technical trigger mask: block the corresponding algorithm if bit value is 1 bool techFinalOr = false; for (unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) { bool iBitDecision = false; int triggerMaskTechTrigBit = -1; if (technicalTriggersUnmasked) { triggerMaskTechTrigBit = 0; } else { triggerMaskTechTrigBit = triggerMaskTechTrig[iBit] & (1 << iDaq); } //LogTrace("L1GlobalTrigger") //<< "\nTechnical trigger bit: " << iBit //<< " mask = " << triggerMaskTechTrigBit //<< std::endl; if (triggerMaskTechTrigBit) { iBitDecision = false; //LogTrace("L1GlobalTrigger") //<< "\nMasked technical trigger: " << iBit << ". Result set to false" //<< std::endl; } else { iBitDecision = techDecisionWord[iBit]; } techFinalOr = techFinalOr || iBitDecision; } daqPartitionFinalOR = algoFinalOr || techFinalOr; } else { daqPartitionFinalOR = false; // vetoTechTrig } // push it in finalOrValue boost::uint16_t daqPartitionFinalORValue = static_cast<boost::uint16_t>(daqPartitionFinalOR); finalOrValue = finalOrValue | (daqPartitionFinalORValue << iDaq); } // fill everything we know in the L1GtFdlWord typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps; for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) { if ((itBoard->gtBoardType() == FDL)) { m_gtFdlWord->setBoardId( itBoard->gtBoardId() ); // BxInEvent m_gtFdlWord->setBxInEvent(iBxInEvent); // bunch crossing // fill in emulator the same bunch crossing (12 bits - hardwired number of bits...) // and the same local bunch crossing for all boards int bxCross = iEvent.bunchCrossing(); boost::uint16_t bxCrossHw = 0; if ((bxCross & 0xFFF) == bxCross) { bxCrossHw = static_cast<boost::uint16_t> (bxCross); } else { bxCrossHw = 0; // Bx number too large, set to 0! if (m_verbosity) { LogDebug("L1GlobalTrigger") << "\nBunch cross number [hex] = " << std::hex << bxCross << "\n larger than 12 bits. Set to 0! \n" << std::dec << std::endl; } } m_gtFdlWord->setBxNr(bxCrossHw); // set event number since last L1 reset generated in FDL m_gtFdlWord->setEventNr( static_cast<boost::uint32_t>(iEvent.id().event()) ); // technical trigger decision word m_gtFdlWord->setGtTechnicalTriggerWord(techDecisionWord); // algorithm trigger decision word m_gtFdlWord->setGtDecisionWord(algoDecisionWord); // index of prescale factor set - technical triggers and algo m_gtFdlWord->setGtPrescaleFactorIndexTech(static_cast<boost::uint16_t>(pfTechSetIndex)); m_gtFdlWord->setGtPrescaleFactorIndexAlgo(static_cast<boost::uint16_t>(pfAlgoSetIndex)); // NoAlgo bit FIXME // finalOR m_gtFdlWord->setFinalOR(finalOrValue); // orbit number m_gtFdlWord->setOrbitNr(static_cast<boost::uint32_t>(iEvent.orbitNumber()) ); // luminosity segment number m_gtFdlWord->setLumiSegmentNr(static_cast<boost::uint16_t>(iEvent.luminosityBlock())); // local bunch crossing - set identical with absolute BxNr m_gtFdlWord->setLocalBxNr(bxCrossHw); } } }
void L1GlobalTriggerFDL::setVerbosity | ( | const int | verbosity | ) | [inline] |
Definition at line 104 of file L1GlobalTriggerFDL.h.
References m_verbosity, and verbosity.
Referenced by L1GlobalTrigger::L1GlobalTrigger().
{ m_verbosity = verbosity; }
bool L1GlobalTriggerFDL::m_firstEv [private] |
logical switches for the first event the first event in the luminosity segment and the first event in the run
Definition at line 122 of file L1GlobalTriggerFDL.h.
Referenced by run().
bool L1GlobalTriggerFDL::m_firstEvLumiSegment [private] |
Definition at line 123 of file L1GlobalTriggerFDL.h.
Referenced by run().
bool L1GlobalTriggerFDL::m_firstEvRun [private] |
Definition at line 124 of file L1GlobalTriggerFDL.h.
L1GtFdlWord* L1GlobalTriggerFDL::m_gtFdlWord [private] |
Definition at line 110 of file L1GlobalTriggerFDL.h.
Referenced by fillDaqFdlBlock(), fillEvmFdlBlock(), gtFdlWord(), L1GlobalTriggerFDL(), reset(), run(), and ~L1GlobalTriggerFDL().
bool L1GlobalTriggerFDL::m_isDebugEnabled [private] |
Definition at line 130 of file L1GlobalTriggerFDL.h.
std::vector<std::vector<int> > L1GlobalTriggerFDL::m_prescaleCounterAlgoTrig [private] |
prescale counters: NumberPhysTriggers counters per bunch cross in event
Definition at line 113 of file L1GlobalTriggerFDL.h.
Referenced by run().
std::vector<std::vector<int> > L1GlobalTriggerFDL::m_prescaleCounterTechTrig [private] |
prescale counters: technical trigger counters per bunch cross in event
Definition at line 116 of file L1GlobalTriggerFDL.h.
Referenced by run().
int L1GlobalTriggerFDL::m_verbosity [private] |
verbosity level
Definition at line 129 of file L1GlobalTriggerFDL.h.
Referenced by run(), and setVerbosity().