CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTPrescaleTable.h
Go to the documentation of this file.
1 #ifndef HLTReco_HLTPrescaleTable_h
2 #define HLTReco_HLTPrescaleTable_h
3 
13 #include <map>
14 #include <string>
15 #include <vector>
16 #include <cassert>
17 
18 namespace trigger
19 {
22 
24  private:
26  unsigned int set_;
28  std::vector<std::string> labels_;
30  std::map<std::string,std::vector<unsigned int> > table_;
32 
34  public:
35 
37  unsigned int size() const {return labels_.size();}
38 
40  unsigned int prescale(const std::string& trigger) const {
41  return prescale(set_,trigger);
42  }
43 
45  unsigned int prescale(unsigned int set, const std::string& trigger) const {
46  const std::map<std::string,std::vector<unsigned int> >::const_iterator it(table_.find(trigger));
47  if ((it==table_.end()) || (set>=it->second.size())) {
48  return 1;
49  } else {
50  return it->second[set];
51  }
52  }
53 
56 
58  HLTPrescaleTable(unsigned int set, const std::vector<std::string>& labels, const std::map<std::string,std::vector<unsigned int> >& table):
59  set_(set), labels_(labels), table_(table) {
61  const unsigned int n(labels_.size());
62  assert((((set_==0)&&(n==0)) || (set_<n)));
63  const std::map<std::string,std::vector<unsigned int> >::const_iterator ib(table_.begin());
64  const std::map<std::string,std::vector<unsigned int> >::const_iterator ie(table_.end());
65  for (std::map<std::string,std::vector<unsigned int> >::const_iterator it=ib; it!=ie; ++it) {
66  assert (it->second.size()==n);
67  }
68  }
69 
71  bool isProductEqual(const HLTPrescaleTable& that) const {
72  return ((set()==that.set()) && (labels()==that.labels()) && (table()==that.table()));
73  }
74 
76  unsigned int set() const {return set_;}
77  const std::vector<std::string>& labels() const {return labels_;}
78  const std::map<std::string,std::vector<unsigned int> >& table() const {return table_;}
79 
80  };
81 }
82 
83 #endif
unsigned int set() const
low-level const accessors for data members
int ib
Definition: cuy.py:660
The single EDProduct containing the HLT Prescale Table.
const std::map< std::string, std::vector< unsigned int > > & table() const
const std::vector< std::string > & labels() const
std::map< std::string, std::vector< unsigned int > > table_
prescale sets keyed on trigger path name
unsigned int set_
data members
unsigned int prescale(const std::string &trigger) const
high-level user access method: prescale for given trigger path
bool isProductEqual(const HLTPrescaleTable &that) const
merge rule - just checking equality
unsigned int prescale(unsigned int set, const std::string &trigger) const
high-level user access method: prescale for given trigger path
HLTPrescaleTable(unsigned int set, const std::vector< std::string > &labels, const std::map< std::string, std::vector< unsigned int > > &table)
real constructor taking payload
unsigned int size() const
consistency condition: all vectors must have the same length
HLTPrescaleTable()
default constructor
std::vector< std::string > labels_
names of prescale sets