Do Hbook and Root histos have a common parent class?
Of course not. I made the classes Histo1d, 2d, and so on, which are the interface to
the real histogram (in case of Hbook, it is not even really an object). So they inherit from a common parent, and they delegate our actions to the real histogram.
This is association at work.
class RootHisto1d : public Histo1d {
RootHisto1d(const char* , const int , const float, const float);
RootHisto1d(const int id , const char* , const int , const float, const float);
virtual void Fill( const float, const float weight =1.);
virtual void print() const;
virtual TH1F * getHistoObject() {return h1d;} ;
Our RootHisto1d object has a TH1F object associated and will delegate the actions to it.
RootHisto1d::RootHisto1d(const char* title , const int bins, const float xl, const float xh)
h1d = new TH1F ( title, title, bins, xl, xh);
void RootHisto1d::Fill (const float x, const float weight)