Rivet  1.8.3
HistoHandler.hh
1 // -*- C++ -*-
2 #ifndef RIVET_HistoHandler_HH
3 #define RIVET_HistoHandler_HH
4 
5 #include "Rivet/Rivet.hh"
6 #include "Rivet/Tools/Logging.fhh"
7 #include "Rivet/Analysis.fhh"
8 
9 namespace Rivet {
10 
12  class AnalysisObject;
13 
14 
26  class HistoHandler {
27  private:
28 
30 
31 
33  HistoHandler() { }
34 
36  ~HistoHandler();
37 
39  HistoHandler& operator=(const HistoHandler&);
40 
42  HistoHandler(const HistoHandler&);
43 
45 
46 
47  public:
48 
51  static HistoHandler _instance;
52  return _instance;
53  }
54 
55 
57 
58 
59  public:
61 
62  const AnalysisObject* registerAnalysisObject(const Analysis& parent,
64  const AnalysisObject& histo,
65  const string& name);
66 
67 
69 
70 
72  const AnalysisObject* getAnalysisObject(const Analysis& parent,
73  const string& name) const {
74  return _getAnalysisObject(parent, name);
75  }
76 
77 
79  AnalysisObject* getAnalysisObject(const Analysis& parent,
80  const string& name) {
81  return _getAnalysisObject(parent, name);
82  }
83 
85 
86 
89  void clear();
90 
91 
92  private:
93 
94  AnalysisObject* _getAnalysisObject(const Analysis& parent,
95  const string& name) const;
96 
98  Log& getLog() const;
99 
100 
101  private:
102 
104  typedef const AnalysisObject* HistoHandle;
105 
107  typedef vector<HistoHandle> HistoHandles;
108 
111  typedef map<const string, HistoHandle> NamedHistos;
112 
114  typedef map<const Analysis*, NamedHistos> NamedHistosMap;
115 
117  NamedHistosMap _namedhistos;
118  };
119 
120 
121 }
122 
123 #endif
Definition: MC_JetAnalysis.hh:9
void clear()
Definition: HistoHandler.cc:17
const AnalysisObject * getAnalysisObject(const Analysis &parent, const string &name) const
Retrieve a named histo for the given Analysis parent (const version).
Definition: HistoHandler.hh:72
AnalysisObject * getAnalysisObject(const Analysis &parent, const string &name)
Retrieve a named histo for the given Analysis parent (non-const version).
Definition: HistoHandler.hh:79
Definition: Logging.hh:9
This is the base class of all analysis classes in Rivet.
Definition: Analysis.hh:51
static HistoHandler & getInstance()
Singleton getter function.
Definition: HistoHandler.hh:50
const AnalysisObject * registerAnalysisObject(const Analysis &parent, const AnalysisObject &histo, const string &name)
Copy an analysis object into a central collection and return the copy.
Definition: HistoHandler.cc:28
The projection handler is a central repository for histograms (and other analysis stats objects) to b...
Definition: HistoHandler.hh:26