#ifndef HEPHISTONTUPLE_H #define HEPHISTONTUPLE_H // ---------------------------------------------------------------------- // // HepHistoNtuple.h - class declaration for Histo n-tuple // // HepHistoNtuple is the implementation of the Histo n-tuple // It is derived from HepNtuple (the generic interface). // It is mainly a C++ wrapper around the CERNlib Histo // Fortran histogramming libraries. // // No HepHistoNtuple objects are ever directly // instantiated by the programmer. When creating new HepNtuple* objects, // the manager is in charge of creating the appropriate HepHisto object. // // To use generate Histo n-tuple, HepHistoFileManager must be used: // // int lunit = 10; // HepFileManager* m = new HepHistoFileManager("filename.rz", lunit); // : // : // HepNtuple& h(m->newHepNtuple("Title")); // [define HepNtuple] // : // [gather data] // : // h->capture(); // // // Note that the constructor can take an ID number which is used by // the Histo implementation of HepNtuple. If omitted, the ID number is // generated automatically (which is recommended). The ID number is // available through the id() method. // // // History: // 20-Aug-1998 Philippe Canal Bare Creation // // ---------------------------------------------------------------------- #ifndef HEPHISTOFILEMANAGER_H #include "HepTuple/HepHistoFileManager.h" #endif #ifndef HEPTUPLE_H #include "HepTuple/HepNtuple.h" #endif ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ class HepHistoNtuple : public HepNtuple { friend class HepHistoFileManager; protected: // create a 1D histogram with the given title and binning HepHistoNtuple( HepHistoFileManager * manager , const std::string& title , const int id_req = 0 , const int histo_id = 0 ); // Used for dummy construction ... // the object is then not valid ... HepHistoNtuple( ); // default constructor public: virtual ~HepHistoNtuple(); // clone an existing 1D histogram HepHistoNtuple( HepNtuple * original , const std::string& title , const int id_req = 0 ); virtual bool isNameAvailable ( const std::string& nameTag) const; virtual const TupleNameTag& parseNameTag ( TupleNameTag& what, const std::string& nameTag, bool WithIndices = false) const; protected: virtual bool isRowWiseEnabled() const; virtual bool isColumnWiseEnabled() const; virtual bool isBlockWiseEnabled() const; virtual bool isDiskResidentEnabled() const; virtual bool isMemResidentEnabled() const; virtual bool isSharedMemoryEnabled() const; virtual bool isNwbuffEnabled(int nwbuff) const; virtual bool isBuffLimitEnabled(int limit) const; virtual bool isDemandBuffersEnabled() const; virtual bool isCircularBufferEnabled() const; virtual bool isCaseSensitive() const; // These methods tell if a manager can handle a certain type in // the given block. virtual bool isTypeEnabled(ColumnData_t type,Block *bk); virtual bool isTypeEnabled(ColumnData_t type); virtual bool setStorageGeometry(StorageGeometryName newStrategy); // override this function to prevent change of storage strategy // after actual creation of the Histo ntuple. virtual bool setStorageLocation(unsigned char newLocation); // override this function to prevent change of storage location // after actual creation of the Histo ntuple. virtual bool setNwbuffValue(int nwbuff); // override this function to do the actual Histo setting necessary // NOTE: the change is NOT local to this NTuple !! // NOTE: this is not available is Histo-scope virtual bool setBuffLimitValue(int limit); // over-ride this function to do the actual histo setting. // NOTE: the value is 'per column' in histoscope virtual bool book(); // this method should implement the booking the ntuple parts virtual bool bookRowWise(); virtual bool bookColumnWise(); virtual bool storeWholeRow(); virtual bool storeSingleBlock(Block* bk); // Instruct the manager to store the row/block virtual int readWholeRow(int irow); virtual int readWholeBlock(Block* bk, int irow); virtual int readSingleColumn(Column* col, int irow); virtual int readSingleColumn(Column* col, const std::string& indices, int irow, void * val); virtual int readSingleColumn(Column* col, int irow, void * val); // Instruct the manager to read from file/memory into the destination // variable of all the columns of repectively the row, block, single column // ALL the listed columns are expected to have destination variables // (i,e. get the value at an address and send it to col->set(void *addr); // function to help caching of reading calls Float4* readRWNrow(int irow); bool restoreNtuple(); // This function restores the details of the internal structure // for an existing ntuple int histo_id(int new_id=-1); // return or set the histo-scope id of this object private: // forbidden operations, hence private: //HepHistoNtuple( ); // default constructor HepHistoNtuple( const HepHistoNtuple & ); // copy constructor HepHistoNtuple & operator=( const HepHistoNtuple & ); // assignment int _nColumnCreated; // Number of column created in a row wise N-Tuple // data to help caching of reading calls Float4* _lastRwnArray; void* _lastArrayRead; int _lastRowRead; // remember the Histoscope id for quick reference int histo_id_; bool isVersion5_; }; // HepHistoNtuple ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPHISTONTUPLE_H