CMS 3D CMS Logo

SiStripConfObject.h
Go to the documentation of this file.
1 #ifndef SiStripConfObject_h
2 #define SiStripConfObject_h
3 
5 
6 #include <iostream>
7 #include <vector>
8 #include <map>
9 #include <algorithm>
10 #include <iterator>
11 #include <sstream>
12 
14 
15 class TrackerTopology;
16 
32 public:
34 
35  template <class valueType>
36  bool put(const std::string& name, const valueType& inputValue) {
37  std::stringstream ss;
38  ss << inputValue;
39  if (parameters.insert(std::make_pair(name, ss.str())).second)
40  return true;
41  return false;
42  }
43 
47  template <class valueType>
48  bool update(const std::string& name, const valueType& inputValue) {
49  parMap::iterator it = parameters.find(name);
50  if (it == parameters.end()) {
51  std::cout << "WARNING in SiStripConfObject::update: parameter " << name << " not found, "
52  << "so cannot be updated to '" << inputValue << "'." << std::endl;
53  return false;
54  } else {
55  std::stringstream ss;
56  ss << inputValue;
57  it->second = ss.str();
58  return true;
59  }
60  }
61 
62  template <class valueType>
63  valueType get(const std::string& name) const {
64  valueType returnValue = 0;
65  parMap::const_iterator it = parameters.find(name);
66  std::stringstream ss;
67  if (it != parameters.end()) {
68  ss << it->second;
69  ss >> returnValue;
70  } else {
71  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
72  }
73  return returnValue;
74  }
75 
76  bool isParameter(const std::string& name) const { return (parameters.find(name) != parameters.end()); }
77 
79  void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
81  void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
82 
83  typedef std::map<std::string, std::string> parMap;
84 
86 
88 };
89 
90 template <>
91 std::string SiStripConfObject::get<std::string>(const std::string& name) const;
92 template <>
93 bool SiStripConfObject::put<std::vector<int> >(const std::string& name, const std::vector<int>& inputValue);
94 template <>
95 bool SiStripConfObject::update<std::vector<int> >(const std::string& name, const std::vector<int>& inputValue);
96 template <>
97 std::vector<int> SiStripConfObject::get<std::vector<int> >(const std::string& name) const;
98 template <>
99 bool SiStripConfObject::put<std::vector<std::string> >(const std::string& name,
100  const std::vector<std::string>& inputValue);
101 template <>
102 bool SiStripConfObject::update<std::vector<std::string> >(const std::string& name,
103  const std::vector<std::string>& inputValue);
104 template <>
105 std::vector<std::string> SiStripConfObject::get<std::vector<std::string> >(const std::string& name) const;
106 
107 #endif
MessageLogger.h
SiStripConfObject::update
bool update(const std::string &name, const valueType &inputValue)
Definition: SiStripConfObject.h:48
SiStripConfObject::printDebug
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the full list of parameters.
Definition: SiStripConfObject.cc:115
TrackerTopology
Definition: TrackerTopology.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
SiStripConfObject::isParameter
bool isParameter(const std::string &name) const
Definition: SiStripConfObject.h:76
SiStripConfObject::SiStripConfObject
SiStripConfObject()
Definition: SiStripConfObject.h:33
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripConfObject::parMap
std::map< std::string, std::string > parMap
Definition: SiStripConfObject.h:83
SiStripConfObject::printSummary
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the full list of parameters.
Definition: SiStripConfObject.cc:108
SiStripConfObject::put
bool put(const std::string &name, const valueType &inputValue)
Definition: SiStripConfObject.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripConfObject::parameters
parMap parameters
Definition: SiStripConfObject.h:85
Serializable.h
SiStripConfObject::get
valueType get(const std::string &name) const
Definition: SiStripConfObject.h:63
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
SiStripConfObject
Definition: SiStripConfObject.h:31