/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 /* 00002 * StatisticsSvc 00003 * 00004 * Provides 'Event Store' like access to ROOT objects (hist, graph, tree, etc.) 00005 * - Data can be shared between algorithms. 00006 * - Data is not cleared each event loop, so it can be used to collect 00007 * statistics, fill trees, etc. 00008 * 00009 * Created by Dan Dwyer on 2009/01/21 00010 */ 00011 00012 #ifndef DATASVC_STATISTICSSVC_H 00013 #define DATASVC_STATISTICSSVC_H 00014 00015 #include "StatisticsSvc/IStatisticsSvc.h" 00016 #include "GaudiKernel/Service.h" 00017 #include <string> 00018 #include <vector> 00019 #include <map> 00020 00021 class TFile; 00022 class HistMan; 00023 class IMessageSvc; 00024 00025 class StatisticsSvc : public Service, 00026 virtual public IStatisticsSvc 00027 { 00028 public: 00029 // Service interface implementation 00030 StatisticsSvc(const std::string& name, ISvcLocator *svc); 00031 ~StatisticsSvc(); 00032 virtual StatusCode initialize(); 00033 virtual StatusCode finalize(); 00034 virtual StatusCode queryInterface(const InterfaceID& riid, 00035 void** ppvInterface); 00036 00037 // IStatisticsSvc interface implementation 00038 00044 virtual StatusCode put(const std::string& path, TObject* object); 00047 virtual TObject* get(const std::string& path); 00049 virtual bool exists(const std::string& path); 00053 virtual std::vector<std::string> getContents(const std::string& path); 00057 virtual std::vector<std::string> getSubFolders(const std::string& path); 00058 00060 00063 virtual TH1F* getTH1F(const std::string& path); 00066 virtual TH2F* getTH2F(const std::string& path); 00069 virtual TH3F* getTH3F(const std::string& path); 00072 virtual TTree* getTree(const std::string& path); 00075 virtual TGraph* getGraph(const std::string& path); 00076 00077 private: 00078 StatusCode checkOptions(std::string& handle, std::string& filename); 00079 StatusCode parsePath(const std::string& fullpath, std::string& top, 00080 std::string& rest); 00081 StatusCode reverseParsePath(const std::string& fullpath, 00082 std::string& rest, 00083 std::string& bottom); 00084 StatusCode getManager(const std::string& path, HistMan*& hm, 00085 std::string& localPath, bool report = true); 00086 void dump(); 00087 void dumpPath(const std::string& path, std::ostringstream& dumpStr); 00088 00089 private: 00094 std::map<std::string,std::string> m_input; 00095 00100 std::map<std::string,std::string> m_output; 00101 00102 // Handle to message service 00103 IMessageSvc* m_msgSvc; 00104 00105 // Map of all files by filename (myfile0.root, myfile1.root, etc.) 00106 std::map<std::string, TFile*> m_files; 00107 00108 // Map of HistMan instances by logical name (path0, path1, etc.) 00109 std::map<std::string, HistMan*> m_histMan; 00110 00111 }; 00112 00113 #endif // DATASVC_STATISTICSSVC_H