CMS 3D CMS Logo

ProducerWithPSetDesc.cc
Go to the documentation of this file.
1 #include "ProducerWithPSetDesc.h"
2 #include "DataFormats/TestObjects/interface/ThingCollection.h"
5 
21 
22 #include <vector>
23 #include <limits>
24 #include <string>
25 #include <iostream>
26 
27 namespace edmtest {
28 
30  virtual ~AnotherIntMakerBase() = default;
31  virtual int value() const = 0;
32  };
33 
35 
37  explicit AnotherOneMaker(edm::ParameterSet const&) {}
38  int value() const final { return 1; };
39 
41  };
42 
44  explicit AnotherValueMaker(edm::ParameterSet const& iPSet) : value_{iPSet.getParameter<int>("value")} {}
45  int value() const final { return value_; };
46 
47  static void fillPSetDescription(edm::ParameterSetDescription& iDesc) { iDesc.add<int>("value", 5); }
48  int value_;
49  };
50 } // namespace edmtest
54 
55 namespace edmtest {
56 
58  testingAutoGeneratedCfi = ps.getUntrackedParameter<bool>("testingAutoGeneratedCfi", true);
59 
60  assert(ps.getParameter<int>("p_int") == 2147483647);
61  assert(ps.getUntrackedParameter<int>("p_int_untracked") == -2147483647);
63  assert(ps.getParameter<int>("p_int_opt") == 0);
65  assert(ps.getUntrackedParameter<int>("p_int_optuntracked") == 7);
66  assert(!ps.exists("p_int_opt_nd"));
67  assert(!ps.exists("p_int_optuntracked_nd"));
68  } else {
69  assert(!ps.exists("p_int_optuntracked"));
70  assert(ps.getParameter<int>("p_int_opt_nd") == 11);
71  assert(ps.getUntrackedParameter<int>("p_int_optuntracked_nd") == 12);
72  }
73 
74  std::vector<int> vint;
75  vint = ps.getParameter<std::vector<int>>("vint1");
76  assert(vint.empty());
77  vint = ps.getParameter<std::vector<int>>("vint2");
78  assert(vint[0] == 2147483647);
79  vint = ps.getParameter<std::vector<int>>("vint3");
80  assert(vint[0] == 2147483647);
81  assert(vint[1] == -2147483647);
82  std::array<int, 2> testArray = ps.getParameter<std::array<int, 2>>(std::string("vint3"));
83  assert(testArray[0] == 2147483647);
84  assert(testArray[1] == -2147483647);
85  std::array<int, 2> testArray1 = ps.getParameter<std::array<int, 2>>("vint3");
86  assert(testArray1[0] == 2147483647);
87  assert(testArray1[1] == -2147483647);
88  vint = ps.getParameter<std::vector<int>>("vint4");
89  assert(vint[0] == 2147483647);
90  assert(vint[1] == -2147483647);
91  assert(vint[2] == 0);
92 
93  assert(ps.getParameter<unsigned>("uint1") == 4294967295U);
94  assert(ps.getUntrackedParameter<unsigned>("uint2") == 0);
95 
96  std::vector<unsigned> vuint;
97  vuint = ps.getParameter<std::vector<unsigned>>("vuint1");
98  assert(vuint.empty());
99  vuint = ps.getParameter<std::vector<unsigned>>("vuint2");
100  assert(vuint[0] == 4294967295U);
101  vuint = ps.getParameter<std::vector<unsigned>>("vuint3");
102  assert(vuint[0] == 4294967295U);
103  assert(vuint[1] == 0);
104  vuint = ps.getParameter<std::vector<unsigned>>("vuint4");
105  assert(vuint[0] == 4294967295U);
106  assert(vuint[1] == 0);
107  assert(vuint[2] == 11);
108 
109  assert(ps.getParameter<long long>("int64v1") == 9000000000000000000LL);
110  assert(ps.getParameter<long long>("int64v2") == -9000000000000000000LL);
111  assert(ps.getParameter<long long>("int64v3") == 0);
112 
113  std::vector<long long> vint64;
114  vint64 = ps.getParameter<std::vector<long long>>("vint64v1");
115  assert(vint64.empty());
116  vint64 = ps.getParameter<std::vector<long long>>("vint64v2");
117  assert(vint64[0] == 9000000000000000000LL);
118  vint64 = ps.getParameter<std::vector<long long>>("vint64v3");
119  assert(vint64[0] == 9000000000000000000LL);
120  assert(vint64[1] == -9000000000000000000LL);
121  vint64 = ps.getParameter<std::vector<long long>>("vint64v4");
122  assert(vint64[0] == 9000000000000000000LL);
123  assert(vint64[1] == -9000000000000000000LL);
124  assert(vint64[2] == 0);
125 
126  assert(ps.getParameter<unsigned long long>("uint64v1") == 18000000000000000000ULL);
127  assert(ps.getUntrackedParameter<unsigned long long>("uint64v2") == 0);
128 
129  std::vector<unsigned long long> vuint64;
130  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v1");
131  assert(vuint64.empty());
132  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v2");
133  assert(vuint64[0] == 18000000000000000000ULL);
134  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v3");
135  assert(vuint64[0] == 18000000000000000000ULL);
136  assert(vuint64[1] == 0);
137  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v4");
138  assert(vuint64[0] == 18000000000000000000ULL);
139  assert(vuint64[1] == 0);
140  assert(vuint64[2] == 11);
141 
142  // This one does not work because the precision in the ParameterSet stringified
143  // format is 16 instead of 17.
144  // assert(ps.getParameter<double>("doublev1") == std::numeric_limits<double>::min());
145  assert(ps.getUntrackedParameter<double>("doublev2") == 0.0);
146  assert(fabs(ps.getUntrackedParameter<double>("doublev3") - 0.3) < 0.0000001);
147 
148  std::vector<double> vdouble;
149  vdouble = ps.getParameter<std::vector<double>>("vdoublev1");
150  assert(vdouble.empty());
151  // cmsRun will fail with a value this big
152  // vdouble.push_back(std::numeric_limits<double>::max());
153  // This works though
154  vdouble = ps.getParameter<std::vector<double>>("vdoublev2");
155  assert(vdouble[0] == 1e+300);
156  vdouble = ps.getParameter<std::vector<double>>("vdoublev3");
157  assert(vdouble[0] == 1e+300);
158  assert(vdouble[1] == 0.0);
159  vdouble = ps.getParameter<std::vector<double>>("vdoublev4");
160  assert(vdouble[0] == 1e+300);
161  assert(vdouble[1] == 0.0);
162  assert(vdouble[2] == 11.0);
163  vdouble = ps.getParameter<std::vector<double>>("vdoublev5");
164  assert(vdouble[0] == 1e+300);
165  assert(vdouble[1] == 0.0);
166  assert(vdouble[2] == 11.0);
167  assert(fabs(vdouble[3] - 0.3) < 0.0000001);
168 
169  assert(ps.getParameter<bool>("boolv1") == true);
170  assert(ps.getParameter<bool>("boolv2") == false);
171 
172  std::string test("Hello");
173  assert(ps.getParameter<std::string>("stringv1") == test);
174  test.clear();
175  assert(ps.getParameter<std::string>("stringv2") == test);
176 
177  std::vector<std::string> vstring;
178  vstring = ps.getParameter<std::vector<std::string>>("vstringv1");
179  assert(vstring.empty());
180  vstring = ps.getParameter<std::vector<std::string>>("vstringv2");
181  assert(vstring[0] == std::string("Hello"));
182  vstring = ps.getParameter<std::vector<std::string>>("vstringv3");
183  assert(vstring[0] == std::string("Hello"));
184  assert(vstring[1] == std::string("World"));
185  vstring = ps.getParameter<std::vector<std::string>>("vstringv4");
186  assert(vstring[0] == std::string("Hello"));
187  assert(vstring[1] == std::string("World"));
188  assert(vstring[2] == std::string(""));
189 
190  edm::EventID eventID1(11, 0, 12);
191  assert(ps.getParameter<edm::EventID>("eventIDv1") == eventID1);
192  edm::EventID eventID2(101, 0, 102);
193  assert(ps.getParameter<edm::EventID>("eventIDv2") == eventID2);
194 
195  std::vector<edm::EventID> vEventID;
196  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv1");
197  assert(vEventID.empty());
198  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv2");
199  assert(vEventID[0] == edm::EventID(1000, 0, 1100));
200  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv3");
201  assert(vEventID[0] == edm::EventID(1000, 0, 1100));
202  assert(vEventID[1] == edm::EventID(10000, 0, 11000));
203  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv4");
204  assert(vEventID[0] == edm::EventID(1000, 0, 1100));
205  assert(vEventID[1] == edm::EventID(10000, 0, 11000));
206  assert(vEventID[2] == edm::EventID(100000, 0, 110000));
207 
208  edm::LuminosityBlockID luminosityID1(11, 12);
209  assert(ps.getParameter<edm::LuminosityBlockID>("luminosityIDv1") == luminosityID1);
210  edm::LuminosityBlockID luminosityID2(101, 102);
211  assert(ps.getParameter<edm::LuminosityBlockID>("luminosityIDv2") == luminosityID2);
212 
213  std::vector<edm::LuminosityBlockID> vLuminosityBlockID;
214  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv1");
215  assert(vLuminosityBlockID.empty());
216  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv2");
217  assert(vLuminosityBlockID[0] == edm::LuminosityBlockID(1000, 1100));
218  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv3");
219  assert(vLuminosityBlockID[0] == edm::LuminosityBlockID(1000, 1100));
220  assert(vLuminosityBlockID[1] == edm::LuminosityBlockID(10000, 11000));
221  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv4");
222  assert(vLuminosityBlockID[0] == edm::LuminosityBlockID(1000, 1100));
223  assert(vLuminosityBlockID[1] == edm::LuminosityBlockID(10000, 11000));
224  assert(vLuminosityBlockID[2] == edm::LuminosityBlockID(100000, 110000));
225 
226  edm::LuminosityBlockRange lumiRange1(1, 1, 9, 9);
227  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev1").startLumiID() == lumiRange1.startLumiID());
228  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev1").endLumiID() == lumiRange1.endLumiID());
229  edm::LuminosityBlockRange lumiRange2(3, 4, 1000, 1000);
230  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev2").startLumiID() == lumiRange2.startLumiID());
231  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev2").endLumiID() == lumiRange2.endLumiID());
232 
233  std::vector<edm::LuminosityBlockRange> vLumiRange;
234  vLumiRange = ps.getParameter<std::vector<edm::LuminosityBlockRange>>("vLumiRangev1");
235  assert(vLumiRange.empty());
236  vLumiRange = ps.getParameter<std::vector<edm::LuminosityBlockRange>>("vLumiRangev2");
237  assert(vLumiRange[0].startLumiID() == lumiRange1.startLumiID());
238  vLumiRange = ps.getParameter<std::vector<edm::LuminosityBlockRange>>("vLumiRangev3");
239  assert(vLumiRange[0].startLumiID() == lumiRange1.startLumiID());
240  assert(vLumiRange[1].startLumiID() == lumiRange2.startLumiID());
241  assert(vLumiRange[1].endLumiID() == lumiRange2.endLumiID());
242 
243  edm::EventRange eventRange1(1, 0, 1, 8, 0, 8);
244  assert(ps.getParameter<edm::EventRange>("eventRangev1").startEventID() == eventRange1.startEventID());
245  assert(ps.getParameter<edm::EventRange>("eventRangev1").endEventID() == eventRange1.endEventID());
246  edm::EventRange eventRange2(3, 0, 4, 1001, 0, 1002);
247  assert(ps.getParameter<edm::EventRange>("eventRangev2").startEventID() == eventRange2.startEventID());
248  assert(ps.getParameter<edm::EventRange>("eventRangev2").endEventID() == eventRange2.endEventID());
249 
250  std::vector<edm::EventRange> vEventRange;
251  vEventRange = ps.getParameter<std::vector<edm::EventRange>>("vEventRangev1");
252  assert(vEventRange.empty());
253  vEventRange = ps.getParameter<std::vector<edm::EventRange>>("vEventRangev2");
254  assert(vEventRange[0].startEventID() == eventRange1.startEventID());
255  vEventRange = ps.getParameter<std::vector<edm::EventRange>>("vEventRangev3");
256  assert(vEventRange[0].startEventID() == eventRange1.startEventID());
257  assert(vEventRange[1].startEventID() == eventRange2.startEventID());
258 
259  edm::InputTag inputTag1("One", "Two", "Three");
260  assert(ps.getParameter<edm::InputTag>("inputTagv1") == inputTag1);
261  edm::InputTag inputTag2("One", "Two");
262  assert(ps.getParameter<edm::InputTag>("inputTagv2") == inputTag2);
263  edm::InputTag inputTag3("One");
264  assert(ps.getParameter<edm::InputTag>("inputTagv3") == inputTag3);
265  edm::InputTag inputTag4("One", "", "Three");
266  assert(ps.getParameter<edm::InputTag>("inputTagv4") == inputTag4);
267 
268  std::vector<edm::InputTag> vInputTag;
269  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv1");
270  assert(vInputTag.empty());
271  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv2");
272  assert(vInputTag[0] == inputTag1);
273  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv3");
274  assert(vInputTag[0] == inputTag1);
275  assert(vInputTag[1] == inputTag2);
276  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv4");
277  assert(vInputTag[0] == inputTag1);
278  assert(vInputTag[1] == inputTag2);
279  assert(vInputTag[2] == inputTag3);
280  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv5");
281  assert(vInputTag[0] == inputTag1);
282  assert(vInputTag[1] == inputTag2);
283  assert(vInputTag[2] == inputTag3);
284  assert(vInputTag[3] == inputTag4);
285 
286  edm::ESInputTag esinputTag1("One", "Two");
287  assert(ps.getParameter<edm::ESInputTag>("esinputTagv1") == esinputTag1);
288  edm::ESInputTag esinputTag2("One", "");
289  assert(ps.getParameter<edm::ESInputTag>("esinputTagv2") == esinputTag2);
290  edm::ESInputTag esinputTag3("", "Two");
291  assert(ps.getParameter<edm::ESInputTag>("esinputTagv3") == esinputTag3);
292 
293  std::vector<edm::ESInputTag> vESInputTag;
294  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv1");
295  assert(vESInputTag.empty());
296  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv2");
297  assert(vESInputTag[0] == esinputTag1);
298  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv3");
299  assert(vESInputTag[0] == esinputTag1);
300  assert(vESInputTag[1] == esinputTag2);
301  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv4");
302  assert(vESInputTag[0] == esinputTag1);
303  assert(vESInputTag[1] == esinputTag2);
304  assert(vESInputTag[2] == esinputTag3);
305 
306  // For purposes of the test, this just needs to point to any file
307  // that exists.
308  edm::FileInPath fileInPath("FWCore/Integration/plugins/ProducerWithPSetDesc.cc");
309  assert(fileInPath == ps.getParameter<edm::FileInPath>("fileInPath"));
310 
311  edm::ParameterSet const& pset = ps.getParameterSet("bar");
312  assert(pset.getParameter<unsigned>("Drinks") == 5U);
313  assert(pset.getUntrackedParameter<unsigned>("uDrinks") == 5U);
315  assert(pset.getParameter<unsigned>("oDrinks") == 5U);
317  assert(pset.getUntrackedParameter<unsigned>("ouDrinks") == 5U);
318 
319  //std::vector<edm::ParameterSet> const& vpsetUntracked =
320  // ps.getUntrackedParameterSetVector("test104");
321 
322  std::vector<edm::ParameterSet> const& vpset = ps.getParameterSetVector("bars");
323 
324  assert(vpset.size() == 2U);
325 
326  edm::ParameterSet pset0 = vpset[0];
327  assert(pset0.getParameter<unsigned>("Drinks") == 5U);
328  assert(pset0.getUntrackedParameter<unsigned>("uDrinks") == 5U);
329  assert(pset0.getParameter<unsigned>("oDrinks") == 11U);
330  assert(pset0.exists("ouDrinks") == false);
331  assert(pset0.exists("ndoDrinks") == false);
332  assert(pset0.exists("ndouDrinks") == false);
333  // assert(pset0.getUntrackedParameter<unsigned>("ndouDrinks") == 5);
334 
335  edm::ParameterSet pset1 = vpset[1];
336  assert(pset1.getParameter<unsigned>("Drinks") == 5U);
337  assert(pset1.getUntrackedParameter<unsigned>("uDrinks") == 5U);
338  assert(pset1.getParameter<unsigned>("oDrinks") == 11U);
339  assert(pset1.getUntrackedParameter<unsigned>("ouDrinks") == 11U);
340  assert(pset1.exists("ndoDrinks") == false);
341  assert(pset1.getUntrackedParameter<unsigned>("ndouDrinks") == 11U);
342 
343  assert(ps.getParameter<double>("test1") == 0.1);
345  assert(ps.getParameter<double>("test2") == 0.2);
346  assert(ps.exists("test3") == false);
347 
348  assert(ps.getParameter<std::string>("testA") == std::string("fooA"));
349  assert(ps.getParameter<int>("testB") == 100);
350  assert(ps.getParameter<int>("testC") == 101);
351 
352  assert(ps.getParameter<int>("oiswitch") == 1);
353  assert(ps.getParameter<double>("oivalue1") == 101.0);
354  assert(ps.getParameter<double>("oivalue2") == 101.0);
355  } else {
356  assert(!ps.exists("test2"));
357  assert(!ps.exists("test3"));
358 
359  assert(!ps.exists("testA"));
360  assert(!ps.exists("testB"));
361  assert(!ps.exists("testC"));
362 
363  assert(!ps.exists("oiswitch"));
364  assert(!ps.exists("oivalue1"));
365  assert(!ps.exists("oivalue2"));
366  }
367 
368  edm::ParameterSet const& deeplyNestedPSet = pset1.getParameterSet("testDeeplyNested");
370  assert(!deeplyNestedPSet.exists("ndiswitch"));
371  assert(!deeplyNestedPSet.exists("ndivalue1"));
372  assert(!deeplyNestedPSet.exists("ndivalue2"));
373  } else {
374  assert(!deeplyNestedPSet.exists("ndiswitch"));
375  assert(!deeplyNestedPSet.exists("ndivalue1"));
376  assert(!deeplyNestedPSet.exists("ndivalue2"));
377  }
378 
379  assert(deeplyNestedPSet.getParameter<bool>("bswitch") == false);
380  assert(deeplyNestedPSet.getParameter<double>("bvalue1") == 101.0);
381  assert(deeplyNestedPSet.getParameter<double>("bvalue2") == 101.0);
382  assert(!deeplyNestedPSet.exists("bvalue"));
383 
384  assert(deeplyNestedPSet.getParameter<int>("iswitch") == 1);
385  assert(deeplyNestedPSet.getParameter<double>("ivalue1") == 101.0);
386  assert(deeplyNestedPSet.getUntrackedParameter<double>("ivalue2") == 101.0);
387  assert(!deeplyNestedPSet.exists("ivalue"));
388 
389  assert(deeplyNestedPSet.getParameter<std::string>("sswitch") == std::string("1"));
390  assert(deeplyNestedPSet.getParameter<double>("svalue1") == 101.0);
391  assert(deeplyNestedPSet.getParameter<double>("svalue2") == 101.0);
392  assert(!deeplyNestedPSet.exists("svalue"));
393 
395  edm::ParameterSet const& pset11 = ps.getParameterSet("subpset");
396  assert(pset11.getParameter<int>("xvalue") == 11);
397  edm::ParameterSet const& pset111 = pset11.getUntrackedParameterSet("bar");
398  assert(pset111.getParameter<unsigned>("Drinks") == 5U);
399  assert(pset111.getUntrackedParameter<unsigned>("uDrinks") == 5U);
400  assert(pset111.getParameter<unsigned>("oDrinks") == 5U);
401  assert(pset111.getUntrackedParameter<unsigned>("ouDrinks") == 5U);
402  }
403 
404  edm::ParameterSet const& psetXor = ps.getParameterSet("xorPset");
405  assert(psetXor.getParameter<std::string>("name1") == std::string("11"));
406  assert(!psetXor.exists("name2"));
408  assert(psetXor.getParameter<std::string>("name") == std::string("11"));
409  } else {
410  assert(psetXor.getParameter<unsigned>("name") == 11U);
411  }
412 
413  edm::ParameterSet const& psetOr = ps.getParameterSet("orPset");
414  assert(!psetOr.exists("z1"));
415  assert(!psetOr.exists("z2"));
417  assert(psetOr.getParameter<std::string>("x1") == std::string("11"));
418  assert(!psetOr.exists("x2"));
419  assert(psetOr.getParameter<std::string>("y1") == std::string("11"));
420  assert(!psetOr.exists("y2"));
421  } else {
422  assert(!psetOr.exists("x1"));
423  assert(psetOr.getParameter<unsigned>("x2") == 11U);
424  assert(psetOr.getParameter<std::string>("y1") == std::string("11"));
425  assert(psetOr.getParameter<unsigned>("y2") == 11U);
426  }
427 
428  edm::ParameterSet const& psetAnd = ps.getParameterSet("andPset");
429  assert(psetAnd.getParameter<std::string>("x1") == std::string("11"));
430  assert(psetAnd.getParameter<unsigned>("x2") == 11U);
431  assert(psetAnd.getParameter<std::string>("y1") == std::string("11"));
432  assert(psetAnd.getParameter<unsigned>("y2") == 11U);
433  assert(psetAnd.getParameter<std::string>("z1") == std::string("11"));
434  assert(psetAnd.getParameter<unsigned>("z2") == 11U);
435  assert(psetAnd.getParameter<std::string>("b1") == std::string("11"));
436  assert(psetAnd.getParameter<unsigned>("b2") == 11U);
437  assert(psetAnd.getParameter<unsigned>("b3") == 11U);
438  assert(psetAnd.getParameter<unsigned>("b4") == 11U);
439  assert(psetAnd.getParameter<unsigned>("b5") == 11U);
440  assert(psetAnd.getParameter<unsigned>("b6") == 11U);
442  assert(!psetAnd.exists("a1"));
443  assert(!psetAnd.exists("a2"));
444  } else {
445  assert(psetAnd.getParameter<std::string>("a1") == std::string("11"));
446  assert(psetAnd.getParameter<unsigned>("a2") == 11U);
447  }
448 
449  edm::ParameterSet const& psetIfExists = ps.getParameterSet("ifExistsPset");
450  assert(psetIfExists.getParameter<unsigned>("x1") == 11U);
451  assert(psetIfExists.getParameter<std::string>("x2") == std::string("11"));
452  assert(psetIfExists.getParameter<unsigned>("z1") == 11U);
453  assert(psetIfExists.getParameter<std::string>("z2") == std::string("11"));
455  assert(!psetIfExists.exists("y1"));
456  assert(!psetIfExists.exists("y2"));
457  } else {
458  assert(psetIfExists.getParameter<unsigned>("y1") == 11U);
459  assert(!psetIfExists.exists("y2"));
460  }
461 
462  edm::ParameterSet const& psetAllowed = ps.getParameterSet("allowedLabelsPset");
464  assert(psetAllowed.getParameter<std::vector<std::string>>("testAllowedLabels").empty());
465  assert(psetAllowed.getUntrackedParameter<std::vector<std::string>>("testAllowedLabelsUntracked").empty());
466  assert(!psetAllowed.exists("testOptAllowedLabels"));
467  assert(!psetAllowed.exists("testOptAllowedLabelsUntracked"));
468  }
469 
470  produces<ThingCollection>();
471  }
472 
474  // This serves no purpose, I just put it here so the module does something
475  // Probably could just make this method do nothing and it would not
476  // affect the test.
477  auto result = std::make_unique<ThingCollection>(); //Empty
478  e.put(std::move(result));
479  }
480 
483 
484  // Try to exercise the description code by adding all different
485  // types of parameters with a large range of values. Also
486  // nested ParameterSets and vectors of them at the end.
487 
488  iDesc.addOptionalUntracked<bool>("testingAutoGeneratedCfi", true);
489 
491  pn = iDesc.add<int>("p_int", 2147483647);
492  pn->setComment(
493  "A big integer. I am trying to test the wrapping of comments in"
494  " the printed output by putting in a long comment to see if it gets"
495  " wrapped OK. The comment should get indented to the second column"
496  " indent on every line. By default newlines should be inserted between"
497  " words to make the lines fit in the terminal screen width. There is "
498  "a command line parameter that can be set to override this width to "
499  "any desired value. If there is no terminal then it should default to "
500  "80. The logic for setting the width is in edmPluginHelp.cpp");
501 
502  iDesc.addUntracked<int>("p_int_untracked", -2147483647);
503  iDesc.addOptional<int>("p_int_opt", 0);
504  iDesc.addOptionalUntracked<int>("p_int_optuntracked", 7);
505  iDesc.addOptional<int>("p_int_opt_nd");
506  iDesc.addOptionalUntracked<int>("p_int_optuntracked_nd");
507 
508  std::vector<int> vint;
509  iDesc.add<std::vector<int>>("vint1", vint);
510  vint.push_back(2147483647);
511  iDesc.add<std::vector<int>>(std::string("vint2"), vint);
512  vint.push_back(-2147483647);
513  iDesc.add<std::vector<int>>("vint3", vint);
514  vint.push_back(0);
515  iDesc.add<std::vector<int>>("vint4", vint);
516 
517  iDesc.add<unsigned>("uint1", 4294967295U);
518  iDesc.addUntracked<unsigned>("uint2", 0);
519 
520  std::vector<unsigned> vuint;
521  iDesc.add<std::vector<unsigned>>("vuint1", vuint);
522  vuint.push_back(4294967295U);
523  iDesc.add<std::vector<unsigned>>("vuint2", vuint);
524  vuint.push_back(0);
525  iDesc.add<std::vector<unsigned>>("vuint3", vuint);
526  vuint.push_back(11);
527  iDesc.add<std::vector<unsigned>>("vuint4", vuint);
528  vuint.push_back(21);
529  vuint.push_back(31);
530  vuint.push_back(41);
531  iDesc.add<std::vector<unsigned>>("vuint5", vuint);
532 
533  iDesc.add<long long>("int64v1", 9000000000000000000LL);
534  iDesc.add<long long>("int64v2", -9000000000000000000LL);
535  iDesc.add<long long>("int64v3", 0);
536 
537  std::vector<long long> vint64;
538  iDesc.add<std::vector<long long>>("vint64v1", vint64);
539  vint64.push_back(9000000000000000000LL);
540  iDesc.add<std::vector<long long>>("vint64v2", vint64);
541  vint64.push_back(-9000000000000000000LL);
542  iDesc.add<std::vector<long long>>("vint64v3", vint64);
543  vint64.push_back(0);
544  iDesc.add<std::vector<long long>>("vint64v4", vint64);
545 
546  iDesc.add<unsigned long long>("uint64v1", 18000000000000000000ULL);
547  iDesc.addUntracked<unsigned long long>("uint64v2", 0);
548 
549  std::vector<unsigned long long> vuint64;
550  iDesc.add<std::vector<unsigned long long>>("vuint64v1", vuint64);
551  vuint64.push_back(18000000000000000000ULL);
552  iDesc.add<std::vector<unsigned long long>>("vuint64v2", vuint64);
553  vuint64.push_back(0);
554  iDesc.add<std::vector<unsigned long long>>("vuint64v3", vuint64);
555  vuint64.push_back(11);
556  iDesc.add<std::vector<unsigned long long>>("vuint64v4", vuint64);
557 
558  iDesc.add<double>("doublev1", std::numeric_limits<double>::min());
559  iDesc.addUntracked<double>("doublev2", 0.0);
560  iDesc.addUntracked<double>("doublev3", 0.3);
561 
562  std::vector<double> vdouble;
563  iDesc.add<std::vector<double>>("vdoublev1", vdouble);
564  // cmsRun will fail with a value this big
565  // vdouble.push_back(std::numeric_limits<double>::max());
566  // This works though
567  vdouble.push_back(1e+300);
568  iDesc.add<std::vector<double>>("vdoublev2", vdouble);
569  vdouble.push_back(0.0);
570  iDesc.add<std::vector<double>>("vdoublev3", vdouble);
571  vdouble.push_back(11.0);
572  iDesc.add<std::vector<double>>("vdoublev4", vdouble);
573  vdouble.push_back(0.3);
574  iDesc.add<std::vector<double>>("vdoublev5", vdouble);
575 
576  iDesc.add<bool>("boolv1", true);
577  iDesc.add<bool>("boolv2", false);
578 
579  std::string test("Hello");
580  iDesc.add<std::string>("stringv1", test);
581  test.clear();
582  iDesc.add<std::string>("stringv2", test);
583 
584  std::vector<std::string> vstring;
585  iDesc.add<std::vector<std::string>>("vstringv1", vstring);
586  test = "Hello";
587  vstring.push_back(test);
588  iDesc.add<std::vector<std::string>>("vstringv2", vstring);
589  test = "World";
590  vstring.push_back(test);
591  iDesc.add<std::vector<std::string>>("vstringv3", vstring);
592  test = "";
593  vstring.push_back(test);
594  iDesc.add<std::vector<std::string>>("vstringv4", vstring);
595 
596  edm::EventID eventID(11, 0, 12);
597  iDesc.add<edm::EventID>("eventIDv1", eventID);
598  edm::EventID eventID2(101, 0, 102);
599  iDesc.add<edm::EventID>("eventIDv2", eventID2);
600  std::vector<edm::EventID> vEventID;
601  iDesc.add<std::vector<edm::EventID>>("vEventIDv1", vEventID);
602  edm::EventID eventID3(1000, 0, 1100);
603  vEventID.push_back(eventID3);
604  iDesc.add<std::vector<edm::EventID>>("vEventIDv2", vEventID);
605  edm::EventID eventID4(10000, 0, 11000);
606  vEventID.push_back(eventID4);
607  iDesc.add<std::vector<edm::EventID>>("vEventIDv3", vEventID);
608  edm::EventID eventID5(100000, 0, 110000);
609  vEventID.push_back(eventID5);
610  iDesc.add<std::vector<edm::EventID>>("vEventIDv4", vEventID);
611 
612  edm::LuminosityBlockID luminosityID(11, 12);
613  iDesc.add<edm::LuminosityBlockID>("luminosityIDv1", luminosityID);
614  edm::LuminosityBlockID luminosityID2(101, 102);
615  iDesc.add<edm::LuminosityBlockID>("luminosityIDv2", luminosityID2);
616 
617  std::vector<edm::LuminosityBlockID> vLuminosityBlockID;
618  iDesc.add<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv1", vLuminosityBlockID);
619  edm::LuminosityBlockID luminosityID3(1000, 1100);
620  vLuminosityBlockID.push_back(luminosityID3);
621  iDesc.add<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv2", vLuminosityBlockID);
622  edm::LuminosityBlockID luminosityID4(10000, 11000);
623  vLuminosityBlockID.push_back(luminosityID4);
624  iDesc.add<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv3", vLuminosityBlockID);
625  edm::LuminosityBlockID luminosityID5(100000, 110000);
626  vLuminosityBlockID.push_back(luminosityID5);
627  iDesc.add<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv4", vLuminosityBlockID);
628 
630  iDesc.add<edm::LuminosityBlockRange>("lumiRangev1", lumiRange);
631  edm::LuminosityBlockRange lumiRange2(3, 4, 1000, 1000);
632  iDesc.add<edm::LuminosityBlockRange>("lumiRangev2", lumiRange2);
633 
634  std::vector<edm::LuminosityBlockRange> vLumiRange;
635  iDesc.add<std::vector<edm::LuminosityBlockRange>>("vLumiRangev1", vLumiRange);
636  vLumiRange.push_back(lumiRange);
637  iDesc.add<std::vector<edm::LuminosityBlockRange>>("vLumiRangev2", vLumiRange);
638  vLumiRange.push_back(lumiRange2);
639  iDesc.add<std::vector<edm::LuminosityBlockRange>>("vLumiRangev3", vLumiRange);
640 
641  edm::EventRange eventRange(1, 0, 1, 8, 0, 8);
642  iDesc.add<edm::EventRange>("eventRangev1", eventRange);
643  edm::EventRange eventRange2(3, 0, 4, 1001, 0, 1002);
644  iDesc.add<edm::EventRange>("eventRangev2", eventRange2);
645 
646  std::vector<edm::EventRange> vEventRange;
647  iDesc.add<std::vector<edm::EventRange>>("vEventRangev1", vEventRange);
648  vEventRange.push_back(eventRange);
649  iDesc.add<std::vector<edm::EventRange>>("vEventRangev2", vEventRange);
650  vEventRange.push_back(eventRange2);
651  iDesc.add<std::vector<edm::EventRange>>("vEventRangev3", vEventRange);
652 
653  edm::InputTag inputTag("One", "Two", "Three");
654  iDesc.add<edm::InputTag>("inputTagv1", inputTag);
655  edm::InputTag inputTag2("One", "Two");
656  iDesc.add<edm::InputTag>("inputTagv2", inputTag2);
657  edm::InputTag inputTag3("One");
658  iDesc.add<edm::InputTag>("inputTagv3", inputTag3);
659  edm::InputTag inputTag4("One", "", "Three");
660  iDesc.add<edm::InputTag>("inputTagv4", inputTag4);
661 
662  std::vector<edm::InputTag> vInputTag;
663  iDesc.add<std::vector<edm::InputTag>>("vInputTagv1", vInputTag);
664  vInputTag.push_back(inputTag);
665  iDesc.add<std::vector<edm::InputTag>>("vInputTagv2", vInputTag);
666  vInputTag.push_back(inputTag2);
667  iDesc.add<std::vector<edm::InputTag>>("vInputTagv3", vInputTag);
668  vInputTag.push_back(inputTag3);
669  iDesc.add<std::vector<edm::InputTag>>("vInputTagv4", vInputTag);
670  vInputTag.push_back(inputTag4);
671  iDesc.add<std::vector<edm::InputTag>>("vInputTagv5", vInputTag);
672 
673  edm::ESInputTag esinputTag("One", "Two");
674  iDesc.add<edm::ESInputTag>("esinputTagv1", esinputTag);
675  edm::ESInputTag esinputTag2("One", "");
676  iDesc.add<edm::ESInputTag>("esinputTagv2", esinputTag2);
677  edm::ESInputTag esinputTag3("", "Two");
678  iDesc.add<edm::ESInputTag>("esinputTagv3", esinputTag3);
679 
680  std::vector<edm::ESInputTag> vESInputTag;
681  iDesc.add<std::vector<edm::ESInputTag>>("vESInputTagv1", vESInputTag);
682  vESInputTag.push_back(esinputTag);
683  iDesc.add<std::vector<edm::ESInputTag>>("vESInputTagv2", vESInputTag);
684  vESInputTag.push_back(esinputTag2);
685  iDesc.add<std::vector<edm::ESInputTag>>("vESInputTagv3", vESInputTag);
686  vESInputTag.push_back(esinputTag3);
687  iDesc.add<std::vector<edm::ESInputTag>>("vESInputTagv4", vESInputTag);
688 
689  // For purposes of the test, this just needs to point to any file
690  // that exists.
691  edm::FileInPath fileInPath("FWCore/Integration/plugins/ProducerWithPSetDesc.cc");
692  iDesc.add<edm::FileInPath>("fileInPath", fileInPath);
693 
694  edm::EmptyGroupDescription emptyGroup;
695  iDesc.addNode(emptyGroup);
696 
698  bar.add<unsigned int>("Drinks", 5);
699  bar.addUntracked<unsigned int>("uDrinks", 5);
700  bar.addOptional<unsigned int>("oDrinks", 5);
701  bar.addOptionalUntracked<unsigned int>("ouDrinks", 5);
702  iDesc.add("bar", bar);
703 
704  edm::ParameterDescription<edm::ParameterSetDescription> test101("test101", bar, true);
705  iDesc.addOptionalNode(test101, false);
706 
708  barx.add<unsigned int>("Drinks", 5);
709  barx.addUntracked<unsigned int>("uDrinks", 5);
710  barx.addOptional<unsigned int>("oDrinks", 5);
711  barx.addOptionalUntracked<unsigned int>("ouDrinks", 5);
712  barx.addOptional<unsigned int>("ndoDrinks");
713  barx.addOptionalUntracked<unsigned int>("ndouDrinks");
714 
716  iDesc.addOptionalNode(test102, false);
717 
719  iDesc.addOptionalNode(test103, false);
720 
721  std::vector<edm::ParameterSet> defaultVPSet104;
722  defaultVPSet104.push_back(edm::ParameterSet());
724  std::string("test104"), barx, false, defaultVPSet104);
725  iDesc.addNode(test104);
726 
727  std::vector<edm::ParameterSet> defaultVPSet105;
729  std::string("test105"), barx, false, defaultVPSet105);
730  iDesc.addNode(test105);
731 
732  double d1 = 0.1;
733  double d2 = 0.2;
734  double d3 = 0.3;
735  iDesc.addNode(edm::ParameterDescription<double>("test1", d1, true));
736  iDesc.addOptionalNode(edm::ParameterDescription<double>("test2", d2, true), true);
737  // The value in the second argument is not used in this case
738  iDesc.addOptionalNode(edm::ParameterDescription<double>("test3", d3, true), false);
739 
740  iDesc.addOptionalNode(edm::ParameterDescription<std::string>("testA", "fooA", true) and
741  edm::ParameterDescription<int>("testB", 100, true) &&
742  edm::ParameterDescription<int>("testC", 101, true),
743  true);
744 
745  iDesc.ifValueOptional(edm::ParameterDescription<int>("oiswitch", 1, true),
746  0 >> edm::ParameterDescription<int>("oivalue", 100, true) or
747  1 >> (edm::ParameterDescription<double>("oivalue1", 101.0, true) and
748  edm::ParameterDescription<double>("oivalue2", 101.0, true)) or
749  2 >> edm::ParameterDescription<std::string>("oivalue", "102", true),
750  true);
751 
752  edm::ParameterSetDescription deeplyNested;
753 
754  bool case0 = true;
755  bool case1 = false;
756  deeplyNested.ifValue(edm::ParameterDescription<bool>("bswitch", false, true),
757  case0 >> edm::ParameterDescription<int>("bvalue", 100, true) or
758  case1 >> (edm::ParameterDescription<double>("bvalue1", 101.0, true) and
759  edm::ParameterDescription<double>("bvalue2", 101.0, true)));
760  deeplyNested.ifValue(edm::ParameterDescription<int>("iswitch", 1, true),
761  0 >> edm::ParameterDescription<int>("ivalue", 100, true) or
762  1 >> (edm::ParameterDescription<double>("ivalue1", 101.0, true) and
763  edm::ParameterDescription<double>("ivalue2", 101.0, false)) or
764  2 >> edm::ParameterDescription<std::string>("ivalue", "102", true));
765  deeplyNested.ifValue(edm::ParameterDescription<std::string>("sswitch", std::string("1"), true),
766  std::string("0") >> edm::ParameterDescription<int>("svalue", 100, true) or
767  "1" >> (edm::ParameterDescription<double>("svalue1", 101.0, true) and
768  edm::ParameterDescription<double>("svalue2", 101.0, true)) or
769  "2" >> edm::ParameterDescription<std::string>("svalue", "102", true));
770 
771  deeplyNested.ifValueOptional(edm::ParameterDescription<int>("ndiswitch", 1, true),
772  0 >> edm::ParameterDescription<int>("ndivalue", 100, true) or
773  1 >> (edm::ParameterDescription<double>("ndivalue1", 101.0, true) and
774  edm::ParameterDescription<double>("ndivalue2", 101.0, true)) or
775  2 >> edm::ParameterDescription<std::string>("ndivalue", "102", true),
776  false);
777 
778  deeplyNested.add<int>("testint", 1000);
779 
780  barx.add("testDeeplyNested", deeplyNested);
781 
782  iDesc.add("testDeeplyNested2", deeplyNested);
783 
785  validator.add<int>("xvalue", 7);
786  std::vector<edm::ParameterSet> vDefaults;
787  edm::ParameterSet vDefaults0;
788  vDefaults.push_back(vDefaults0);
789  edm::ParameterSet vDefaults1;
790  vDefaults1.addParameter<int>("xvalue", 100);
791  vDefaults.push_back(vDefaults1);
792  barx.addVPSet("anotherVPSet", validator, vDefaults);
793 
794  std::vector<edm::ParameterSet> defaultVPSet;
795 
796  edm::ParameterSet psetInVector1;
797  psetInVector1.addParameter<unsigned int>("oDrinks", 11U);
798  defaultVPSet.push_back(psetInVector1);
799 
800  edm::ParameterSet psetInVector2;
801  psetInVector2.addParameter<unsigned int>("oDrinks", 11U);
802  psetInVector2.addUntrackedParameter<unsigned int>("ouDrinks", 11U);
803  psetInVector2.addUntrackedParameter<unsigned int>("ndouDrinks", 11U);
804 
805  std::vector<edm::ParameterSet> anotherDefaultVPSet;
806  anotherDefaultVPSet.push_back(edm::ParameterSet());
807  edm::ParameterSet anotherParameterSet;
808  anotherParameterSet.addParameter<int>("xvalue", 17);
809  anotherDefaultVPSet.push_back(anotherParameterSet);
810  psetInVector2.addParameter<std::vector<edm::ParameterSet>>("anotherVPSet", anotherDefaultVPSet);
811 
812  edm::ParameterSet defaultForDeeplyNested;
813  defaultForDeeplyNested.addParameter<int>("testint", 2);
814  psetInVector2.addParameter<edm::ParameterSet>("testDeeplyNested", defaultForDeeplyNested);
815 
816  defaultVPSet.push_back(psetInVector2);
817 
818  iDesc.addVPSet("bars", barx, defaultVPSet);
819 
820  // Alternate way to add a ParameterSetDescription
821  edm::ParameterDescriptionBase* parDescription;
822  parDescription = iDesc.addOptional("subpset", edm::ParameterSetDescription());
823  edm::ParameterSetDescription* subPsetDescription = parDescription->parameterSetDescription();
824 
825  subPsetDescription->add<int>("xvalue", 11);
826  subPsetDescription->addUntracked<edm::ParameterSetDescription>(std::string("bar"), bar);
827 
828  // -----------------------------------------------
829 
831  wildcardPset.addOptional<unsigned>("p_uint_opt", 0);
832  wildcardPset.addWildcard<int>("*");
833  pn = wildcardPset.addWildcardUntracked<double>(std::string("*"));
834  pn->setComment("A comment for a wildcard parameter");
835 
836  std::unique_ptr<edm::ParameterDescriptionNode> wnode =
837  std::make_unique<edm::ParameterWildcard<edm::ParameterSetDescription>>("*", edm::RequireExactlyOne, true);
838  wildcardPset.addOptionalNode(std::move(wnode), false);
839 
841  wSet1.add<unsigned int>("Drinks", 5);
842 
843  std::unique_ptr<edm::ParameterDescriptionNode> wnode2 =
844  std::make_unique<edm::ParameterWildcard<edm::ParameterSetDescription>>(
845  "*", edm::RequireAtLeastOne, true, wSet1);
846  wildcardPset.addOptionalNode(std::move(wnode2), false);
847 
848  std::unique_ptr<edm::ParameterDescriptionNode> wnode3 =
849  std::make_unique<edm::ParameterWildcard<std::vector<edm::ParameterSet>>>("*", edm::RequireExactlyOne, true);
850  wildcardPset.addOptionalNode(std::move(wnode3), false);
851 
852  wSet1.add<unsigned int>("Drinks2", 11);
853 
854  std::unique_ptr<edm::ParameterDescriptionNode> wnode4 =
855  std::make_unique<edm::ParameterWildcard<std::vector<edm::ParameterSet>>>(
856  "*", edm::RequireAtLeastOne, true, wSet1);
857  wildcardPset.addOptionalNode(std::move(wnode4), false);
858 
859  iDesc.add("wildcardPset", wildcardPset);
860 
861  // ---------------------------------------------
862 
863  std::vector<int> testIntVector;
864  testIntVector.push_back(21);
865  testIntVector.push_back(22);
867  pn = switchPset.ifValue(edm::ParameterDescription<int>("iswitch", 1, true),
868  0 >> edm::ParameterDescription<std::vector<int>>("ivalue", testIntVector, true) or
869  1 >> (edm::ParameterDescription<double>("ivalue1", 101.0, true) and
870  edm::ParameterDescription<double>("ivalue2", 101.0, true)) or
871  2 >> edm::ParameterDescription<std::string>("ivalue", "102", true));
872  pn->setComment("Comment for a ParameterSwitch");
873 
874  switchPset
875  .ifValue(edm::ParameterDescription<bool>("addTeVRefits", true, true),
876  true >> (edm::ParameterDescription<edm::InputTag>("pickySrc", edm::InputTag(), true) and
878  false >> edm::EmptyGroupDescription())
879  ->setComment("If TeV refits are added, their sources need to be specified");
880 
881  iDesc.add("switchPset", switchPset);
882 
883  // -----------------------------------------------
884 
886  xorPset.addNode(edm::ParameterDescription<std::string>("name", "11", true) xor
887  edm::ParameterDescription<unsigned int>("name", 11U, true));
888 
889  xorPset.addNode(edm::ParameterDescription<std::string>("name1", "11", true) xor
890  edm::ParameterDescription<unsigned int>("name1", 11U, true));
891 
892  xorPset.addOptionalNode(edm::ParameterDescription<std::string>("name2", "11", true) xor
893  edm::ParameterDescription<unsigned int>("name2", 11U, true),
894  false);
895 
896  xorPset.addNode(edm::ParameterDescription<std::string>("name3", "11", true) xor
897  edm::ParameterDescription<unsigned int>("name4", 11U, true) xor test101 xor test103);
898 
899  iDesc.add("xorPset", xorPset);
900 
901  // -----------------------------------------
902 
904 
905  orPset.addNode(edm::ParameterDescription<std::string>("x1", "11", true) or
907 
908  orPset.addNode(edm::ParameterDescription<std::string>("y1", "11", true) or
910 
911  orPset.addOptionalNode(edm::ParameterDescription<std::string>("z1", "11", true) or
912  edm::ParameterDescription<unsigned int>("z2", 11U, true) or test101 or test103,
913  false);
914 
915  iDesc.add("orPset", orPset);
916 
917  // ------------------------------------------------
918 
920 
921  andPset.addNode(edm::ParameterDescription<std::string>("x1", "11", true) and
923 
924  andPset.addNode(edm::ParameterDescription<std::string>("y1", "11", true) and
926 
927  andPset.addNode(edm::ParameterDescription<std::string>("z1", "11", true) and
929 
930  andPset.addOptionalNode(edm::ParameterDescription<std::string>("a1", "11", true) and
932  false);
933 
934  andPset.addOptionalNode((edm::ParameterDescription<std::string>("b1", "11", true) and
935  edm::ParameterDescription<unsigned int>("b2", 11U, true)) and
936  edm::ParameterDescription<unsigned int>("b3", 11U, true) and
937  (edm::ParameterDescription<unsigned int>("b4", 11U, true) and
938  (edm::ParameterDescription<unsigned int>("b5", 11U, true) and
940  true);
941 
942  iDesc.add("andPset", andPset);
943 
944  // --------------------------------------
945 
947 
949  edm::ParameterDescription<std::string>("x2", "11", true));
950 
951  ifExistsPset.ifExistsOptional(edm::ParameterDescription<unsigned int>("y1", 11U, true),
952  edm::ParameterDescription<std::string>("y2", "11", true),
953  false);
954 
956  edm::ParameterDescription<std::string>("z2", "11", true));
957 
958  iDesc.add("ifExistsPset", ifExistsPset);
959 
960  // ------------------------------------------
961 
963 
964  allowedLabelsPset.addOptional<int>("p_int_opt", 0);
965  allowedLabelsPset.labelsFrom<int>("testAllowedLabels");
966  allowedLabelsPset.labelsFromUntracked<unsigned>(std::string("testAllowedLabelsUntracked"));
967  allowedLabelsPset.labelsFromOptional<int>("testOptAllowedLabels", false);
968  allowedLabelsPset.labelsFromOptionalUntracked<unsigned>(std::string("testOptAllowedLabelsUntracked"), false);
969  allowedLabelsPset.labelsFromOptionalUntracked<edm::ParameterSetDescription>(std::string("testWithSet"), true, bar);
970 
971  allowedLabelsPset.labelsFromOptionalUntracked<std::vector<edm::ParameterSet>>(
972  std::string("testWithVectorOfSets"), true, bar);
973 
974  iDesc.add("allowedLabelsPset", allowedLabelsPset);
975 
976  edm::ParameterSetDescription noDefaultPset3;
977 
978  noDefaultPset3.addOptional<int>(std::string("noDefault1"));
979  noDefaultPset3.addOptional<std::vector<int>>("noDefault2");
980  noDefaultPset3.addOptional<unsigned>("noDefault3");
981  noDefaultPset3.addOptional<std::vector<unsigned>>("noDefault4");
982  noDefaultPset3.addOptional<long long>("noDefault5");
983  noDefaultPset3.addOptional<std::vector<long long>>("noDefault6");
984  noDefaultPset3.addOptional<unsigned long long>("noDefault7");
985  noDefaultPset3.addOptional<std::vector<unsigned long long>>("noDefault8");
986  noDefaultPset3.addOptional<double>("noDefault9");
987  noDefaultPset3.addOptional<std::vector<double>>("noDefault10");
988  noDefaultPset3.addOptional<bool>("noDefault11");
989  noDefaultPset3.addOptional<std::string>("noDefault12");
990  noDefaultPset3.addOptional<std::vector<std::string>>("noDefault13");
991  noDefaultPset3.addOptional<edm::EventID>("noDefault14");
992  noDefaultPset3.addOptional<std::vector<edm::EventID>>("noDefault15");
993  noDefaultPset3.addOptional<edm::LuminosityBlockID>("noDefault16");
994  noDefaultPset3.addOptional<std::vector<edm::LuminosityBlockID>>("noDefault17");
995  noDefaultPset3.addOptional<edm::InputTag>("noDefault18");
996  noDefaultPset3.addOptional<std::vector<edm::InputTag>>("noDefault19");
997  noDefaultPset3.addOptional<edm::FileInPath>("noDefault20");
998  noDefaultPset3.addOptional<edm::LuminosityBlockRange>("noDefault21");
999  noDefaultPset3.addOptional<std::vector<edm::LuminosityBlockRange>>("noDefault22");
1000  noDefaultPset3.addOptional<edm::EventRange>("noDefault23");
1001  noDefaultPset3.addOptional<std::vector<edm::EventRange>>("noDefault24");
1002 
1003  iDesc.add("noDefaultPset3", noDefaultPset3);
1004 
1005  edm::ParameterSetDescription noDefaultPset4;
1006 
1007  noDefaultPset4.addOptionalUntracked<int>(std::string("noDefault1"));
1008  noDefaultPset4.addOptionalUntracked<std::vector<int>>("noDefault2");
1009  noDefaultPset4.addOptionalUntracked<unsigned>("noDefault3");
1010  noDefaultPset4.addOptionalUntracked<std::vector<unsigned>>("noDefault4");
1011  noDefaultPset4.addOptionalUntracked<long long>("noDefault5");
1012  noDefaultPset4.addOptionalUntracked<std::vector<long long>>("noDefault6");
1013  noDefaultPset4.addOptionalUntracked<unsigned long long>("noDefault7");
1014  noDefaultPset4.addOptionalUntracked<std::vector<unsigned long long>>("noDefault8");
1015  noDefaultPset4.addOptionalUntracked<double>("noDefault9");
1016  noDefaultPset4.addOptionalUntracked<std::vector<double>>("noDefault10");
1017  noDefaultPset4.addOptionalUntracked<bool>("noDefault11");
1018  noDefaultPset4.addOptionalUntracked<std::string>("noDefault12");
1019  noDefaultPset4.addOptionalUntracked<std::vector<std::string>>("noDefault13");
1020  noDefaultPset4.addOptionalUntracked<edm::EventID>("noDefault14");
1021  noDefaultPset4.addOptionalUntracked<std::vector<edm::EventID>>("noDefault15");
1022  noDefaultPset4.addOptionalUntracked<edm::LuminosityBlockID>("noDefault16");
1023  noDefaultPset4.addOptionalUntracked<std::vector<edm::LuminosityBlockID>>("noDefault17");
1024  noDefaultPset4.addOptionalUntracked<edm::InputTag>("noDefault18");
1025  noDefaultPset4.addOptionalUntracked<std::vector<edm::InputTag>>("noDefault19");
1026  noDefaultPset4.addOptionalUntracked<edm::FileInPath>("noDefault20");
1027  noDefaultPset4.addOptionalUntracked<edm::LuminosityBlockRange>("noDefault21");
1028  noDefaultPset4.addOptionalUntracked<std::vector<edm::LuminosityBlockRange>>("noDefault22");
1029  noDefaultPset4.addOptionalUntracked<edm::EventRange>("noDefault23");
1030  noDefaultPset4.addOptionalUntracked<std::vector<edm::EventRange>>("noDefault24");
1031 
1032  iDesc.add("noDefaultPset4", noDefaultPset4);
1033 
1034  edm::ParameterSetDescription pluginDesc;
1035  pluginDesc.addNode(edm::PluginDescription<AnotherIntFactory>("type", "edmtestAnotherValueMaker", true));
1036  iDesc.add<edm::ParameterSetDescription>("plugin", pluginDesc);
1037 
1038  edm::ParameterSetDescription pluginDesc1;
1039  pluginDesc1.addNode(edm::PluginDescription<AnotherIntFactory>("type", true));
1040  iDesc.add<edm::ParameterSetDescription>("plugin1", pluginDesc1);
1041 
1042  edm::ParameterSetDescription pluginDesc2;
1043  pluginDesc2.addNode(edm::PluginDescription<AnotherIntFactory>("type", true));
1044  std::vector<edm::ParameterSet> vDefaultsPlugins2;
1045  iDesc.addVPSet("plugin2", pluginDesc2, vDefaultsPlugins2);
1046 
1047  edm::ParameterSetDescription pluginDesc3;
1048  pluginDesc3.addNode(edm::PluginDescription<AnotherIntFactory>("type", true));
1049  std::vector<edm::ParameterSet> vDefaultsPlugins3;
1050  edm::ParameterSet vpsetDefault0;
1051  vpsetDefault0.addParameter<std::string>("type", "edmtestAnotherOneMaker");
1052  vDefaultsPlugins3.push_back(vpsetDefault0);
1053  edm::ParameterSet vpsetDefault1;
1054  vpsetDefault1.addParameter<std::string>("type", "edmtestAnotherValueMaker");
1055  vpsetDefault1.addParameter<int>("value", 11);
1056  vDefaultsPlugins3.push_back(vpsetDefault1);
1057 
1058  iDesc.addVPSet("plugin3", pluginDesc3, vDefaultsPlugins3);
1059 
1060  // ------------------------------------------
1061 
1062  descriptions.add("testProducerWithPsetDesc", iDesc);
1063 
1064  // ------------------------------------------
1065 
1067  iDesc1.add<int>("p_int", 1);
1068  iDesc1.setAllowAnything();
1069  iDesc1.setComment("A comment for a ParameterSetDescription");
1070 
1071  edm::ParameterSetDescription noDefaultPset1;
1072 
1073  noDefaultPset1.add<int>(std::string("noDefault1"));
1074  noDefaultPset1.add<std::vector<int>>("noDefault2");
1075  noDefaultPset1.add<unsigned>("noDefault3");
1076  noDefaultPset1.add<std::vector<unsigned>>("noDefault4");
1077  noDefaultPset1.add<long long>("noDefault5");
1078  noDefaultPset1.add<std::vector<long long>>("noDefault6");
1079  noDefaultPset1.add<unsigned long long>("noDefault7");
1080  noDefaultPset1.add<std::vector<unsigned long long>>("noDefault8");
1081  noDefaultPset1.add<double>("noDefault9");
1082  noDefaultPset1.add<std::vector<double>>("noDefault10");
1083  noDefaultPset1.add<bool>("noDefault11");
1084  noDefaultPset1.add<std::string>("noDefault12");
1085  noDefaultPset1.add<std::vector<std::string>>("noDefault13");
1086  noDefaultPset1.add<edm::EventID>("noDefault14");
1087  noDefaultPset1.add<std::vector<edm::EventID>>("noDefault15");
1088  noDefaultPset1.add<edm::LuminosityBlockID>("noDefault16");
1089  noDefaultPset1.add<std::vector<edm::LuminosityBlockID>>("noDefault17");
1090  noDefaultPset1.add<edm::InputTag>("noDefault18");
1091  noDefaultPset1.add<std::vector<edm::InputTag>>("noDefault19");
1092  noDefaultPset1.add<edm::FileInPath>("noDefault20");
1093  noDefaultPset1.add<edm::LuminosityBlockRange>("noDefault21");
1094  noDefaultPset1.add<std::vector<edm::LuminosityBlockRange>>("noDefault22");
1095  noDefaultPset1.add<edm::EventRange>("noDefault23");
1096  noDefaultPset1.add<std::vector<edm::EventRange>>("noDefault24");
1097 
1098  iDesc1.add("noDefaultPset1", noDefaultPset1);
1099 
1100  edm::ParameterSetDescription noDefaultPset2;
1101 
1102  noDefaultPset2.addUntracked<int>(std::string("noDefault1"));
1103  noDefaultPset2.addUntracked<std::vector<int>>("noDefault2");
1104  noDefaultPset2.addUntracked<unsigned>("noDefault3");
1105  noDefaultPset2.addUntracked<std::vector<unsigned>>("noDefault4");
1106  noDefaultPset2.addUntracked<long long>("noDefault5");
1107  noDefaultPset2.addUntracked<std::vector<long long>>("noDefault6");
1108  noDefaultPset2.addUntracked<unsigned long long>("noDefault7");
1109  noDefaultPset2.addUntracked<std::vector<unsigned long long>>("noDefault8");
1110  noDefaultPset2.addUntracked<double>("noDefault9");
1111  noDefaultPset2.addUntracked<std::vector<double>>("noDefault10");
1112  noDefaultPset2.addUntracked<bool>("noDefault11");
1113  noDefaultPset2.addUntracked<std::string>("noDefault12");
1114  noDefaultPset2.addUntracked<std::vector<std::string>>("noDefault13");
1115  noDefaultPset2.addUntracked<edm::EventID>("noDefault14");
1116  noDefaultPset2.addUntracked<std::vector<edm::EventID>>("noDefault15");
1117  noDefaultPset2.addUntracked<edm::LuminosityBlockID>("noDefault16");
1118  noDefaultPset2.addUntracked<std::vector<edm::LuminosityBlockID>>("noDefault17");
1119  noDefaultPset2.addUntracked<edm::InputTag>("noDefault18");
1120  noDefaultPset2.addUntracked<std::vector<edm::InputTag>>("noDefault19");
1121  noDefaultPset2.addUntracked<edm::FileInPath>("noDefault20");
1122  noDefaultPset2.addUntracked<edm::LuminosityBlockRange>("noDefault21");
1123  noDefaultPset2.addUntracked<std::vector<edm::LuminosityBlockRange>>("noDefault22");
1124  noDefaultPset2.addUntracked<edm::EventRange>("noDefault23");
1125  noDefaultPset2.addUntracked<std::vector<edm::EventRange>>("noDefault24");
1126 
1127  iDesc1.add("noDefaultPset2", noDefaultPset2);
1128  descriptions.add("testLabel1", iDesc1);
1129 
1130  // ------------------------------------------
1131 
1133  iDesc2.add<int>("p_int", 2);
1134  descriptions.addDefault(iDesc2);
1135 
1136  // ------------------------------------------
1137 
1139  iDesc3.add<int>("p_int", 3);
1140  descriptions.addWithDefaultLabel(iDesc3);
1141  }
1142 } // namespace edmtest
void setComment(std::string const &value)
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EventID startEventID() const
Definition: EventRange.h:46
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
#define EDM_REGISTER_VALIDATED_PLUGINFACTORY(_factory_, _category_)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
vector< string > vstring
Definition: ExoticaDQM.cc:7
void setAllowAnything()
allow any parameter label/value pairs
AnotherOneMaker(edm::ParameterSet const &)
virtual ~AnotherIntMakerBase()=default
bool exists(std::string const &parameterName) const
checks if a parameter exists
EventID endEventID() const
Definition: EventRange.h:47
ParameterSet const & getParameterSet(std::string const &) const
virtual ParameterSetDescription const * parameterSetDescription() const
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
virtual int value() const =0
AnotherValueMaker(edm::ParameterSet const &iPSet)
assert(be >=bs)
double vint[400]
LuminosityBlockID endLumiID() const
T getUntrackedParameter(std::string const &, T const &) const
void setComment(std::string const &value)
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_EDM_VALIDATED_PLUGIN(factory, type, name)
static void fillPSetDescription(edm::ParameterSetDescription &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< double > vdouble
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:192
ParameterDescriptionNode * ifValueOptional(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases, bool writeToCfi)
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ProducerWithPSetDesc(edm::ParameterSet const &ps)
VParameterSet const & getParameterSetVector(std::string const &name) const
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
LuminosityBlockID startLumiID() const
static constexpr float d1
def move(src, dest)
Definition: eostools.py:511
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)