Let’s review what we did with the designs
We made an abstract class HistogramFactory which are subclassed by a HbookHistogramFactory and a RootHistogramFactory. One will create Hbook histogram objects, the other one Root histogram objects. The objects returned have a common parent, and our code will deal with the parent class only, that is, with any implementation of histograms which inherit from the parent, without recompilation.
We made each of the factories a singleton. It will not be possible to have more than one instance of a given object. In this way we prevent conflicts which we would have if there were more than one instance of a factory.
Design patterns can give you a lot of help in designing your object model and save a lot of time.