PyDataRep Class Reference

#include <PyDataRep.h>

Collaboration diagram for PyDataRep:

Collaboration graph
ProjectorBaseDataSourceErrorBarRepCutRangeRepColorDataRepObservableObserverAxisModelBaseRangeRepBasePointRepBase
[legend]
List of all members.

Detailed Description

This class is the public interface the what the user sees as the DataRep object from Python.

Author:
J. Chiang <jchiang@slac.stanford.edu>

Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Sanket B Malde <sanket@slac.stanford.edu>

Definition at line 37 of file PyDataRep.h.

Public Member Functions

void addCut ()
 Adds a new region cut.
void applyCut (QtCut *cut)
 Apply a cut.
void applyCuts (const std::vector< QtCut * > &cuts)
 Apply a sequence of cuts to the DataRep.
const std::vector< std::string > & colorNames ()
 Returns the names of the available colors.
const NTuplecreateNTuple () const
 Create an NTuple for the displayed data.
NTuplecreateNTupleUnderRegion () const
 Returns a new NTuple from the bound DataSource by selecting rows that satisfy the region cut.
double getBinWidth (const std::string &axis)
 Get the bin width for the specified axis.
const std::vector< double > & getColumnWithCuts (const std::string &column)
 Return the named column with the present set of cuts applied.
hippodraw::DataRepgetDataRep ()
 The get method.
double getMean (const std::string &axis)
 Returns the mean value along axis axis.
NTuplegetNTupleWithCuts () const
 Return the current NTuple but with the present set of cuts applied.
double getRMS (const std::string &axis)
 Returns the RMS of the mean value along axis axis.
const std::string & name () const
 Return the display name used to create this data rep.
void normalizeTo (const PyDataRep *target)
 Normalizes the receiving object to the target one.
double numberOfEntries () const
 Return the number of entries in the rep.
 PyDataRep (PyDataRep *pyRep)
 Copy constructor.
 PyDataRep ()
 The default constructor.
 PyDataRep (const std::string &type, const PyDataSource *ntuple, const std::vector< std::string > &bindings)
 Constructor to create data reps from python using a PyDataSource object.
 PyDataRep (const std::string &type, const DataSource *ntuple, const std::vector< std::string > &bindings)
 Constructor to create data reps from python.
 PyDataRep (hippodraw::DataRep *)
 A constructor.
void set (hippodraw::Line::Style style)
 sets the plotting line style.
void set (hippodraw::Symbol::Type type)
 sets the plotting symbol and size for a point.
void set (Color::Value value)
 Sets the Color of the point representation to one of Color::Value.
void setAxisBinding (const std::string &axis, const std::string &label)
 Set the axis bindings for a single axis.
void setAxisBindings (const std::vector< std::string > &bindings)
 Set the axis bindings for all axes at once.
void setBinWidth (const std::string &axis, double width)
 Sets the bin width, if binned, on axis to width.
void setColor (const std::string &color)
 Set the color used for plotting, selecting from a predefined palette of "black", "red", "green", "blue", "yellow", "cyan", "magenta".
void setCutRange (double low, double high)
 Sets the range of the region cut.
void setErrorDisplay (const std::string &axis, bool flag)
 Turn on the error bars.
void setLineStyle (const std::string &lineStyle)
 Set the plotting line style.
void setPointRep (RepBase *pointRep)
 Set the point representation.
void setSize (double value)
 Sets the size of the point representation.
void setSymbol (const std::string &symbolName, float size=2.)
 Set the plotting symbol and size.
void setWeight (const std::string &label)
 Set the weight for DyHistogram (or Color Plot or Contour plots).

Static Public Member Functions

static const std::vector<
std::string > & 
names ()
 Returns the names of the types of DataRep objects available.

Private Member Functions

void init ()
 Used in the constructors.

Static Private Member Functions

static void makeColorMap ()
 Create the color map.
static void makeLineStyleMap ()
 Create the line style map.
static void makeSymbolMap ()
 Create the plotting symbols map.

Private Attributes

std::vector< double > m_columnData
 Vector of values returned by const reference for getColumnWithCuts method.
hippodraw::DataRepm_datarep
 The actual DataRep object.

Static Private Attributes

static bool s_have_static_members
 A flag to indicate that we have the static data members.
static std::map< std::string,
hippodraw::Line::Style
s_lineStyles
 A map of line styles, keyed by name.
static std::map< std::string,
hippodraw::Symbol::Type
s_symbols
 A map of symbol types, keyed by name.


Constructor & Destructor Documentation

PyDataRep ( hippodraw::DataRep  ) 

A constructor.

Definition at line 263 of file PyDataRep.cxx.

References PyDataRep::init(), and PyDataRep::m_datarep.

PyDataRep ( const std::string &  type,
const DataSource ntuple,
const std::vector< std::string > &  bindings 
)

Constructor to create data reps from python.

Definition at line 269 of file PyDataRep.cxx.

References DataRepController::createDataRep(), PyDataRep::init(), DataRepController::instance(), and PyDataRep::m_datarep.

