14 #include "msdevstudio/MSconfig.h"
34 using namespace hippodraw;
36 #ifdef ITERATOR_MEMBER_DEFECT
40 using std::accumulate;
75 m_x_label ( projector.m_x_label ),
76 m_y_label ( projector.m_y_label ),
77 m_cols ( projector.m_cols ),
78 m_rows ( projector.m_rows ),
79 m_x_step ( projector.m_x_step ),
80 m_y_step ( projector.m_y_step ),
81 m_x_origin ( projector.m_x_origin ),
82 m_y_origin ( projector.m_y_origin ),
83 m_null_value ( projector.m_null_value ),
84 m_transpose ( projector.m_transpose )
193 bool in = x_range.
includes ( lvalue ) ||
194 x_range.
includes ( lvalue + m_x_step );
202 y_range.
includes ( bvalue + m_y_step );
206 if ( accept && use_z ==
true ) {
209 accept &= z_range.
includes ( value );
227 namespace dp = hippodraw::DataPoint3DTuple;
236 return Range ( 0.0, 1.0, 0.5 );
240 return Range ( values );
253 if ( m_x_step < 0. ) {
262 if ( m_y_step < 0. ) {
284 double low = DBL_MAX;
285 double pos = DBL_MAX;
286 double high = -DBL_MIN;
289 std::size_t rows =
m_ntuple -> rows ();
290 unsigned int used = 0;
291 for (
unsigned int row = 0; row < rows; row++ ) {
295 low = std::min ( low, value );
297 pos = std::min ( pos, value );
299 high = std::max ( high, value );
359 unsigned int col = 3;
380 const vector < double > &
data = ntuple -> getColumn ( col );
382 unsigned int size = ntuple -> rows ();
385 sum = accumulate ( data.begin(), data.end(), sum );
402 unsigned int size = ntuple->
rows ();
403 double s = static_cast <
double > (
size );
404 double side = sqrt ( s );
406 m_rows = static_cast <
unsigned int > ( side );
407 m_cols = static_cast <
unsigned int > ( side );
430 unsigned int i_x = static_cast <
unsigned int> ( xx );
431 unsigned int i_y = static_cast <
unsigned int> ( yy );
456 unsigned int columns = 6;
460 ntuple -> setLabelAt (
getXLabel (), 0 );
461 ntuple -> setLabelAt (
getYLabel (
false ), 1 );
462 ntuple -> setLabelAt (
getZLabel (), 2 );
463 ntuple -> setLabelAt (
"Width", 3 );
464 ntuple -> setLabelAt (
"Height", 4 );
465 if ( z_err < UINT_MAX ) {
466 ntuple -> setLabelAt (
m_ntuple -> getLabelAt ( z_err ), 5 );
469 ntuple -> setLabelAt (
"Error", 5 );
495 for (
unsigned int i = 0; i <
m_cols; i++ ) {
503 for (
unsigned int j = 0; j <
m_rows; j++ ) {
511 index = i + m_cols * j;
514 index = i * m_rows + j;
532 ntuple -> addRow ( row );
537 vector < unsigned int >
shape ( 3 );
542 ntuple -> setShape ( shape );
double m_x_origin
The origin along the X axis.
const std::string & getXLabel() const
Returns the label (title) of the x axis.
virtual void matrixTranspose(bool yes)
Transposes the X and Y axis of the contained matrix.
virtual Range dataRangeOn(hippodraw::Axes::Type) const
Returns the range of the data on the specified axis.
The base class for the Projector hierarchy.
virtual void setNumberOfBins(hippodraw::Axes::Type axis, unsigned int number)
Sets the number of steps.
double m_x_step
The step along the X axis.
unsigned int calcRowIndex(unsigned int row) const
Calculates the index of the row of the matrix, given the row of the NTuple.
hippodraw::AxisModelBase class interface
virtual Range preferredRange(hippodraw::Axes::Type axis) const
Returns the preferred Range.
virtual void setNTuple(const DataSource *source)
Changes the DataSource used for the projections to source.
AxisModelBase * m_y_axis
The AxisModel along the Y axis.
An NTupleProjector is a projector that projects data from an DataSource object.
MapMatrixProjector()
This default constructor binds to the first two columns.
virtual Range valueRange() const
Finds the range of the projected values.
Expresses a range of values.
hippodraw::DataPointTuple namespace interface
void * data(numeric::array arr)
ProjectorBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
unsigned int calcColumnIndex(unsigned int row) const
Calculates the index of the column of the matrix, given the row of the NTuple.
double m_null_value
The value of the null value.
Base class for DataSource.
virtual void fillProjectedValues(DataSource *ntuple, bool in_range=false) const
bool inRangeWithZ(int row, bool flag) const
Returns true if value at row is within range.
virtual double getPosOn(hippodraw::Axes::Type axis) const
Returns the minimum positive value of the data on a specified axis.
virtual DataSource * createNTuple() const
Creates an NTuple representation of the projected values.
double getPos(int column) const
Returns the minimum positive value on the specified column.
std::vector< unsigned int > m_columns
A vector containing indexes to the columns of the DataSource.
const std::string & getYLabel(bool flag) const
Returns the label for the Y axis.
const Range & getRange(bool scaled) const
Returns the range represented by this AxisModel.
std::vector< intptr_t > shape(numeric::array arr)
virtual void changedNTuple()
This function is called when the NTuple has been changed to a new one.
bool includes(double value) const
Returns true if the argument value is inside the range.
double getPosWithError(int data, int error) const
Returns the minimum positive values considering both data and error.
virtual const std::string & getLabelAt(unsigned int index) const
Returns the label for the column at index index.
virtual unsigned int rows() const =0
Returns the number of rows.
bool m_transpose
A flag to indicate if the X-Y matrix should be transposed or not.
unsigned int columns() const
Returns the number of columns or data arrays available from this DataSource.
virtual void addPointReps()
Function to add the acceptable point reps.
DataSource * m_proj_values
The NTuple representing the result of the projection.
unsigned int m_rows
The number of rows for each column.
double m_y_step
The step along the Y axis.
std::string m_x_label
The label for the generated x axis.
std::vector< std::string > m_pointreps
Vector of acceptable PointReps.
AxisModelBase * m_x_axis
The AxisModel along the X axis.
bool acceptRow(unsigned int i, const CutList_t &cut_list) const
For row i of the column in the DataSource, returns true if all the cuts accept the row...
virtual void setDirty(bool value=true)
Sets the dirty flag to value.
virtual const Range & setBinWidth(hippodraw::Axes::Type axis, double step)
Sets the bin width.
virtual Range preferredRange(Axes::Type) const
Returns the preferred Range.
virtual double getZValue(double x, double y) const
Returns the value at the coordinate.
virtual void prepareValues()
Informs the projector to prepare its projected values for plotting.
CutList_t m_cut_list
A list of cuts that filter the projection.
void setRange(double low, double high, double pos)
Changes the current Range.
double m_scale_factor
The scale factor.
intp size(numeric::array arr)
AxisModelBase * m_z_axis
The AxisModel along the Z axis.
virtual const Range & getRange(Axes::Type) const
Returns the Range along the specified axis.
virtual double getOffset(hippodraw::Axes::Type axis) const
Returns the origin along the axis axis.
virtual int getNumberOfBins(hippodraw::Axes::Type axis) const
Returns the number of bins.
virtual Range dataRangeOnValue() const
double m_y_origin
The origin along the Y axis.
const std::string & getZLabel() const
Returns the label of the z axis.
hippodraw::MapMatrixProjector class interface
virtual double getAverage(hippodraw::Axes::Type axis) const
Get the Average of all projected values on the specified axis.
virtual bool inRange(int row) const
Checks if the entries in a given row are within the range of the axis model.
virtual double getBinWidth(hippodraw::Axes::Type axis) const
Returns the step size along the axis axis.
virtual void setNTuple(const DataSource *ntuple)
Changes the DataSource used for the projections to source.
error on X or half bin width
virtual bool isImageConvertable() const
Returns true since the projected values can be converted to an image.
std::string m_y_label
The label for the generated y axis.
A DataSource class implemented with std::vector<double> to store the row data.
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.
const DataSource * getProjectedValues() const
Returns DataSource representation of projected values.
unsigned int m_min_bindings
The minimum number of columns that must be bound.
A derived class of NTupleProjector that maps 1 DataSource column to a Y axis of two dimensional proje...
bool isDirty() const
Returns true if the projector has been marked dirty.
virtual void setOffset(hippodraw::Axes::Type axis, double origin)
Sets the bin offset.
unsigned int m_cols
The number of columns for each row.