00001 #ifndef Framework_ConfigurableInputSource_h 00002 #define Framework_ConfigurableInputSource_h 00003 00004 /*---------------------------------------------------------------------- 00005 $Id: ConfigurableInputSource.h,v 1.33 2008/07/31 23:17:14 wmtan Exp $ 00006 ----------------------------------------------------------------------*/ 00007 00008 #include "boost/shared_ptr.hpp" 00009 00010 #include "FWCore/Framework/interface/InputSource.h" 00011 #include "FWCore/Framework/interface/Frameworkfwd.h" 00012 #include "DataFormats/Provenance/interface/EventAuxiliary.h" 00013 #include "DataFormats/Provenance/interface/EventID.h" 00014 #include "DataFormats/Provenance/interface/Timestamp.h" 00015 #include "DataFormats/Provenance/interface/LuminosityBlockID.h" 00016 #include "DataFormats/Provenance/interface/RunID.h" 00017 00018 namespace edm { 00019 class ParameterSet; 00020 class ConfigurableInputSource : public InputSource { 00021 public: 00022 explicit ConfigurableInputSource(ParameterSet const& pset, InputSourceDescription const& desc, bool realData = true); 00023 virtual ~ConfigurableInputSource(); 00024 00025 unsigned int numberEventsInRun() const {return numberEventsInRun_;} 00026 unsigned int numberEventsInLumi() const {return numberEventsInLumi_;} 00027 TimeValue_t presentTime() const {return presentTime_;} 00028 unsigned int timeBetweenEvents() const {return timeBetweenEvents_;} 00029 unsigned int eventCreationDelay() const {return eventCreationDelay_;} 00030 unsigned int numberEventsInThisRun() const {return numberEventsInThisRun_;} 00031 unsigned int numberEventsInThisLumi() const {return numberEventsInThisLumi_;} 00032 RunNumber_t run() const {return eventID_.run();} 00033 EventNumber_t event() const {return eventID_.event();} 00034 LuminosityBlockNumber_t luminosityBlock() const {return luminosityBlock_;} 00035 00036 protected: 00037 00038 void setEventNumber(EventNumber_t e) { 00039 RunNumber_t r = run(); 00040 eventID_ = EventID(r, e); 00041 eventSet_ = true; 00042 } 00043 void setTime(TimeValue_t t) {presentTime_ = t;} 00044 void reallyReadEvent(LuminosityBlockNumber_t lumi); 00045 00046 private: 00047 virtual ItemType getNextItemType(); 00048 virtual void setRunAndEventInfo(); 00049 virtual bool produce(Event & e) = 0; 00050 virtual void beginRun(Run &); 00051 virtual void endRun(Run &); 00052 virtual void beginLuminosityBlock(LuminosityBlock &); 00053 virtual void endLuminosityBlock(LuminosityBlock &); 00054 virtual std::auto_ptr<EventPrincipal> readEvent_(); 00055 virtual boost::shared_ptr<LuminosityBlockPrincipal> readLuminosityBlock_(); 00056 virtual boost::shared_ptr<RunPrincipal> readRun_(); 00057 virtual void skip(int offset); 00058 virtual void setRun(RunNumber_t r); 00059 virtual void setLumi(LuminosityBlockNumber_t lb); 00060 virtual void rewind_(); 00061 00062 unsigned int numberEventsInRun_; 00063 unsigned int numberEventsInLumi_; 00064 TimeValue_t presentTime_; 00065 TimeValue_t origTime_; 00066 unsigned int timeBetweenEvents_; 00067 unsigned int eventCreationDelay_; /* microseconds */ 00068 00069 unsigned int numberEventsInThisRun_; 00070 unsigned int numberEventsInThisLumi_; 00071 unsigned int const zerothEvent_; 00072 EventID eventID_; 00073 EventID origEventID_; 00074 LuminosityBlockNumber_t luminosityBlock_; 00075 LuminosityBlockNumber_t origLuminosityBlockNumber_t_; 00076 bool newRun_; 00077 bool newLumi_; 00078 bool lumiSet_; 00079 bool eventSet_; 00080 std::auto_ptr<EventPrincipal> ep_; 00081 bool isRealData_; 00082 EventAuxiliary::ExperimentType eType_; 00083 }; 00084 } 00085 #endif