Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CutController Class Reference

A singleton class that handles the application logic for cuts. More...

#include <CutController.h>

Collaboration diagram for CutController:
Collaboration graph
[legend]

Public Member Functions

Cut1DPlotteraddCut (PlotterBase *plotter, const std::string &label)
 Adds a one dimension cut to the plotter.
PlotterBaseaddCut (PlotterBase *plotter, std::vector< std::string > &bindings)
 Adds a cut to the plotter.
void addCut (PlotterBase *cut_plotter, PlotterBase *plotter)
 Adds an existing cut to a plotter.
void addCuts (const std::vector< PlotterBase * > &cut_list, PlotterBase *plotter)
 Adds each of the existing cuts in the sequence to the plotter.
void appendToWeb (PlotterBase *plotter, PlotterList_t &web)
 Appends to the web the plotter and any cuts targeting the contained active data rep.
void appendToWeb (CutPlotter *cutter, PlotterList_t &web)
 Appends to the web the cutter if it is not already in it.
void appendToWeb (const std::vector< PlotterBase * > &cutters, PlotterList_t &web)
 Appends to web all the targets of each cutters.
void connectDataRep (const std::list< ViewBase * > &targets, const std::vector< const ViewBase * > &views)
 Connects the DataRep objects to its appropriate (cut) PlotterBase.
CutPlottercreateCut (const std::string &name, const DataSource *source, const std::vector< std::string > &bindings, const Color &color) const
 Creates a new cut plotter.
void createIdCut (const DataSource *source, DataSource *destination)
 Creates a new column in destination DataSource with elements of value 1.0 if element of source is contained in correspoding column in destinations.
void fillCutList (const std::vector< PlotterBase * > &plotter_list, std::vector< CutPlotter * > &cut_list)
 Clears and fills the cut_list with those PlotterBase objects in plotter_list that are CutPlotter objects.
void fillCutList (const PlotterBase *plotter, std::vector< PlotterBase * > &cut_list)
 Clears and fills the cut_list with the CutPlotter objects that target any DataRep cbject contained by the plotter.
void fillCutWeb (const std::vector< PlotterBase * > &plotters, std::vector< PlotterBase * > &web)
 Clears and fills the web with the PlotterBase objects in plotters, each of their CutPlotter objects that target them, and all of their targets.
void fillTupleCutList (const std::vector< const ViewBase * > &views, std::vector< const TupleCut * > &cut_list)
 Fills the cut_map with the TupleCut objects contained the list of views, if any.
PlotterBasefindPlotter (const DataRep *data_rep)
 Finds and returns the PlotterBase object containing the data_rep.
const std::vector< const
TupleCut * > & 
getCutList (const DataRep *rep) const
 Returns a list of TupleCut objects that are used by the DataRep.
const std::vector< PlotterBase * > & getCutList (const std::vector< PlotterBase * > &, const DataSource *rep) const
 Returns a list of CutPlotter objects that are in PlotterBase list and which use the same DataSource as rep.
bool isZoomPan (const PlotterBase *cut_plotter, hippodraw::Axes::Type axis) const
 Returns true if plotter is in zoom/pan list.
void linkCutAndRep (CutPlotter *cut_plotter, DataRep *target)
 Adds cut (associated with the given cut plotter)to the projector of target rep and registers target as the target of the cut_plotter for cut plotter.
void removeCut (PlotterBase *cut_plotter, PlotterBase *plotter)
 Removes the cut from the plotter.
void setZoomPan (PlotterBase *plotter, hippodraw::Axes::Type axis, bool yes)
 Sets the zoom/pan status of plotter.

Static Public Member Functions

static void fillAcceptedRows (std::vector< bool > &array, const DataSource *source, const std::vector< const TupleCut * > &cuts)
static CutControllerinstance ()
 Returns the pointer to the singleton instance.

Protected Member Functions

 CutController ()
 A default constructor for avoiding creation except by itself or with derived classes.

Private Types

