Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:24

0001 #ifndef HLTrigger_HLTcore_TriggerExpressionEvaluator_h
0002 #define HLTrigger_HLTcore_TriggerExpressionEvaluator_h
0003 
0004 #include <iostream>
0005 #include <string>
0006 #include <vector>
0007 #include <utility>
0008 
0009 namespace triggerExpression {
0010 
0011   class Data;
0012 
0013   class Evaluator {
0014   public:
0015     Evaluator() = default;
0016 
0017     // virtual destructor
0018     virtual ~Evaluator() = default;
0019 
0020     // check if the data satisfies the logical expression
0021     virtual bool operator()(const Data& data) const = 0;
0022 
0023     // (re)initialise the logical expression
0024     virtual void init(const Data& data) {}
0025 
0026     // list CMSSW path patterns associated to the logical expression
0027     virtual std::vector<std::string> patterns() const { return {}; }
0028 
0029     // list of triggers associated to the Evaluator (filled only for certain derived classes)
0030     virtual std::vector<std::pair<std::string, unsigned int>> triggers() const { return {}; }
0031 
0032     // dump the logical expression to the output stream
0033     virtual void dump(std::ostream& out, bool const ignoreMasks = false) const = 0;
0034 
0035     // apply masks based on another Evaluator
0036     virtual void mask(Evaluator const&) {}
0037 
0038     // methods to control m_masksEnabled boolean
0039     virtual bool masksEnabled() const { return m_masksEnabled; }
0040     virtual void enableMasks() { m_masksEnabled = true; }
0041     virtual void disableMasks() { m_masksEnabled = false; }
0042 
0043   private:
0044     bool m_masksEnabled = false;
0045   };
0046 
0047   inline std::ostream& operator<<(std::ostream& out, const Evaluator& eval) {
0048     eval.dump(out);
0049     return out;
0050   }
0051 
0052 }  // namespace triggerExpression
0053 
0054 #endif  // HLTrigger_HLTcore_TriggerExpressionEvaluator_h