Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-14 00:04:41

0001 // -*- C++ -*-
0002 //
0003 // Package:    __subsys__/__pkgname__
0004 // Class:      __class__
0005 //
0006 /**\class __class__ __class__.cc __subsys__/__pkgname__/plugins/__class__.cc
0007 
0008  Description: [one line class summary]
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  __author__
0015 //         Created:  __date__
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/LooperFactory.h"
0024 #include "FWCore/Framework/interface/ESProducerLooper.h"
0025 
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 
0028 #include "FWCore/Framework/interface/ESProducts.h"
0029 
0030 //
0031 // class declaration
0032 //
0033 
0034 class __class__ : public edm::ESProducerLooper {
0035 public:
0036   __class__(const edm::ParameterSet&);
0037   ~__class__() override;
0038 
0039 #python_begin
0040     if  len(__datatypes__) > 1:
0041         datatypes = []
0042         for dtype in __datatypes__:
0043             datatypes.append("std::unique_ptr<%s>" % dtype)
0044         print("  using ReturnType = edm::ESProducts<%s>;" % ','.join(datatypes))
0045     elif len(__datatypes__) == 1:
0046         print("  using ReturnType = std::shared_ptr<%s>;" % __datatypes__[0])
0047 #python_end
0048 
0049   ReturnType produce(const __record__&);
0050 
0051   void beginOfJob() override;
0052   void startingNewLoop(unsigned int) override;
0053   Status duringLoop(const edm::Event&, const edm::EventSetup&) override;
0054   Status endOfLoop(const edm::EventSetup&) override;
0055   void endOfJob() override;
0056 
0057 private:
0058   // ----------member data ---------------------------
0059 };
0060 
0061 //
0062 // constants, enums and typedefs
0063 //
0064 
0065 //
0066 // static data member definitions
0067 //
0068 
0069 //
0070 // constructors and destructor
0071 //
0072 __class__::__class__(const edm::ParameterSet& iConfig) {
0073   //the following line is needed to tell the framework what
0074   // data is being produced
0075   setWhatProduced(this);
0076 
0077   //now do what ever other initialization is needed
0078 }
0079 
0080 __class__::~__class__() {
0081   // do anything here that needs to be done at desctruction time
0082   // (e.g. close files, deallocate resources etc.)
0083 }
0084 
0085 //
0086 // member functions
0087 //
0088 
0089 // ------------ method called to produce the data  ------------
0090 __class__::ReturnType __class__::produce(const __record__& iRecord) {
0091   using namespace edm::es;
0092 #python_begin
0093     out1 = []
0094     out2 = []
0095     for dtype in __datatypes__:
0096         out1.append("  std::unique_ptr<%s> p%s;" % (dtype, dtype))
0097         out2.append("p%s" % dtype)
0098     output  = '\n'.join(out1)
0099     output += "\n  return products(%s);" % ','.join(out2)
0100     print(output)
0101 #python_end
0102 }
0103 
0104 // ------------ method called once per job just before starting to loop over events  ------------
0105 void __class__::beginOfJob(const edm::EventSetup&) {
0106 }
0107 
0108 // ------------ method called at the beginning of a new loop over the event  ------------
0109 // ------------ the argument starts at 0 and increments for each loop        ------------
0110 void __class__::startingNewLoop(unsigned int iIteration) {
0111 }
0112 
0113 // ------------ called for each event in the loop.  The present event loop can be stopped by return kStop ------------
0114 __class__::Status __class__::duringLoop(const edm::Event&, const edm::EventSetup&) {
0115   return kContinue;
0116 }
0117 
0118 
0119 // ------------ called at the end of each event loop. A new loop will occur if you return kContinue ------------
0120 __class__::Status __class__::endOfLoop(const edm::EventSetup&, unsigned int) {
0121   return kStop;
0122 }
0123 
0124 // ------------ called once each job just before the job ends ------------
0125 void __class__::endOfJob() {
0126 }
0127 
0128 //define this as a plug-in
0129 DEFINE_FWK_LOOPER(__class__);