VarDict.cxx
Go to the documentation of this file.
1 #include <algorithm>
2 #include <iostream>
4 
5 template<class T>
6 std::vector<std::string> get_sorted_keys(
7  const std::unordered_map<std::string, T> &varMap
8 ) {
9  std::vector<std::string> keys;
10  for (auto &it : varMap) {
11  keys.push_back(it.first);
12  }
13 
14  std::sort(keys.begin(), keys.end());
15 
16  return keys;
17 }
18 
20 {
21  std::cout << "\tScalar Vars: {" << std::endl;
22 
23  for (auto &key : get_sorted_keys(scalarVarMap))
24  {
25  std::cout << "\t\t" << key
26  << "\t : \t" << scalarVarMap.at(key)
27  << std::endl;
28  }
29  std::cout << "\t}" << std::endl;
30 }
31 
33 {
34  std::cout << "\tVector Vars: {" << std::endl;
35 
36  for (auto &key : get_sorted_keys(vectorVarMap))
37  {
38  std::cout << "\t\t" << key << "\t : \t\"";
39  for (auto &v : vectorVarMap.at(key)) {
40  std::cout << v << ',';
41  }
42  std::cout << '"' << std::endl;
43  }
44 
45  std::cout << "\t}" << std::endl;
46 }
47 
48 void VarDict::pprint() const
49 {
50  std::cout << "VarDict {" << std::endl;
53  std::cout << "}" << std::endl;
54 }
55 
keys
Reco plots.
Definition: caf_analysis.py:46
set< int >::iterator it
std::unordered_map< std::string, std::vector< double > > vectorVarMap
Definition: VarDict.h:11
void pprintVectorVars() const
Definition: VarDict.cxx:32
std::vector< std::string > get_sorted_keys(const std::unordered_map< std::string, T > &varMap)
Definition: VarDict.cxx:6
void pprintScalarVars() const
Definition: VarDict.cxx:19
OStream cout
Definition: OStream.cxx:6
void pprint() const
Definition: VarDict.cxx:48
std::unordered_map< std::string, double > scalarVarMap
Definition: VarDict.h:10