HLTrigger
HLTcore
src
TriggerExpressionPathReader.cc
Go to the documentation of this file.
1
#include <cassert>
2
#include <sstream>
3
4
#include "
FWCore/Utilities/interface/RegexMatch.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
#include "
DataFormats/Common/interface/TriggerResults.h
"
7
#include "
HLTrigger/HLTcore/interface/TriggerExpressionPathReader.h
"
8
#include "
HLTrigger/HLTcore/interface/TriggerExpressionData.h
"
9
10
namespace
triggerExpression
{
11
12
// define the result of the module from the HLT reults
13
bool
PathReader::operator()
(
const
Data
&
data
)
const
{
14
if
(not
data
.hasHLT() && not
data
.usePathStatus())
15
return
false
;
16
17
for
(
auto
const
&
trigger
:
m_triggers
)
18
if
(
data
.passHLT(
trigger
.second))
19
return
true
;
20
21
return
false
;
22
}
23
24
void
PathReader::dump
(std::ostream&
out
)
const
{
25
if
(
m_triggers
.empty()) {
26
out
<<
"FALSE"
;
27
}
else
if
(
m_triggers
.size() == 1) {
28
out
<<
m_triggers
[0].first;
29
}
else
{
30
out
<<
"("
<<
m_triggers
[0].first;
31
for
(
unsigned
int
i
= 1;
i
<
m_triggers
.size(); ++
i
)
32
out
<<
" OR "
<<
m_triggers
[
i
].
first
;
33
out
<<
")"
;
34
}
35
}
36
37
// (re)initialize the module
38
void
PathReader::init
(
const
Data
&
data
) {
39
// clear the previous configuration
40
m_triggers
.clear();
41
42
// check if the pattern has is a glob expression, or a single trigger name
43
if
(not
edm::is_glob
(
m_pattern
)) {
44
// no wildcard expression
45
auto
index
=
data
.triggerIndex(
m_pattern
);
46
if
(
index
>= 0)
47
m_triggers
.push_back(std::make_pair(
m_pattern
,
index
));
48
else
{
49
std::stringstream
msg
;
50
msg
<<
"requested HLT path \""
<<
m_pattern
<<
"\" does not exist - known paths are:"
;
51
if
(
data
.triggerNames().empty())
52
msg
<<
" (none)"
;
53
else
54
for
(
auto
const
&
p
:
data
.triggerNames())
55
msg
<<
"\n\t"
<<
p
;
56
if
(
data
.shouldThrow())
57
throw
cms::Exception
(
"Configuration"
) <<
msg
.str();
58
else
59
edm::LogWarning
(
"Configuration"
) <<
msg
.str();
60
}
61
}
else
{
62
// expand wildcards in the pattern
63
const
std::vector<std::vector<std::string>::const_iterator>&
matches
=
64
edm::regexMatch
(
data
.triggerNames(),
m_pattern
);
65
if
(
matches
.empty()) {
66
// m_pattern does not match any trigger paths
67
std::stringstream
msg
;
68
msg
<<
"requested pattern \""
<<
m_pattern
<<
"\" does not match any HLT paths - known paths are:"
;
69
if
(
data
.triggerNames().empty())
70
msg
<<
" (none)"
;
71
else
72
for
(
auto
const
&
p
:
data
.triggerNames())
73
msg
<<
"\n\t"
<<
p
;
74
if
(
data
.shouldThrow())
75
throw
cms::Exception
(
"Configuration"
) <<
msg
.str();
76
else
77
edm::LogWarning
(
"Configuration"
) <<
msg
.str();
78
}
else
{
79
// store indices corresponding to the matching triggers
80
for
(
auto
const
&
match
:
matches
) {
81
auto
index
=
data
.triggerIndex(*
match
);
82
assert
(
index
>= 0);
83
m_triggers
.push_back(std::make_pair(*
match
,
index
));
84
}
85
}
86
}
87
}
88
89
}
// namespace triggerExpression
mps_fire.i
i
Definition:
mps_fire.py:428
triggerExpression::PathReader::init
void init(const Data &data) override
Definition:
TriggerExpressionPathReader.cc:38
MessageLogger.h
TriggerResults.h
edm::regexMatch
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const ®exp)
Definition:
RegexMatch.cc:26
oniaPATMuonsWithTrigger_cff.matches
matches
Definition:
oniaPATMuonsWithTrigger_cff.py:77
cms::cuda::assert
assert(be >=bs)
mps_check.msg
tuple msg
Definition:
mps_check.py:285
edm::is_glob
bool is_glob(std::string const &pattern)
Definition:
RegexMatch.cc:17
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
triggerExpression::PathReader::m_triggers
std::vector< std::pair< std::string, unsigned int > > m_triggers
Definition:
TriggerExpressionPathReader.h:23
TriggerExpressionPathReader.h
first
auto first
Definition:
CAHitNtupletGeneratorKernelsImpl.h:125
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
triggerExpression::PathReader::m_pattern
std::string m_pattern
Definition:
TriggerExpressionPathReader.h:22
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::Data
Definition:
TriggerExpressionData.h:23
triggerExpression::PathReader::operator()
bool operator()(const Data &data) const override
Definition:
TriggerExpressionPathReader.cc:13
triggerExpression
Definition:
TriggerExpressionConstant.h:6
data
char data[epos_bytes_allocation]
Definition:
EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
trigger
Definition:
HLTPrescaleTableCond.h:8
TriggerExpressionData.h
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
cms::Exception
Definition:
Exception.h:70
RegexMatch.h
triggerExpression::PathReader::dump
void dump(std::ostream &out) const override
Definition:
TriggerExpressionPathReader.cc:24
Generated for CMSSW Reference Manual by
1.8.16