CMS 3D CMS Logo

HistDefinition.cc
Go to the documentation of this file.
3 #include <algorithm>
4 
5 namespace dqmoffline {
6 namespace l1t {
7 
8 typedef std::vector<double> vdouble;
9 
11  name("name"),
12  title("title"),
13  nbinsX(0),
14  nbinsY(0),
15  xmin(0),
16  xmax(0),
17  ymin(0),
18  ymax(0),
19  binsX(),
20  binsY() {
21 
22 }
23 
25  name(ps.getUntrackedParameter<std::string>("name")),
26  title(ps.getUntrackedParameter<std::string>("title")),
27  nbinsX(ps.getUntrackedParameter<unsigned int>("nbinsX", 0)),
28  nbinsY(ps.getUntrackedParameter<unsigned int>("nbinsY", 0)),
29  xmin(ps.getUntrackedParameter<double>("xmin", 0)),
30  xmax(ps.getUntrackedParameter<double>("xmax", 0)),
31  ymin(ps.getUntrackedParameter<double>("ymin", 0)),
32  ymax(ps.getUntrackedParameter<double>("ymax", 0)),
33  binsXtmp(ps.getUntrackedParameter<vdouble>("binsX", vdouble())),
34  binsYtmp(ps.getUntrackedParameter<vdouble>("binsY", vdouble())),
37 
38 }
39 
41 
42 }
43 
46  const std::map<std::string, unsigned int> &mapping) {
48  std::vector<std::string> names = ps.getParameterNames();
49  std::vector<unsigned int> map_values;
50 
51  for (auto const &imap : mapping) {
52  map_values.push_back(imap.second);
53  }
54  unsigned int max_size = *std::max_element(map_values.begin(), map_values.end());
55  max_size = std::max(max_size, (unsigned int) mapping.size());
56  definitions.resize(max_size);
57 
58  for (auto name : names) {
59  if (mapping.find(name) != mapping.end()) {
61  definitions[mapping.at(name)] = HistDefinition(hd);
62  } else {
63  edm::LogError("HistDefinition::readHistDefinitions")
64  << "Could not find histogram definition for '" << name << "'"
65  << std::endl;
66  }
67  }
68  return definitions;
69 }
70 }
71 }
std::vector< float > binsX
std::vector< double > binsYtmp
T getParameter(std::string const &) const
std::vector< HistDefinition > HistDefinitions
delete x;
Definition: CaloConfig.h:22
const std::string names[nVars_]
#define end
Definition: vmac.h:39
std::vector< std::string > getParameterNames() const
std::vector< double > vdouble
HistDefinitions readHistDefinitions(const edm::ParameterSet &ps, const std::map< std::string, unsigned int > &mapping)
std::vector< float > binsY
#define begin
Definition: vmac.h:32
std::vector< double > binsXtmp