Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
HLTrigger
HLTcore
src
TriggerExpressionL1uGTReader.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <boost/foreach.hpp>
3
#include <boost/regex.hpp>
4
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
#include "
FWCore/Utilities/interface/RegexMatch.h
"
7
#include "
CondFormats/L1TObjects/interface/L1GtTriggerMask.h
"
8
#include "
CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h
"
9
#include "
DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h
"
10
#include "
HLTrigger/HLTcore/interface/TriggerExpressionData.h
"
11
#include "
HLTrigger/HLTcore/interface/TriggerExpressionL1uGTReader.h
"
12
13
namespace
triggerExpression {
14
15
// define the result of the module from the L1 reults
16
bool
L1uGTReader::operator()
(
const
Data
&
data
)
const
{
17
if
(not data.
hasL1T
())
18
return
false
;
19
20
std::vector<bool>
const
& word = data.
l1tResults
();
21
if
(word.empty())
22
return
false
;
23
24
for
(
auto
const
& trigger:
m_triggers
)
25
if
(trigger.second < word.size() and word[trigger.second])
26
return
true
;
27
28
return
false
;
29
}
30
31
void
L1uGTReader::dump
(std::ostream &
out
)
const
{
32
if
(
m_triggers
.size() == 0) {
33
out <<
"FALSE"
;
34
}
else
if
(
m_triggers
.size() == 1) {
35
out <<
m_triggers
[0].first;
36
}
else
{
37
out <<
"("
<<
m_triggers
[0].first;
38
for
(
unsigned
int
i
= 1;
i
<
m_triggers
.size(); ++
i
)
39
out <<
" OR "
<<
m_triggers
[
i
].
first
;
40
out <<
")"
;
41
}
42
}
43
44
void
L1uGTReader::init
(
const
Data
&
data
) {
45
if
(not data.
hasL1T
())
46
return
;
47
48
const
L1TUtmTriggerMenu
&
menu
= data.
l1tMenu
();
49
50
// clear the previous configuration
51
m_triggers
.clear();
52
53
// check if the pattern has is a glob expression, or a single trigger name
54
auto
const
& triggerMap = menu.
getAlgorithmMap
();
55
if
(not
edm::is_glob
(
m_pattern
)) {
56
// no wildcard expression
57
auto
entry
= triggerMap.find(
m_pattern
);
58
if
(
entry
!= triggerMap.end()) {
59
// single L1 bit
60
m_triggers
.push_back( std::make_pair(
m_pattern
,
entry
->second.getIndex()) );
61
}
else
62
// trigger not found in the current menu
63
if
(data.
shouldThrow
())
64
throw
cms::Exception
(
"Configuration"
) <<
"requested L1 trigger \""
<<
m_pattern
<<
"\" does not exist in the current L1 menu"
;
65
else
66
edm::LogWarning
(
"Configuration"
) <<
"requested L1 trigger \""
<<
m_pattern
<<
"\" does not exist in the current L1 menu"
;
67
}
else
{
68
// expand wildcards in the pattern
69
bool
match
=
false
;
70
boost::regex re(
edm::glob2reg
(
m_pattern
));
71
for
(
auto
const
&
entry
: triggerMap)
72
if
(boost::regex_match(
entry
.first, re)) {
73
match =
true
;
74
m_triggers
.push_back( std::make_pair(
entry
.first,
entry
.second.getIndex()) );
75
}
76
77
if
(not match) {
78
// m_pattern does not match any L1 bits
79
if
(data.
shouldThrow
())
80
throw
cms::Exception
(
"Configuration"
) <<
"requested pattern \""
<<
m_pattern
<<
"\" does not match any L1 trigger in the current menu"
;
81
else
82
edm::LogWarning
(
"Configuration"
) <<
"requested pattern \""
<<
m_pattern
<<
"\" does not match any L1 trigger in the current menu"
;
83
}
84
}
85
86
}
87
88
}
// namespace triggerExpression
i
int i
Definition:
DBlmapReader.cc:9
MessageLogger.h
triggerExpression::Data::l1tMenu
const L1TUtmTriggerMenu & l1tMenu() const
Definition:
TriggerExpressionData.h:147
edm::is_glob
bool is_glob(std::string const &pattern)
Definition:
RegexMatch.cc:18
L1GtTriggerMask.h
edm::glob2reg
std::string glob2reg(std::string const &pattern)
Definition:
RegexMatch.cc:22
edm::LogWarning
Definition:
MessageLogger.h:140
triggerExpression::Data::hasL1T
bool hasL1T() const
Definition:
TriggerExpressionData.h:127
TriggerExpressionL1uGTReader.h
RegexMatch.h
TriggerExpressionData.h
triggerExpression::L1uGTReader::dump
void dump(std::ostream &out) const
Definition:
TriggerExpressionL1uGTReader.cc:31
L1GlobalTriggerReadoutRecord.h
triggerExpression::L1uGTReader::m_triggers
std::vector< std::pair< std::string, unsigned int > > m_triggers
Definition:
TriggerExpressionL1uGTReader.h:26
GenerateHcalLaserBadRunList.out
tuple out
Definition:
GenerateHcalLaserBadRunList.py:91
triggerExpression::Data::l1tResults
const std::vector< bool > & l1tResults() const
Definition:
TriggerExpressionData.h:143
triggerExpression::Data::shouldThrow
bool shouldThrow() const
Definition:
TriggerExpressionData.h:167
L1TUtmTriggerMenu.h
cms::Exception
Definition:
Exception.h:68
triggerExpression::L1uGTReader::operator()
bool operator()(const Data &data) const
Definition:
TriggerExpressionL1uGTReader.cc:16
triggerExpression::Data
Definition:
TriggerExpressionData.h:22
triggerExpression::L1uGTReader::init
void init(const Data &data)
Definition:
TriggerExpressionL1uGTReader.cc:44
L1TUtmTriggerMenu::getAlgorithmMap
const std::map< std::string, L1TUtmAlgorithm > & getAlgorithmMap() const
Definition:
L1TUtmTriggerMenu.h:56
triggerExpression::L1uGTReader::m_pattern
std::string m_pattern
Definition:
TriggerExpressionL1uGTReader.h:25
data
char data[epos_bytes_allocation]
Definition:
EPOS_Wrapper.h:82
L1TUtmTriggerMenu
Definition:
L1TUtmTriggerMenu.h:40
relval_steps.menu
list menu
Definition:
relval_steps.py:995
mps_splice.entry
list entry
Definition:
mps_splice.py:62
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
plotBeamSpotDB.first
first
Definition:
plotBeamSpotDB.py:379
Generated for CMSSW Reference Manual by
1.8.5