PyDataRep ( const std::string &  type,
const PyDataSource ntuple,
const std::vector< std::string > &  bindings 
)

Constructor to create data reps from python using a PyDataSource object.

Definition at line 278 of file PyDataRep.cxx.

References DataRepController::createDataRep(), PyDataSource::dataSource(), PyDataRep::init(), DataRepController::instance(), and PyDataRep::m_datarep.

PyDataRep (  ) 

The default constructor.

Definition at line 288 of file PyDataRep.cxx.

References PyDataRep::init(), and PyDataRep::m_datarep.

PyDataRep ( PyDataRep pyRep  ) 

Copy constructor.

Definition at line 294 of file PyDataRep.cxx.

References DataRep::clone(), PyDataRep::getDataRep(), and PyDataRep::m_datarep.


Member Function Documentation

void addCut (  ) 

Adds a new region cut.

Bug:
@ Only works on X axis.

Definition at line 536 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void applyCut ( QtCut cut  ) 

Apply a cut.

Definition at line 409 of file PyDataRep.cxx.

References CutController::instance(), PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void applyCuts ( const std::vector< QtCut * > &  cuts  ) 

Apply a sequence of cuts to the DataRep.

Definition at line 418 of file PyDataRep.cxx.

References CutController::instance(), PyApp::lock(), PyDataRep::m_datarep, num_util::size(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

const vector< string > & colorNames (  ) 

Returns the names of the available colors.

Definition at line 433 of file PyDataRep.cxx.

References Color::colorNames().

Referenced by hippodraw::Python::export_DataRep().

const NTuple * createNTuple (  )  const

Create an NTuple for the displayed data.

Definition at line 489 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

NTuple * createNTupleUnderRegion (  )  const

Returns a new NTuple from the bound DataSource by selecting rows that satisfy the region cut.

Definition at line 523 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

double getBinWidth ( const std::string &  axis  ) 

Get the bin width for the specified axis.

Definition at line 371 of file PyDataRep.cxx.

References hippodraw::String::convert(), ProjectorBase::getBinWidth(), DataRep::getProjector(), PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

const std::vector< double > & getColumnWithCuts ( const std::string &  column  ) 

Return the named column with the present set of cuts applied.

Definition at line 510 of file PyDataRep.cxx.

References DataRep::fillColumnAfterCuts(), PyDataRep::m_columnData, PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

DataRep * getDataRep (  ) 

The get method.

Definition at line 308 of file PyDataRep.cxx.

References PyDataRep::m_datarep.

Referenced by QtDisplay::addDataRep(), and PyDataRep::PyDataRep().

double getMean ( const std::string &  axis  ) 

Returns the mean value along axis axis.

Definition at line 383 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, mean, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

NTuple * getNTupleWithCuts (  )  const

Return the current NTuple but with the present set of cuts applied.

Definition at line 500 of file PyDataRep.cxx.

References DataRep::getNTupleAfterCuts(), PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

double getRMS ( const std::string &  axis  ) 

Returns the RMS of the mean value along axis axis.

Definition at line 394 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void init (  )  [private]

Used in the constructors.

Definition at line 663 of file PyDataRep.cxx.

References PyDataRep::makeLineStyleMap(), PyDataRep::makeSymbolMap(), and PyDataRep::s_have_static_members.

Referenced by PyDataRep::PyDataRep().

static void makeColorMap (  )  [static, private]

Create the color map.

void makeLineStyleMap (  )  [static, private]

Create the line style map.

Definition at line 613 of file PyDataRep.cxx.

References hippodraw::Line::Dash, hippodraw::Line::DashDot, hippodraw::Line::DashDotDot, hippodraw::Line::Dot, hippodraw::Line::Invisible, PyDataRep::s_lineStyles, and hippodraw::Line::Solid.

Referenced by PyDataRep::init().

void makeSymbolMap (  )  [static, private]

Create the plotting symbols map.

Definition at line 555 of file PyDataRep.cxx.

References hippodraw::Symbol::CIRCLE, hippodraw::Symbol::FILLED_CIRCLE, hippodraw::Symbol::FILLED_TRIANGLE, hippodraw::Symbol::PLUS, PyDataRep::s_symbols, hippodraw::Symbol::SOLIDSQUARE, hippodraw::Symbol::SQUARE, hippodraw::Symbol::TIMES, and hippodraw::Symbol::TRIANGLE.

Referenced by PyDataRep::init().

const std::string & name (  )  const

Return the display name used to create this data rep.

Definition at line 366 of file PyDataRep.cxx.

References PyDataRep::m_datarep, and DataRep::name().

Referenced by hippodraw::Python::export_DataRep().

const vector< string > & names (  )  [static]

Returns the names of the types of DataRep objects available.

Definition at line 301 of file PyDataRep.cxx.

References DataRepController::instance().

Referenced by hippodraw::Python::export_DataRep().

void normalizeTo ( const PyDataRep target  ) 

Normalizes the receiving object to the target one.

Definition at line 674 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

double numberOfEntries (  )  const

Return the number of entries in the rep.

Definition at line 403 of file PyDataRep.cxx.

References DataRep::getProjector(), and PyDataRep::m_datarep.

Referenced by hippodraw::Python::export_DataRep().

void set ( hippodraw::Line::Style  style  ) 

sets the plotting line style.

Definition at line 624 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

void set ( hippodraw::Symbol::Type  type  ) 

sets the plotting symbol and size for a point.

Definition at line 568 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

void set ( Color::Value  value  ) 

Sets the Color of the point representation to one of Color::Value.

Definition at line 440 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setAxisBinding ( const std::string &  axis,
const std::string &  label 
)

Set the axis bindings for a single axis.

Definition at line 325 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, DataRep::setAxisBinding(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setAxisBindings ( const std::vector< std::string > &  bindings  ) 

Set the axis bindings for all axes at once.

Definition at line 339 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, DataRep::setAxisBindings(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setBinWidth ( const std::string &  axis,
double  width 
)

Sets the bin width, if binned, on axis to width.

Bug:
Doesn't always work if display hasn't drawn yet.

Definition at line 686 of file PyDataRep.cxx.

References hippodraw::String::convert(), DisplayController::instance(), PyApp::lock(), PyDataRep::m_datarep, num_util::type(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setColor ( const std::string &  color  ) 

Set the color used for plotting, selecting from a predefined palette of "black", "red", "green", "blue", "yellow", "cyan", "magenta".

Definition at line 457 of file PyDataRep.cxx.

References Color::isValid(), PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setCutRange ( double  low,
double  high 
)

Sets the range of the region cut.

Definition at line 545 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setErrorDisplay ( const std::string &  axis,
bool  flag 
)

Turn on the error bars.

Definition at line 477 of file PyDataRep.cxx.

References hippodraw::String::convert(), PyApp::lock(), PyDataRep::m_datarep, DataRep::setErrorDisplay(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setLineStyle ( const std::string &  lineStyle  ) 

Set the plotting line style.

Deprecated:
Use set(hippodraw::Line::Style) instead.

Definition at line 642 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, PyDataRep::s_lineStyles, DataRep::setRepStyle(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setPointRep ( RepBase pointRep  ) 

Set the point representation.

Definition at line 318 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, DataRep::setPointRep(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setSize ( double  value  ) 

Sets the size of the point representation.

Definition at line 585 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setSymbol ( const std::string &  symbolName,
float  size = 2. 
)

Set the plotting symbol and size.

Deprecated:
Use set(hippodraw::Symbol::Type) instead.

Definition at line 592 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, PyDataRep::s_symbols, and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().

void setWeight ( const std::string &  label  ) 

Set the weight for DyHistogram (or Color Plot or Contour plots).

Definition at line 352 of file PyDataRep.cxx.

References PyApp::lock(), PyDataRep::m_datarep, DataRep::name(), DataRep::setAxisBinding(), and PyApp::unlock().

Referenced by hippodraw::Python::export_DataRep().


Member Data Documentation

std::vector<double> m_columnData [private]

Vector of values returned by const reference for getColumnWithCuts method.

Definition at line 48 of file PyDataRep.h.

Referenced by PyDataRep::getColumnWithCuts().

hippodraw::DataRep* m_datarep [private]

The actual DataRep object.

Definition at line 43 of file PyDataRep.h.

Referenced by PyDataRep::addCut(), PyDataRep::applyCut(), PyDataRep::applyCuts(), PyDataRep::createNTuple(), PyDataRep::createNTupleUnderRegion(), PyDataRep::getBinWidth(), PyDataRep::getColumnWithCuts(), PyDataRep::getDataRep(), PyDataRep::getMean(), PyDataRep::getNTupleWithCuts(), PyDataRep::getRMS(), PyDataRep::name(), PyDataRep::normalizeTo(), PyDataRep::numberOfEntries(), PyDataRep::PyDataRep(), PyDataRep::set(), PyDataRep::setAxisBinding(), PyDataRep::setAxisBindings(), PyDataRep::setBinWidth(), PyDataRep::setColor(), PyDataRep::setCutRange(), PyDataRep::setErrorDisplay(), PyDataRep::setLineStyle(), PyDataRep::setPointRep(), PyDataRep::setSize(), PyDataRep::setSymbol(), and PyDataRep::setWeight().

bool s_have_static_members [static, private]

A flag to indicate that we have the static data members.

Definition at line 57 of file PyDataRep.h.

Referenced by PyDataRep::init().

std::map< std::string, hippodraw::Line::Style > s_lineStyles [static, private]

A map of line styles, keyed by name.

Definition at line 54 of file PyDataRep.h.

Referenced by PyDataRep::makeLineStyleMap(), and PyDataRep::setLineStyle().

std::map< std::string, hippodraw::Symbol::Type > s_symbols [static, private]

A map of symbol types, keyed by name.

Definition at line 51 of file PyDataRep.h.

Referenced by PyDataRep::makeSymbolMap(), and PyDataRep::setSymbol().


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen