00001 #ifndef EVENTSTREAMSERVICE_H 00002 #define EVENTSTREAMSERVICE_H 00003 00004 // $Id: EventStreamService.h,v 1.2 2008/09/04 17:44:13 biery Exp $ 00005 00006 // - handling output files per stream make the problem 1-dimensional 00007 // - allows to use different file handling rules per stream 00008 00009 // functionality: 00010 // - create and delete output service 00011 // - pass init and event message to correct output service 00012 // - do accounting 00013 // - enforce file management rules 00014 00015 // needs: 00016 // - event selector 00017 // - copy of init message to create a new file 00018 // - filename, rules, etc. 00019 00020 #include <FWCore/Framework/interface/EventSelector.h> 00021 00022 #include <IOPool/Streamer/interface/InitMessage.h> 00023 #include <IOPool/Streamer/interface/EventMessage.h> 00024 00025 #include <EventFilter/StorageManager/interface/StreamService.h> 00026 00027 namespace edm { 00028 00029 class EventStreamService : public StreamService 00030 { 00031 public: 00032 EventStreamService(ParameterSet const&, InitMsgView const&); 00033 ~EventStreamService() { stop(); } 00034 00035 bool nextEvent(const uint8 * const); 00036 void stop(); 00037 void report(std::ostream &os, int indentation) const; 00038 00039 void closeTimedOutFiles(int lumi, double timeoutstart); 00040 void closeTimedOutFiles(); 00041 00042 private: 00043 boost::shared_ptr<OutputService> newOutputService(); 00044 boost::shared_ptr<OutputService> getOutputService(EventMsgView const&); 00045 boost::shared_ptr<FileRecord> generateFileRecord(); 00046 00047 void saveInitMessage(InitMsgView const&); 00048 void initializeSelection(InitMsgView const&); 00049 bool acceptEvent(EventMsgView const&); 00050 bool checkEvent(boost::shared_ptr<FileRecord>, EventMsgView const&) const; 00051 00052 // variables 00053 boost::shared_ptr<edm::EventSelector> eventSelector_; 00054 00055 // set from init message ( is init message ) 00056 std::vector<unsigned char> saved_initmsg_; 00057 00058 }; 00059 00060 } // edm namespace 00061 #endif