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 
15 #include <map>
16 #include <string>
17 #include <vector>
18 #include <cassert>
19 
20 namespace trigger
21 {
24 
26  private:
28  unsigned int set_;
30  std::vector<std::string> labels_;
32  std::map<std::string,std::vector<unsigned int> > table_;
34 
36  public:
37 
39  unsigned int size() const {return labels_.size();}
40 
42  unsigned int prescale(const std::string& trigger) const {
43  return prescale(set_,trigger);
44  }
45 
47  unsigned int prescale(unsigned int set, const std::string& trigger) const {
48  const std::map<std::string,std::vector<unsigned int> >::const_iterator it(table_.find(trigger));
49  if ((it==table_.end()) || (set>=it->second.size())) {
50  return 1;
51  } else {
52  return it->second[set];
53  }
54  }
55 
58 
60  HLTPrescaleTable(unsigned int set, const std::vector<std::string>& labels, const std::map<std::string,std::vector<unsigned int> >& table):
61  set_(set), labels_(labels), table_(table) {
63  const unsigned int n(labels_.size());
64  assert((((set_==0)&&(n==0)) || (set_<n)));
65  const std::map<std::string,std::vector<unsigned int> >::const_iterator ib(table_.begin());
66  const std::map<std::string,std::vector<unsigned int> >::const_iterator ie(table_.end());
67  for (std::map<std::string,std::vector<unsigned int> >::const_iterator it=ib; it!=ie; ++it) {
68  assert (it->second.size()==n);
69  }
70  }
71 
73  bool isProductEqual(const HLTPrescaleTable& that) const {
74  return ((set()==that.set()) && (labels()==that.labels()) && (table()==that.table()));
75  }
76 
78  unsigned int set() const {return set_;}
79  const std::vector<std::string>& labels() const {return labels_;}
80  const std::map<std::string,std::vector<unsigned int> >& table() const {return table_;}
81 
82  };
83 }
84 
85 #endif
unsigned int set() const
low-level const accessors for data members
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