Retrieving named histograms

Once the histograms have been saved and named in an Objectivity data store, a mechanism for retrieving them is clearly required. The HLocator class allows the retrieval of a histogram by name, as follows:

#include "HTL/HNaming.h" 
... 
  // Locate Histograms pt and 10 
  HLocator myLocator; 
  HPrintert hp(cout); 
  myLocator.init(this); 
  HepRef(PHisto1D) h = myLocator.Histo1D("pt"); 
  if (h != 0) 
    hp.print(*h); 
  h = myLocator.Histo1D(10); 
  if (h != 0) 
    hp.print(*h); 

Notice that the HLocator class provides methods to retrieve different kinds of histograms (so users should know what they are retrieving). Type checking is thus guaranteed and if the expected histogram type does not match the real one, an error message is printed and the return value is zero.