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::L1TechReader Class Reference

#include <TriggerExpressionL1TechReader.h>

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

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
 
- 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 TriggerExpressionL1TechReader.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file TriggerExpressionL1TechReader.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::L1TechReader::dump ( std::ostream &  out) const
virtual

Implements triggerExpression::Evaluator.

Definition at line 48 of file TriggerExpressionL1TechReader.cc.

References plotBeamSpotDB::first, i, and m_triggers.

48  {
49  if (m_triggers.size() == 0) {
50  out << "FALSE";
51  } else if (m_triggers.size() == 1) {
52  out << m_triggers[0].first;
53  } else {
54  out << "(" << m_triggers[0].first;
55  for (unsigned int i = 1; i < m_triggers.size(); ++i)
56  out << " OR " << m_triggers[i].first;
57  out << ")";
58  }
59 }
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
std::vector< std::pair< std::string, unsigned int > > m_triggers
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::hasL1T(), triggerExpression::Data::ignoreL1Mask(), triggerExpression::Data::l1tMenu(), triggerExpression::Data::l1tTechMask(), m_pattern, m_triggers, match(), relval_steps::menu, or, and triggerExpression::Data::shouldThrow().

61  {
62  if (not data.hasL1T())
63  return;
64 
65  const L1GtTriggerMenu & menu = data.l1tMenu();
66  const L1GtTriggerMask & mask = data.l1tTechMask();
67 
68  // clear the previous configuration
69  m_triggers.clear();
70 
71  // L1 technical bits have a versioning suffix (".v0", ".v1", etc...)
72  // so we always go through wildcard expansion
73  bool match = false;
74  boost::regex re(edm::glob2reg(m_pattern) + "\\.v\\d");
75  const AlgorithmMap & triggerMap = menu.gtTechnicalTriggerMap();
76  BOOST_FOREACH(const AlgorithmMap::value_type & entry, triggerMap)
77  if (boost::regex_match(entry.first, re)) {
78  match = true;
79  if (data.ignoreL1Mask() or (mask.gtTriggerMask()[entry.second.algoBitNumber()] & data.daqPartitions()) != data.daqPartitions()) // unmasked in one or more partitions
80  m_triggers.push_back( std::make_pair(entry.first, entry.second.algoBitNumber()) );
81  }
82 
83  if (not match) {
84  // m_pattern does not match any L1 bits
85  if (data.shouldThrow())
86  throw cms::Exception("Configuration") << "requested pattern \"" << m_pattern << "\" does not match any L1 trigger in the current menu";
87  else
88  edm::LogWarning("Configuration") << "requested pattern \"" << m_pattern << "\" does not match any L1 trigger in the current menu";
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
std::string glob2reg(std::string const &pattern)
Definition: RegexMatch.cc:22
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
Container::value_type value_type
std::vector< std::pair< std::string, unsigned int > > m_triggers
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
if(conf.exists("allCellsPositionCalc"))
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().

18  {
19  if (not data.hasL1T())
20  return false;
21 
22  typedef std::pair<std::string, unsigned int> value_type;
23  if (data.ignoreL1TechPrescales()) {
24  // select PSB#9 and bunch crossing 0
25  const L1GtPsbWord & psb = data.l1tResults().gtPsbWord(0xbb09, 0);
26  // the four 16-bit words psb.bData(1), psb.aData(1), psb.bData(0) and psb.aData(0) yield
27  // (in this sequence) the 64 technical trigger bits from most significant to least significant bit
28  uint64_t psbTriggerWord = ((uint64_t) psb.bData(1) << 48) |
29  ((uint64_t) psb.aData(1) << 32) |
30  ((uint64_t) psb.bData(0) << 16) |
31  ((uint64_t) psb.aData(0));
32  BOOST_FOREACH(const value_type & trigger, m_triggers)
33  if (psbTriggerWord & ((uint64_t) 0x01 << trigger.second))
34  return true;
35  } else {
36  const std::vector<bool> & word = data.l1tResults().technicalTriggerWord();
37  if (word.empty())
38  return false;
39 
40  BOOST_FOREACH(const value_type & trigger, m_triggers)
41  if (trigger.second < word.size() and word[trigger.second])
42  return true;
43  }
44 
45  return false;
46 }
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:323
return((rh^lh)&mask)
else
Definition: XrdSource.cc:104
U second(std::pair< T, U > const &p)
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:228
Container::value_type value_type
unsigned long long uint64_t
Definition: Time.h:15
std::vector< std::pair< std::string, unsigned int > > m_triggers
volatile std::atomic< bool > shutdown_flag false
if(conf.exists("allCellsPositionCalc"))
tuple size
Write out results.

Member Data Documentation

std::string triggerExpression::L1TechReader::m_pattern
private

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()().