CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDLooper.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: __subsys__/__pkgname__
4 // Class: __class__
5 //
13 //
14 // Original Author: __author__
15 // Created: __date__
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
28 
30 
31 
32 //
33 // class declaration
34 //
35 
36 class __class__ : public edm::ESProducerLooper {
37  public:
39  ~__class__();
40 
41 #python_begin
42  if len(__datatypes__) > 1:
43  datatypes = []
44  for dtype in __datatypes__:
45  datatypes.append("boost::auto_ptr<%s>" % dtype)
46  print " typedef edm::ESProducts<%s> ReturnType;" % ','.join(datatypes)
47  elif len(__datatypes__) == 1:
48  print " typedef std::shared_ptr<%s> ReturnType;" % __datatypes__[0]
49 #python_end
50 
51  ReturnType produce(const recordname&);
52 
53  virtual void beginOfJob();
54  virtual void startingNewLoop(unsigned int ) ;
55  virtual Status duringLoop(const edm::Event&, const edm::EventSetup&) ;
56  virtual Status endOfLoop(const edm::EventSetup&);
57  virtual void endOfJob();
58 private:
59  // ----------member data ---------------------------
60 };
61 
62 //
63 // constants, enums and typedefs
64 //
65 
66 //
67 // static data member definitions
68 //
69 
70 //
71 // constructors and destructor
72 //
74 {
75  //the following line is needed to tell the framework what
76  // data is being produced
77  setWhatProduced(this);
78 
79  //now do what ever other initialization is needed
80 }
81 
82 
84 {
85 
86  // do anything here that needs to be done at desctruction time
87  // (e.g. close files, deallocate resources etc.)
88 
89 }
90 
91 
92 //
93 // member functions
94 //
95 
96 // ------------ method called to produce the data ------------
98 __class__::produce(const recordname& iRecord)
99 {
100  using namespace edm::es;
101 #python_begin
102  out1 = []
103  out2 = []
104  for dtype in __datatypes__:
105  out1.append(" std::auto_ptr<%s> p%s;" % (dtype, dtype))
106  out2.append("p%s" % dtype)
107  output = '\n'.join(out1)
108  output += "\n return products(%s);\n" % ','.join(out2)
109  print output
110 #python_end
111 }
112 
113 
114 // ------------ method called once per job just before starting to loop over events ------------
115 void
117 {
118 }
119 
120 // ------------ method called at the beginning of a new loop over the event ------------
121 // ------------ the argument starts at 0 and increments for each loop ------------
122 void
123 __class__::startingNewLoop(unsigned int iIteration)
124 {
125 }
126 
127 // ------------ called for each event in the loop. The present event loop can be stopped by return kStop ------------
130 {
131  return kContinue;
132 }
133 
134 
135 // ------------ called at the end of each event loop. A new loop will occur if you return kContinue ------------
138 {
139  return kStop;
140 }
141 
142 // ------------ called once each job just before the job ends ------------
143 void
145 {
146 }
147 
148 //define this as a plug-in
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition: EDLooper.cc:98
virtual Status endOfLoop(const edm::EventSetup &)
Definition: EDLooper.cc:137
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:10
virtual Status duringLoop(const edm::Event &, const edm::EventSetup &)
Definition: EDLooper.cc:129
#define DEFINE_FWK_LOOPER(type)
virtual void endOfJob()
Definition: EDLooper.cc:144
__class__()
Definition: Skeleton.cc:30
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
if virtual len(__datatypes__) > 1 void beginOfJob()
Definition: EDLooper.cc:116
std::map< DetId, double > ReturnType
virtual void startingNewLoop(unsigned int)
Definition: EDLooper.cc:123
virtual ~__class__()
Definition: EDAnalyzer.cc:89