Rivet  1.8.0
HistoHandler.hh
00001 // -*- C++ -*-
00002 #ifndef RIVET_HistoHandler_HH
00003 #define RIVET_HistoHandler_HH
00004 
00005 #include "Rivet/Rivet.hh"
00006 #include "Rivet/Tools/Logging.fhh"
00007 #include "Rivet/Analysis.fhh"
00008 
00009 namespace Rivet {
00010 
00012   class AnalysisObject;
00013 
00014 
00026   class HistoHandler {
00027   private:
00028 
00030 
00031 
00033     HistoHandler() { }
00034 
00036     ~HistoHandler();
00037 
00039     HistoHandler& operator=(const HistoHandler&);
00040 
00042     HistoHandler(const HistoHandler&);
00043 
00045 
00046 
00047   public:
00048 
00050     static HistoHandler& getInstance() {
00051       static HistoHandler _instance;
00052       return _instance;
00053     }
00054 
00055 
00057 
00058 
00059   public:
00061 
00062 
00063     const AnalysisObject* registerAnalysisObject(const Analysis& parent,
00064                                                  const AnalysisObject& histo,
00065                                                  const string& name);
00066 
00067 
00069 
00070 
00072     const AnalysisObject* getAnalysisObject(const Analysis& parent,
00073                                             const string& name) const {
00074       return _getAnalysisObject(parent, name);
00075     }
00076 
00077 
00079     AnalysisObject* getAnalysisObject(const Analysis& parent,
00080                                       const string& name) {
00081       return _getAnalysisObject(parent, name);
00082     }
00083 
00085 
00086 
00089     void clear();
00090 
00091 
00092   private:
00093 
00094     AnalysisObject* _getAnalysisObject(const Analysis& parent,
00095                                              const string& name) const;
00096 
00098     Log& getLog() const;
00099 
00100 
00101   private:
00102 
00104     typedef const AnalysisObject* HistoHandle;
00105 
00107     typedef vector<HistoHandle> HistoHandles;
00108 
00111     typedef map<const string, HistoHandle> NamedHistos;
00112 
00114     typedef map<const Analysis*, NamedHistos> NamedHistosMap;
00115 
00117     NamedHistosMap _namedhistos;
00118   };
00119 
00120 
00121 }
00122 
00123 #endif