CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edmtest::ProducerWithPSetDesc Class Reference

#include <ProducerWithPSetDesc.h>

Inheritance diagram for edmtest::ProducerWithPSetDesc:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
 
 ProducerWithPSetDesc (edm::ParameterSet const &ps)
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::unique_ptr< AnotherIntMakerBasepluginHelper1_
 
std::unique_ptr< AnotherIntMakerBasepluginHelper4_
 
std::unique_ptr< AnotherIntMakerBasepluginHelper_
 
std::vector< std::unique_ptr< AnotherIntMakerBase > > pluginHelpers2_
 
std::vector< std::unique_ptr< AnotherIntMakerBase > > pluginHelpers3_
 
std::vector< std::unique_ptr< AnotherIntMakerBase > > pluginHelpers5_
 
bool testingAutoGeneratedCfi
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file ProducerWithPSetDesc.h.

Constructor & Destructor Documentation

◆ ProducerWithPSetDesc()

edmtest::ProducerWithPSetDesc::ProducerWithPSetDesc ( edm::ParameterSet const &  ps)
explicit

Definition at line 88 of file ProducerWithPSetDesc.cc.

References cms::cuda::assert(), beamerCreator::create(), MillePedeFileConverter_cfg::e, edm::EventRange::endEventID(), edm::LuminosityBlockRange::endLumiID(), edm::ParameterSet::exists(), get, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getParameterSetVector(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), HLT_2024v14_cff::inputTag1, HLT_2024v14_cff::inputTag2, HLT_2024v14_cff::inputTag3, L1DTConfigBti_cff::LL, pluginHelper1_, pluginHelper4_, pluginHelper_, pluginHelpers2_, pluginHelpers3_, pluginHelpers5_, muonDTDigis_cfi::pset, edm::EventRange::startEventID(), edm::LuminosityBlockRange::startLumiID(), AlCaHLTBitMon_QueryRunRegistry::string, builder_last_value_cfg::test, testingAutoGeneratedCfi, mitigatedMETSequence_cff::U, and vint.

