14 #include "msdevstudio/MSconfig.h"
31 using namespace hippodraw;
33 #ifdef ITERATOR_MEMBER_DEFECT
36 using std::accumulate;
37 using std::inner_product;
59 m_title ( projector.m_title ),
60 m_x_label ( projector.m_x_label ),
61 m_y_label ( projector.m_y_label ),
62 m_z_label ( projector.m_y_label )
123 namespace dp = hippodraw::DataPoint3DTuple;
132 unsigned int col = 3;
154 const vector < double > & value = ntuple -> getColumn (
dp::Z );
157 const vector < double > &
data = ntuple -> getColumn ( col );
161 sumXV = std::inner_product ( data.begin(), data.end(),
162 value.begin(), sumXV );
165 sumV = accumulate ( value.begin(), value.end(), sumV );
167 result = sumXV / sumV;
171 sumV = accumulate ( value.begin(), value.end (), sumV );
172 result = ( sumV / value.size () ) *
m_z_axis -> getScaleFactor ();
191 return static_cast <
int > ( sum );
214 double w = v.size() == 3 ? v[2] : 1.0;
StHist2DProjector()
The default constructor.
const std::string & getZLabel() const
Returns the label (title) of the z axis.
const std::string & getXLabel() const
Returns the label (title) of the X axis.
virtual const Range & getRange(hippodraw::Axes::Type axis)=0
The base class for the Projector hierarchy.
A derived class of ProjectorBase that projects data accumulated by calls to its addValues function in...
std::string m_y_label
The label of the y axis.
hippodraw::AxisModelBase class interface
A derived class of BinningProjector projects to a two dimensional histogram.
virtual int getOverflow() const =0
Returns the overflow.
Expresses a range of values.
virtual void checkScaling()
Checks the axis scaling.
hippodraw::DataPointTuple namespace interface
void * data(numeric::array arr)
Base class for DataSource.
const std::string & getYLabel(bool flag=false) const
Returns the label (title) of the Y axis.
std::string m_title
The title of the histogram.
virtual void addValues(const std::vector< double > &v)
Add the values to the histogram.
virtual void notifyObservers() const
Notifies Observer objects of a change.
virtual double getPosOn(hippodraw::Axes::Type axis) const
Returns the minimum positive value of the data on a specified axis.
virtual int getUnderflow() const =0
Returns the underflow.
virtual bool isAxisBinned(const std::string &axis) const
Returns true if the intended axis is "X", otherwise returns false.
StHist2DProjector class interface.
ProjectorBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
bool isEmpty() const
Returns false as this class' data source is never empty even if no filling has occurred yet...
virtual Range dataRangeOn(hippodraw::Axes::Type axis) const
Returns the range of the data on a specified axis.
virtual void setDirty(bool value=true)
Sets the dirty flag to value.
virtual void setRange(hippodraw::Axes::Type axis, bool)
Sets the range of the selected axis.
std::string m_z_label
The label of the y axis.
BinsBase * m_binner
The binner object.
std::string m_x_label
The label of the x axis.
AxisModelBase * m_z_axis
The AxisModel along the Z axis.
virtual int getNumberOfEntries() const =0
Returns the true number of entries.
double getPosOnValue() const
Returns the smallest positive value on the Y axis.
hippodraw::BinsBase class interface
virtual const std::string & getTitle() const
Finds the title of the plot.
virtual double getAverage(hippodraw::Axes::Type axis) const
Get the Average of all projected values on the specified axis.
virtual void prepareValues()
Prepares the projector for plotting by executing, if needed, the binning procedure.
virtual void setBinnerRange(hippodraw::Axes::Type axis, const Range &range, bool const_width)
Sets the Range of the binner.
hippodraw::DataSource class interface.
virtual int getNumberOfEntries() const
Returns the total number of entries that went into creating the projected values. ...
virtual int getOverflow() const
Returns the number of overflow.
const DataSource * getProjectedValues() const
Returns DataSource representation of projected values.
virtual int getUnderflow() const
Returns the number of underflow.
Range dataRangeOnValue() const
Returns the data range on the Z axis.