CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
triggerExpression::L1AlgoReader Class Reference

#include <TriggerExpressionL1AlgoReader.h>

Inheritance diagram for triggerExpression::L1AlgoReader:
triggerExpression::Evaluator

Public Member Functions

void dump (std::ostream &out) const
 
void init (const Data &data)
 
 L1AlgoReader (const std::string &pattern)
 
bool operator() (const Data &data) const
 
- Public Member Functions inherited from triggerExpression::Evaluator
 Evaluator ()
 
virtual ~Evaluator ()
 

Private Attributes

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

Detailed Description

Definition at line 11 of file TriggerExpressionL1AlgoReader.h.

Constructor & Destructor Documentation

triggerExpression::L1AlgoReader::L1AlgoReader ( const std::string &  pattern)
inline

Definition at line 13 of file TriggerExpressionL1AlgoReader.h.

13  :
15  m_triggers()
16  { }
list pattern
Definition: chain.py:104
std::vector< std::pair< std::string, unsigned int > > m_triggers

Member Function Documentation

void triggerExpression::L1AlgoReader::dump ( std::ostream &  out) const
virtual

Implements triggerExpression::Evaluator.

Definition at line 33 of file TriggerExpressionL1AlgoReader.cc.

References first, i, and m_triggers.

33  {
34  if (m_triggers.size() == 0) {
35  out << "FALSE";
36  } else if (m_triggers.size() == 1) {
37  out << m_triggers[0].first;
38  } else {
39  out << "(" << m_triggers[0].first;
40  for (unsigned int i = 1; i < m_triggers.size(); ++i)
41  out << " OR " << m_triggers[i].first;
42  out << ")";
43  }
44 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::pair< std::string, unsigned int > > m_triggers
bool first
Definition: L1TdeRCT.cc:75
tuple out
Definition: dbtoconf.py:99
void triggerExpression::L1AlgoReader::init ( const Data data)
virtual

Reimplemented from triggerExpression::Evaluator.

Definition at line 46 of file TriggerExpressionL1AlgoReader.cc.

References triggerExpression::Data::daqPartitions(), edm::glob2reg(), L1GtTriggerMenu::gtAlgorithmAliasMap(), L1GtTriggerMask::gtTriggerMask(), triggerExpression::Data::hasL1T(), triggerExpression::Data::ignoreL1Mask(), edm::is_glob(), triggerExpression::Data::l1tAlgoMask(), triggerExpression::Data::l1tMenu(), m_pattern, m_triggers, match(), relval_steps::menu, or, and triggerExpression::Data::shouldThrow().

46  {
47  if (not data.hasL1T())
48  return;
49 
50  const L1GtTriggerMenu & menu = data.l1tMenu();
51  const L1GtTriggerMask & mask = data.l1tAlgoMask();
52 
53  // clear the previous configuration
54  m_triggers.clear();
55 
56  // check if the pattern has is a glob expression, or a single trigger name
57  if (not edm::is_glob(m_pattern)) {
58  // no wildcard expression
59  const AlgorithmMap & triggerMap = menu.gtAlgorithmAliasMap();
60  AlgorithmMap::const_iterator entry = triggerMap.find(m_pattern);
61  if (entry != triggerMap.end()) {
62  // single L1 bit
63  m_triggers.push_back( std::make_pair(m_pattern, entry->second.algoBitNumber()) );
64  } else
65  // trigger not found in the current menu
66  if (data.shouldThrow())
67  throw cms::Exception("Configuration") << "requested L1 trigger \"" << m_pattern << "\" does not exist in the current L1 menu";
68  else
69  edm::LogWarning("Configuration") << "requested L1 trigger \"" << m_pattern << "\" does not exist in the current L1 menu";
70  } else {
71  // expand wildcards in the pattern
72  bool match = false;
73  boost::regex re(edm::glob2reg(m_pattern));
74  const AlgorithmMap & triggerMap = menu.gtAlgorithmAliasMap();
75  BOOST_FOREACH(const AlgorithmMap::value_type & entry, triggerMap)
76  if (boost::regex_match(entry.first, re)) {
77  match = true;
78  if (data.ignoreL1Mask() or (mask.gtTriggerMask()[entry.second.algoBitNumber()] & data.daqPartitions()) != data.daqPartitions()) // unmasked in one or more partitions
79  m_triggers.push_back( std::make_pair(entry.first, entry.second.algoBitNumber()) );
80  }
81 
82  if (not match) {
83  // m_pattern does not match any L1 bits
84  if (data.shouldThrow())
85  throw cms::Exception("Configuration") << "requested pattern \"" << m_pattern << "\" does not match any L1 trigger in the current menu";
86  else
87  edm::LogWarning("Configuration") << "requested pattern \"" << m_pattern << "\" does not match any L1 trigger in the current menu";
88  }
89  }
90 
91 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
bool is_glob(std::string const &pattern)
Definition: RegexMatch.cc:18
std::string glob2reg(std::string const &pattern)
Definition: RegexMatch.cc:22
std::vector< std::pair< std::string, unsigned int > > m_triggers
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
bool first
Definition: L1TdeRCT.cc:75
Container::value_type value_type
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
if(conf.exists("allCellsPositionCalc"))
bool triggerExpression::L1AlgoReader::operator() ( const Data data) const
virtual

Implements triggerExpression::Evaluator.

Definition at line 17 of file TriggerExpressionL1AlgoReader.cc.

References L1GlobalTriggerReadoutRecord::decisionWord(), triggerExpression::Data::hasL1T(), triggerExpression::Data::l1tResults(), and m_triggers.

17  {
18  if (not data.hasL1T())
19  return false;
20 
21  const std::vector<bool> & word = data.l1tResults().decisionWord();
22  if (word.empty())
23  return false;
24 
25  typedef std::pair<std::string, unsigned int> value_type;
26  BOOST_FOREACH(const value_type & trigger, m_triggers)
27  if (trigger.second < word.size() and word[trigger.second])
28  return true;
29 
30  return false;
31 }
return((rh^lh)&mask)
std::vector< std::pair< std::string, unsigned int > > m_triggers
U second(std::pair< T, U > const &p)
Container::value_type value_type
volatile std::atomic< bool > shutdown_flag false
if(conf.exists("allCellsPositionCalc"))
tuple size
Write out results.

Member Data Documentation

std::string triggerExpression::L1AlgoReader::m_pattern
private

Definition at line 25 of file TriggerExpressionL1AlgoReader.h.

Referenced by init().

std::vector<std::pair<std::string, unsigned int> > triggerExpression::L1AlgoReader::m_triggers
private

Definition at line 26 of file TriggerExpressionL1AlgoReader.h.

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