Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:47:56

0001 // -*- C++ -*-
0002 //
0003 // Package:    __subsys__/__pkgname__
0004 // Class:      __class__
0005 //
0006 /**\class __class__
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 // PLEASE DELETE COMMENTS THAT THE SKELETON METHOD (mkesprod)
0020 // GENERATES THAT ARE NOT USEFUL FOR LONG TERM CODE MAINTENANCE
0021 // AND UNDERSTANDING. (For example, please delete this comment)
0022 
0023 // system include files
0024 #include <memory>
0025 
0026 // user include files
0027 #include "FWCore/Framework/interface/ModuleFactory.h"
0028 #include "FWCore/Framework/interface/ESProducer.h"
0029 
0030 #include "FWCore/Framework/interface/ESHandle.h"
0031 
0032 #python_begin
0033     if  len(__datatypes__) > 1:
0034         print('#include "FWCore/Framework/interface/ESProducts.h"')
0035 #python_end
0036 
0037 // Need to add #include statements for definitions of
0038 // the data type and record type here
0039 
0040 //
0041 // class declaration
0042 //
0043 
0044 class __class__ : public edm::ESProducer {
0045 public:
0046   __class__(const edm::ParameterSet&);
0047   ~__class__() override;
0048 
0049 #python_begin
0050     if  len(__datatypes__) > 1:
0051         datatypes = []
0052         for dtype in __datatypes__:
0053             datatypes.append("std::unique_ptr<%s>" % dtype)
0054         print("  using ReturnType = edm::ESProducts<%s>;" % ', '.join(datatypes))
0055     elif len(__datatypes__) == 1:
0056         print("  using ReturnType = std::unique_ptr<%s>;" % __datatypes__[0])
0057 #python_end
0058 
0059   ReturnType produce(const __record__&);
0060 
0061 private:
0062   // ----------member data ---------------------------
0063 };
0064 
0065 //
0066 // constants, enums and typedefs
0067 //
0068 
0069 //
0070 // static data member definitions
0071 //
0072 
0073 //
0074 // constructors and destructor
0075 //
0076 __class__::__class__(const edm::ParameterSet& iConfig) {
0077   //the following line is needed to tell the framework what
0078   // data is being produced
0079   setWhatProduced(this);
0080 
0081   //now do what ever other initialization is needed
0082 }
0083 
0084 __class__::~__class__() {
0085   // do anything here that needs to be done at destruction time
0086   // (e.g. close files, deallocate resources etc.)
0087 }
0088 
0089 //
0090 // member functions
0091 //
0092 
0093 // ------------ method called to produce the data  ------------
0094 __class__::ReturnType __class__::produce(const __record__& iRecord) {
0095   // You can add arguments to the make_unique function call
0096   // and they will be forwarded to the constructor of the
0097   // data object. Also you can call functions that modify
0098   // the data object after creating it. Often, before this
0099   // you will retrieve data from the EventSetup through the
0100   // record.
0101 #python_begin
0102     if  len(__datatypes__) > 1:
0103         out1 = []
0104         out2 = []
0105         i = 1
0106         for dtype in __datatypes__:
0107             out1.append("  auto p%s = std::make_unique<%s>();" % (i, dtype))
0108             out2.append("std::move(p%s)" % i)
0109             i = i + 1
0110         output  = '\n'.join(out1)
0111         output += "\n  return edm::es::products(%s);" % ', '.join(out2)
0112         print(output)
0113     elif len(__datatypes__) == 1:
0114         print("  auto product = std::make_unique<%s>();" % __datatypes__[0])
0115         print("  return product;")
0116 #python_end
0117 }
0118 
0119 //define this as a plug-in
0120 DEFINE_FWK_EVENTSETUP_MODULE(__class__);