CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/FWCore/Framework/interface/ConfigurableInputSource.h

Go to the documentation of this file.
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     virtual size_t fileIndex() const {return 0UL;}
00063     virtual void nextEvent() {}
00064 
00065     virtual void postForkReacquireResources(boost::shared_ptr<edm::multicore::MessageReceiverForSource>);
00066     void advanceToNext() ;
00067     void retreatToPrevious();
00068 
00069     unsigned int numberEventsInRun_;
00070     unsigned int numberEventsInLumi_;
00071     TimeValue_t presentTime_;
00072     TimeValue_t origTime_;
00073     TimeValue_t timeBetweenEvents_;
00074     unsigned int eventCreationDelay_;  /* microseconds */
00075 
00076     unsigned int numberEventsInThisRun_;
00077     unsigned int numberEventsInThisLumi_;
00078     unsigned int const zerothEvent_;
00079     EventID eventID_;
00080     EventID origEventID_;
00081     bool newRun_;
00082     bool newLumi_;
00083     bool eventCached_;
00084     bool lumiSet_;
00085     bool eventSet_;
00086     bool isRealData_;
00087     EventAuxiliary::ExperimentType eType_;
00088      
00089     //used when process has been forked
00090     boost::shared_ptr<edm::multicore::MessageReceiverForSource> receiver_;
00091     unsigned int numberOfEventsBeforeBigSkip_;
00092     unsigned int numberOfSequentialEvents_;
00093   };
00094 }
00095 #endif