CMS 3D CMS Logo

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