Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-08 02:27:18

0001 
0002 /*----------------------------------------------------------------------
0003 
0004 Toy EDProducers of doubles for testing purposes only.
0005 
0006 ----------------------------------------------------------------------*/
0007 
0008 #include "DataFormats/Common/interface/Handle.h"
0009 #include "DataFormats/TestObjects/interface/ToyProducts.h"
0010 
0011 #include "FWCore/Framework/interface/global/EDProducer.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 
0016 #include <string>
0017 #include <vector>
0018 
0019 namespace edmtest {
0020 
0021   //--------------------------------------------------------------------
0022   //
0023   // Toy double producers
0024   //
0025   //--------------------------------------------------------------------
0026 
0027   //--------------------------------------------------------------------
0028   //
0029   // Produces an DoubleProduct instance.
0030   //
0031 
0032   class ToyDoubleProducer : public edm::global::EDProducer<> {
0033   public:
0034     explicit ToyDoubleProducer(edm::ParameterSet const& p) : value_(p.getParameter<double>("dvalue")) {
0035       produces<DoubleProduct>();
0036     }
0037     explicit ToyDoubleProducer(double d) : value_(d) { produces<DoubleProduct>(); }
0038     void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const final;
0039 
0040   private:
0041     double value_;
0042   };
0043 
0044   void ToyDoubleProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const {
0045     // Make output
0046     e.put(std::make_unique<DoubleProduct>(value_));
0047   }
0048 }  // namespace edmtest
0049 
0050 using edmtest::ToyDoubleProducer;
0051 DEFINE_FWK_MODULE(ToyDoubleProducer);