CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
29  // possible return codes for the testSelectionOverlap
30  // method defined below.
31  namespace evtSel
32  {
34  NoOverlap = 1,
36  ExactMatch = 3};
37  }
38 
41  {
42  public:
43 
44  typedef std::vector<std::string> Strings;
45 
46  EventSelector(Strings const& pathspecs,
47  Strings const& names);
48 
49  explicit
50  EventSelector(Strings const& pathspecs);
51 
52  EventSelector(edm::ParameterSet const& pset,
53  Strings const& pathNames);
54 
55  bool wantAll() const { return accept_all_; }
56  bool acceptEvent(TriggerResults const&);
57  bool acceptEvent(unsigned char const*, int) const;
58 
59  // 29-Jan-2008, KAB - added methods for testing and using
60  // trigger selections (pathspecs).
61  static bool selectionIsValid(Strings const& pathspec,
62  Strings const& fullPathList);
64  testSelectionOverlap(Strings const& pathspec1,
65  Strings const& pathspec2,
66  Strings const& fullPathList);
67  std::shared_ptr<TriggerResults>
68  maskTriggerResults(TriggerResults const& inputResults);
69  static std::vector<std::string>
71 
72  static void fillDescription(ParameterSetDescription& desc);
73 
74  private:
75 
76  struct BitInfo
77  {
78  BitInfo(unsigned int pos, bool state):pos_(pos),accept_state_(state) { }
80 
81  unsigned int pos_;
83  };
84 
85  // These three data members never change after being initialized.
88  bool const accept_all_;
89 
90  typedef std::vector<BitInfo> Bits;
91 
95  std::vector<Bits> all_must_fail_; // change 1
96  std::vector<Bits> all_must_fail_noex_; // change 3
97 
99 
101 
102  // private member functions
103 
104  Strings initPathSpecs(Strings const& pathSpecs);
105 
106  bool initAcceptAll();
107 
108  void initPathNames(Strings const& pathNames);
109 
110  bool acceptTriggerPath(HLTPathStatus const&, BitInfo const&) const;
111 
112  bool acceptOneBit (Bits const & b,
113  HLTGlobalStatus const & tr,
114  hlt::HLTState const & s = hlt::Ready) const;
115  bool acceptAllBits (Bits const & b,
116  HLTGlobalStatus const & tr) const;
117 
118  bool containsExceptions(HLTGlobalStatus const & tr) const;
119 
120  bool selectionDecision(HLTGlobalStatus const & tr) const;
121 
122  static std::string glob2reg(std::string const& s);
123  static std::vector< Strings::const_iterator >
124  matching_triggers(Strings const& trigs, std::string const& s);
125 
126  static bool identical (std::vector<bool> const & a,
127  std::vector<bool> const & b);
128  static bool identical (EventSelector const & a,
129  EventSelector const & b,
130  unsigned int N);
131  static std::vector<bool> expandDecisionList (
132  Bits const & b,
133  bool PassOrFail,
134  unsigned int n);
135  static bool overlapping ( std::vector<bool> const& a,
136  std::vector<bool> const& b );
137  static bool subset ( std::vector<bool> const& a,
138  std::vector<bool> const& b );
139  static std::vector<bool> combine ( std::vector<bool> const& a,
140  std::vector<bool> const& b );
141  };
142 }
143 
144 #endif
std::vector< Bits > all_must_fail_noex_
Definition: EventSelector.h:96
EventSelector(Strings const &pathspecs, Strings const &names)
void initPathNames(Strings const &pathNames)
not [yet] run
Definition: HLTenums.h:18
static bool selectionIsValid(Strings const &pathspec, Strings const &fullPathList)
std::vector< std::string > Strings
Definition: EventSelector.h:44
static const HistoName names[]
EventSelector::Strings Strings
bool const accept_all_
Definition: EventSelector.h:88
HLTState
status of a trigger path
Definition: HLTenums.h:18
std::vector< BitInfo > Bits
Definition: EventSelector.h:90
static std::vector< bool > combine(std::vector< bool > const &a, std::vector< bool > const &b)
Strings initPathSpecs(Strings const &pathSpecs)
bool acceptAllBits(Bits const &b, HLTGlobalStatus const &tr) const
bool acceptEvent(TriggerResults const &)
std::vector< Bits > all_must_fail_
Definition: EventSelector.h:95
BitInfo(unsigned int pos, bool state)
Definition: EventSelector.h:78
Strings const pathspecs_
Definition: EventSelector.h:86
static std::vector< std::string > getEventSelectionVString(edm::ParameterSet const &pset)
bool acceptOneBit(Bits const &b, HLTGlobalStatus const &tr, hlt::HLTState const &s=hlt::Ready) const
bool acceptTriggerPath(HLTPathStatus const &, BitInfo const &) const
static void fillDescription(ParameterSetDescription &desc)
bool wantAll() const
Definition: EventSelector.h:55
static std::string glob2reg(std::string const &s)
static bool overlapping(std::vector< bool > const &a, std::vector< bool > const &b)
static evtSel::OverlapResult testSelectionOverlap(Strings const &pathspec1, Strings const &pathspec2, Strings const &fullPathList)
bool selectionDecision(HLTGlobalStatus const &tr) const
static bool subset(std::vector< bool > const &a, std::vector< bool > const &b)
#define N
Definition: blowfish.cc:9
double b
Definition: hdecay.h:120
static std::vector< Strings::const_iterator > matching_triggers(Strings const &trigs, std::string const &s)
ParameterSetID psetID_
Definition: EventSelector.h:98
static bool identical(std::vector< bool > const &a, std::vector< bool > const &b)
double a
Definition: hdecay.h:121
static std::vector< bool > expandDecisionList(Bits const &b, bool PassOrFail, unsigned int n)
bool const results_from_current_process_
Definition: EventSelector.h:87
std::shared_ptr< TriggerResults > maskTriggerResults(TriggerResults const &inputResults)
bool containsExceptions(HLTGlobalStatus const &tr) const