88  {
89  testingAutoGeneratedCfi = ps.getUntrackedParameter<bool>("testingAutoGeneratedCfi", true);
90 
91  assert(ps.getParameter<int>("p_int") == 2147483647);
92  assert(ps.getUntrackedParameter<int>("p_int_untracked") == -2147483647);
94  assert(ps.getParameter<int>("p_int_opt") == 0);
96  assert(ps.getUntrackedParameter<int>("p_int_optuntracked") == 7);
97  assert(!ps.exists("p_int_opt_nd"));
98  assert(!ps.exists("p_int_optuntracked_nd"));
99  } else {
100  assert(!ps.exists("p_int_optuntracked"));
101  assert(ps.getParameter<int>("p_int_opt_nd") == 11);
102  assert(ps.getUntrackedParameter<int>("p_int_optuntracked_nd") == 12);
103  }
104 
105  std::vector<int> vint;
106  vint = ps.getParameter<std::vector<int>>("vint1");
107  assert(vint.empty());
108  vint = ps.getParameter<std::vector<int>>("vint2");
109  assert(vint[0] == 2147483647);
110  vint = ps.getParameter<std::vector<int>>("vint3");
111  assert(vint[0] == 2147483647);
112  assert(vint[1] == -2147483647);
113  std::array<int, 2> testArray = ps.getParameter<std::array<int, 2>>(std::string("vint3"));
114  assert(testArray[0] == 2147483647);
115  assert(testArray[1] == -2147483647);
116  std::array<int, 2> testArray1 = ps.getParameter<std::array<int, 2>>("vint3");
117  assert(testArray1[0] == 2147483647);
118  assert(testArray1[1] == -2147483647);
119  vint = ps.getParameter<std::vector<int>>("vint4");
120  assert(vint[0] == 2147483647);
121  assert(vint[1] == -2147483647);
122  assert(vint[2] == 0);
123 
124  assert(ps.getParameter<unsigned>("uint1") == 4294967295U);
125  assert(ps.getUntrackedParameter<unsigned>("uint2") == 0);
126 
127  std::vector<unsigned> vuint;
128  vuint = ps.getParameter<std::vector<unsigned>>("vuint1");
129  assert(vuint.empty());
130  vuint = ps.getParameter<std::vector<unsigned>>("vuint2");
131  assert(vuint[0] == 4294967295U);
132  vuint = ps.getParameter<std::vector<unsigned>>("vuint3");
133  assert(vuint[0] == 4294967295U);
134  assert(vuint[1] == 0);
135  vuint = ps.getParameter<std::vector<unsigned>>("vuint4");
136  assert(vuint[0] == 4294967295U);
137  assert(vuint[1] == 0);
138  assert(vuint[2] == 11);
139 
140  assert(ps.getParameter<long long>("int64v1") == 9000000000000000000LL);
141  assert(ps.getParameter<long long>("int64v2") == -9000000000000000000LL);
142  assert(ps.getParameter<long long>("int64v3") == 0);
143 
144  std::vector<long long> vint64;
145  vint64 = ps.getParameter<std::vector<long long>>("vint64v1");
146  assert(vint64.empty());
147  vint64 = ps.getParameter<std::vector<long long>>("vint64v2");
148  assert(vint64[0] == 9000000000000000000LL);
149  vint64 = ps.getParameter<std::vector<long long>>("vint64v3");
150  assert(vint64[0] == 9000000000000000000LL);
151  assert(vint64[1] == -9000000000000000000LL);
152  vint64 = ps.getParameter<std::vector<long long>>("vint64v4");
153  assert(vint64[0] == 9000000000000000000LL);
154  assert(vint64[1] == -9000000000000000000LL);
155  assert(vint64[2] == 0);
156 
157  assert(ps.getParameter<unsigned long long>("uint64v1") == 18000000000000000000ULL);
158  assert(ps.getUntrackedParameter<unsigned long long>("uint64v2") == 0);
159 
160  std::vector<unsigned long long> vuint64;
161  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v1");
162  assert(vuint64.empty());
163  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v2");
164  assert(vuint64[0] == 18000000000000000000ULL);
165  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v3");
166  assert(vuint64[0] == 18000000000000000000ULL);
167  assert(vuint64[1] == 0);
168  vuint64 = ps.getParameter<std::vector<unsigned long long>>("vuint64v4");
169  assert(vuint64[0] == 18000000000000000000ULL);
170  assert(vuint64[1] == 0);
171  assert(vuint64[2] == 11);
172 
173  // This one does not work because the precision in the ParameterSet stringified
174  // format is 16 instead of 17.
175  // assert(ps.getParameter<double>("doublev1") == std::numeric_limits<double>::min());
176  assert(ps.getUntrackedParameter<double>("doublev2") == 0.0);
177  assert(fabs(ps.getUntrackedParameter<double>("doublev3") - 0.3) < 0.0000001);
178 
179  std::vector<double> vdouble;
180  vdouble = ps.getParameter<std::vector<double>>("vdoublev1");
181  assert(vdouble.empty());
182  // cmsRun will fail with a value this big
183  // vdouble.push_back(std::numeric_limits<double>::max());
184  // This works though
185  vdouble = ps.getParameter<std::vector<double>>("vdoublev2");
186  assert(vdouble[0] == 1e+300);
187  vdouble = ps.getParameter<std::vector<double>>("vdoublev3");
188  assert(vdouble[0] == 1e+300);
189  assert(vdouble[1] == 0.0);
190  vdouble = ps.getParameter<std::vector<double>>("vdoublev4");
191  assert(vdouble[0] == 1e+300);
192  assert(vdouble[1] == 0.0);
193  assert(vdouble[2] == 11.0);
194  vdouble = ps.getParameter<std::vector<double>>("vdoublev5");
195  assert(vdouble[0] == 1e+300);
196  assert(vdouble[1] == 0.0);
197  assert(vdouble[2] == 11.0);
198  assert(fabs(vdouble[3] - 0.3) < 0.0000001);
199 
200  assert(ps.getParameter<bool>("boolv1") == true);
201  assert(ps.getParameter<bool>("boolv2") == false);
202 
203  std::string test("Hello");
204  assert(ps.getParameter<std::string>("stringv1") == test);
205  test.clear();
206  assert(ps.getParameter<std::string>("stringv2") == test);
207 
208  std::vector<std::string> vstring;
209  vstring = ps.getParameter<std::vector<std::string>>("vstringv1");
210  assert(vstring.empty());
211  vstring = ps.getParameter<std::vector<std::string>>("vstringv2");
212  assert(vstring[0] == std::string("Hello"));
213  vstring = ps.getParameter<std::vector<std::string>>("vstringv3");
214  assert(vstring[0] == std::string("Hello"));
215  assert(vstring[1] == std::string("World"));
216  vstring = ps.getParameter<std::vector<std::string>>("vstringv4");
217  assert(vstring[0] == std::string("Hello"));
218  assert(vstring[1] == std::string("World"));
219  assert(vstring[2] == std::string(""));
220 
221  edm::EventID eventID1(11, 0, 12);
222  assert(ps.getParameter<edm::EventID>("eventIDv1") == eventID1);
223  edm::EventID eventID2(101, 0, 102);
224  assert(ps.getParameter<edm::EventID>("eventIDv2") == eventID2);
225 
226  std::vector<edm::EventID> vEventID;
227  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv1");
228  assert(vEventID.empty());
229  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv2");
230  assert(vEventID[0] == edm::EventID(1000, 0, 1100));
231  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv3");
232  assert(vEventID[0] == edm::EventID(1000, 0, 1100));
233  assert(vEventID[1] == edm::EventID(10000, 0, 11000));
234  vEventID = ps.getParameter<std::vector<edm::EventID>>("vEventIDv4");
235  assert(vEventID[0] == edm::EventID(1000, 0, 1100));
236  assert(vEventID[1] == edm::EventID(10000, 0, 11000));
237  assert(vEventID[2] == edm::EventID(100000, 0, 110000));
238 
239  edm::LuminosityBlockID luminosityID1(11, 12);
240  assert(ps.getParameter<edm::LuminosityBlockID>("luminosityIDv1") == luminosityID1);
241  edm::LuminosityBlockID luminosityID2(101, 102);
242  assert(ps.getParameter<edm::LuminosityBlockID>("luminosityIDv2") == luminosityID2);
243 
244  std::vector<edm::LuminosityBlockID> vLuminosityBlockID;
245  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv1");
246  assert(vLuminosityBlockID.empty());
247  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv2");
248  assert(vLuminosityBlockID[0] == edm::LuminosityBlockID(1000, 1100));
249  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv3");
250  assert(vLuminosityBlockID[0] == edm::LuminosityBlockID(1000, 1100));
251  assert(vLuminosityBlockID[1] == edm::LuminosityBlockID(10000, 11000));
252  vLuminosityBlockID = ps.getParameter<std::vector<edm::LuminosityBlockID>>("vLuminosityBlockIDv4");
253  assert(vLuminosityBlockID[0] == edm::LuminosityBlockID(1000, 1100));
254  assert(vLuminosityBlockID[1] == edm::LuminosityBlockID(10000, 11000));
255  assert(vLuminosityBlockID[2] == edm::LuminosityBlockID(100000, 110000));
256 
257  edm::LuminosityBlockRange lumiRange1(1, 1, 9, 9);
258  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev1").startLumiID() == lumiRange1.startLumiID());
259  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev1").endLumiID() == lumiRange1.endLumiID());
260  edm::LuminosityBlockRange lumiRange2(3, 4, 1000, 1000);
261  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev2").startLumiID() == lumiRange2.startLumiID());
262  assert(ps.getParameter<edm::LuminosityBlockRange>("lumiRangev2").endLumiID() == lumiRange2.endLumiID());
263 
264  std::vector<edm::LuminosityBlockRange> vLumiRange;
265  vLumiRange = ps.getParameter<std::vector<edm::LuminosityBlockRange>>("vLumiRangev1");
266  assert(vLumiRange.empty());
267  vLumiRange = ps.getParameter<std::vector<edm::LuminosityBlockRange>>("vLumiRangev2");
268  assert(vLumiRange[0].startLumiID() == lumiRange1.startLumiID());
269  vLumiRange = ps.getParameter<std::vector<edm::LuminosityBlockRange>>("vLumiRangev3");
270  assert(vLumiRange[0].startLumiID() == lumiRange1.startLumiID());
271  assert(vLumiRange[1].startLumiID() == lumiRange2.startLumiID());
272  assert(vLumiRange[1].endLumiID() == lumiRange2.endLumiID());
273 
274  edm::EventRange eventRange1(1, 0, 1, 8, 0, 8);
275  assert(ps.getParameter<edm::EventRange>("eventRangev1").startEventID() == eventRange1.startEventID());
276  assert(ps.getParameter<edm::EventRange>("eventRangev1").endEventID() == eventRange1.endEventID());
277  edm::EventRange eventRange2(3, 0, 4, 1001, 0, 1002);
278  assert(ps.getParameter<edm::EventRange>("eventRangev2").startEventID() == eventRange2.startEventID());
279  assert(ps.getParameter<edm::EventRange>("eventRangev2").endEventID() == eventRange2.endEventID());
280 
281  std::vector<edm::EventRange> vEventRange;
282  vEventRange = ps.getParameter<std::vector<edm::EventRange>>("vEventRangev1");
283  assert(vEventRange.empty());
284  vEventRange = ps.getParameter<std::vector<edm::EventRange>>("vEventRangev2");
285  assert(vEventRange[0].startEventID() == eventRange1.startEventID());
286  vEventRange = ps.getParameter<std::vector<edm::EventRange>>("vEventRangev3");
287  assert(vEventRange[0].startEventID() == eventRange1.startEventID());
288  assert(vEventRange[1].startEventID() == eventRange2.startEventID());
289 
290  edm::InputTag inputTag1("One", "Two", "Three");
291  assert(ps.getParameter<edm::InputTag>("inputTagv1") == inputTag1);
292  edm::InputTag inputTag2("One", "Two");
293  assert(ps.getParameter<edm::InputTag>("inputTagv2") == inputTag2);
294  edm::InputTag inputTag3("One");
295  assert(ps.getParameter<edm::InputTag>("inputTagv3") == inputTag3);
296  edm::InputTag inputTag4("One", "", "Three");
297  assert(ps.getParameter<edm::InputTag>("inputTagv4") == inputTag4);
298 
299  std::vector<edm::InputTag> vInputTag;
300  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv1");
301  assert(vInputTag.empty());
302  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv2");
303  assert(vInputTag[0] == inputTag1);
304  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv3");
305  assert(vInputTag[0] == inputTag1);
306  assert(vInputTag[1] == inputTag2);
307  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv4");
308  assert(vInputTag[0] == inputTag1);
309  assert(vInputTag[1] == inputTag2);
310  assert(vInputTag[2] == inputTag3);
311  vInputTag = ps.getParameter<std::vector<edm::InputTag>>("vInputTagv5");
312  assert(vInputTag[0] == inputTag1);
313  assert(vInputTag[1] == inputTag2);
314  assert(vInputTag[2] == inputTag3);
315  assert(vInputTag[3] == inputTag4);
316 
317  edm::ESInputTag esinputTag1("One", "Two");
318  assert(ps.getParameter<edm::ESInputTag>("esinputTagv1") == esinputTag1);
319  edm::ESInputTag esinputTag2("One", "");
320  assert(ps.getParameter<edm::ESInputTag>("esinputTagv2") == esinputTag2);
321  edm::ESInputTag esinputTag3("", "Two");
322  assert(ps.getParameter<edm::ESInputTag>("esinputTagv3") == esinputTag3);
323 
324  std::vector<edm::ESInputTag> vESInputTag;
325  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv1");
326  assert(vESInputTag.empty());
327  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv2");
328  assert(vESInputTag[0] == esinputTag1);
329  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv3");
330  assert(vESInputTag[0] == esinputTag1);
331  assert(vESInputTag[1] == esinputTag2);
332  vESInputTag = ps.getParameter<std::vector<edm::ESInputTag>>("vESInputTagv4");
333  assert(vESInputTag[0] == esinputTag1);
334  assert(vESInputTag[1] == esinputTag2);
335  assert(vESInputTag[2] == esinputTag3);
336 
337  // For purposes of the test, this just needs to point to any file
338  // that exists.
339  edm::FileInPath fileInPath("FWCore/Integration/plugins/ProducerWithPSetDesc.cc");
340  assert(fileInPath == ps.getParameter<edm::FileInPath>("fileInPath"));
341 
342  edm::ParameterSet const& pset = ps.getParameterSet("bar");
343  assert(pset.getParameter<unsigned>("Drinks") == 5U);
344  assert(pset.getUntrackedParameter<unsigned>("uDrinks") == 5U);
346  assert(pset.getParameter<unsigned>("oDrinks") == 5U);
348  assert(pset.getUntrackedParameter<unsigned>("ouDrinks") == 5U);
349 
350  //std::vector<edm::ParameterSet> const& vpsetUntracked =
351  // ps.getUntrackedParameterSetVector("test104");
352 
353  std::vector<edm::ParameterSet> const& vpset = ps.getParameterSetVector("bars");
354 
355  assert(vpset.size() == 2U);
356 
357  const edm::ParameterSet& pset0 = vpset[0];
358  assert(pset0.getParameter<unsigned>("Drinks") == 5U);
359  assert(pset0.getUntrackedParameter<unsigned>("uDrinks") == 5U);
360  assert(pset0.getParameter<unsigned>("oDrinks") == 11U);
361  assert(pset0.exists("ouDrinks") == false);
362  assert(pset0.exists("ndoDrinks") == false);
363  assert(pset0.exists("ndouDrinks") == false);
364  // assert(pset0.getUntrackedParameter<unsigned>("ndouDrinks") == 5);
365 
366  const edm::ParameterSet& pset1 = vpset[1];
367  assert(pset1.getParameter<unsigned>("Drinks") == 5U);
368  assert(pset1.getUntrackedParameter<unsigned>("uDrinks") == 5U);
369  assert(pset1.getParameter<unsigned>("oDrinks") == 11U);
370  assert(pset1.getUntrackedParameter<unsigned>("ouDrinks") == 11U);
371  assert(pset1.exists("ndoDrinks") == false);
372  assert(pset1.getUntrackedParameter<unsigned>("ndouDrinks") == 11U);
373 
374  assert(ps.getParameter<double>("test1") == 0.1);
376  assert(ps.getParameter<double>("test2") == 0.2);
377  assert(ps.exists("test3") == false);
378 
379  assert(ps.getParameter<std::string>("testA") == std::string("fooA"));
380  assert(ps.getParameter<int>("testB") == 100);
381  assert(ps.getParameter<int>("testC") == 101);
382 
383  assert(ps.getParameter<int>("oiswitch") == 1);
384  assert(ps.getParameter<double>("oivalue1") == 101.0);
385  assert(ps.getParameter<double>("oivalue2") == 101.0);
386  } else {
387  assert(!ps.exists("test2"));
388  assert(!ps.exists("test3"));
389 
390  assert(!ps.exists("testA"));
391  assert(!ps.exists("testB"));
392  assert(!ps.exists("testC"));
393 
394  assert(!ps.exists("oiswitch"));
395  assert(!ps.exists("oivalue1"));
396  assert(!ps.exists("oivalue2"));
397  }
398 
399  edm::ParameterSet const& deeplyNestedPSet = pset1.getParameterSet("testDeeplyNested");
401  assert(!deeplyNestedPSet.exists("ndiswitch"));
402  assert(!deeplyNestedPSet.exists("ndivalue1"));
403  assert(!deeplyNestedPSet.exists("ndivalue2"));
404  } else {
405  assert(!deeplyNestedPSet.exists("ndiswitch"));
406  assert(!deeplyNestedPSet.exists("ndivalue1"));
407  assert(!deeplyNestedPSet.exists("ndivalue2"));
408  }
409 
410  assert(deeplyNestedPSet.getParameter<bool>("bswitch") == false);
411  assert(deeplyNestedPSet.getParameter<double>("bvalue1") == 101.0);
412  assert(deeplyNestedPSet.getParameter<double>("bvalue2") == 101.0);
413  assert(!deeplyNestedPSet.exists("bvalue"));
414 
415  assert(deeplyNestedPSet.getParameter<int>("iswitch") == 1);
416  assert(deeplyNestedPSet.getParameter<double>("ivalue1") == 101.0);
417  assert(deeplyNestedPSet.getUntrackedParameter<double>("ivalue2") == 101.0);
418  assert(!deeplyNestedPSet.exists("ivalue"));
419 
420  assert(deeplyNestedPSet.getParameter<std::string>("sswitch") == std::string("1"));
421  assert(deeplyNestedPSet.getParameter<double>("svalue1") == 101.0);
422  assert(deeplyNestedPSet.getParameter<double>("svalue2") == 101.0);
423  assert(!deeplyNestedPSet.exists("svalue"));
424 
426  edm::ParameterSet const& pset11 = ps.getParameterSet("subpset");
427  assert(pset11.getParameter<int>("xvalue") == 11);
428  edm::ParameterSet const& pset111 = pset11.getUntrackedParameterSet("bar");
429  assert(pset111.getParameter<unsigned>("Drinks") == 5U);
430  assert(pset111.getUntrackedParameter<unsigned>("uDrinks") == 5U);
431  assert(pset111.getParameter<unsigned>("oDrinks") == 5U);
432  assert(pset111.getUntrackedParameter<unsigned>("ouDrinks") == 5U);
433  }
434 
435  edm::ParameterSet const& psetXor = ps.getParameterSet("xorPset");
436  assert(psetXor.getParameter<std::string>("name1") == std::string("11"));
437  assert(!psetXor.exists("name2"));
439  assert(psetXor.getParameter<std::string>("name") == std::string("11"));
440  } else {
441  assert(psetXor.getParameter<unsigned>("name") == 11U);
442  }
443 
444  edm::ParameterSet const& psetOr = ps.getParameterSet("orPset");
445  assert(!psetOr.exists("z1"));
446  assert(!psetOr.exists("z2"));
448  assert(psetOr.getParameter<std::string>("x1") == std::string("11"));
449  assert(!psetOr.exists("x2"));
450  assert(psetOr.getParameter<std::string>("y1") == std::string("11"));
451  assert(!psetOr.exists("y2"));
452  } else {
453  assert(!psetOr.exists("x1"));
454  assert(psetOr.getParameter<unsigned>("x2") == 11U);
455  assert(psetOr.getParameter<std::string>("y1") == std::string("11"));
456  assert(psetOr.getParameter<unsigned>("y2") == 11U);
457  }
458 
459  edm::ParameterSet const& psetAnd = ps.getParameterSet("andPset");
460  assert(psetAnd.getParameter<std::string>("x1") == std::string("11"));
461  assert(psetAnd.getParameter<unsigned>("x2") == 11U);
462  assert(psetAnd.getParameter<std::string>("y1") == std::string("11"));
463  assert(psetAnd.getParameter<unsigned>("y2") == 11U);
464  assert(psetAnd.getParameter<std::string>("z1") == std::string("11"));
465  assert(psetAnd.getParameter<unsigned>("z2") == 11U);
466  assert(psetAnd.getParameter<std::string>("b1") == std::string("11"));
467  assert(psetAnd.getParameter<unsigned>("b2") == 11U);
468  assert(psetAnd.getParameter<unsigned>("b3") == 11U);
469  assert(psetAnd.getParameter<unsigned>("b4") == 11U);
470  assert(psetAnd.getParameter<unsigned>("b5") == 11U);
471  assert(psetAnd.getParameter<unsigned>("b6") == 11U);
473  assert(!psetAnd.exists("a1"));
474  assert(!psetAnd.exists("a2"));
475  } else {
476  assert(psetAnd.getParameter<std::string>("a1") == std::string("11"));
477  assert(psetAnd.getParameter<unsigned>("a2") == 11U);
478  }
479 
480  edm::ParameterSet const& psetIfExists = ps.getParameterSet("ifExistsPset");
481  assert(psetIfExists.getParameter<unsigned>("x1") == 11U);
482  assert(psetIfExists.getParameter<std::string>("x2") == std::string("11"));
483  assert(psetIfExists.getParameter<unsigned>("z1") == 11U);
484  assert(psetIfExists.getParameter<std::string>("z2") == std::string("11"));
486  assert(!psetIfExists.exists("y1"));
487  assert(!psetIfExists.exists("y2"));
488  } else {
489  assert(psetIfExists.getParameter<unsigned>("y1") == 11U);
490  assert(!psetIfExists.exists("y2"));
491  }
492 
493  edm::ParameterSet const& psetAllowed = ps.getParameterSet("allowedLabelsPset");
495  assert(psetAllowed.getParameter<std::vector<std::string>>("testAllowedLabels").empty());
496  assert(psetAllowed.getUntrackedParameter<std::vector<std::string>>("testAllowedLabelsUntracked").empty());
497  assert(!psetAllowed.exists("testOptAllowedLabels"));
498  assert(!psetAllowed.exists("testOptAllowedLabelsUntracked"));
499  }
500 
501  auto pluginPSet = ps.getParameter<edm::ParameterSet>("plugin");
502  pluginHelper_ = AnotherIntFactory::get()->create(pluginPSet.getParameter<std::string>("type"), pluginPSet);
503 
504  auto plugin1PSet = ps.getParameter<edm::ParameterSet>("plugin1");
505  pluginHelper1_ = AnotherIntFactory::get()->create(plugin1PSet.getParameter<std::string>("type"), plugin1PSet);
506 
507  std::vector<edm::ParameterSet> vpset2 = ps.getParameter<std::vector<edm::ParameterSet>>("plugin2");
508  for (auto const& pset2 : vpset2) {
509  pluginHelpers2_.emplace_back(AnotherIntFactory::get()->create(pset2.getParameter<std::string>("type"), pset2));
510  }
511 
512  std::vector<edm::ParameterSet> vpset3 = ps.getParameter<std::vector<edm::ParameterSet>>("plugin3");
513  for (auto const& pset3 : vpset3) {
514  pluginHelpers3_.emplace_back(AnotherIntFactory::get()->create(pset3.getParameter<std::string>("type"), pset3));
515  }
516 
517  auto plugin4PSet = ps.getParameter<edm::ParameterSet>("plugin4");
518  pluginHelper4_ = AnotherIntFactory::get()->create(plugin4PSet.getParameter<std::string>("type"), plugin4PSet);
519 
520  std::vector<edm::ParameterSet> vpset5 = ps.getParameter<std::vector<edm::ParameterSet>>("plugin5");
521  for (auto const& pset5 : vpset5) {
522  pluginHelpers5_.emplace_back(AnotherIntFactory::get()->create(pset5.getParameter<std::string>("type"), pset5));
523  }
524 
525  produces<ThingCollection>();
526  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EventID startEventID() const
Definition: EventRange.h:46
std::unique_ptr< AnotherIntMakerBase > pluginHelper_
std::vector< std::unique_ptr< AnotherIntMakerBase > > pluginHelpers5_
def create(alignables, pedeDump, additionalData, outputFile, config)
vector< string > vstring
Definition: ExoticaDQM.cc:7
std::unique_ptr< AnotherIntMakerBase > pluginHelper1_
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
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
std::vector< std::unique_ptr< AnotherIntMakerBase > > pluginHelpers2_
assert(be >=bs)
double vint[400]
LuminosityBlockID endLumiID() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > vdouble
std::unique_ptr< AnotherIntMakerBase > pluginHelper4_
std::vector< std::unique_ptr< AnotherIntMakerBase > > pluginHelpers3_
#define get
LuminosityBlockID startLumiID() const

