00001 #ifndef ONLINEHTTPREADER_H 00002 #define ONLINEHTTPREADER_H 00003 00004 // Online version of EventStreamHttpReader that works with 00005 // the FUEventProcessor XDAQ application 00006 // TODO: create a common source for this and EventStreamHttpReader 00007 // so we do not duplicate code, and make maintenance easier 00008 // $Id: OnlineHttpReader.h,v 1.2 2008/08/13 21:46:12 wmtan Exp $ 00009 00010 #include "IOPool/Streamer/interface/EventBuffer.h" 00011 #include "IOPool/Streamer/interface/StreamerInputSource.h" 00012 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00013 #include "DataFormats/Provenance/interface/ProductRegistry.h" 00014 00015 #include <vector> 00016 #include <memory> 00017 #include <string> 00018 #include <fstream> 00019 00020 namespace edm 00021 { 00022 struct ReadData; 00023 00024 class OnlineHttpReader : public edm::StreamerInputSource 00025 { 00026 public: 00027 typedef std::vector<char> Buf; 00028 00029 OnlineHttpReader(edm::ParameterSet const& pset, 00030 edm::InputSourceDescription const& desc); 00031 virtual ~OnlineHttpReader(); 00032 00033 virtual std::auto_ptr<edm::EventPrincipal> read(); 00034 void readHeader(); 00035 void registerWithEventServer(); 00036 00037 private: 00038 std::auto_ptr<edm::EventPrincipal> getOneEvent(); 00039 00040 virtual void setRun(RunNumber_t r); 00041 00042 std::string sourceurl_; 00043 char eventurl_[256]; 00044 char headerurl_[256]; 00045 char subscriptionurl_[256]; 00046 Buf buf_; 00047 int hltBitCount; 00048 int l1BitCount; 00049 std::string consumerName_; 00050 std::string consumerPriority_; 00051 std::string consumerPSetString_; 00052 int headerRetryInterval_; 00053 double minEventRequestInterval_; 00054 unsigned int consumerId_; 00055 struct timeval lastRequestTime_; 00056 bool endRunAlreadyNotified_; 00057 bool runEnded_; 00058 bool alreadySaidHalted_; 00059 bool alreadyRegistered_; 00060 bool alreadyGotHeader_; 00061 enum 00062 { 00063 DEFAULT_MAX_CONNECT_TRIES = 360, 00064 DEFAULT_CONNECT_TRY_SLEEP_TIME = 10 00065 }; 00066 int maxConnectTries_; 00067 int connectTrySleepTime_; 00068 }; 00069 00070 } 00071 #endif 00072