CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
FWPSetCellEditor.cc File Reference
#include <sstream>
#include "KeySymbols.h"
#include "Fireworks/FWInterface/src/FWPSetCellEditor.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "Fireworks/Core/interface/fwLog.h"
#include "FWCore/Utilities/interface/Parse.h"

Go to the source code of this file.

Functions

bool editESInputTag (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 
void editFileInPath (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 
bool editInputTag (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 
template<class T >
bool editNumericParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 
void editStringParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 
template<typename T >
void editVectorParameter (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 
bool editVInputTag (edm::ParameterSet &ps, bool tracked, const std::string &label, const std::string &value)
 

Function Documentation

bool editESInputTag ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 162 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), edm::tokenize(), and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

Referenced by FWPSetCellEditor::apply().

165 {
166  std::vector<std::string> tokens = edm::tokenize(value, ":");
167  size_t nwords = tokens.size();
168 
169  bool fail;
170 
171  if ( nwords > 2 )
172  {
173  fail = true;
174  }
175  else
176  {
177  std::string it_module("");
178  std::string it_data("");
179 
180  if ( nwords > 0 )
181  it_module = tokens[0];
182  if ( nwords > 1 )
183  it_data = tokens[1];
184 
185  if ( tracked )
186  ps.addParameter(label, edm::ESInputTag(it_module, it_data));
187  else
188  ps.addUntrackedParameter(label, edm::ESInputTag(it_module, it_data));
189 
190  fail = false;
191  }
192 
193  return fail;
194 }
const std::string & label
Definition: MVAComputer.cc:186
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57
void editFileInPath ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 56 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), and edm::ParameterSet::addUntrackedParameter().

Referenced by FWPSetCellEditor::apply().

59 {
60  if (tracked)
62  else
64 }
const std::string & label
Definition: MVAComputer.cc:186
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
bool editInputTag ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 123 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), edm::tokenize(), and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

Referenced by FWPSetCellEditor::apply().

126 {
127  std::vector<std::string> tokens = edm::tokenize(value, ":");
128  size_t nwords = tokens.size();
129 
130  bool fail;
131 
132  if ( nwords > 3 )
133  {
134  fail = true;
135  }
136  else
137  {
138  std::string it_label("");
139  std::string it_instance("");
140  std::string it_process("");
141 
142  if ( nwords > 0 )
143  it_label = tokens[0];
144  if ( nwords > 1 )
145  it_instance = tokens[1];
146  if ( nwords > 2 )
147  it_process = tokens[2];
148 
149  if ( tracked )
150  ps.addParameter(label, edm::InputTag(it_label, it_instance, it_process));
151  else
152  ps.addUntrackedParameter(label, edm::InputTag(it_label, it_instance, it_process));
153 
154  fail = false;
155  }
156 
157  return fail;
158 }
const std::string & label
Definition: MVAComputer.cc:186
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57
template<class T >
bool editNumericParameter ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 27 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), and v.

30 {
31  std::stringstream str(value);
32  T v;
33  str >> v;
34  bool fail = str.fail();
35  if (tracked)
36  ps.addParameter(label, v);
37  else
39 
40  return fail;
41 }
const std::string & label
Definition: MVAComputer.cc:186
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
long double T
mathSSE::Vec4< T > v
void editStringParameter ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 44 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), and edm::ParameterSet::addUntrackedParameter().

Referenced by FWPSetCellEditor::apply().

47 {
48  if (tracked)
50  else
52 }
const std::string & label
Definition: MVAComputer.cc:186
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
template<typename T >
void editVectorParameter ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 198 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), CommonUtil::lst, and valueVector().

201 {
202  std::vector<T> valueVector;
203 
204  std::stringstream iss(value);
205  std::string vitem;
206 
207  size_t fst, lst;
208 
209  while (getline(iss, vitem, ','))
210  {
211  fst = vitem.find("[");
212  lst = vitem.find("]");
213 
214  if ( fst != std::string::npos )
215  vitem.erase(fst,1);
216  if ( lst != std::string::npos )
217  vitem.erase(lst,1);
218 
219  std::stringstream oss(vitem);
220  T on;
221  oss >> on;
222 
223  valueVector.push_back(on);
224  }
225 
226  if (tracked)
227  ps.addParameter(label, valueVector);
228  else
229  ps.addUntrackedParameter(label, valueVector);
230 }
const std::string & label
Definition: MVAComputer.cc:186
void valueVector(const std::map< K, V > &extract, std::vector< V > &output)
Definition: Operators.h:43
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
long double T
bool editVInputTag ( edm::ParameterSet ps,
bool  tracked,
const std::string &  label,
const std::string &  value 
)

Definition at line 68 of file FWPSetCellEditor.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), cmsPerfPublish::fail(), CommonUtil::lst, edm::tokenize(), and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

Referenced by FWPSetCellEditor::apply().

71 {
72  std::vector<edm::InputTag> inputTags;
73  std::stringstream iss(value);
74  std::string vitem;
75  bool fail = false;
76  size_t fst, lst;
77 
78  while (getline(iss, vitem, ','))
79  {
80  fst = vitem.find("[");
81  lst = vitem.find("]");
82 
83  if ( fst != std::string::npos )
84  vitem.erase(fst,1);
85  if ( lst != std::string::npos )
86  vitem.erase(lst,1);
87 
88  std::vector<std::string> tokens = edm::tokenize(vitem, ":");
89  size_t nwords = tokens.size();
90 
91  if ( nwords > 3 )
92  {
93  fail = true;
94  return fail;
95  }
96  else
97  {
98  std::string it_label("");
99  std::string it_instance("");
100  std::string it_process("");
101 
102  if ( nwords > 0 )
103  it_label = tokens[0];
104  if ( nwords > 1 )
105  it_instance = tokens[1];
106  if ( nwords > 2 )
107  it_process = tokens[2];
108 
109  inputTags.push_back(edm::InputTag(it_label, it_instance, it_process));
110  }
111  }
112 
113  if (tracked)
114  ps.addParameter(label, inputTags);
115  else
116  ps.addUntrackedParameter(label, inputTags);
117 
118  return fail;
119 }
const std::string & label
Definition: MVAComputer.cc:186
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:139
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:203
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57