PyDataRep.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef PyDataRep_H
15 #define PyDataRep_H
16 
17 #include "graphics/Color.h"
18 #include "graphics/LineStyle.h"
19 #include "graphics/SymbolType.h"
20 
21 namespace hippodraw {
22 
23 class DataRep;
24 class RepBase;
25 class DataSource;
26 class PyDataSource;
27 class NTuple;
28 class QtCut;
29 
37 class PyDataRep
38 {
39 
40 private:
41 
44 
48  std::vector<double> m_columnData;
49 
51  static std::map< std::string, hippodraw::Symbol::Type > s_symbols;
52 
54  static std::map< std::string, hippodraw::Line::Style > s_lineStyles;
55 
57  static bool s_have_static_members;
58 
60  static void makeColorMap();
61 
63  static void makeSymbolMap();
64 
66  static void makeLineStyleMap();
67 
70  void init();
71 
72 public:
73 
76 
78  PyDataRep ( const std::string & type,
79  const DataSource * ntuple,
80  const std::vector< std::string > & bindings );
81 
85  PyDataRep ( const std::string & type,
86  const PyDataSource * ntuple,
87  const std::vector< std::string > & bindings );
88 
90  PyDataRep ();
91 
93  PyDataRep ( PyDataRep * pyRep );
94 
97  static const std::vector < std::string > & names ();
98 
101 
104  void setSize ( double value );
105 
107  void setPointRep ( RepBase * pointRep );
108 
110  void setAxisBinding ( const std::string &axis,
111  const std::string &label );
112 
114  void setAxisBindings ( const std::vector< std::string > & bindings );
115 
117  void setWeight ( const std::string &label );
118 
120  const std::string & name () const;
121 
123  double getBinWidth ( const std::string &axis );
124 
127  double getMean ( const std::string & axis );
128 
131  double getRMS ( const std::string & axis );
132 
134  double numberOfEntries() const;
135 
137  void applyCut ( QtCut * cut );
138 
141  void applyCuts ( const std::vector < QtCut * > & cuts );
142 
145  const std::vector < std::string > & colorNames ();
146 
149  void set ( Color::Value value );
150 
155  void setColor ( const std::string & color );
156 
158  void setErrorDisplay( const std::string &axis, bool flag );
159 
161  const NTuple * createNTuple () const;
162 
166  NTuple * getNTupleWithCuts () const;
167 
169  const std::vector<double> &
170  getColumnWithCuts(const std::string & column);
171 
175  NTuple * createNTupleUnderRegion () const;
176 
180  void addCut ( );
181 
184  void setCutRange ( double low, double high );
185 
189 
190 
194  void setSymbol( const std::string &symbolName, float size=2.);
195 
198  void set ( hippodraw::Line::Style style );
199 
203  void setLineStyle( const std::string &lineStyle );
204 
206  void normalizeTo ( const PyDataRep * target );
207 
211  void setBinWidth ( const std::string & axis, double width );
212 
213 
214 };
215 
216 } // namespace hippodraw
217 
218 #endif // PyDataRep_H
static void makeSymbolMap()
Create the plotting symbols map.
Definition: PyDataRep.cxx:555
NTuple * getNTupleWithCuts() const
Return the current NTuple but with the present set of cuts applied.
Definition: PyDataRep.cxx:500
void init()
Used in the constructors.
Definition: PyDataRep.cxx:663
void setAxisBindings(const std::vector< std::string > &bindings)
Set the axis bindings for all axes at once.
Definition: PyDataRep.cxx:339
Qt Displays wraps a derived class of Cut1DPlotter.
Definition: QtCut.h:42
double numberOfEntries() const
Return the number of entries in the rep.
Definition: PyDataRep.cxx:403
void setPointRep(RepBase *pointRep)
Set the point representation.
Definition: PyDataRep.cxx:318
hippodraw::DataRep * m_datarep
The actual DataRep object.
Definition: PyDataRep.h:43
void setColor(const std::string &color)
Set the color used for plotting, selecting from a predefined palette of &quot;black&quot;, &quot;red&quot;, &quot;green&quot;, &quot;blue&quot;, &quot;yellow&quot;, &quot;cyan&quot;, &quot;magenta&quot;.
Definition: PyDataRep.cxx:457
static void makeColorMap()
Create the color map.
Type
Enumeration of the type of symbols supported by this class.
Definition: SymbolType.h:28
PyDataRep()
The default constructor.
Definition: PyDataRep.cxx:288
column
The column indices for 2 dimension data point tuple.
static std::map< std::string, hippodraw::Line::Style > s_lineStyles
A map of line styles, keyed by name.
Definition: PyDataRep.h:54
void setCutRange(double low, double high)
Sets the range of the region cut.
Definition: PyDataRep.cxx:545
void setLineStyle(const std::string &lineStyle)
Set the plotting line style.
Definition: PyDataRep.cxx:642
const std::string & name() const
Return the display name used to create this data rep.
Definition: PyDataRep.cxx:366
void setErrorDisplay(const std::string &axis, bool flag)
Turn on the error bars.
Definition: PyDataRep.cxx:477
void set(Color::Value value)
Sets the Color of the point representation to one of Color::Value.
Definition: PyDataRep.cxx:440
Value
A few common colors.
Definition: Color.h:51
double getMean(const std::string &axis)
Returns the mean value along axis axis.
Definition: PyDataRep.cxx:383
NTuple * createNTupleUnderRegion() const
Returns a new NTuple from the bound DataSource by selecting rows that satisfy the region cut...
Definition: PyDataRep.cxx:523
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
The base class for data representations.
Definition: DataRep.h:68
SymbolType enumeration.
void addCut()
Adds a new region cut.
Definition: PyDataRep.cxx:536
double getRMS(const std::string &axis)
Returns the RMS of the mean value along axis axis.
Definition: PyDataRep.cxx:394
double getBinWidth(const std::string &axis)
Get the bin width for the specified axis.
Definition: PyDataRep.cxx:371
intp size(numeric::array arr)
Definition: num_util.cpp:296
Color class interface.
This class is the public interface to a DataSource object that the user sees as the DataArray object ...
Definition: PyDataSource.h:43
Style
Line style constants.
Definition: LineStyle.h:25
const std::vector< std::string > & colorNames()
Returns the names of the available colors.
Definition: PyDataRep.cxx:433
void applyCut(QtCut *cut)
Apply a cut.
Definition: PyDataRep.cxx:409
static void makeLineStyleMap()
Create the line style map.
Definition: PyDataRep.cxx:613
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
The namespace for lines.
std::vector< double > m_columnData
Vector of values returned by const reference for getColumnWithCuts method.
Definition: PyDataRep.h:48
const std::vector< double > & getColumnWithCuts(const std::string &column)
Return the named column with the present set of cuts applied.
Definition: PyDataRep.cxx:510
void applyCuts(const std::vector< QtCut * > &cuts)
Apply a sequence of cuts to the DataRep.
Definition: PyDataRep.cxx:418
static std::map< std::string, hippodraw::Symbol::Type > s_symbols
A map of symbol types, keyed by name.
Definition: PyDataRep.h:51
void normalizeTo(const PyDataRep *target)
Normalizes the receiving object to the target one.
Definition: PyDataRep.cxx:674
static const std::vector< std::string > & names()
Returns the names of the types of DataRep objects available.
Definition: PyDataRep.cxx:301
void setBinWidth(const std::string &axis, double width)
Sets the bin width, if binned, on axis to width.
Definition: PyDataRep.cxx:686
hippodraw::DataRep * getDataRep()
The get method.
Definition: PyDataRep.cxx:308
const NTuple * createNTuple() const
Create an NTuple for the displayed data.
Definition: PyDataRep.cxx:489
void setSymbol(const std::string &symbolName, float size=2.)
Set the plotting symbol and size.
Definition: PyDataRep.cxx:592
void setSize(double value)
Sets the size of the point representation.
Definition: PyDataRep.cxx:585
void setAxisBinding(const std::string &axis, const std::string &label)
Set the axis bindings for a single axis.
Definition: PyDataRep.cxx:325
The base class for the point representation hierarchy.
Definition: RepBase.h:45
void setWeight(const std::string &label)
Set the weight for DyHistogram (or Color Plot or Contour plots).
Definition: PyDataRep.cxx:352
This class is the public interface the what the user sees as the DataRep object from Python...
Definition: PyDataRep.h:37
static bool s_have_static_members
A flag to indicate that we have the static data members.
Definition: PyDataRep.h:57
Base class for DataSource.
Definition: DataSource.h:55

Generated for HippoDraw Class Library by doxygen