Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:47

0001 #include "FWCore/Framework/interface/Event.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/global/EDProducer.h"
0004 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0007 
0008 namespace edm {
0009   class BooleanProducer : public global::EDProducer<> {
0010   public:
0011     explicit BooleanProducer(ParameterSet const& config)
0012         : value_(config.getParameter<bool>("value")), token_(produces<bool>()) {}
0013 
0014     void produce(StreamID sid, Event& event, EventSetup const& setup) const final { event.emplace(token_, value_); }
0015 
0016     static void fillDescriptions(ConfigurationDescriptions& descriptions);
0017 
0018   private:
0019     const bool value_;
0020     const edm::EDPutTokenT<bool> token_;
0021   };
0022 
0023   void BooleanProducer::fillDescriptions(ConfigurationDescriptions& descriptions) {
0024     edm::ParameterSetDescription desc;
0025     desc.add<bool>("value", false);
0026     descriptions.addWithDefaultLabel(desc);
0027     descriptions.setComment("This EDProducer produces a boolean value according to the \"value\" parameter.");
0028   }
0029 }  // namespace edm
0030 
0031 #include "FWCore/Framework/interface/MakerMacros.h"
0032 using edm::BooleanProducer;
0033 DEFINE_FWK_MODULE(BooleanProducer);