Member Function Documentation

◆ fillDescriptions()

void edmtest::ProducerWithPSetDesc::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 1140 of file ProducerWithPSetDesc.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addUntracked(), edm::ConfigurationDescriptions::addWithDefaultLabel(), makeListRunsInFiles::description, edm::ParameterSetDescription::setAllowAnything(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

1140  {
1141  auto iDesc = description(2147483647);
1142  // ------------------------------------------
1143 
1144  descriptions.add("testProducerWithPsetDesc", iDesc);
1145 
1146  // ------------------------------------------
1147 
1149  iDesc1.setAllowAnything();
1150  iDesc1.setComment("A comment for a ParameterSetDescription");
1151 
1152  edm::ParameterSetDescription noDefaultPset1;
1153 
1154  noDefaultPset1.add<int>(std::string("noDefault1"));
1155  noDefaultPset1.add<std::vector<int>>("noDefault2");
1156  noDefaultPset1.add<unsigned>("noDefault3");
1157  noDefaultPset1.add<std::vector<unsigned>>("noDefault4");
1158  noDefaultPset1.add<long long>("noDefault5");
1159  noDefaultPset1.add<std::vector<long long>>("noDefault6");
1160  noDefaultPset1.add<unsigned long long>("noDefault7");
1161  noDefaultPset1.add<std::vector<unsigned long long>>("noDefault8");
1162  noDefaultPset1.add<double>("noDefault9");
1163  noDefaultPset1.add<std::vector<double>>("noDefault10");
1164  noDefaultPset1.add<bool>("noDefault11");
1165  noDefaultPset1.add<std::string>("noDefault12");
1166  noDefaultPset1.add<std::vector<std::string>>("noDefault13");
1167  noDefaultPset1.add<edm::EventID>("noDefault14");
1168  noDefaultPset1.add<std::vector<edm::EventID>>("noDefault15");
1169  noDefaultPset1.add<edm::LuminosityBlockID>("noDefault16");
1170  noDefaultPset1.add<std::vector<edm::LuminosityBlockID>>("noDefault17");
1171  noDefaultPset1.add<edm::InputTag>("noDefault18");
1172  noDefaultPset1.add<std::vector<edm::InputTag>>("noDefault19");
1173  noDefaultPset1.add<edm::FileInPath>("noDefault20");
1174  noDefaultPset1.add<edm::LuminosityBlockRange>("noDefault21");
1175  noDefaultPset1.add<std::vector<edm::LuminosityBlockRange>>("noDefault22");
1176  noDefaultPset1.add<edm::EventRange>("noDefault23");
1177  noDefaultPset1.add<std::vector<edm::EventRange>>("noDefault24");
1178 
1179  iDesc1.add("noDefaultPset1", noDefaultPset1);
1180 
1181  edm::ParameterSetDescription noDefaultPset2;
1182 
1183  noDefaultPset2.addUntracked<int>(std::string("noDefault1"));
1184  noDefaultPset2.addUntracked<std::vector<int>>("noDefault2");
1185  noDefaultPset2.addUntracked<unsigned>("noDefault3");
1186  noDefaultPset2.addUntracked<std::vector<unsigned>>("noDefault4");
1187  noDefaultPset2.addUntracked<long long>("noDefault5");
1188  noDefaultPset2.addUntracked<std::vector<long long>>("noDefault6");
1189  noDefaultPset2.addUntracked<unsigned long long>("noDefault7");
1190  noDefaultPset2.addUntracked<std::vector<unsigned long long>>("noDefault8");
1191  noDefaultPset2.addUntracked<double>("noDefault9");
1192  noDefaultPset2.addUntracked<std::vector<double>>("noDefault10");
1193  noDefaultPset2.addUntracked<bool>("noDefault11");
1194  noDefaultPset2.addUntracked<std::string>("noDefault12");
1195  noDefaultPset2.addUntracked<std::vector<std::string>>("noDefault13");
1196  noDefaultPset2.addUntracked<edm::EventID>("noDefault14");
1197  noDefaultPset2.addUntracked<std::vector<edm::EventID>>("noDefault15");
1198  noDefaultPset2.addUntracked<edm::LuminosityBlockID>("noDefault16");
1199  noDefaultPset2.addUntracked<std::vector<edm::LuminosityBlockID>>("noDefault17");
1200  noDefaultPset2.addUntracked<edm::InputTag>("noDefault18");
1201  noDefaultPset2.addUntracked<std::vector<edm::InputTag>>("noDefault19");
1202  noDefaultPset2.addUntracked<edm::FileInPath>("noDefault20");
1203  noDefaultPset2.addUntracked<edm::LuminosityBlockRange>("noDefault21");
1204  noDefaultPset2.addUntracked<std::vector<edm::LuminosityBlockRange>>("noDefault22");
1205  noDefaultPset2.addUntracked<edm::EventRange>("noDefault23");
1206  noDefaultPset2.addUntracked<std::vector<edm::EventRange>>("noDefault24");
1207 
1208  iDesc1.add("noDefaultPset2", noDefaultPset2);
1209  descriptions.add("testLabel1", iDesc1);
1210 
1211  // ------------------------------------------
1212 
1213  descriptions.addDefault(description(2));
1214 
1215  // ------------------------------------------
1216 
1217  descriptions.addWithDefaultLabel(description(3));
1218  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
void setComment(std::string const &value)
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void edmtest::ProducerWithPSetDesc::produce ( edm::StreamID  ,
edm::Event e,
edm::EventSetup const &  c 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 528 of file ProducerWithPSetDesc.cc.

References MillePedeFileConverter_cfg::e, eostools::move(), and mps_fire::result.

528  {
529  // This serves no purpose, I just put it here so the module does something
530  // Probably could just make this method do nothing and it would not
531  // affect the test.
532  auto result = std::make_unique<ThingCollection>(); //Empty
533  e.put(std::move(result));
534  }
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ pluginHelper1_

std::unique_ptr<AnotherIntMakerBase> edmtest::ProducerWithPSetDesc::pluginHelper1_
private

Definition at line 36 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().

◆ pluginHelper4_

std::unique_ptr<AnotherIntMakerBase> edmtest::ProducerWithPSetDesc::pluginHelper4_
private

Definition at line 39 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().

◆ pluginHelper_

std::unique_ptr<AnotherIntMakerBase> edmtest::ProducerWithPSetDesc::pluginHelper_
private

Definition at line 35 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().

◆ pluginHelpers2_

std::vector<std::unique_ptr<AnotherIntMakerBase> > edmtest::ProducerWithPSetDesc::pluginHelpers2_
private

Definition at line 37 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().

◆ pluginHelpers3_

std::vector<std::unique_ptr<AnotherIntMakerBase> > edmtest::ProducerWithPSetDesc::pluginHelpers3_
private

Definition at line 38 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().

◆ pluginHelpers5_

std::vector<std::unique_ptr<AnotherIntMakerBase> > edmtest::ProducerWithPSetDesc::pluginHelpers5_
private

Definition at line 40 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().

◆ testingAutoGeneratedCfi

bool edmtest::ProducerWithPSetDesc::testingAutoGeneratedCfi
private

Definition at line 33 of file ProducerWithPSetDesc.h.

Referenced by ProducerWithPSetDesc().