#include <EventIDMatcher.h>
Definition at line 12 of file EventIDMatcher.h.
art::EventIDMatcher::EventIDMatcher |
( |
std::string const & |
pattern | ) |
|
|
explicit |
Definition at line 19 of file EventIDMatcher.cc.
24 <<
"EventIDMatcher given an empty pattern!";
std::vector< std::string > pattern_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< std::vector< std::vector< PatternRangeElement > > > parsed_patterns_
Definition at line 31 of file EventIDMatcher.cc.
34 if (patterns.size() == 0) {
36 <<
"EventIDMatcher given an empty list of patterns!";
40 for (
auto const&
val : patterns) {
43 <<
"EventIDMatcher given an empty pattern!";
std::vector< std::string > pattern_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< std::vector< std::vector< PatternRangeElement > > > parsed_patterns_
bool art::EventIDMatcher::match |
( |
EventID const & |
eid | ) |
const |
Definition at line 187 of file EventIDMatcher.cc.
189 if (!eid.isValid() || eid.isFlush()) {
192 if (!eid.subRunID().isValid() || eid.subRunID().isFlush()) {
195 if (!eid.runID().isValid() || eid.runID().isFlush()) {
201 for (
auto i = 0U; i < 3; ++i) {
202 for (
auto const&
val : parsed_pattern[i]) {
207 }
else if (
val.low ==
val.high) {
211 if (eid.run() ==
val.low) {
215 }
else if (i == 1U) {
217 if (eid.subRun() ==
val.low) {
223 if (eid.event() ==
val.low) {
232 if ((eid.run() >=
val.low) && (eid.run() <=
val.high)) {
236 }
else if (i == 1U) {
238 if ((eid.subRun() >=
val.low) && (eid.subRun() <=
val.high)) {
244 if ((eid.event() >=
val.low) && (eid.event() <=
val.high)) {
std::vector< std::vector< std::vector< PatternRangeElement > > > parsed_patterns_
bool art::EventIDMatcher::operator() |
( |
EventID const & |
eid | ) |
const |
void art::EventIDMatcher::parse_pattern |
( |
| ) |
|
|
private |
Definition at line 51 of file EventIDMatcher.cc.
61 "[[:blank:]]*-[[:blank:]]*" 68 for (
auto const& given_pattern :
pattern_) {
70 regex_iterator<string::const_iterator>
I(
71 given_pattern.cbegin(), given_pattern.cend(), pat);
72 regex_iterator<string::const_iterator>
E;
82 if (
m.str(7).size()) {
85 if (
m.position() != (prev_pos + prev_len)) {
89 buf <<
"Illegal character in pattern near here:\n";
92 for (
auto i = 0L; i < (prev_pos + prev_len); ++i) {
101 }
else if (
m[4].matched) {
104 for (
auto val :
m.str(4)) {
111 for (
auto val :
m.str(5)) {
112 num_low = (num_low * 10U) + (
val -
'0');
115 for (
auto val :
m.str(6)) {
116 num_high = (num_high * 10U) + (
val -
'0');
119 {num_low, num_high,
false});
122 if (part_num == 0U) {
124 }
else if (part_num == 1U) {
126 }
else if (part_num == 2U) {
131 <<
"Syntax error, event part of pattern ended with a ':' here:\n";
132 buf << given_pattern;
134 for (
auto i = 0L; i <
m.position(7); ++i) {
141 }
else if (sep ==
',') {
146 prev_pos =
m.position();
147 prev_len =
m.length();
150 if (prev_sep !=
'\0') {
154 printf(
"pep: Syntax error, near here:\n");
155 buf << given_pattern;
157 for (
auto i = 0L; i < (prev_pos + prev_len); ++i) {
163 if (static_cast<string::size_type>(prev_pos + prev_len) !=
164 given_pattern.size()) {
168 printf(
"pep: Syntax error, near here:\n");
169 buf << given_pattern;
171 for (
auto i = 0L; i < (prev_pos + prev_len); ++i) {
std::vector< std::string > pattern_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< std::vector< std::vector< PatternRangeElement > > > parsed_patterns_
The documentation for this class was generated from the following files: