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