CMS 3D CMS Logo

Classes | Functions
SiStripConfObject.h File Reference
#include "CondFormats/Serialization/interface/Serializable.h"
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iterator>
#include <sstream>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Classes

class  SiStripConfObject
 

Functions

template<>
std::string SiStripConfObject::get< std::string > (const std::string &name) const
 
template<>
std::vector< int > SiStripConfObject::get< std::vector< int > > (const std::string &name) const
 
template<>
std::vector< std::string > SiStripConfObject::get< std::vector< std::string > > (const std::string &name) const
 
template<>
bool SiStripConfObject::put< std::vector< int > > (const std::string &name, const std::vector< int > &inputValue)
 
template<>
bool SiStripConfObject::put< std::vector< std::string > > (const std::string &name, const std::vector< std::string > &inputValue)
 
template<>
bool SiStripConfObject::update< std::vector< int > > (const std::string &name, const std::vector< int > &inputValue)
 
template<>
bool SiStripConfObject::update< std::vector< std::string > > (const std::string &name, const std::vector< std::string > &inputValue)
 

Function Documentation

◆ SiStripConfObject::get< std::string >()

template<>
std::string SiStripConfObject::get< std::string > ( const std::string &  name) const

Definition at line 5 of file SiStripConfObject.cc.

5  {
6  std::string returnValue;
7  parMap::const_iterator it = parameters.find(name);
8  std::stringstream ss;
9  if (it != parameters.end()) {
10  ss << it->second;
11  ss >> returnValue;
12  } else {
13  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
14  }
15  return returnValue;
16 }

References gather_cfg::cout, Skims_PA_cff::name, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ SiStripConfObject::get< std::vector< int > >()

template<>
std::vector<int> SiStripConfObject::get< std::vector< int > > ( const std::string &  name) const

Definition at line 47 of file SiStripConfObject.cc.

47  {
48  std::vector<int> returnValue;
49  parMap::const_iterator it = parameters.find(name);
50  std::stringstream ss;
51  if (it != parameters.end()) {
52  ss << it->second;
53  int elem;
54  while (ss >> elem)
55  returnValue.push_back(elem);
56  } else {
57  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
58  }
59  return returnValue;
60 }

References gather_cfg::cout, Skims_PA_cff::name, and contentValuesCheck::ss.

◆ SiStripConfObject::get< std::vector< std::string > >()

template<>
std::vector<std::string> SiStripConfObject::get< std::vector< std::string > > ( const std::string &  name) const

Definition at line 93 of file SiStripConfObject.cc.

93  {
94  std::vector<std::string> returnValue;
95  parMap::const_iterator it = parameters.find(name);
96  std::stringstream ss;
97  if (it != parameters.end()) {
98  ss << it->second;
99  std::string elem;
100  while (ss >> elem)
101  returnValue.push_back(elem);
102  } else {
103  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
104  }
105  return returnValue;
106 }

References gather_cfg::cout, Skims_PA_cff::name, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ SiStripConfObject::put< std::vector< int > >()

template<>
bool SiStripConfObject::put< std::vector< int > > ( const std::string &  name,
const std::vector< int > &  inputValue 
)

Definition at line 19 of file SiStripConfObject.cc.

19  {
20  std::stringstream ss;
21  for (std::vector<int>::const_iterator elem = inputValue.begin(); elem != inputValue.end(); ++elem) {
22  ss << *elem << " ";
23  }
24  if (parameters.insert(std::make_pair(name, ss.str())).second)
25  return true;
26  return false;
27 }

References Skims_PA_cff::name, and contentValuesCheck::ss.

◆ SiStripConfObject::put< std::vector< std::string > >()

template<>
bool SiStripConfObject::put< std::vector< std::string > > ( const std::string &  name,
const std::vector< std::string > &  inputValue 
)

Definition at line 63 of file SiStripConfObject.cc.

64  {
65  std::stringstream ss;
66  for (std::vector<std::string>::const_iterator elem = inputValue.begin(); elem != inputValue.end(); ++elem) {
67  ss << *elem << " ";
68  }
69  if (parameters.insert(std::make_pair(name, ss.str())).second)
70  return true;
71  return false;
72 }

References Skims_PA_cff::name, and contentValuesCheck::ss.

◆ SiStripConfObject::update< std::vector< int > >()

template<>
bool SiStripConfObject::update< std::vector< int > > ( const std::string &  name,
const std::vector< int > &  inputValue 
)

Definition at line 30 of file SiStripConfObject.cc.

30  {
31  parMap::iterator it = parameters.find(name);
32  if (it == parameters.end()) {
33  std::cout << "WARNING in SiStripConfObject::update: parameter " << name << " not found, "
34  << "so cannot be updated to the vector of int of size'" << inputValue.size() << "'." << std::endl;
35  return false;
36  } else {
37  std::stringstream ss;
38  for (std::vector<int>::const_iterator elem = inputValue.begin(); elem != inputValue.end(); ++elem) {
39  ss << *elem << " ";
40  }
41  it->second = ss.str();
42  return true;
43  }
44 }

References gather_cfg::cout, Skims_PA_cff::name, and contentValuesCheck::ss.

◆ SiStripConfObject::update< std::vector< std::string > >()

template<>
bool SiStripConfObject::update< std::vector< std::string > > ( const std::string &  name,
const std::vector< std::string > &  inputValue 
)

Definition at line 75 of file SiStripConfObject.cc.

76  {
77  parMap::iterator it = parameters.find(name);
78  if (it == parameters.end()) {
79  std::cout << "WARNING in SiStripConfObject::update: parameter " << name << " not found, "
80  << "so cannot be updated to the vector of std::string of size'" << inputValue.size() << "'." << std::endl;
81  return false;
82  } else {
83  std::stringstream ss;
84  for (std::vector<std::string>::const_iterator elem = inputValue.begin(); elem != inputValue.end(); ++elem) {
85  ss << *elem << " ";
86  }
87  it->second = ss.str();
88  return true;
89  }
90 }

References gather_cfg::cout, Skims_PA_cff::name, and contentValuesCheck::ss.

BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
gather_cfg.cout
cout
Definition: gather_cfg.py:144
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17