1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#ifndef TriggerResultsFilter_h
#define TriggerResultsFilter_h
/** \class TriggerResultsFilter
*
*
* This class is an EDFilter implementing filtering on arbitrary logical combinations
* of L1 and HLT results.
*
* It has been written as an extension of the HLTHighLevel and HLTHighLevelDev filters.
*
*
* Authors: Martin Grunewald, Andrea Bocci
*
*/
#include <memory>
#include <string>
#include <vector>
#include <regex>
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "HLTrigger/HLTcore/interface/TriggerExpressionData.h"
// forward declaration
namespace edm {
class ConfigurationDescriptions;
}
namespace triggerExpression {
class Evaluator;
}
//
// class declaration
//
class TriggerResultsFilter : public edm::stream::EDFilter<> {
public:
explicit TriggerResultsFilter(const edm::ParameterSet &);
~TriggerResultsFilter() override = default;
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
bool filter(edm::Event &, const edm::EventSetup &) override;
private:
void beginStream(edm::StreamID) override;
/// parse the logical expression into functionals
void parse(const std::string &expression);
void parse(const std::vector<std::string> &expressions);
/// evaluator for the trigger condition
std::unique_ptr<triggerExpression::Evaluator> m_expression;
/// cache some data from the Event for faster access by the m_expression
triggerExpression::Data m_eventCache;
struct PatternData {
PatternData(std::string const &aStr, std::regex const &aRegex, bool const hasMatch = false)
: str(aStr), regex(aRegex), matched(hasMatch) {}
std::string str;
std::regex regex;
bool matched;
};
std::vector<PatternData> hltPathStatusPatterns_;
};
#endif //TriggerResultsFilter_h
|