CMS 3D CMS Logo

EventSelector.h
Go to the documentation of this file.
1 #ifndef Framework_EventSelector_h
2 #define Framework_EventSelector_h
3 
4 /*
5  Author: Jim Kowalkowski 01-02-06
6 
7  */
8 
9 // Change Log
10 //
11 // 1 - Mark Fischler Feb 6, 2008
12 // Internals for implementation of glob-style wildcard selection
13 // In particular, !xyz* requires the vector nonveto_bits_
14 // nonveto_bits_ is designed to also accomodate an AND of triggers
15 // selection criterion, if that is wanted at some future date.
16 
21 
22 #include <memory>
23 
24 #include <vector>
25 #include <string>
26 
27 namespace edm {
28  // possible return codes for the testSelectionOverlap
29  // method defined below.
30  namespace evtSel {
32  }
33 
35  class EventSelector {
36  public:
37  typedef std::vector<std::string> Strings;
38 
39  EventSelector(Strings const& pathspecs, Strings const& names);
40 
41  explicit EventSelector(Strings const& pathspecs);
42 
43  EventSelector(edm::ParameterSet const& pset, Strings const& pathNames);
44 
45  bool wantAll() const { return accept_all_; }
46  bool acceptEvent(TriggerResults const&);
47  bool acceptEvent(unsigned char const*, int) const;
48 
49  // 29-Jan-2008, KAB - added methods for testing and using
50  // trigger selections (pathspecs).
51  static bool selectionIsValid(Strings const& pathspec, Strings const& fullPathList);
52  static evtSel::OverlapResult testSelectionOverlap(Strings const& pathspec1,
53  Strings const& pathspec2,
54  Strings const& fullPathList);
55  std::shared_ptr<TriggerResults> maskTriggerResults(TriggerResults const& inputResults);
56  static std::vector<std::string> getEventSelectionVString(edm::ParameterSet const& pset);
57 
58  static void fillDescription(ParameterSetDescription& desc);
59 
60  private:
61  struct BitInfo {
62  BitInfo(unsigned int pos, bool state) : pos_(pos), accept_state_(state) {}
63  BitInfo() : pos_(), accept_state_() {}
64 
65  unsigned int pos_;
67  };
68 
69  // These three data members never change after being initialized.
70  Strings const pathspecs_;
72  bool const accept_all_;
73 
74  typedef std::vector<BitInfo> Bits;
75 
76  Bits absolute_acceptors_; // change 3
77  Bits conditional_acceptors_; // change 3
78  Bits exception_acceptors_; // change 3
79  std::vector<Bits> all_must_fail_; // change 1
80  std::vector<Bits> all_must_fail_noex_; // change 3
81 
83 
85 
86  // private member functions
87 
88  Strings initPathSpecs(Strings const& pathSpecs);
89 
90  bool initAcceptAll();
91 
92  void initPathNames(Strings const& pathNames);
93 
94  bool acceptTriggerPath(HLTPathStatus const&, BitInfo const&) const;
95 
96  bool acceptOneBit(Bits const& b, HLTGlobalStatus const& tr, hlt::HLTState const& s = hlt::Ready) const;
97  bool acceptAllBits(Bits const& b, HLTGlobalStatus const& tr) const;
98 
99  bool containsExceptions(HLTGlobalStatus const& tr) const;
100 
101  bool selectionDecision(HLTGlobalStatus const& tr) const;
102 
103  static std::string glob2reg(std::string const& s);
104  static std::vector<Strings::const_iterator> matching_triggers(Strings const& trigs, std::string const& s);
105 
106  static bool identical(std::vector<bool> const& a, std::vector<bool> const& b);
107  static bool identical(EventSelector const& a, EventSelector const& b, unsigned int N);
108  static std::vector<bool> expandDecisionList(Bits const& b, bool PassOrFail, unsigned int n);
109  static bool overlapping(std::vector<bool> const& a, std::vector<bool> const& b);
110  static bool subset(std::vector<bool> const& a, std::vector<bool> const& b);
111  static std::vector<bool> combine(std::vector<bool> const& a, std::vector<bool> const& b);
112  };
113 } // namespace edm
114 
115 #endif
std::vector< Bits > all_must_fail_noex_
Definition: EventSelector.h:80
not [yet] run
Definition: HLTenums.h:18
std::vector< std::string > Strings
Definition: EventSelector.h:37
Selector< edm::EventBase > EventSelector
Definition: EventSelector.h:20
bool const accept_all_
Definition: EventSelector.h:72
HLTState
status of a trigger path
Definition: HLTenums.h:18
std::string glob2reg(std::string const &pattern)
Definition: RegexMatch.cc:19
std::vector< BitInfo > Bits
Definition: EventSelector.h:74
const std::string names[nVars_]
std::vector< Bits > all_must_fail_
Definition: EventSelector.h:79
BitInfo(unsigned int pos, bool state)
Definition: EventSelector.h:62
static type combine(const A &_1, const B &_2)
Definition: Factorize.h:188
Strings const pathspecs_
Definition: EventSelector.h:70
bool wantAll() const
Definition: EventSelector.h:45
#define N
Definition: blowfish.cc:9
double b
Definition: hdecay.h:120
ParameterSetID psetID_
Definition: EventSelector.h:82
HLT enums.
double a
Definition: hdecay.h:121
bool const results_from_current_process_
Definition: EventSelector.h:71