CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/Skeletons/scripts/mkTemplates/EDLooper/edlooper.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    loopername
00004 // Class:      loopername
00005 // 
00013 //
00014 // Original Author:  John Doe
00015 //         Created:  day-mon-xx
00016 // RCS(Id)
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include "boost/shared_ptr.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/LooperFactory.h"
00027 #include "FWCore/Framework/interface/ESProducerLooper.h"
00028 
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 
00031 @perl if( 1 lt scalar( @::datatypes ) ) {$result="#include \"FWCore/Framework/interface/ESProducts.h\""; } @\perl
00032 
00033 
00034 //
00035 // class declaration
00036 //
00037 
00038 class loopername : public edm::ESProducerLooper {
00039    public:
00040       loopername(const edm::ParameterSet&);
00041       ~loopername();
00042 
00043       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;
00044 
00045       ReturnType produce(const recordname&);
00046 
00047       virtual void beginOfJob(); 
00048       virtual void startingNewLoop(unsigned int ) ; 
00049       virtual Status duringLoop(const edm::Event&, const edm::EventSetup&) ; 
00050       virtual Status endOfLoop(const edm::EventSetup&); 
00051       virtual void endOfJob();
00052 private:
00053       // ----------member data ---------------------------
00054 };
00055 
00056 //
00057 // constants, enums and typedefs
00058 //
00059 
00060 //
00061 // static data member definitions
00062 //
00063 
00064 //
00065 // constructors and destructor
00066 //
00067 loopername::loopername(const edm::ParameterSet& iConfig)
00068 {
00069    //the following line is needed to tell the framework what
00070    // data is being produced
00071    setWhatProduced(this);
00072 
00073    //now do what ever other initialization is needed
00074 }
00075 
00076 
00077 loopername::~loopername()
00078 {
00079  
00080    // do anything here that needs to be done at desctruction time
00081    // (e.g. close files, deallocate resources etc.)
00082 
00083 }
00084 
00085 
00086 //
00087 // member functions
00088 //
00089 
00090 // ------------ method called to produce the data  ------------
00091 loopername::ReturnType
00092 loopername::produce(const recordname& iRecord)
00093 {
00094    using namespace edm::es;
00095 @perl $result=""; foreach $type (@::datatypes) {$result ="$result   std::auto_ptr<$type> p$type ;\n";} @\perl
00096 
00097    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 ;
00098 }
00099 
00100 
00101 // ------------ method called once per job just before starting to loop over events  ------------
00102 void 
00103 loopername::beginOfJob(const edm::EventSetup&)
00104 {
00105 }
00106 
00107 // ------------ method called at the beginning of a new loop over the event  ------------
00108 // ------------ the argument starts at 0 and increments for each loop        ------------
00109 void 
00110 loopername::startingNewLoop(unsigned int iIteration)
00111 {
00112 }
00113 
00114 // ------------ called for each event in the loop.  The present event loop can be stopped by return kStop ------------
00115 loopername::Status 
00116 loopername::duringLoop(const edm::Event&, const edm::EventSetup&)
00117 {
00118   return kContinue;
00119 }
00120 
00121 
00122 // ------------ called at the end of each event loop. A new loop will occur if you return kContinue ------------
00123 loopername::Status 
00124 loopername::endOfLoop(const edm::EventSetup&, unsigned int)
00125 {
00126   return kStop;
00127 }
00128 
00129 // ------------ called once each job just before the job ends ------------
00130 void 
00131 loopername::endOfJob()
00132 {
00133 }
00134 
00135 //define this as a plug-in
00136 DEFINE_FWK_LOOPER(loopername);