CMS 3D CMS Logo

Public Member Functions | Private Attributes

triggerExpression::L1TechReader Class Reference

#include <TriggerExpressionL1TechReader.h>

Inheritance diagram for triggerExpression::L1TechReader:
triggerExpression::Evaluator

List of all members.

Public Member Functions

void dump (std::ostream &out) const
void init (const Data &data)
 L1TechReader (const std::string &pattern)
bool operator() (const Data &data) const

Private Attributes

std::string m_pattern
std::vector< std::pair
< std::string, unsigned int > > 
m_triggers

Detailed Description

Definition at line 11 of file TriggerExpressionL1TechReader.h.


Constructor & Destructor Documentation

triggerExpression::L1TechReader::L1TechReader ( const std::string &  pattern) [inline]

Definition at line 13 of file TriggerExpressionL1TechReader.h.


Member Function Documentation

void triggerExpression::L1TechReader::dump ( std::ostream &  out) const [virtual]

Implements triggerExpression::Evaluator.

Definition at line 48 of file TriggerExpressionL1TechReader.cc.

References first, i, and m_triggers.

                                              {
  if (m_triggers.size() == 0) {
    out << "FALSE";
  } else if (m_triggers.size() == 1) {
    out << m_triggers[0].first;
  } else {
    out << "(" << m_triggers[0].first;
    for (unsigned int i = 1; i < m_triggers.size(); ++i)
      out << " OR " << m_triggers[i].first;
    out << ")";
  }
}
void triggerExpression::L1TechReader::init ( const Data data) [virtual]

Reimplemented from triggerExpression::Evaluator.

Definition at line 61 of file TriggerExpressionL1TechReader.cc.

References triggerExpression::Data::daqPartitions(), edm::glob2reg(), L1GtTriggerMenu::gtTechnicalTriggerMap(), L1GtTriggerMask::gtTriggerMask(), triggerExpression::Data::ignoreL1Mask(), triggerExpression::Data::l1tMenu(), triggerExpression::Data::l1tTechMask(), m_pattern, m_triggers, match(), relval_steps::menu, and triggerExpression::Data::shouldThrow().

                                         {
  const L1GtTriggerMenu & menu = data.l1tMenu();
  const L1GtTriggerMask & mask = data.l1tTechMask();

  // clear the previous configuration
  m_triggers.clear();

  // L1 technical bits have a versioning suffix (".v0", ".v1", etc...)
  // so we always go through wildcard expansion
  bool match = false;
  boost::regex re(edm::glob2reg(m_pattern) + "\\.v\\d");
  const AlgorithmMap & triggerMap = menu.gtTechnicalTriggerMap();
  BOOST_FOREACH(const AlgorithmMap::value_type & entry, triggerMap)
    if (boost::regex_match(entry.first, re)) {
      match = true;
      if (data.ignoreL1Mask() or (mask.gtTriggerMask()[entry.second.algoBitNumber()] & data.daqPartitions()) != data.daqPartitions()) // unmasked in one or more partitions
        m_triggers.push_back( std::make_pair(entry.first, entry.second.algoBitNumber()) );
    }

  if (not match) {
    // m_pattern does not match any L1 bits
    if (data.shouldThrow())
      throw cms::Exception("Configuration") << "requested pattern \"" << m_pattern <<  "\" does not match any L1 trigger in the current menu";
    else
      edm::LogWarning("Configuration") << "requested pattern \"" << m_pattern <<  "\" does not match any L1 trigger in the current menu";
  }

}
bool triggerExpression::L1TechReader::operator() ( const Data data) const [virtual]

Implements triggerExpression::Evaluator.

Definition at line 18 of file TriggerExpressionL1TechReader.cc.

References L1GtPsbWord::aData(), L1GtPsbWord::bData(), L1GlobalTriggerReadoutRecord::gtPsbWord(), triggerExpression::Data::hasL1T(), triggerExpression::Data::ignoreL1TechPrescales(), triggerExpression::Data::l1tResults(), m_triggers, and L1GlobalTriggerReadoutRecord::technicalTriggerWord().

                                                     {
  if (not data.hasL1T())
    return false;

  typedef std::pair<std::string, unsigned int> value_type;
  if (data.ignoreL1TechPrescales()) {
    // select PSB#9 and bunch crossing 0
    const L1GtPsbWord & psb = data.l1tResults().gtPsbWord(0xbb09, 0);
    // the four 16-bit words psb.bData(1), psb.aData(1), psb.bData(0) and psb.aData(0) yield
    // (in this sequence) the 64 technical trigger bits from most significant to least significant bit
    uint64_t psbTriggerWord = ((uint64_t) psb.bData(1) << 48) | 
                              ((uint64_t) psb.aData(1) << 32) | 
                              ((uint64_t) psb.bData(0) << 16) | 
                              ((uint64_t) psb.aData(0));
    BOOST_FOREACH(const value_type & trigger, m_triggers)
      if (psbTriggerWord & ((uint64_t) 0x01 << trigger.second))
        return true;
  } else {
    const std::vector<bool> & word = data.l1tResults().technicalTriggerWord();
    if (word.empty())
      return false;

    BOOST_FOREACH(const value_type & trigger, m_triggers)
      if (trigger.second < word.size() and word[trigger.second])
        return true;
  }

  return false;
}

Member Data Documentation

Definition at line 25 of file TriggerExpressionL1TechReader.h.

Referenced by init().

std::vector<std::pair<std::string, unsigned int> > triggerExpression::L1TechReader::m_triggers [private]

Definition at line 26 of file TriggerExpressionL1TechReader.h.

Referenced by dump(), init(), and operator()().