// ---------------------------------------------------------------------- // // HepHist.cc - implementation of generic model for a histogram // // The HepHist model is of a histogram that stores individual // data items into a set of bins that have been previously defined. // Storage occurs at the time of the call. // // HepHist is the base class for creating specialized histograms (which // currently consist of HepHist1D, a one-dimensional histogram; // HepHist2D, a two-dimensional histogram; and HepHistProf, a profile // histogram. HepHist provides very basic methods for obtaining // information about a histogram. The classes derived from this one are // also abstract classes whose concrete implementation depends on a // manager class (a derivative of HepFileManager). // // HepHist objects will not be instantiated. // // See the class declaration for the subclasses of HepHist (HepHist1D, // HepHist2D, and HepHistProf) for their usage. // // // History: // ??-???-19?? Bob Jacobsen Initial draft, based on ideas in HepTuple // and the SLT histogram classes of Joe Boudreau // 05-May-1997 Walter Brown Initial design & draft of Hist class // 22-May-1997 Walter Brown Merged Hist into HepHist // 30-May-1997 Walter Brown Added cloning functions // 29-May-1997 Jason Luther Added comments // 04-Jun-1997 Jason Luther Added comments from HepHist.h // 20-Jun-1997 Walter Brown Added checks for manager's existence // 27-Jul-1997 Walter Brown Make use of new HepObj class // // ---------------------------------------------------------------------- #ifndef HEPTRACE_H #include "HepTuple/HepTrace.h" #endif #ifndef HEPHIST_H #include "HepTuple/HepHist.h" #endif #ifndef HEPFILEMANAGER_H #include "HepTuple/HepFileManager.h" #endif #include "ZMutility/iostream" USING( std::string ) ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ #define BADCALL(fctnName) \ ZMthrow(ZMxHepUnsupported("your Histogram class does not support the "\ #fctnName " call.")); HepHist::HepHist( // constructor HepFileManager * mgr , const string& title , const int idReq ) : HepObj( mgr, title, idReq ) { HEP_DEBUG( "HepHist::constructor( \"" << title << "\", " << id_ << " )" ); if (mgr) mgr->signIn( this ); } // Used for dummy construction ... // the object is then not valid ... HepHist::HepHist() : HepObj() { HEP_DEBUG( "HepHist::constructor( )" ); } HepHist::~HepHist() { // destructor HEP_DEBUG( "HepHist::destructor( \"" << *title_ << "\", " << id_ << " )" ); } ZM_COVARIANT_TYPE(HepObj,HepHist) & HepHist::makeClone( // clone existing histogram, filling bins const string& title , const int id ) const { BADCALL(makeClone()); return *(HepHist*)HepFileManager::deadHepObj(); } ZM_COVARIANT_TYPE(HepObj,HepHist) & HepHist::makeEmpty( // clone existing histogram, but zero bins const string& title , const int id ) const { BADCALL(makeEmpty()); return *(HepHist*)HepFileManager::deadHepObj(); } ZM_COVARIANT_TYPE(HepObj,HepHist) & HepHist::makeClone( // clone existing histogram, filling bins HepFileManager *manager , const string& title , const int id ) const { BADCALL(makeClone()); return *(HepHist*)HepFileManager::deadHepObj(); } ZM_COVARIANT_TYPE(HepObj,HepHist) & HepHist::makeEmpty( // clone existing histogram, but zero bins HepFileManager *manager , const string& title , const int id ) const { BADCALL(makeEmpty()); return *(HepHist*)HepFileManager::deadHepObj(); } void HepHist::reset() { BADCALL(reset()); } ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */