14 #include "msdevstudio/MSconfig.h" 25 #ifdef ITERATOR_MEMBER_DEFECT 35 BinningProjector::BinningProjector (
unsigned int axes )
36 : m_binner_dim ( axes ),
101 if ( type ==
Axes::X ) axis =
"X";
102 else if ( type ==
Axes::Y ) axis =
"Y";
136 assert ( axis ==
Axes::X && width > 0. );
161 if ( axis !=
"X" )
return;
249 m_binner -> scaleNumberOfEntries ( number );
256 m_binner -> setEntriesScaling ( on );
289 double norm = number;
double getBinWidth(hippodraw::Axes::Type axis) const
Returns the bin width of the axis.
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
virtual int numberOfBins(hippodraw::Axes::Type axis) const =0
Returns the number of bins on specified axis.
virtual bool isAxisBinned(const std::string &axis) const
Returns true if specified axis is binned.
virtual double binWidth(hippodraw::Axes::Type axis) const =0
Returns the bin width parameter on the specified axis.
virtual double calcBinWidth(hippodraw::Axes::Type axis, int parm, bool dragging) const =0
Calculates a new bin width base on dragging slider value.
The BinningProjector is an abstract class provides most of the functionality for a projector that doe...
hippodraw::BinningProjector class interface
virtual void willDelete(const Observable *object)
If object is the target of normalization, removes the target and sets normalization off...
AxisModelBase * m_x_axis
The AxisModel along the X axis.
virtual void notifyObservers() const
Notifies Observer objects of a change.
virtual void setMinEntries(int entries)
Set the minimum entries/bin.
double norm(const std::vector< double > &a)
Computes the two norm of the vector.
void setBinner(BinsBase *bins)
Sets the BinsBase object to be used by this projector.
BinningProjector(unsigned int axes)
The following constructor takes the number of axes used by the BinsBase object.
PyArray_TYPES type(numeric::array arr)
virtual int getMinEntries()
Get the minimum entries/bin.
virtual const Range & setBinWidth(hippodraw::Axes::Type axis, double width)
virtual double getZValue(double x, double y) const
Get the z value at the specified point (x,y).
virtual void setOffset(hippodraw::Axes::Type axis, double value)=0
Sets the offset parameter on the specified axis.
virtual const Range & getRange(hippodraw::Axes::Type axis)=0
virtual void execute()
Provides the all the data to the binner.
virtual bool isValueBinned() const
Returns true if the projected values are the result of binning.
virtual DataSource * createNTuple() const
Returns an data source representing the binned values.
virtual double calcOffset(const std::string &, int parm, bool dragging) const =0
Calculates and returns a new range from dragging slider.
double getOffset(hippodraw::Axes::Type axis) const
Returns the offset of the axis.
bool isDirty() const
Returns true if the projector has been marked dirty.
virtual bool isImageConvertable() const
Returns true if projected values are convertable to image.
hippodraw::NTuple class interface.
virtual void reset()
Resets the bins.
virtual void setDirty(bool value=true)
Sets the dirty flag to value.
void setRange(double low, double high, double pos)
Sets the Range to the low and high values.
hippodraw::BinsBase class interface
void removeObserver(Observer *)
Removes an Observer from the Observer list.
virtual const Range & setBinWidth(hippodraw::Axes::Type axis, double value)=0
Sets the bin width parameter on the specified axis.
void setBinContents(const DataSource *source)
Sets the contents of the bins from the data source.
virtual NTuple * createNTuple() const =0
Creates an NTuple.
BinsBase * m_binner
The binner object.
virtual void normalize()
Normalizes the projector to its target.
virtual void checkScaling()
Checks and sets if an AxisModelBase object on an axis should be scaled.
The base class for the BinnerAxis hierarchy.
The AxisModelBase class maintains the Range and scaling of an axis.
const BinsBase * getBinner() const
Returns reference to BinsBase object used by this projector.
virtual double getZValue(double x, double y) const
Get the z value at the specified point (x,y).
virtual void setBinnerOn(BinnerAxis *binner, hippodraw::Axes::Type axis)
Sets the bin edge calculator to binner on axis axis.
virtual double getOffset(hippodraw::Axes::Type axis) const =0
Returns the offset parameter on specific axis.
virtual BinsBase * clone() const =0
The virtual function to make copy of concrete derived class.
hippodraw::AxisModelBase class interface
The base class for the Projector hierarchy.
virtual void setAxisModel(hippodraw::Axes::Type, AxisModelBase *)
Sets the AxisModel for axis axis.
virtual void setBinnerOn(BinnerAxis *, hippodraw::Axes::Type axis)=0
Sets the bin calculator on specified axis.
virtual void update(const Observable *object)
Updates the receiving projector.
unsigned int m_binner_dim
The number of AxesType accepted by the binner.
DataSource * m_proj_values
The NTuple representing the result of the projection.
virtual void prepareValues()
Prepares the projector for plotting by executing, if needed, the binning procedure.
virtual void setAxisModel(Axes::Type axis, AxisModelBase *)
Sets the AxisModel for axis axis.
virtual void setOffset(const std::string &axis, int parm, bool dragging)
Sets the bin offset.
virtual void normalizeTo(double number)
Sets a scale factor on the output so that the number of entries appears to be number.
Expresses a range of values.
virtual int getNumberOfBins(Axes::Type) const
Returns the number of bins.
virtual void fillDataSource(DataSource *ntuple, bool in_range=false) const
virtual ~BinningProjector()
The destructor.
virtual int getNumberOfEntries() const =0
Returns the total number of entries that went into creating the projected values. ...
void addObserver(Observer *)
Adds an Observer to the Observer list.
virtual int getNumberOfBins(hippodraw::Axes::Type axis) const
Returns the number of bins.
virtual void setNormalizing(bool on)
Sets the scaling number of entries on if on is true, otherwise turns if off.
The base class for the binner hierarchy.
const ProjectorBase * m_target
The target projector.
Base class for DataSource.