typedef std::vector
< PlotterBase * > 
PlotterList_t
 The type of standard C++ container used to hold PlotterBase objects.

Private Member Functions

void connectDataRep (DataRep *rep, const std::vector< const ViewBase * > &views)
 Connects the DataRep object to its appropriate Cut Plotter.
void connectDataRep (const TupleCut *cut, DataRep *rep, const std::vector< const ViewBase * > &views)
 Connects the DataRep object to appropriate Cut Plotter.
 CutController (const CutController &)
 A private copy constructor in order to avoid copying.
void fillCutList (const DataRep *data_rep, std::vector< PlotterBase * > &cut_list)
 Clears and fills the cut_list with the CutPlotter objects that target the data_rep.

Private Attributes

std::vector< PlotterBase * > m_cut_list
 A temporary list of selected (cut) PlotterBase objects.
std::vector< std::string > m_cut_strings
 A temporary list of string corresponding to cuts.
std::list< std::pair
< PlotterBase *, Axes::Type > > 
m_zoom_pan
 A list of cutplotter-axis pair that have been placed in zoom/pan mode.

Static Private Attributes

static CutControllers_instance = 0
 The pointer to the singleton object.

Detailed Description

A singleton class that handles the application logic for cuts.

Author
Paul F. Kunz Paul_.nosp@m.Kunz.nosp@m.@slac.nosp@m..sta.nosp@m.nford.nosp@m..edu

Definition at line 38 of file CutController.h.

Member Typedef Documentation

typedef std::vector< PlotterBase * > PlotterList_t
private

The type of standard C++ container used to hold PlotterBase objects.

Definition at line 46 of file CutController.h.

Constructor & Destructor Documentation

CutController ( const CutController )
private

A private copy constructor in order to avoid copying.

CutController ( )
protected

A default constructor for avoiding creation except by itself or with derived classes.

Definition at line 56 of file CutController.cxx.

Referenced by CutController::instance().

Member Function Documentation

Cut1DPlotter * addCut ( PlotterBase plotter,
const std::string &  label 
)

Adds a one dimension cut to the plotter.

The cut uses the same DataSource as the plotter and is bound to the column with label label.

Deprecated:
This function is only here for the SIP Python module so that SIP will wrap Cut1DPlotter instead of PlotterBase.

Definition at line 70 of file CutController.cxx.

Referenced by CutController::addCut(), and CutController::addCuts().

PlotterBase * addCut ( PlotterBase plotter,
std::vector< std::string > &  bindings 
)

Adds a cut to the plotter.

Adds a simple one/two dimensional cut to the plotter. The cut uses the same DataSource as the plotter and is bound to the column with label binding. Returns the cut plotter object that was added.

Definition at line 81 of file CutController.cxx.

References CutController::addCut(), CutController::createCut(), DisplayController::getDataSource(), CutController::instance(), and Color::yellow.

void addCut ( PlotterBase cut_plotter,
PlotterBase plotter 
)

Adds an existing cut to a plotter.

If only one contained DataRep object by the plotter is active, then add the cut to it, otherwise add the cut to each having DataSource bindings. If plotter is itself a cut, then add the cut to its targets recursively. If cut_plotter is not a CutPlotter, then throw an exception.

Definition at line 96 of file CutController.cxx.

References PlotterBase::activePlotIndex(), PlotterBase::getDataRep(), CutController::linkCutAndRep(), and num_util::size().

void addCuts ( const std::vector< PlotterBase * > &  cut_list,
PlotterBase plotter 
)

Adds each of the existing cuts in the sequence to the plotter.

Definition at line 134 of file CutController.cxx.

References CutController::addCut(), and num_util::size().

void appendToWeb ( PlotterBase plotter,
PlotterList_t web 
)

Appends to the web the plotter and any cuts targeting the contained active data rep.

Definition at line 319 of file CutController.cxx.

References CutController::fillCutList().

Referenced by CutController::appendToWeb(), and CutController::fillCutWeb().

void appendToWeb ( CutPlotter cutter,
PlotterList_t web 
)

