00001 #ifndef Framework_ConfigurableInputSource_h 00002 #define Framework_ConfigurableInputSource_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 ConfigurableInputSource : public InputSource { 00020 public: 00021 explicit ConfigurableInputSource(ParameterSet const& pset, InputSourceDescription const& desc, bool realData = true); 00022 virtual ~ConfigurableInputSource(); 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 static void fillDescription(ParameterSetDescription& desc); 00035 00036 protected: 00037 00038 void setEventNumber(EventNumber_t e) { 00039 RunNumber_t r = run(); 00040 LuminosityBlockNumber_t lb = luminosityBlock(); 00041 eventID_ = EventID(r, lb, e); 00042 eventSet_ = true; 00043 } 00044 void setTime(TimeValue_t t) {presentTime_ = t;} 00045 void reallyReadEvent(); 00046 00047 private: 00048 virtual ItemType getNextItemType(); 00049 virtual void setRunAndEventInfo(); 00050 virtual bool produce(Event& e) = 0; 00051 virtual void beginRun(Run&); 00052 virtual void endRun(Run&); 00053 virtual void beginLuminosityBlock(LuminosityBlock&); 00054 virtual void endLuminosityBlock(LuminosityBlock&); 00055 virtual EventPrincipal* readEvent_(); 00056 virtual boost::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_(); 00057 virtual boost::shared_ptr<RunAuxiliary> readRunAuxiliary_(); 00058 virtual void skip(int offset); 00059 virtual void setRun(RunNumber_t r); 00060 virtual void setLumi(LuminosityBlockNumber_t lb); 00061 virtual void rewind_(); 00062 00063 virtual void postForkReacquireResources(boost::shared_ptr<edm::multicore::MessageReceiverForSource>); 00064 void advanceToNext() ; 00065 void retreatToPrevious(); 00066 00067 unsigned int numberEventsInRun_; 00068 unsigned int numberEventsInLumi_; 00069 TimeValue_t presentTime_; 00070 TimeValue_t origTime_; 00071 unsigned int timeBetweenEvents_; 00072 unsigned int eventCreationDelay_; /* microseconds */ 00073 00074 unsigned int numberEventsInThisRun_; 00075 unsigned int numberEventsInThisLumi_; 00076 unsigned int const zerothEvent_; 00077 EventID eventID_; 00078 EventID origEventID_; 00079 bool newRun_; 00080 bool newLumi_; 00081 bool eventCached_; 00082 bool lumiSet_; 00083 bool eventSet_; 00084 bool isRealData_; 00085 EventAuxiliary::ExperimentType eType_; 00086 00087 //used when process has been forked 00088 boost::shared_ptr<edm::multicore::MessageReceiverForSource> receiver_; 00089 unsigned int numberOfEventsBeforeBigSkip_; 00090 unsigned int numberOfSequentialEvents_; 00091 }; 00092 } 00093 #endif