NTupleProjector.h
Go to the documentation of this file.
1 /* -*- mode: c++; -*- */
2 
14 #ifndef _NTupleProjector_H_
15 #define _NTupleProjector_H_
16 
17 #include "ProjectorBase.h"
18 
19 namespace hippodraw {
20 
21 class DataSource;
22 
45 {
46 
49  typedef std::vector < const TupleCut * > CutList_t;
50 
53  mutable bool m_is_valid;
54 
58  NTuple * createEmptyNTuple () const;
59 
64  void fillNTuple ( NTuple * ntuple, const CutList_t & cut_list ) const;
65 
66 protected:
67 
77  std::vector< std::string > m_binding_options;
78 
80  mutable std::vector< std::string > m_bindings;
81 
86  std::vector< unsigned int > m_columns;
87 
90 
94 
100  unsigned int m_min_bindings;
101 
104  NTupleProjector ( unsigned int columns );
105 
107  NTupleProjector ( const NTupleProjector & projector );
108 
111  Range dataRange ( int column ) const;
112 
114  Range dataRangeWithError ( int data, int error ) const;
115 
117  double getPos ( int column ) const;
118 
121  double getPosWithError ( int data, int error ) const;
122 
126  void setAxisBinding ( int axis, const std::string & label );
127 
128 public:
129 
131  virtual ~NTupleProjector();
132 
135  virtual void update ( const Observable * );
136 
141  virtual void willDelete ( const Observable * );
142 
145  virtual const std::vector< std::string > & bindingOptions () const;
146 
151  virtual const std::vector < std::string > & getAxisBindings () const;
152 
153 
157  unsigned int indexOfBindingOption ( const std::string & axis ) const;
158 
162  virtual int indexOf ( const std::string & label ) const;
163 
166  virtual void setXErrorOption ( bool enable );
167 
170  virtual void setYErrorOption ( bool enable );
171 
176  virtual void setAxisBinding ( const std::string & axis,
177  const std::string & label );
178 
184  virtual void setAxisBindings ( const std::vector < std::string > & labels );
185 
190  virtual void setNTuple ( const DataSource * source );
191 
193  virtual const DataSource * getNTuple () const;
194 
196  virtual DataSource * getNTuple ();
197 
199  virtual const std::string & getNTupleName () const;
200 
205  virtual void changedNTuple() = 0;
206 
209  virtual Range dataRangeOn ( Axes::Type ) const = 0;
210 
212  virtual void addCut ( const TupleCut * cut );
213 
216  virtual void removeCut ( const TupleCut * cut );
217 
219  const std::vector < const TupleCut * > & getCutList () const;
220 
224  bool acceptRow ( unsigned int i, const CutList_t & cut_list ) const;
225 
229  virtual const std::string & getTitle() const;
230 
231  virtual const std::string & getXLabel() const;
232  virtual const std::string & getYLabel ( bool flag = false ) const;
233 
236  int getNumberOfEntries () const;
237 
238 
240  virtual int getUnderflow () const;
241 
243  virtual int getOverflow () const;
244 
247  virtual bool inRange ( int row ) const;
248 
250  virtual double getAverage ( Axes::Type axis ) const;
251 
252  /* Implements ProjectorBase. */
253  virtual bool isEmpty () const;
254 
255  /* Create an DataSource given the present set of cuts.
256  */
257  virtual NTuple * getNTupleAfterCuts () const;
258 
262  virtual void fillColumnAfterCuts(const std::string & column,
263  std::vector<double> & columnData) const;
264 
265  virtual
266  NTuple * createNTupleWith ( const std::vector< TupleCut > & cut_list ) const;
267 
270  bool isDataValid () const;
271 
275  virtual bool hasDataSourceBindings () const;
276 
277 };
278 
279 } // namespace hippodraw
280 
281 #endif // _NTupleProjector_H_
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
Definition: Observable.h:39
unsigned int i
CutList_t m_cut_list
A list of cuts that filter the projection.
std::vector< unsigned int > m_columns
A vector containing indexes to the columns of the DataSource.
void * data(numeric::array arr)
Definition: num_util.cpp:389
column
The column indices for 2 dimension data point tuple.
An NTupleProjector is a projector that projects data from an DataSource object.
The class expresses a cut on a DataSource, i.e.
Definition: TupleCut.h:43
std::vector< const TupleCut * > CutList_t
The type of container for list of cuts.
const DataSource * m_ntuple
The pointer to the data source being projected.
std::vector< std::string > m_binding_options
The list of binding options for the Projector.
std::vector< std::string > m_bindings
The list of current bindings.
hippodraw::ProjectorBase class interface.
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
Expresses a range of values.
Definition: Range.h:33
unsigned int m_min_bindings
The minimum number of columns that must be bound.
bool m_is_valid
Set to false if any data is bound column is invalid.
Type
Axes constants.
Definition: AxesType.h:31
Base class for DataSource.
Definition: DataSource.h:55

Generated for HippoDraw Class Library by doxygen