#ifndef HEPROOTNTUPLE_H #define HEPROOTNTUPLE_H // ---------------------------------------------------------------------- // // HepRootNtuple.h - class declaration for Root n-tuple // // HepRootNtuple is the implementation of the Root n-tuple // It is derived from HepNtuple (the generic interface). // It is mainly a C++ wrapper around the Root // histogramming libraries. // // No HepRootNtuple objects are ever directly // instantiated by the programmer. When creating new HepNtuple* objects, // the manager is in charge of creating the appropriate HepRoot object. // // To use generate Root n-tuple, HepRootFileManager must be used: // // int lunit = 10; // HepFileManager* m = new HepRootFileManager("filename.rz", lunit); // : // : // HepNtuple& h(m->newHepNtuple("Title")); // [define HepNtuple] // : // [gather data] // : // h->capture(); // // // // History: // 26-Aug-1998 Philippe Canal Initial draft // // ---------------------------------------------------------------------- #ifndef HEPROOTFILEMANAGER_H #include "HepTuple/HepRootFileManager.h" #endif #ifndef HEPTUPLE_H #include "HepTuple/HepNtuple.h" #endif #ifndef HEPROOTOBJ_H #include "HepTuple/HepRootObj.h" #endif class TTree; ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ class HepRootNtuple : public HepNtuple, public HepRootObj { friend class HepRootFileManager; protected: // create a ntuple with an existing root TTree HepRootNtuple( HepRootFileManager * manager, TTree* histo ); // create a ntuple with the given title and binning HepRootNtuple( HepRootFileManager * manager , const std::string& title , const int id_req = 0 ); // Used for dummy construction ... // the object is then not valid ... HepRootNtuple( ); // default constructor public: virtual ~HepRootNtuple(); // clone an existing 1D histogram HepRootNtuple( HepRootNtuple * 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 Root ntuple. virtual bool setStorageLocation(unsigned char newLocation); // override this function to prevent change of storage location // after actual creation of the Root ntuple. virtual bool setNwbuffValue(int nwbuff); // override this function to do the actual Root setting necessary // NOTE: the change is NOT local to this NTuple !! virtual bool setBuffLimitValue(int limit); // over-ride this function to do the actual root setting. 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 bool restoreNtuple(); // This function restores the details of the internal structure // for an existing ntuple bool setAddresses(); // This function makes the needed set-up to an existing // Column Wise Ntuple private: // forbidden operations, hence private: //HepRootNtuple( ); // default constructor HepRootNtuple( const HepRootNtuple & ); // copy constructor HepRootNtuple & operator=( const HepRootNtuple & ); // assignment std::string flipString( std::string ); // restoreNtuple helper function int _nColumnCreated; // Number of column created in a N-Tuple // data to help caching of reading calls Float4* _lastRwnArray; void* _lastArrayRead; int _lastRowRead; bool _addrSetUp; }; // HepRootNtuple ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPROOTNTUPLE_H