Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LdfNTuple.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 
00014 #ifndef RootNTuple_H
00015 #define RootNTuple_H
00016 
00017 #include "RootDataType.h"
00018 
00019 #include "datasrcs/DataSource.h"
00020 
00021 class RootBranch;
00022 class TTree;
00023 class TBranch;
00024 
00031 class MDL_HIPPOPLOT_API RootNTuple : public DataSource
00032 {
00033 
00034  private:
00035 
00038   std::vector < RootBranch * > m_data;
00039 
00042   std::vector < std::vector < double > * >  m_data_cache;
00043 
00047   std::vector < bool > m_multiDimensional;
00048   
00051   TTree * m_tree;
00052 
00055   mutable unsigned int m_cur_entry;
00056 
00058   bool rotateWheels( std::vector< int > & wheels,
00059                      const std::vector < int > & sz,
00060                      unsigned int d );
00061 
00073   int addColumn ( const std::string & label, RootBranch * );
00074 
00075 protected:
00076 
00082   RootNTuple ();
00083 
00086   RootNTuple ( const RootNTuple & );
00087 
00088  public:
00089 
00091   RootNTuple ( TTree * tree );
00092 
00095   virtual ~RootNTuple();
00096 
00100   virtual void copy ( const DataSource & );
00101 
00105   virtual void notifyObservers ( ) const;
00106 
00109   virtual unsigned int rows () const;
00110 
00113   virtual bool empty () const;
00114 
00118   virtual void clear ();
00119 
00122   virtual void reserve ( unsigned int );
00123 
00127   virtual void addRow ( const std::vector < double > & row );
00128 
00132   virtual double 
00133   operator [] (  std::vector < unsigned int > & indices ) const;
00134 
00135   virtual double valueAt ( unsigned int row, unsigned int column ) const;
00136 
00139   hippodraw::RootData::Type getType ( unsigned int column ) const;
00140 
00143   double * doubleArrayAt ( unsigned int row, unsigned int column ) const;
00144 
00147   float * floatArrayAt ( unsigned int row, unsigned int column ) const;
00148 
00151   int * intArrayAt ( unsigned int row, unsigned int column ) const;
00152 
00161   int addColumn ( const std::string & label,
00162                   const std::vector < double > & column );
00163 
00171   void replaceColumn ( unsigned int index,
00172                        const std::vector < double > & data );
00173 
00181   void replaceColumn ( const std::string & label,
00182                        const std::vector < double > & data );
00183 
00184   virtual const std::vector < double > &
00185   getColumn ( const std::string & name ) const;
00186 
00191   virtual const std::vector < double > &
00192   getColumn ( const std::string & name,
00193               const std::vector < int > & indices ) const;
00194 
00195   virtual const std::vector < double > &
00196   getColumn ( unsigned int index ) const;
00197 
00200   virtual const std::vector < double > & getRow ( unsigned int i ) const;
00201 
00208   virtual void setShape ( std::vector < unsigned int > & shape );
00209 
00212   const std::vector < unsigned int > & getShape () const;
00213 
00217   unsigned int getRank () const;
00218 
00221   virtual bool isMultiDimensional ( const std::string & column ) const;
00222     
00226   virtual bool setReleventIndex( const std::string & column,
00227                                  const std::vector< unsigned int >& index );
00228   
00234   const std::vector < int > & rowDataDimSize ( const std::string &
00235                                                column ) const;
00236 
00239   const std::vector < int > & getColumnShape ( unsigned int column ) const;
00240 
00242   TBranch * getTBranch(  const std::string & column );
00243   
00250   void smartExpandRootNTuple( const std::string & column ) const;
00251 
00259   void expandIfNeeded ( const std::vector < std::string > & labels ) const;
00260 
00264   std::string 
00265   createBinding ( const std::string & name, 
00266                   const std::vector < int > & indices ) const;
00267 
00268 private:
00269 
00270   void expandIfNeeded ( const std::string & label ) const;
00271 
00274   void initBranches ();
00275 
00278   void fillDataCache ( unsigned int column );
00279   
00280 };
00281 
00282 #endif // RootNTuple_H

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3