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: loopername
4 // Class: loopername
5 //
13 //
14 // Original Author: John Doe
15 // Created: day-mon-xx
16 // RCS(Id)
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include "boost/shared_ptr.hpp"
24 
25 // user include files
28 
30 
31 @perl if( 1 lt scalar( @::datatypes ) ) {$result="#include \"FWCore/Framework/interface/ESProducts.h\""; } @\perl
32 
33 
34 //
35 // class declaration
36 //
37 
39  public:
41  ~loopername();
42 
43  typedef @perl if( 1 eq scalar( @::datatypes ) ) { $result="std::auto_ptr<$::datatypes[0]>"; } else { $result="edm::ESProducts<"; $line = 0; foreach $type ( @::datatypes ) { if ($line) { $result = "$result, "; } $result= "$result $type"; $line =1;} $result="$result>"; } @\perl ReturnType;
44 
45  ReturnType produce(const recordname&);
46 
47  virtual void beginOfJob();
48  virtual void startingNewLoop(unsigned int ) ;
49  virtual Status duringLoop(const edm::Event&, const edm::EventSetup&) ;
50  virtual Status endOfLoop(const edm::EventSetup&);
51  virtual void endOfJob();
52 private:
53  // ----------member data ---------------------------
54 };
55 
56 //
57 // constants, enums and typedefs
58 //
59 
60 //
61 // static data member definitions
62 //
63 
64 //
65 // constructors and destructor
66 //
68 {
69  //the following line is needed to tell the framework what
70  // data is being produced
71  setWhatProduced(this);
72 
73  //now do what ever other initialization is needed
74 }
75 
76 
78 {
79 
80  // do anything here that needs to be done at desctruction time
81  // (e.g. close files, deallocate resources etc.)
82 
83 }
84 
85 
86 //
87 // member functions
88 //
89 
90 // ------------ method called to produce the data ------------
92 loopername::produce(const recordname& iRecord)
93 {
94  using namespace edm::es;
95 @perl $result=""; foreach $type (@::datatypes) {$result ="$result std::auto_ptr<$type> p$type ;\n";} @\perl
96 
97  return @perl if( 1 eq scalar( @::datatypes ) ) { $result="p$::datatypes[0]" } else { $result="products("; $line = 0; foreach $type ( @::datatypes ) { if ($line) { $result = "$result,"; } $result= "$result $type"; $line +=1; } $result="$result)"; } @\perl ;
98 }
99 
100 
101 // ------------ method called once per job just before starting to loop over events ------------
102 void
104 {
105 }
106 
107 // ------------ method called at the beginning of a new loop over the event ------------
108 // ------------ the argument starts at 0 and increments for each loop ------------
109 void
110 loopername::startingNewLoop(unsigned int iIteration)
111 {
112 }
113 
114 // ------------ called for each event in the loop. The present event loop can be stopped by return kStop ------------
117 {
118  return kContinue;
119 }
120 
121 
122 // ------------ called at the end of each event loop. A new loop will occur if you return kContinue ------------
125 {
126  return kStop;
127 }
128 
129 // ------------ called once each job just before the job ends ------------
130 void
132 {
133 }
134 
135 //define this as a plug-in
ReturnType produce(const recordname &)
Definition: edlooper.cc:92
virtual Status endOfLoop(const edm::EventSetup &)
Definition: edlooper.cc:124
#define DEFINE_FWK_LOOPER(type)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
~loopername()
Definition: edlooper.cc:77
virtual Status duringLoop(const edm::Event &, const edm::EventSetup &)
Definition: edlooper.cc:116
virtual void startingNewLoop(unsigned int)
Definition: edlooper.cc:110
else $result
Definition: edlooper.cc:43
virtual void beginOfJob()
Definition: edlooper.cc:103
foreach $type(@::datatypes)
Definition: edlooper.cc:43
loopername(const edm::ParameterSet &)
Definition: edlooper.cc:67
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
virtual void endOfJob()
Definition: edlooper.cc:131
perl ReturnType
Definition: edlooper.cc:43
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:184