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

Generated for HippoDraw Class Library by doxygen