Go to the documentation of this file.00001 #ifndef FWCore_Framework_EDProducer_h
00002 #define FWCore_Framework_EDProducer_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "FWCore/Framework/interface/ProducerBase.h"
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00016
00017 #include <string>
00018 #include <vector>
00019
00020 namespace edm {
00021 class EDProducer : public ProducerBase {
00022 public:
00023 template <typename T> friend class WorkerT;
00024 typedef EDProducer ModuleType;
00025 typedef WorkerT<EDProducer> WorkerType;
00026
00027 EDProducer ();
00028 virtual ~EDProducer();
00029
00030 static void fillDescriptions(ConfigurationDescriptions& descriptions);
00031 static const std::string& baseType();
00032
00033 protected:
00034
00035
00036 CurrentProcessingContext const* currentContext() const;
00037
00038 private:
00039 bool doEvent(EventPrincipal& ep, EventSetup const& c,
00040 CurrentProcessingContext const* cpcp);
00041 void doBeginJob();
00042 void doEndJob();
00043 bool doBeginRun(RunPrincipal& rp, EventSetup const& c,
00044 CurrentProcessingContext const* cpc);
00045 bool doEndRun(RunPrincipal& rp, EventSetup const& c,
00046 CurrentProcessingContext const* cpc);
00047 bool doBeginLuminosityBlock(LuminosityBlockPrincipal& lbp, EventSetup const& c,
00048 CurrentProcessingContext const* cpc);
00049 bool doEndLuminosityBlock(LuminosityBlockPrincipal& lbp, EventSetup const& c,
00050 CurrentProcessingContext const* cpc);
00051 void doRespondToOpenInputFile(FileBlock const& fb);
00052 void doRespondToCloseInputFile(FileBlock const& fb);
00053 void doRespondToOpenOutputFiles(FileBlock const& fb);
00054 void doRespondToCloseOutputFiles(FileBlock const& fb);
00055 void doPreForkReleaseResources();
00056 void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
00057 void registerAnyProducts(EDProducer* module, ProductRegistry* reg) {
00058 registerProducts(module, reg, moduleDescription_);
00059 }
00060
00061 std::string workerType() const {return "WorkerT<EDProducer>";}
00062
00063 virtual void produce(Event&, EventSetup const&) = 0;
00064 virtual void beginJob() {}
00065 virtual void endJob(){}
00066 virtual void beginRun(Run&, EventSetup const&){}
00067 virtual void endRun(Run&, EventSetup const&){}
00068 virtual void beginLuminosityBlock(LuminosityBlock&, EventSetup const&){}
00069 virtual void endLuminosityBlock(LuminosityBlock&, EventSetup const&){}
00070 virtual void respondToOpenInputFile(FileBlock const& fb) {}
00071 virtual void respondToCloseInputFile(FileBlock const& fb) {}
00072 virtual void respondToOpenOutputFiles(FileBlock const& fb) {}
00073 virtual void respondToCloseOutputFiles(FileBlock const& fb) {}
00074 virtual void preForkReleaseResources() {}
00075 virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {}
00076
00077 void setModuleDescription(ModuleDescription const& md) {
00078 moduleDescription_ = md;
00079 }
00080 ModuleDescription moduleDescription_;
00081 CurrentProcessingContext const* current_context_;
00082 std::vector<BranchID> previousParentage_;
00083 ParentageID previousParentageId_;
00084 };
00085 }
00086
00087 #endif