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