Appends to the web the cutter if it is not already in it.

Definition at line 341 of file CutController.cxx.

References CutController::appendToWeb(), and CutController::findPlotter().

void appendToWeb ( const std::vector< PlotterBase * > &  cutters,
PlotterList_t web 
)

Appends to web all the targets of each cutters.

Definition at line 363 of file CutController.cxx.

References CutController::appendToWeb().

void connectDataRep ( DataRep rep,
const std::vector< const ViewBase * > &  views 
)
private

Connects the DataRep object to its appropriate Cut Plotter.

This method is intended to be used when creating new objects that are copies of old ones If the newly created object contains cuts, then it's corresponding cut Plotter needs to add it to its target list. In the list views, the appropriate Cut Plotter object should be found.

Definition at line 456 of file CutController.cxx.

References NTupleProjector::getCutList(), and DataRep::getProjector().

Referenced by CutController::connectDataRep(), and XmlController::getFromDocument().

void connectDataRep ( const TupleCut cut,
DataRep rep,
const std::vector< const ViewBase * > &  views 
)
private

Connects the DataRep object to appropriate Cut Plotter.

This method is intended to be used when creating new objects that are copies of old ones If the newly created object contains cuts, then it's corresponding cut Plotter needs to add it to its target list. In the list views, the appropriate cut Plotter object should be found.

Definition at line 480 of file CutController.cxx.

References CutPlotter::addCutTarget(), and ViewBase::getPlotter().

void connectDataRep ( const std::list< ViewBase * > &  targets,
const std::vector< const ViewBase * > &  views 
)

Connects the DataRep objects to its appropriate (cut) PlotterBase.

This method is intended to be used when creating new objects that are copies of old ones If the newly created object contains cuts, then it's corresponding (cut) PlotterBase needs to add it to its target list. In the list views, the appropriate (cut) PlotterBase object should be found.

Definition at line 429 of file CutController.cxx.

References CutController::connectDataRep(), PlotterBase::getDataRep(), ViewBase::getPlotter(), and DataRep::hasNTupleBindings().

CutPlotter * createCut ( const std::string &  name,
const DataSource source,
const std::vector< std::string > &  bindings,
const Color color 
) const

Creates a new cut plotter.

The newly created cut plotter is bound to the source with bindings. Optionally, the color of the shading showing the cut inclusive range can be changed by overriding the default file for color. The name argument is ignored and may be used in the future to create different kinds of cuts. Returns the pointer to the cut plotter.

Definition at line 171 of file CutController.cxx.

References Factory< Type >::create(), DataRepController::createDataRep(), and CutController::instance().

Referenced by CutController::addCut().

void createIdCut ( const DataSource source,
DataSource destination 
)

Creates a new column in destination DataSource with elements of value 1.0 if element of source is contained in correspoding column in destinations.

Definition at line 602 of file CutController.cxx.

void fillAcceptedRows ( std::vector< bool > &  array,
const DataSource source,
const std::vector< const TupleCut * > &  cuts 
)
static

Definition at line 559 of file CutController.cxx.

References num_util::size().

Referenced by FitsController::writeNTupleToFile().

void fillCutList ( const std::vector< PlotterBase * > &  plotter_list,
std::vector< CutPlotter * > &  cut_list 
)

Clears and fills the cut_list with those PlotterBase objects in plotter_list that are CutPlotter objects.

Definition at line 233 of file CutController.cxx.

Referenced by CutController::appendToWeb(), and CutController::fillCutList().

void fillCutList ( const PlotterBase plotter,
std::vector< PlotterBase * > &  cut_list 
)

Clears and fills the cut_list with the CutPlotter objects that target any DataRep cbject contained by the plotter.

Definition at line 266 of file CutController.cxx.

References CutController::fillCutList().

void fillCutList ( const DataRep data_rep,
std::vector< PlotterBase * > &  cut_list 
)
private

Clears and fills the cut_list with the CutPlotter objects that target the data_rep.

Definition at line 281 of file CutController.cxx.

