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