RootNTuple.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 
14 #ifndef RootNTuple_H
15 #define RootNTuple_H
16 
17 #include "RootDataType.h"
18 
19 #include "datasrcs/DataSource.h"
20 
21 class TTree;
22 class TBranch;
23 
24 namespace hippodraw {
25 
26 class RootBranch;
27 
38 {
39 
40  private:
41 
44  typedef std::vector < RootBranch * > BranchList_t;
45 
49 
52  typedef std::vector < std::vector < double > * > CacheList_t;
56 
60  std::vector < bool > m_multiDimensional;
61 
65 
68  mutable unsigned int m_cur_entry;
69 
71  bool rotateWheels( std::vector< int > & wheels,
72  const std::vector < int > & sz,
73  unsigned int d );
74 
86  int addColumn ( const std::string & label, RootBranch * );
87 
90  TBranch * getTBranch( const std::string & column );
91 
92 
93 protected:
94 
100  RootNTuple ();
101 
104  RootNTuple ( const RootNTuple & );
105 
106  public:
107 
109  RootNTuple ( TTree * tree );
110 
113  virtual ~RootNTuple();
114 
118  virtual void notifyObservers ( ) const;
119 
122  virtual unsigned int rows () const;
123 
126  virtual bool empty () const;
127 
131  virtual void clear ();
132 
135  virtual void reserve ( unsigned int );
136 
140  virtual double
141  operator [] ( std::vector < unsigned int > & indices ) const;
142 
143  virtual double valueAt ( unsigned int row, unsigned int column ) const;
144 
145  virtual double valueAtNoCache ( unsigned int row,
146  unsigned int column ) const;
147 
150  hippodraw::RootData::Type getType ( unsigned int column ) const;
151 
154  virtual double * doubleArrayAt ( unsigned int row,
155  unsigned int column ) const;
156 
159  virtual float * floatArrayAt ( unsigned int row,
160  unsigned int column ) const;
161 
164  virtual int * intArrayAt ( unsigned int row,
165  unsigned int column ) const;
166 
170  virtual unsigned int * uintArrayAt ( unsigned int row,
171  unsigned int column ) const;
172 
181  int addColumn ( const std::string & label,
182  const std::vector < double > & column );
183 
191  void replaceColumn ( unsigned int index,
192  const std::vector < double > & data );
193 
194  virtual const std::vector < double > &
195  getColumn ( const std::string & name ) const;
196 
201  virtual const std::vector < double > &
202  getColumn ( const std::string & name,
203  const std::vector < int > & indices ) const;
204 
205  virtual const std::vector < double > &
206  getColumn ( unsigned int index ) const;
207 
212  virtual const std::vector < double > & getRow ( unsigned int i ) const;
213 
220  virtual void setShape ( std::vector < unsigned int > & shape );
221 
224  const std::vector < unsigned int > & getShape () const;
225 
228  virtual bool isMultiDimensional ( const std::string & column ) const;
229 
234  virtual bool isUseable ( const std::string & label ) const;
235 
239  virtual bool setReleventIndex( const std::string & column,
240  const std::vector< unsigned int >& index );
241 
248  virtual void fillShape ( std::vector < int > & v,
249  unsigned int column ) const;
250 
257  void smartExpandRootNTuple( const std::string & column ) const;
258 
266  void expandIfNeeded ( const std::vector < std::string > & labels ) const;
267 
271  std::string
272  createBinding ( const std::string & name,
273  const std::vector < int > & indices ) const;
274 
275 private:
276 
277  void expandIfNeeded ( const std::string & label ) const;
278 
281  void initBranches ();
282 
285  void fillDataCache ( unsigned int column );
286 
287 };
288 
289 } // namespace hippodraw
290 
291 #endif // RootNTuple_H
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
unsigned int i
Type
The type of data on the branch.
Definition: RootDataType.h:25
The ROOT TTree class.
TTree * m_tree
The ROOT TTree object which is the source of the data.
Definition: RootNTuple.h:64
A DataSource class implemented with a ROOT TBranch objects from a ROOT TTree to store the column data...
Definition: RootNTuple.h:37
void * data(numeric::array arr)
Definition: num_util.cpp:389
A class to read data from a ROOT TBranch.
Definition: RootBranch.h:40
column
The column indices for 2 dimension data point tuple.
std::vector< intptr_t > shape(numeric::array arr)
Definition: num_util.cpp:317
hippodraw::DataSource class interface.
std::vector< bool > m_multiDimensional
Answers if rows of column are composed of the multidimensional data.
Definition: RootNTuple.h:60
ViewBase * v
Definition: PlotTable.cxx:104
CacheList_t m_data_cache
A cache of data already read.
Definition: RootNTuple.h:55
The namespace for ROOT data types.
std::vector< RootBranch * > BranchList_t
The type of container holding pointers to the ROOT branches.
Definition: RootNTuple.h:44
std::vector< std::vector< double > * > CacheList_t
The type of container holding pointers to the cached data vectors.
Definition: RootNTuple.h:52
return index
Definition: PickTable.cxx:182
unsigned int m_cur_entry
Index into the current position in the branches.
Definition: RootNTuple.h:68
BranchList_t m_data
The RootBranch objects that contains the data.
Definition: RootNTuple.h:48
The ROOT TBranch class.
Base class for DataSource.
Definition: DataSource.h:55

Generated for HippoDraw Class Library by doxygen