00001
00002
00003 #ifndef TRIGBUNCHCROSSINGTOOL_WEBBUNCHCROSSINGTOOL_H
00004 #define TRIGBUNCHCROSSINGTOOL_WEBBUNCHCROSSINGTOOL_H
00005
00006
00007 #include <string>
00008 #include <map>
00009 #include <vector>
00010
00011
00012 #include "BunchCrossingToolBase.h"
00013
00014 namespace Trig {
00015
00034 class WebBunchCrossingTool : public BunchCrossingToolBase {
00035
00037 ASG_TOOL_CLASS( WebBunchCrossingTool, Trig::IBunchCrossingTool )
00038
00039 public:
00041 WebBunchCrossingTool( const std::string& name = "WebBunchCrossingTool" );
00042
00044 StatusCode loadConfig( int bgkey );
00046 StatusCode loadConfig( unsigned int run, unsigned int lb );
00047
00063 class IOV {
00064 public:
00066 IOV( unsigned int run = 0, unsigned int lb = 0 );
00068 unsigned int run() const;
00070 unsigned int lb() const;
00072 bool operator< ( const IOV& rhs ) const;
00074 bool operator<=( const IOV& rhs ) const;
00076 bool operator==( const IOV& rhs ) const;
00077 private:
00078 unsigned int m_run;
00079 unsigned int m_lb;
00080 };
00081
00082 protected:
00084 virtual StatusCode beginEvent();
00085
00086 private:
00088 size_t readSize( const char* config ) const;
00090 std::string readJSONConfig( const char* config ) const;
00092 StatusCode cacheJSONConfig( const std::string& data );
00093
00095 std::string m_serverAddress;
00097 int m_serverTimeout;
00098
00099 int m_bgkey;
00100 IOV m_iov;
00101
00102 std::map< int, std::pair< std::vector< int >,
00103 std::vector< int > > > m_knownConfigs;
00108 std::map< std::pair< Trig::WebBunchCrossingTool::IOV,
00109 Trig::WebBunchCrossingTool::IOV >, int > m_configMap;
00110
00111 };
00112
00113 }
00114
00115 #endif // TRIGBUNCHCROSSINGTOOL_WEBBUNCHCROSSINGTOOL_H