00001 #ifndef Framework_Sources_ProducerSourceBase_h 00002 #define Framework_Sources_ProducerSourceBase_h 00003 00004 /*---------------------------------------------------------------------- 00005 ----------------------------------------------------------------------*/ 00006 00007 #include "FWCore/Framework/interface/InputSource.h" 00008 #include "FWCore/Framework/interface/Frameworkfwd.h" 00009 #include "DataFormats/Provenance/interface/EventAuxiliary.h" 00010 #include "DataFormats/Provenance/interface/EventID.h" 00011 #include "DataFormats/Provenance/interface/Timestamp.h" 00012 #include "DataFormats/Provenance/interface/RunID.h" 00013 00014 #include "boost/shared_ptr.hpp" 00015 00016 namespace edm { 00017 class ParameterSet; 00018 class ParameterSetDescription; 00019 class ProducerSourceBase : public InputSource { 00020 public: 00021 explicit ProducerSourceBase(ParameterSet const& pset, InputSourceDescription const& desc, bool realData); 00022 virtual ~ProducerSourceBase(); 00023 00024 unsigned int numberEventsInRun() const {return numberEventsInRun_;} 00025 unsigned int numberEventsInLumi() const {return numberEventsInLumi_;} 00026 TimeValue_t presentTime() const {return presentTime_;} 00027 unsigned int timeBetweenEvents() const {return timeBetweenEvents_;} 00028 unsigned int eventCreationDelay() const {return eventCreationDelay_;} 00029 unsigned int numberEventsInThisRun() const {return numberEventsInThisRun_;} 00030 unsigned int numberEventsInThisLumi() const {return numberEventsInThisLumi_;} 00031 RunNumber_t run() const {return eventID_.run();} 00032 EventNumber_t event() const {return eventID_.event();} 00033 LuminosityBlockNumber_t luminosityBlock() const {return eventID_.luminosityBlock();} 00034 00035 static void fillDescription(ParameterSetDescription& desc); 00036 00037 protected: 00038 00039 private: 00040 virtual ItemType getNextItemType(); 00041 virtual bool setRunAndEventInfo(EventID& id, TimeValue_t& time) = 0; 00042 virtual void produce(Event& e) = 0; 00043 virtual void beginRun(Run&); 00044 virtual void endRun(Run&); 00045 virtual void beginLuminosityBlock(LuminosityBlock&); 00046 virtual void endLuminosityBlock(LuminosityBlock&); 00047 virtual EventPrincipal* readEvent_(EventPrincipal& eventPrincipal); 00048 virtual boost::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_(); 00049 virtual boost::shared_ptr<RunAuxiliary> readRunAuxiliary_(); 00050 virtual void skip(int offset); 00051 virtual void rewind_(); 00052 00053 void advanceToNext(EventID& eventID, TimeValue_t& time); 00054 void retreatToPrevious(EventID& eventID, TimeValue_t& time); 00055 00056 unsigned int numberEventsInRun_; 00057 unsigned int numberEventsInLumi_; 00058 TimeValue_t presentTime_; 00059 TimeValue_t origTime_; 00060 TimeValue_t timeBetweenEvents_; 00061 unsigned int eventCreationDelay_; /* microseconds */ 00062 00063 unsigned int numberEventsInThisRun_; 00064 unsigned int numberEventsInThisLumi_; 00065 unsigned int const zerothEvent_; 00066 EventID eventID_; 00067 EventID origEventID_; 00068 bool isRealData_; 00069 EventAuxiliary::ExperimentType eType_; 00070 }; 00071 } 00072 #endif