CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ParameterSet.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_ParameterSet_h
2 #define FWCore_ParameterSet_ParameterSet_h
3 
4 // ----------------------------------------------------------------------
5 // Declaration for ParameterSet(parameter set) and related types
6 // ----------------------------------------------------------------------
7 
8 // ----------------------------------------------------------------------
9 // prolog
10 
11 // ----------------------------------------------------------------------
12 // prerequisite source files and headers
13 
19 
20 #include <iosfwd>
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 #include <array>
26 
27 // ----------------------------------------------------------------------
28 // contents
29 namespace cms {
30  class Digest;
31 }
32 
33 namespace edm {
35  typedef std::vector<ParameterSet> VParameterSet;
36 
37  template <typename T>
39  //When specializing the template, include the following in the struct:
40  //
41  // using GetType = <underlying parameter type to get from the ParameterSet>;
42  //
43  // //Function to convert the parameter type into the requested type
44  // static T convert(GetType, std::string const&);
45  };
46 
47  class ParameterSet {
48  public:
49  template <typename T>
50  friend class ParameterDescription;
51 
52  // default-construct
53  ParameterSet();
54 
55  // construct from coded string.
56  explicit ParameterSet(std::string const& rep);
57 
58  ~ParameterSet() = default;
59  ParameterSet(ParameterSet const& other) = default;
60  ParameterSet(ParameterSet&& other) = default;
61  ParameterSet& operator=(ParameterSet const& other) = default;
62  ParameterSet& operator=(ParameterSet&& other) = default;
63 
64  void swap(ParameterSet& other);
65 
66  void copyForModify(ParameterSet const& other);
67 
68  // identification
69  ParameterSetID id() const;
70  void setID(ParameterSetID const& id);
71  bool isRegistered() const { return id_.isValid(); }
72  ParameterSetID trackedID() const { return id(); } // to be phased out.
73 
74  // Entry-handling
75  Entry const& retrieve(char const*) const;
76  Entry const& retrieve(std::string const&) const;
77  Entry const* retrieveUntracked(char const*) const;
78  Entry const* retrieveUntracked(std::string const&) const;
79  Entry const* retrieveUnknown(char const*) const;
80  Entry const* retrieveUnknown(std::string const&) const;
87 
88  void insertParameterSet(bool okay_to_replace, std::string const& name, ParameterSetEntry const& entry);
89  void insertVParameterSet(bool okay_to_replace, std::string const& name, VParameterSetEntry const& entry);
90  void insert(bool ok_to_replace, char const*, Entry const&);
91  void insert(bool ok_to_replace, std::string const&, Entry const&);
92  void augment(ParameterSet const& from);
93  void copyFrom(ParameterSet const& from, std::string const& name);
95 
96  // encode only tracked parameters
97  std::string toString() const;
98  void toString(std::string& result) const;
99  void toDigest(cms::Digest& digest) const;
100 
101  //encode tracked and untracked parameters
102  void allToString(std::string& result) const;
103 
104  template <typename T>
105  T getParameter(std::string const&) const;
106 
107  template <typename T>
108  T getParameter(char const*) const;
109 
110  ParameterSet const& getParameterSet(std::string const&) const;
111 
112  ParameterSet const& getParameterSet(char const*) const;
113 
114  ParameterSet getUntrackedParameterSet(std::string const& name, ParameterSet const& defaultValue) const;
115 
116  ParameterSet getUntrackedParameterSet(char const* name, ParameterSet const& defaultValue) const;
117 
119 
120  ParameterSet const& getUntrackedParameterSet(char const* name) const;
121 
123 
124  VParameterSet const& getParameterSetVector(char const* name) const;
125 
127 
128  VParameterSet getUntrackedParameterSetVector(char const* name, VParameterSet const& defaultValue) const;
129 
131 
132  VParameterSet const& getUntrackedParameterSetVector(char const* name) const;
133 
134  template <typename T>
135  void addParameter(std::string const& name, T const& value) {
137  insert(true, name, Entry(name, value, true));
138  }
139 
140  template <typename T>
141  void addParameter(char const* name, T const& value) {
143  insert(true, name, Entry(name, value, true));
144  }
145 
146  template <typename T>
147  T getUntrackedParameter(std::string const&, T const&) const;
148 
149  template <typename T>
150  T getUntrackedParameter(char const*, T const&) const;
151 
152  template <typename T>
153  T getUntrackedParameter(std::string const&) const;
154 
155  template <typename T>
156  T getUntrackedParameter(char const*) const;
157 
162  std::vector<FileInPath>::size_type getAllFileInPaths(std::vector<FileInPath>& output) const;
163 
164  std::vector<std::string> getParameterNames() const;
165 
167  bool exists(std::string const& parameterName) const;
168 
170  template <typename T>
171  bool existsAs(std::string const& parameterName, bool trackiness = true) const {
172  std::vector<std::string> names = getParameterNamesForType<T>(trackiness);
173  return std::find(names.begin(), names.end(), parameterName) != names.end();
174  }
175 
176  void deprecatedInputTagWarning(std::string const& name, std::string const& label) const;
177 
178  template <typename T>
179  std::vector<std::string> getParameterNamesForType(bool trackiness = true) const {
180  std::vector<std::string> result;
181  // This is icky, but I don't know of another way in the current
182  // code to get at the character code that denotes type T.
183  T value = T();
184  Entry type_translator("", value, trackiness);
185  char type_code = type_translator.typeCode();
186 
187  (void)getNamesByCode_(type_code, trackiness, result);
188  return result;
189  }
190 
191  template <typename T>
193  insert(true, name, Entry(name, value, false));
194  }
195 
196  template <typename T>
197  void addUntrackedParameter(char const* name, T const& value) {
198  insert(true, name, Entry(name, value, false));
199  }
200 
201  bool empty() const { return tbl_.empty() && psetTable_.empty() && vpsetTable_.empty(); }
202 
203  ParameterSet trackedPart() const;
204 
205  // Return the names of all parameters of type ParameterSet,
206  // pushing the names into the argument 'output'. Return the number
207  // of names pushed into the vector. If 'trackiness' is true, we
208  // return tracked parameters; if 'trackiness' is false, w return
209  // untracked parameters.
210  size_t getParameterSetNames(std::vector<std::string>& output, bool trackiness = true) const;
211 
212  // Return the names of all parameters of type
213  // vector<ParameterSet>, pushing the names into the argument
214  // 'output'. Return the number of names pushed into the vector. If
215  // 'trackiness' is true, we return tracked parameters; if
216  // 'trackiness' is false, w return untracked parameters.
217  size_t getParameterSetVectorNames(std::vector<std::string>& output, bool trackiness = true) const;
218 
219  // need a simple interface for python
220  std::string dump(unsigned int indent = 0) const;
221 
222  friend std::ostream& operator<<(std::ostream& os, ParameterSet const& pset);
223 
224  ParameterSet const& registerIt();
225 
226  std::unique_ptr<ParameterSet> popParameterSet(std::string const& name);
229 
230  std::vector<ParameterSet> popVParameterSet(std::string const& name);
231 
232  typedef std::map<std::string, Entry> table;
233  table const& tbl() const { return tbl_; }
234 
235  typedef std::map<std::string, ParameterSetEntry> psettable;
236  psettable const& psetTable() const { return psetTable_; }
237 
238  typedef std::map<std::string, VParameterSetEntry> vpsettable;
239  vpsettable const& vpsetTable() const { return vpsetTable_; }
240 
241  ParameterSet* getPSetForUpdate(std::string const& name, bool& isTracked);
242 
244  bool isTracked = false;
245  return getPSetForUpdate(name, isTracked);
246  }
247 
249 
250  // construct from coded string and register it.
251  static void registerFromString(std::string const& rep);
252 
253  // return ID of empty parameter set without registering it.
255 
256  private:
257  // construct from coded string and id.
258  ParameterSet(std::string const& rep, ParameterSetID const& id);
259 
260  // decode
261  bool fromString(std::string const&);
262 
263  void toStringImp(std::string&, bool useAll) const;
264 
268 
269  // If the id_ is invalid, that means a new value should be
270  // calculated before the value is returned. Upon registration, the
271  // id_ is made valid. Updating any tracked parameter invalidates the id_.
273 
274  void invalidateRegistration(std::string const& nameOfTracked);
275 
276  void calculateID();
277 
278  // get the untracked Entry object, throwing an exception if it is
279  // not found.
280  Entry const* getEntryPointerOrThrow_(std::string const& name) const;
281  Entry const* getEntryPointerOrThrow_(char const* name) const;
282 
283  // Return the names of all the entries with the given typecode and
284  // given status (trackiness)
285  size_t getNamesByCode_(char code, bool trackiness, std::vector<std::string>& output) const;
286 
287  }; // ParameterSet
288 
289  inline void swap(ParameterSet& a, ParameterSet& b) { a.swap(b); }
290 
291  bool operator==(ParameterSet const& a, ParameterSet const& b);
292 
293  bool isTransientEqual(ParameterSet const& a, ParameterSet const& b);
294 
295  inline bool operator!=(ParameterSet const& a, ParameterSet const& b) { return !(a == b); }
296 
297  // Free function to retrieve a parameter set, given the parameter set ID.
298  ParameterSet const& getParameterSet(ParameterSetID const& id);
299 
300  ParameterSet const& getProcessParameterSetContainingModule(ModuleDescription const& moduleDescription);
301 
302  template <typename T>
304  using GetType = typename ParameterTypeTraits<T>::GetType;
305  return ParameterTypeTraits<T>::convert(getParameter<GetType>(name), name);
306  }
307 
308  template <typename T>
309  inline T ParameterSet::getParameter(const char* name) const {
310  using GetType = typename ParameterTypeTraits<T>::GetType;
311  return ParameterTypeTraits<T>::convert(getParameter<GetType>(name), name);
312  }
313  // specializations
314  // ----------------------------------------------------------------------
315  namespace pset::exceptions {
316  void throwWrongNumberOfElements(std::string const& iParameterName, size_t iExpected, size_t iGot);
317  }
318  //Read an std::array from an std::vector
319  template <typename T, std::size_t N>
320  struct ParameterTypeTraits<std::array<T, N>> {
321  using GetType = std::vector<T>;
322  static std::array<T, N> convert(std::vector<T> iVec, std::string const& iName) {
323  if (iVec.size() != N) {
324  pset::exceptions::throwWrongNumberOfElements(iName, N, iVec.size());
325  }
326  std::array<T, N> a;
327  std::copy_n(std::make_move_iterator(iVec.begin()), N, a.begin());
328  return a;
329  }
330  };
331  // read an std::vector<std::pair<std::string, T>> from std::vector<PSet>
332  template <typename T>
333  struct ParameterTypeTraits<std::vector<std::pair<std::string, T>>> {
334  using GetType = std::vector<edm::ParameterSet>;
335  static auto convert(std::vector<edm::ParameterSet> vpset, std::string const& iName) {
336  std::vector<std::pair<std::string, T>> ret(vpset.size());
337  std::transform(vpset.begin(), vpset.end(), ret.begin(), [](edm::ParameterSet const& pset) {
338  return std::pair(pset.getParameter<std::string>("key"), pset.getParameter<T>("value"));
339  });
340  return ret;
341  }
342  };
343  // ----------------------------------------------------------------------
344 
345  template <>
346  bool ParameterSet::getParameter<bool>(std::string const& name) const;
347 
348  // ----------------------------------------------------------------------
349  // Int32, vInt32
350 
351  template <>
352  int ParameterSet::getParameter<int>(std::string const& name) const;
353 
354  template <>
355  std::vector<int> ParameterSet::getParameter<std::vector<int>>(std::string const& name) const;
356 
357  // ----------------------------------------------------------------------
358  // Int64, vInt64
359 
360  template <>
361  long long ParameterSet::getParameter<long long>(std::string const& name) const;
362 
363  template <>
364  std::vector<long long> ParameterSet::getParameter<std::vector<long long>>(std::string const& name) const;
365 
366  // ----------------------------------------------------------------------
367  // Uint32, vUint32
368 
369  template <>
370  unsigned int ParameterSet::getParameter<unsigned int>(std::string const& name) const;
371 
372  template <>
373  std::vector<unsigned int> ParameterSet::getParameter<std::vector<unsigned int>>(std::string const& name) const;
374 
375  // ----------------------------------------------------------------------
376  // Uint64, vUint64
377 
378  template <>
379  unsigned long long ParameterSet::getParameter<unsigned long long>(std::string const& name) const;
380 
381  template <>
382  std::vector<unsigned long long> ParameterSet::getParameter<std::vector<unsigned long long>>(
383  std::string const& name) const;
384 
385  // ----------------------------------------------------------------------
386  // Double, vDouble
387 
388  template <>
389  double ParameterSet::getParameter<double>(std::string const& name) const;
390 
391  template <>
392  std::vector<double> ParameterSet::getParameter<std::vector<double>>(std::string const& name) const;
393 
394  // ----------------------------------------------------------------------
395  // String, vString
396 
397  template <>
398  std::string ParameterSet::getParameter<std::string>(std::string const& name) const;
399 
400  template <>
401  std::vector<std::string> ParameterSet::getParameter<std::vector<std::string>>(std::string const& name) const;
402 
403  // ----------------------------------------------------------------------
404  // FileInPath
405 
406  template <>
407  FileInPath ParameterSet::getParameter<FileInPath>(std::string const& name) const;
408 
409  // FileInPath can't default-construct something useful, so we specialize
410  // this template
411  template <>
412  std::vector<std::string> ParameterSet::getParameterNamesForType<FileInPath>(bool trackiness) const;
413 
414  // ----------------------------------------------------------------------
415  // InputTag
416 
417  template <>
418  InputTag ParameterSet::getParameter<InputTag>(std::string const& name) const;
419 
420  // ----------------------------------------------------------------------
421  // VInputTag
422 
423  template <>
424  std::vector<InputTag> ParameterSet::getParameter<std::vector<InputTag>>(std::string const& name) const;
425 
426  // ----------------------------------------------------------------------
427  // ESInputTag
428 
429  template <>
430  ESInputTag ParameterSet::getParameter<ESInputTag>(std::string const& name) const;
431 
432  // ----------------------------------------------------------------------
433  // VESInputTag
434 
435  template <>
436  std::vector<ESInputTag> ParameterSet::getParameter<std::vector<ESInputTag>>(std::string const& name) const;
437 
438  // ----------------------------------------------------------------------
439  // EventID
440 
441  template <>
442  EventID ParameterSet::getParameter<EventID>(std::string const& name) const;
443 
444  // ----------------------------------------------------------------------
445  // VEventID
446 
447  template <>
448  std::vector<EventID> ParameterSet::getParameter<std::vector<EventID>>(std::string const& name) const;
449 
450  // ----------------------------------------------------------------------
451  // LuminosityBlockID
452 
453  template <>
454  LuminosityBlockID ParameterSet::getParameter<LuminosityBlockID>(std::string const& name) const;
455 
456  // ----------------------------------------------------------------------
457  // VLuminosityBlockID
458 
459  template <>
460  std::vector<LuminosityBlockID> ParameterSet::getParameter<std::vector<LuminosityBlockID>>(
461  std::string const& name) const;
462 
463  // ----------------------------------------------------------------------
464  // EventRange
465 
466  template <>
467  EventRange ParameterSet::getParameter<EventRange>(std::string const& name) const;
468 
469  // ----------------------------------------------------------------------
470  // VEventRange
471 
472  template <>
473  std::vector<EventRange> ParameterSet::getParameter<std::vector<EventRange>>(std::string const& name) const;
474 
475  // ----------------------------------------------------------------------
476  // LuminosityBlockRange
477 
478  template <>
479  LuminosityBlockRange ParameterSet::getParameter<LuminosityBlockRange>(std::string const& name) const;
480 
481  // ----------------------------------------------------------------------
482  // VLuminosityBlockRange
483 
484  template <>
485  std::vector<LuminosityBlockRange> ParameterSet::getParameter<std::vector<LuminosityBlockRange>>(
486  std::string const& name) const;
487 
488  // ----------------------------------------------------------------------
489  // PSet, vPSet
490 
491  template <>
492  ParameterSet ParameterSet::getParameter<ParameterSet>(std::string const& name) const;
493 
494  template <>
495  VParameterSet ParameterSet::getParameter<VParameterSet>(std::string const& name) const;
496 
497  template <>
498  void ParameterSet::addParameter<ParameterSet>(std::string const& name, ParameterSet const& value);
499 
500  template <>
501  void ParameterSet::addParameter<ParameterSet>(char const* name, ParameterSet const& value);
502 
503  template <>
504  void ParameterSet::addUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& value);
505 
506  template <>
507  void ParameterSet::addUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& value);
508 
509  template <>
510  void ParameterSet::addParameter<VParameterSet>(std::string const& name, VParameterSet const& value);
511 
512  template <>
513  void ParameterSet::addParameter<VParameterSet>(char const* name, VParameterSet const& value);
514 
515  template <>
516  void ParameterSet::addUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& value);
517 
518  template <>
519  void ParameterSet::addUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& value);
520 
521  // untracked parameters
522 
523  // ----------------------------------------------------------------------
524  // Bool, vBool
525 
526  template <>
527  bool ParameterSet::getUntrackedParameter<bool>(std::string const& name, bool const& defaultValue) const;
528 
529  template <>
530  bool ParameterSet::getUntrackedParameter<bool>(std::string const& name) const;
531 
532  // ----------------------------------------------------------------------
533  // Int32, vInt32
534 
535  template <>
536  int ParameterSet::getUntrackedParameter<int>(std::string const& name, int const& defaultValue) const;
537 
538  template <>
539  int ParameterSet::getUntrackedParameter<int>(std::string const& name) const;
540 
541  template <>
542  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int>>(std::string const& name,
543  std::vector<int> const& defaultValue) const;
544 
545  template <>
546  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int>>(std::string const& name) const;
547 
548  // ----------------------------------------------------------------------
549  // Uint32, vUint32
550 
551  template <>
552  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name,
553  unsigned int const& defaultValue) const;
554 
555  template <>
556  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name) const;
557 
558  template <>
559  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int>>(
560  std::string const& name, std::vector<unsigned int> const& defaultValue) const;
561 
562  template <>
563  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int>>(
564  std::string const& name) const;
565 
566  // ----------------------------------------------------------------------
567  // Uint64, vUint64
568 
569  template <>
570  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(
571  std::string const& name, unsigned long long const& defaultValue) const;
572 
573  template <>
574  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name) const;
575 
576  template <>
577  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long>>(
578  std::string const& name, std::vector<unsigned long long> const& defaultValue) const;
579 
580  template <>
581  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long>>(
582  std::string const& name) const;
583 
584  // ----------------------------------------------------------------------
585  // Int64, Vint64
586 
587  template <>
588  long long ParameterSet::getUntrackedParameter<long long>(std::string const& name,
589  long long const& defaultValue) const;
590 
591  template <>
592  long long ParameterSet::getUntrackedParameter<long long>(std::string const& name) const;
593 
594  template <>
595  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long>>(
596  std::string const& name, std::vector<long long> const& defaultValue) const;
597 
598  template <>
599  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long>>(std::string const& name) const;
600 
601  // ----------------------------------------------------------------------
602  // Double, vDouble
603 
604  template <>
605  double ParameterSet::getUntrackedParameter<double>(std::string const& name, double const& defaultValue) const;
606 
607  template <>
608  double ParameterSet::getUntrackedParameter<double>(std::string const& name) const;
609 
610  template <>
611  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double>>(
612  std::string const& name, std::vector<double> const& defaultValue) const;
613 
614  template <>
615  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double>>(std::string const& name) const;
616 
617  // ----------------------------------------------------------------------
618  // String, vString
619 
620  template <>
621  std::string ParameterSet::getUntrackedParameter<std::string>(std::string const& name,
622  std::string const& defaultValue) const;
623 
624  template <>
625  std::string ParameterSet::getUntrackedParameter<std::string>(std::string const& name) const;
626 
627  template <>
628  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string>>(
629  std::string const& name, std::vector<std::string> const& defaultValue) const;
630 
631  template <>
632  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string>>(std::string const& name) const;
633 
634  // ----------------------------------------------------------------------
635  // FileInPath
636 
637  template <>
638  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name,
639  FileInPath const& defaultValue) const;
640 
641  template <>
642  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name) const;
643 
644  // ----------------------------------------------------------------------
645  // InputTag, VInputTag
646 
647  template <>
648  InputTag ParameterSet::getUntrackedParameter<InputTag>(std::string const& name, InputTag const& defaultValue) const;
649 
650  template <>
651  InputTag ParameterSet::getUntrackedParameter<InputTag>(std::string const& name) const;
652 
653  template <>
654  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag>>(
655  std::string const& name, std::vector<InputTag> const& defaultValue) const;
656 
657  template <>
658  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag>>(std::string const& name) const;
659 
660  // ----------------------------------------------------------------------
661  // EventID, VEventID
662 
663  template <>
664  EventID ParameterSet::getUntrackedParameter<EventID>(std::string const& name, EventID const& defaultValue) const;
665 
666  template <>
667  EventID ParameterSet::getUntrackedParameter<EventID>(std::string const& name) const;
668 
669  template <>
670  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID>>(
671  std::string const& name, std::vector<EventID> const& defaultValue) const;
672  template <>
673  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID>>(std::string const& name) const;
674 
675  // ----------------------------------------------------------------------
676  // LuminosityBlockID, VLuminosityBlockID
677 
678  template <>
679  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name,
680  LuminosityBlockID const& defaultValue) const;
681 
682  template <>
683  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name) const;
684 
685  template <>
686  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID>>(
687  std::string const& name, std::vector<LuminosityBlockID> const& defaultValue) const;
688  template <>
689  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID>>(
690  std::string const& name) const;
691 
692  // ----------------------------------------------------------------------
693  // EventRange, VEventRange
694 
695  template <>
696  EventRange ParameterSet::getUntrackedParameter<EventRange>(std::string const& name,
697  EventRange const& defaultValue) const;
698 
699  template <>
700  EventRange ParameterSet::getUntrackedParameter<EventRange>(std::string const& name) const;
701 
702  template <>
703  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange>>(
704  std::string const& name, std::vector<EventRange> const& defaultValue) const;
705  template <>
706  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange>>(std::string const& name) const;
707 
708  // ----------------------------------------------------------------------
709  // LuminosityBlockRange, VLuminosityBlockRange
710 
711  template <>
712  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(
713  std::string const& name, LuminosityBlockRange const& defaultValue) const;
714 
715  template <>
716  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name) const;
717 
718  template <>
719  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange>>(
720  std::string const& name, std::vector<LuminosityBlockRange> const& defaultValue) const;
721  template <>
722  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange>>(
723  std::string const& name) const;
724 
725  // specializations
726  // ----------------------------------------------------------------------
727  // Bool, vBool
728 
729  template <>
730  bool ParameterSet::getParameter<bool>(char const* name) const;
731 
732  // ----------------------------------------------------------------------
733  // Int32, vInt32
734 
735  template <>
736  int ParameterSet::getParameter<int>(char const* name) const;
737 
738  template <>
739  std::vector<int> ParameterSet::getParameter<std::vector<int>>(char const* name) const;
740 
741  // ----------------------------------------------------------------------
742  // Int64, vInt64
743 
744  template <>
745  long long ParameterSet::getParameter<long long>(char const* name) const;
746 
747  template <>
748  std::vector<long long> ParameterSet::getParameter<std::vector<long long>>(char const* name) const;
749 
750  // ----------------------------------------------------------------------
751  // Uint32, vUint32
752 
753  template <>
754  unsigned int ParameterSet::getParameter<unsigned int>(char const* name) const;
755 
756  template <>
757  std::vector<unsigned int> ParameterSet::getParameter<std::vector<unsigned int>>(char const* name) const;
758 
759  // ----------------------------------------------------------------------
760  // Uint64, vUint64
761 
762  template <>
763  unsigned long long ParameterSet::getParameter<unsigned long long>(char const* name) const;
764 
765  template <>
766  std::vector<unsigned long long> ParameterSet::getParameter<std::vector<unsigned long long>>(char const* name) const;
767 
768  // ----------------------------------------------------------------------
769  // Double, vDouble
770 
771  template <>
772  double ParameterSet::getParameter<double>(char const* name) const;
773 
774  template <>
775  std::vector<double> ParameterSet::getParameter<std::vector<double>>(char const* name) const;
776 
777  // ----------------------------------------------------------------------
778  // String, vString
779 
780  template <>
781  std::string ParameterSet::getParameter<std::string>(char const* name) const;
782 
783  template <>
784  std::vector<std::string> ParameterSet::getParameter<std::vector<std::string>>(char const* name) const;
785 
786  // ----------------------------------------------------------------------
787  // FileInPath
788 
789  template <>
790  FileInPath ParameterSet::getParameter<FileInPath>(char const* name) const;
791 
792  // ----------------------------------------------------------------------
793  // InputTag
794 
795  template <>
796  InputTag ParameterSet::getParameter<InputTag>(char const* name) const;
797 
798  // ----------------------------------------------------------------------
799  // VInputTag
800 
801  template <>
802  std::vector<InputTag> ParameterSet::getParameter<std::vector<InputTag>>(char const* name) const;
803 
804  // ----------------------------------------------------------------------
805  // ESInputTag
806 
807  template <>
808  ESInputTag ParameterSet::getParameter<ESInputTag>(char const* name) const;
809 
810  // ----------------------------------------------------------------------
811  // VESInputTag
812 
813  template <>
814  std::vector<ESInputTag> ParameterSet::getParameter<std::vector<ESInputTag>>(char const* name) const;
815 
816  // ----------------------------------------------------------------------
817  // EventID
818 
819  template <>
820  EventID ParameterSet::getParameter<EventID>(char const* name) const;
821 
822  // ----------------------------------------------------------------------
823  // VEventID
824 
825  template <>
826  std::vector<EventID> ParameterSet::getParameter<std::vector<EventID>>(char const* name) const;
827 
828  // ----------------------------------------------------------------------
829  // LuminosityBlockID
830 
831  template <>
832  LuminosityBlockID ParameterSet::getParameter<LuminosityBlockID>(char const* name) const;
833 
834  // ----------------------------------------------------------------------
835  // VLuminosityBlockID
836 
837  template <>
838  std::vector<LuminosityBlockID> ParameterSet::getParameter<std::vector<LuminosityBlockID>>(char const* name) const;
839 
840  // ----------------------------------------------------------------------
841  // EventRange
842 
843  template <>
844  EventRange ParameterSet::getParameter<EventRange>(char const* name) const;
845 
846  // ----------------------------------------------------------------------
847  // VEventRange
848 
849  template <>
850  std::vector<EventRange> ParameterSet::getParameter<std::vector<EventRange>>(char const* name) const;
851 
852  // ----------------------------------------------------------------------
853  // LuminosityBlockRange
854 
855  template <>
856  LuminosityBlockRange ParameterSet::getParameter<LuminosityBlockRange>(char const* name) const;
857 
858  // ----------------------------------------------------------------------
859  // VLuminosityBlockRange
860 
861  template <>
862  std::vector<LuminosityBlockRange> ParameterSet::getParameter<std::vector<LuminosityBlockRange>>(
863  char const* name) const;
864 
865  // ----------------------------------------------------------------------
866  // PSet, vPSet
867 
868  template <>
869  ParameterSet ParameterSet::getParameter<ParameterSet>(char const* name) const;
870 
871  template <>
872  VParameterSet ParameterSet::getParameter<VParameterSet>(char const* name) const;
873 
874  // untracked parameters
875 
876  // ----------------------------------------------------------------------
877  // Bool, vBool
878 
879  template <>
880  bool ParameterSet::getUntrackedParameter<bool>(char const* name, bool const& defaultValue) const;
881 
882  template <>
883  bool ParameterSet::getUntrackedParameter<bool>(char const* name) const;
884 
885  // ----------------------------------------------------------------------
886  // Int32, vInt32
887 
888  template <>
889  int ParameterSet::getUntrackedParameter<int>(char const* name, int const& defaultValue) const;
890 
891  template <>
892  int ParameterSet::getUntrackedParameter<int>(char const* name) const;
893 
894  template <>
895  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int>>(char const* name,
896  std::vector<int> const& defaultValue) const;
897 
898  template <>
899  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int>>(char const* name) const;
900 
901  // ----------------------------------------------------------------------
902  // Uint32, vUint32
903 
904  template <>
905  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(char const* name,
906  unsigned int const& defaultValue) const;
907 
908  template <>
909  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(char const* name) const;
910 
911  template <>
912  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int>>(
913  char const* name, std::vector<unsigned int> const& defaultValue) const;
914 
915  template <>
916  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int>>(char const* name) const;
917 
918  // ----------------------------------------------------------------------
919  // Uint64, vUint64
920 
921  template <>
922  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(
923  char const* name, unsigned long long const& defaultValue) const;
924 
925  template <>
926  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(char const* name) const;
927 
928  template <>
929  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long>>(
930  char const* name, std::vector<unsigned long long> const& defaultValue) const;
931 
932  template <>
933  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long>>(
934  char const* name) const;
935 
936  // ----------------------------------------------------------------------
937  // Int64, Vint64
938 
939  template <>
940  long long ParameterSet::getUntrackedParameter<long long>(char const* name, long long const& defaultValue) const;
941 
942  template <>
943  long long ParameterSet::getUntrackedParameter<long long>(char const* name) const;
944 
945  template <>
946  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long>>(
947  char const* name, std::vector<long long> const& defaultValue) const;
948 
949  template <>
950  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long>>(char const* name) const;
951 
952  // ----------------------------------------------------------------------
953  // Double, vDouble
954 
955  template <>
956  double ParameterSet::getUntrackedParameter<double>(char const* name, double const& defaultValue) const;
957 
958  template <>
959  double ParameterSet::getUntrackedParameter<double>(char const* name) const;
960 
961  template <>
962  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double>>(
963  char const* name, std::vector<double> const& defaultValue) const;
964 
965  template <>
966  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double>>(char const* name) const;
967 
968  // ----------------------------------------------------------------------
969  // String, vString
970 
971  template <>
972  std::string ParameterSet::getUntrackedParameter<std::string>(char const* name, std::string const& defaultValue) const;
973 
974  template <>
975  std::string ParameterSet::getUntrackedParameter<std::string>(char const* name) const;
976 
977  template <>
978  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string>>(
979  char const* name, std::vector<std::string> const& defaultValue) const;
980 
981  template <>
982  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string>>(char const* name) const;
983 
984  // ----------------------------------------------------------------------
985  // FileInPath
986 
987  template <>
988  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(char const* name, FileInPath const& defaultValue) const;
989 
990  template <>
991  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(char const* name) const;
992 
993  // ----------------------------------------------------------------------
994  // InputTag, VInputTag
995 
996  template <>
997  InputTag ParameterSet::getUntrackedParameter<InputTag>(char const* name, InputTag const& defaultValue) const;
998 
999  template <>
1000  InputTag ParameterSet::getUntrackedParameter<InputTag>(char const* name) const;
1001 
1002  template <>
1003  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag>>(
1004  char const* name, std::vector<InputTag> const& defaultValue) const;
1005 
1006  template <>
1007  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag>>(char const* name) const;
1008 
1009  // ----------------------------------------------------------------------
1010  // EventID, VEventID
1011 
1012  template <>
1013  EventID ParameterSet::getUntrackedParameter<EventID>(char const* name, EventID const& defaultValue) const;
1014 
1015  template <>
1016  EventID ParameterSet::getUntrackedParameter<EventID>(char const* name) const;
1017 
1018  template <>
1019  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID>>(
1020  char const* name, std::vector<EventID> const& defaultValue) const;
1021  template <>
1022  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID>>(char const* name) const;
1023 
1024  // ----------------------------------------------------------------------
1025  // LuminosityBlockID, VLuminosityBlockID
1026 
1027  template <>
1028  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name,
1029  LuminosityBlockID const& defaultValue) const;
1030 
1031  template <>
1032  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name) const;
1033 
1034  template <>
1035  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID>>(
1036  char const* name, std::vector<LuminosityBlockID> const& defaultValue) const;
1037  template <>
1038  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID>>(
1039  char const* name) const;
1040 
1041  // ----------------------------------------------------------------------
1042  // EventRange, VEventRange
1043 
1044  template <>
1045  EventRange ParameterSet::getUntrackedParameter<EventRange>(char const* name, EventRange const& defaultValue) const;
1046 
1047  template <>
1048  EventRange ParameterSet::getUntrackedParameter<EventRange>(char const* name) const;
1049 
1050  template <>
1051  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange>>(
1052  char const* name, std::vector<EventRange> const& defaultValue) const;
1053  template <>
1054  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange>>(char const* name) const;
1055 
1056  // ----------------------------------------------------------------------
1057  // LuminosityBlockRange, VLuminosityBlockRange
1058 
1059  template <>
1060  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(
1061  char const* name, LuminosityBlockRange const& defaultValue) const;
1062 
1063  template <>
1064  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name) const;
1065 
1066  template <>
1067  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange>>(
1068  char const* name, std::vector<LuminosityBlockRange> const& defaultValue) const;
1069  template <>
1070  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange>>(
1071  char const* name) const;
1072 
1073  // ----------------------------------------------------------------------
1074  // PSet, vPSet
1075 
1076  template <>
1077  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(char const* name,
1078  ParameterSet const& defaultValue) const;
1079 
1080  template <>
1081  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name,
1082  ParameterSet const& defaultValue) const;
1083 
1084  template <>
1085  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(char const* name) const;
1086 
1087  template <>
1088  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name) const;
1089 
1090  template <>
1091  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(char const* name,
1092  VParameterSet const& defaultValue) const;
1093 
1094  template <>
1095  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(char const* name) const;
1096 
1097  template <>
1098  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name,
1099  VParameterSet const& defaultValue) const;
1100 
1101  template <>
1102  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name) const;
1103 
1104  template <>
1105  std::vector<std::string> ParameterSet::getParameterNamesForType<ParameterSet>(bool trackiness) const;
1106 
1107  template <>
1108  std::vector<std::string> ParameterSet::getParameterNamesForType<VParameterSet>(bool trackiness) const;
1109 } // namespace edm
1110 #endif
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
void setID(ParameterSetID const &id)
Entry const & retrieve(char const *) const
bool empty() const
Definition: ParameterSet.h:201
std::string toString() const
T getUntrackedParameter(std::string const &, T const &) const
string rep
Definition: cuy.py:1189
VParameterSet const & getParameterSetVector(std::string const &name) const
tuple ret
prodAgent to be discontinued
tuple array
Definition: mps_check.py:216
ParameterSetEntry const & retrieveParameterSet(std::string const &) const
ParameterSetID id_
Definition: ParameterSet.h:272
Entry const * getEntryPointerOrThrow_(std::string const &name) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
std::unique_ptr< ParameterSet > popParameterSet(std::string const &name)
std::map< std::string, ParameterSetEntry > psettable
Definition: ParameterSet.h:235
ParameterSetEntry const * retrieveUntrackedParameterSet(std::string const &) const
bool fromString(std::string const &)
std::string dump(unsigned int indent=0) const
ParameterSetID id() const
VParameterSetEntry const * retrieveUntrackedVParameterSet(std::string const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
size_t getParameterSetVectorNames(std::vector< std::string > &output, bool trackiness=true) const
ParameterSet const & getParameterSet(ParameterSetID const &id)
ParameterSet & operator=(ParameterSet const &other)=default
bool exists(std::string const &parameterName) const
checks if a parameter exists
void toStringImp(std::string &, bool useAll) const
~ParameterSet()=default
void insert(bool ok_to_replace, char const *, Entry const &)
void addUntrackedParameter(char const *name, T const &value)
Definition: ParameterSet.h:197
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
uint16_t size_type
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
ParameterSet const & getProcessParameterSetContainingModule(ModuleDescription const &moduleDescription)
ParameterSet trackedPart() const
tuple result
Definition: mps_fire.py:311
void augment(ParameterSet const &from)
void eraseOrSetUntrackedParameterSet(std::string const &name)
void swap(ParameterSet &other)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
char const * label
std::vector< FileInPath >::size_type getAllFileInPaths(std::vector< FileInPath > &output) const
void copyFrom(ParameterSet const &from, std::string const &name)
static std::array< T, N > convert(std::vector< T > iVec, std::string const &iName)
Definition: ParameterSet.h:322
VParameterSetEntry * getPSetVectorForUpdate(std::string const &name)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
ParameterSetEntry const * retrieveUnknownParameterSet(std::string const &) const
static auto convert(std::vector< edm::ParameterSet > vpset, std::string const &iName)
Definition: ParameterSet.h:335
void insertVParameterSet(bool okay_to_replace, std::string const &name, VParameterSetEntry const &entry)
std::vector< std::string > names
VParameterSetEntry const * retrieveUnknownVParameterSet(std::string const &) const
std::vector< std::string > getParameterNames() const
constexpr bool operator!=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
void eraseSimpleParameter(std::string const &name)
void copyForModify(ParameterSet const &other)
bool isRegistered() const
Definition: ParameterSet.h:71
Hash< ParameterSetType > ParameterSetID
void invalidateRegistration(std::string const &nameOfTracked)
Definition: ParameterSet.cc:39
friend std::ostream & operator<<(std::ostream &os, ParameterSet const &pset)
static void registerFromString(std::string const &rep)
Definition: ParameterSet.cc:86
std::string getParameterAsString(std::string const &name) const
psettable const & psetTable() const
Definition: ParameterSet.h:236
void deprecatedInputTagWarning(std::string const &name, std::string const &label) const
#define N
Definition: blowfish.cc:9
void addParameter(char const *name, T const &value)
Definition: ParameterSet.h:141
ParameterSet const & getParameterSet(std::string const &) const
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:192
size_t getNamesByCode_(char code, bool trackiness, std::vector< std::string > &output) const
void insertParameterSet(bool okay_to_replace, std::string const &name, ParameterSetEntry const &entry)
void toDigest(cms::Digest &digest) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double b
Definition: hdecay.h:118
ParameterSetID trackedID() const
Definition: ParameterSet.h:72
VParameterSetEntry const & retrieveVParameterSet(std::string const &) const
std::map< std::string, Entry > table
Definition: ParameterSet.h:232
void allToString(std::string &result) const
std::vector< ParameterSet > popVParameterSet(std::string const &name)
std::map< std::string, VParameterSetEntry > vpsettable
Definition: ParameterSet.h:238
vpsettable const & vpsetTable() const
Definition: ParameterSet.h:239
bool isValid() const
Definition: Hash.h:141
double a
Definition: hdecay.h:119
psettable psetTable_
Definition: ParameterSet.h:266
VParameterSet getUntrackedParameterSetVector(std::string const &name, VParameterSet const &defaultValue) const
list entry
Definition: mps_splice.py:68
char typeCode() const
Definition: Entry.h:176
Entry const * retrieveUntracked(char const *) const
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
void throwWrongNumberOfElements(std::string const &iParameterName, size_t iExpected, size_t iGot)
Definition: ParameterSet.cc:33
Entry const * retrieveUnknown(char const *) const
table const & tbl() const
Definition: ParameterSet.h:233
long double T
static ParameterSetID emptyParameterSetID()
Definition: ParameterSet.cc:94
ParameterSet const & registerIt()
bool isTransientEqual(ParameterSet const &a, ParameterSet const &b)
vpsettable vpsetTable_
Definition: ParameterSet.h:267
ParameterSet * getPSetForUpdate(std::string const &name)
Definition: ParameterSet.h:243
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
unsigned transform(const HcalDetId &id, unsigned transformCode)