void fillCutWeb ( const std::vector< PlotterBase * > &  plotters,
std::vector< PlotterBase * > &  web 
)

Clears and fills the web with the PlotterBase objects in plotters, each of their CutPlotter objects that target them, and all of their targets.

If the web could not be created, clears the web.

Definition at line 304 of file CutController.cxx.

References CutController::appendToWeb().

void fillTupleCutList ( const std::vector< const ViewBase * > &  views,
std::vector< const TupleCut * > &  cut_list 
)

Fills the cut_map with the TupleCut objects contained the list of views, if any.

The key of the map is the address of the TupleCut object represented as integer.

Definition at line 405 of file CutController.cxx.

References ViewBase::getPlotter().

Referenced by XmlController::fillTupleCutMap().

PlotterBase * findPlotter ( const DataRep data_rep)

Finds and returns the PlotterBase object containing the data_rep.

Definition at line 376 of file CutController.cxx.

Referenced by CutController::appendToWeb().

const vector< const TupleCut * > & getCutList ( const DataRep rep) const

Returns a list of TupleCut objects that are used by the DataRep.

Definition at line 249 of file CutController.cxx.

Referenced by CreateNTuple::getDataCutList(), and Inspector::getDataCutList().

const vector< PlotterBase * > & getCutList ( const std::vector< PlotterBase * > &  plotters,
const DataSource rep 
) const

Returns a list of CutPlotter objects that are in PlotterBase list and which use the same DataSource as rep.

Definition at line 507 of file CutController.cxx.

References DisplayController::getDataSource(), CutController::instance(), and CutController::m_cut_list.

CutController * instance ( )
static
bool isZoomPan ( const PlotterBase cut_plotter,
hippodraw::Axes::Type  axis 
) const

Returns true if plotter is in zoom/pan list.

Definition at line 543 of file CutController.cxx.

References CutController::m_zoom_pan.

void linkCutAndRep ( CutPlotter cut_plotter,
DataRep target 
)

Adds cut (associated with the given cut plotter)to the projector of target rep and registers target as the target of the cut_plotter for cut plotter.

Definition at line 150 of file CutController.cxx.

References NTupleProjector::addCut(), CutPlotter::addCutTarget(), DataRep::getProjector(), and DataRep::setDirty().

Referenced by CutController::addCut().

void removeCut ( PlotterBase cut_plotter,
PlotterBase plotter 
)

Removes the cut from the plotter.

If the plotter does not have selected DataRep object, does nothing.

Definition at line 212 of file CutController.cxx.

References CutController::setZoomPan(), and hippodraw::Axes::X.

void setZoomPan ( PlotterBase plotter,
hippodraw::Axes::Type  axis,
bool  yes 
)

Sets the zoom/pan status of plotter.

If yes is true, the plotter is put in list of plotters with the zoom pan mode set, otherwise it is removed from the list.

Definition at line 533 of file CutController.cxx.

References CutController::m_zoom_pan.

Referenced by CutController::removeCut().

Member Data Documentation

std::vector< PlotterBase * > m_cut_list
mutableprivate

A temporary list of selected (cut) PlotterBase objects.

The selection is made by the application calling one of the getCutList member functions. A selected (Cut) PlotterBase object can be access by index into this list.

Definition at line 61 of file CutController.h.

Referenced by CutController::getCutList().

std::vector< std::string > m_cut_strings
mutableprivate

A temporary list of string corresponding to cuts.

Definition at line 64 of file CutController.h.

std:: list< std::pair< PlotterBase *, Axes::Type > > m_zoom_pan
private

A list of cutplotter-axis pair that have been placed in zoom/pan mode.

Definition at line 55 of file CutController.h.

Referenced by CutController::isZoomPan(), and CutController::setZoomPan().

CutController * s_instance = 0
staticprivate

The pointer to the singleton object.

Definition at line 49 of file CutController.h.

Referenced by CutController::instance().


The documentation for this class was generated from the following files:

Generated for HippoDraw Class Library by doxygen