Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PdbParameterMap.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PdbParameterMap.cc
1 #include "PdbParameterMap.h"
2 
3 #include <boost/functional/hash.hpp>
4 #include <iostream>
5 
6 using namespace std;
7 
9 {
10  cout << "PdbParameterMap::print - Hash 0x" << std::hex << get_hash() << std::dec << endl;
11 
12  cout << "double parameters: " << endl;
13  for (map<const string, double>::const_iterator iter = dparams.begin(); iter != dparams.end(); ++iter)
14  {
15  cout << iter->first << ": " << iter->second << endl;
16  }
17  cout << "integer parameters: " << endl;
18  for (map<const string, int>::const_iterator iter = iparams.begin(); iter != iparams.end(); ++iter)
19  {
20  cout << iter->first << ": " << iter->second << endl;
21  }
22  cout << "string parameters: " << endl;
23  for (map<const string, string>::const_iterator iter = cparams.begin(); iter != cparams.end(); ++iter)
24  {
25  cout << iter->first << ": " << iter->second << endl;
26  }
27 }
28 
30 {
31  dparams.clear();
32  iparams.clear();
33  cparams.clear();
34  return;
35 }
36 
37 void PdbParameterMap::set_int_param(const std::string &name, const int ival)
38 {
39  iparams[name] = ival;
40 }
41 
42 void PdbParameterMap::set_double_param(const std::string &name, const double dval)
43 {
44  dparams[name] = dval;
45 }
46 
48 {
49  cparams[name] = str;
50 }
51 
52 size_t
54 {
55  size_t seed = 0;
56 
57  for (dMap::const_iterator iter = dparams.begin();
58  iter != dparams.end(); ++iter)
59  {
60  // size_t seed = 0;
61  boost::hash_combine(seed, iter->first);
62  boost::hash_combine(seed, iter->second);
63  // cout << iter->first << ": " << iter->second <<" -> "<<seed<< endl;
64  }
65 
66  for (iMap::const_iterator iter = iparams.begin();
67  iter != iparams.end(); ++iter)
68  {
69  // size_t seed = 0;
70  boost::hash_combine(seed, iter->first);
71  boost::hash_combine(seed, iter->second);
72  // cout << iter->first << ": " << iter->second <<" -> "<<seed<< endl;
73  }
74 
75  for (strMap::const_iterator iter = cparams.begin();
76  iter != cparams.end(); ++iter)
77  {
78  // size_t seed = 0;
79  boost::hash_combine(seed, iter->first);
80  boost::hash_combine(seed, iter->second);
81  // cout << iter->first << ": " << iter->second <<" -> "<<seed<< endl;
82  }
83 
84  return seed;
85 }