Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

ROList Class Reference

#include <ROList.h>

Inheritance diagram for ROList:

Inheritance graph
[legend]
Collaboration diagram for ROList:

Collaboration graph
[legend]
List of all members.

Detailed Description

Stores a List of registered Histos (RegO), also recursively.

An ROList stores pointers to RegO objects, and to other ROList objects. Its main purpose is to allow operations on all of the stored objects.

One possibility to operate on all objects is to use an HVisitor object, which will be called with all stored objects in turn (see Gamma, Helm, Johnson, Vlissides: Design Patterns for a discussion of the Visitor pattern). Special methods include Write(), which writes out all histograms to a file, and Draw(...), which draws histograms on a canvas.

A ROList is itself a RegO, which means that we can build trees of such lists (see the "Compound" pattern in Gamma, Helm, Johnson, Vlissides: Design Patterns).

To iterate over all entries, do something like this:

 void iterate_over_ROList (const ROList& rol) {
   for (ROList::const_iterator iter = rol.begin(); iter != rol.end(); ++iter) {
     RegO *ro = rol.getEntry (iter);
     // do something with ro here...
   } 
 *

An older way to iterate is this:

 void iterate_over_ROList (const ROList& rol) {
   ROList::IndexType i = rol.getFirstEntry();
   RegO *ro = rol.getEntry (i);
   while (ro) {
     // do something with ro here...
     ro = rol.getNextEntry (i);   // updates i and ro!
   }
 *

Author: Jenny Böhme, Benno List

Date
2006/05/15 13:28:18
Author
zimmerto

Changelog:

Definition at line 76 of file ROList.h.

Public Types

typedef unsigned long long IndexType
 The type that is used to enumerate the objects internally.

typedef MapType::const_iterator const_iterator
typedef MapType::iterator iterator
typedef MapType::const_reverse_iterator const_reverse_iterator
typedef MapType::reverse_iterator reverse_iterator

Public Member Functions

 ROList ()
 Default constructor: creates an empty ROList.

 ROList (const ROListPoR &mother)
 Creates an empty ROList and registers it with another list.

int registerObject (RegO *h)
 Registers a RegO object.

int registerObject (IndexType n, RegO *h)
 Registers a RegO object under a given number.

virtual void Write ()
 Writes out all histograms (if they are derived from TH1).

virtual ROListvisit (HVisitor &v)
 Visits all histograms.

virtual ROListvisit (const ConstHVisitor &v)
 Visits all histograms.

virtual int Draw (TPad *pad, TVirtualPS *ps=0, Option_t *option=0, bool across=true, Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0, Int_t log=0, bool recursive=false, int izone=0)
 Draws all histograms (if they are derived from TH1).

virtual int Draw (TPad *pad, TVirtualPS *ps, Option_t *option, bool across, Int_t nx, Int_t ny, Int_t log, bool recursive=false, int izone=0)
virtual int DrawFunc (TPad *pad, TVirtualPS *ps=0, Option_t *option=0, const char *fname="", bool across=true, Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0, Int_t log=0, bool recursive=false, int izone=0)
 Enable a specific Fit Function to be plotted with the Histogram.

virtual int DrawFunc (TPad *pad, TVirtualPS *ps, Option_t *option, const char *fname, bool across, Int_t nx, Int_t ny, Int_t log, bool recursive=false, int izone=0)
virtual void DrawCutFlow (TPad *pad, TVirtualPS *ps=0, Option_t *option=0, Option_t *sameoption=0, bool across=true, Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0, Int_t log=0, bool recursive=false, bool backward=false)
 Draws all histograms (if they are derived from TH1), with the following histogram overlaid.

virtual void DrawCutFlow (TPad *pad, TVirtualPS *ps, Option_t *option, Option_t *sameoption, bool across, Int_t nx, Int_t ny, Int_t log, bool recursive=false, bool backward=false)
 Draws all histograms (if they are derived from TH1).

IndexType getEntries () const
 Return the number of entries in the list.

IndexType getHighestEntry () const
 Returns the highest number plus 1 of any entry in the map.

IndexType getFirstEntry () const
 Returns the lowest number of any entry in the map.

RegOgetEntry (IndexType i) const
 Returns pointer to entry with number i, 0 if entry does not exist.

RegOgetNextEntry (IndexType &i) const
 Returns pointer to next entry with number greater than i, 0 if entry does not exist.

RegOgetEntry (const_iterator iter) const
 Returns pointer to entry with number i, 0 if entry does not exist.

RegOgetNextEntry (const_iterator &i) const
 Returns pointer to next entry with number greater than i, 0 if entry does not exist.

iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
iterator lower_bound (IndexType i)
const_iterator lower_bound (IndexType i) const
iterator upper_bound (IndexType i)
const_iterator upper_bound (IndexType i) const
IndexType getIndex (iterator iter) const
 Get index that corresponds to an iterator.

IndexType getIndex (const_iterator iter) const

Private Types

typedef std::map< IndexType,
RegO * > 
MapType
enum  { LINEAR = 0, LOGY = 1, LOGX = 2, LOGXY = 3 }

Private Attributes

MapType theMap
 the map of pointers to registered histos


Constructor & Destructor Documentation

ROList::ROList const ROListPoR mother  ) 
 

Creates an empty ROList and registers it with another list.

Parameters:
mother  The "mother" list

Definition at line 48 of file ROList.C.

References ROListPoR::prol, and registerObject().


Member Function Documentation

int ROList::registerObject RegO h  ) 
 

Registers a RegO object.

Parameters:
h  The object to be registered

Definition at line 57 of file ROList.C.

References getEntries(), getHighestEntry(), and theMap.

Referenced by SetOfHProf::initHisto(), SetOfHistograms::initHisto(), SetOfH2F::initHisto(), MatrixOfHProf::initHisto(), MatrixOfHistograms::initHisto(), MatrixOfH2F::initHisto(), MatrixOfHistograms::MatrixOfHistograms(), RegO::RegO(), ROList(), and SetOfH::SetOfH().

int ROList::registerObject IndexType  n,
RegO h
 

Registers a RegO object under a given number.

Parameters:
n  The number under which to register the object
h  The object to be registered

Definition at line 69 of file ROList.C.

References getEntries(), and theMap.

ROList & ROList::visit HVisitor v  )  [virtual]
 

Visits all histograms.

Calls v(RegO& RegO) for each of the registered histograms See Gamma, Helm, Johnson, Vlissides: "Design Patterns" for a discussion of the Visitor pattern.

Parameters:
v  The visitor object

Definition at line 92 of file ROList.C.

References HVisitor::visit().

Referenced by visit(), and Write().

int ROList::Draw TPad *  pad,
TVirtualPS *  ps = 0,
Option_t *  option = 0,
bool  across = true,
Int_t  nx = 1,
Int_t  ny = 1,
Float_t  xmargin = 0.01,
Float_t  ymargin = 0.01,
Int_t  color = 0,
Int_t  log = 0,
bool  recursive = false,
int  izone = 0
[virtual]
 

Draws all histograms (if they are derived from TH1).

  • pad is usually a TCanvas object and MUST be provided,
  • ps is usually a TPostscript object
  • option is an option string like "HE0"
  • across determines whether the histograms are arranged left-to-right (across=true) or top-to-bottom on the page
  • nx, ny are the number of histos in horizontal (nx) and vertical (ny) direction on a page
  • xmargin, ymargin are the corresponding values used by TPad::Divide.
  • color is passed to TPad::Divide.
  • log determines whether the histos shall be plotted logarithmically.
Parameters:
pad  usually a TCanvas object and MUST be provided
ps  usually a TPostscript object
option  an option string like "HE0"
across  arrange histos left-to-right (true) or top-to-bottom
nx  passed to TPad::Divide.
ny  passed to TPad::Divide.
xmargin  passed to TPad::Divide.
ymargin  passed to TPad::Divide.
color  passed to TPad::Divide.
log  determines whether the histos shall be plotted logarithmically
recursive  determines whether histos in Sets and Matrices shall also be plotted
izone  start at this pad

Definition at line 120 of file ROList.C.

References getEntries(), and IndexType.

Referenced by Draw().

int ROList::Draw TPad *  pad,
TVirtualPS *  ps,
Option_t *  option,
bool  across,
Int_t  nx,
Int_t  ny,
Int_t  log,
bool  recursive = false,
int  izone = 0
[virtual]
 

Draws all histograms (if they are derived from TH1) start at zone izone

Parameters:
pad  usually a TCanvas object and MUST be provided
ps  usually a TPostscript object
option  an option string like "HE0"
across  arrange histos left-to-right (true) or top-to-bottom
nx  passed to TPad::Divide.
ny  passed to TPad::Divide.
log  determines whether the histos shall be plotted logarithmically
recursive  determines whether histos in Sets and Matrices shall also be plotted
izone  start at this pad

Definition at line 172 of file ROList.C.

References Draw().

int ROList::DrawFunc TPad *  pad,
TVirtualPS *  ps = 0,
Option_t *  option = 0,
const char *  fname = "",
bool  across = true,
Int_t  nx = 1,
Int_t  ny = 1,
Float_t  xmargin = 0.01,
Float_t  ymargin = 0.01,
Int_t  color = 0,
Int_t  log = 0,
bool  recursive = false,
int  izone = 0
[virtual]
 

Enable a specific Fit Function to be plotted with the Histogram.

If the Histogram was fitted with the Option "0", the Fit Function is globally disabled for drawing. This function enables it for the active drawing and disables it again afterwards. Note: The Draw is done via DrawCopy ! Inputs:

  • pad is usually a TCanvas object and MUST be provided,
  • ps is usually a TPostscript object
  • option is an option string like "HE0"
  • fname is the name of the function to be plotted
  • across determines whether the histograms are arranged left-to-right (across=true) or top-to-bottom on the page
  • nx, ny are the number of histos in horizontal (nx) and vertical (ny) direction on a page
  • xmargin, ymargin are the corresponding values used by TPad::Divide.
  • color is passed to TPad::Divide.
  • log determines whether the histos shall be plotted logarithmically. Author: Ronnie Weber
Parameters:
pad  usually a TCanvas object and MUST be provided
ps  usually a TPostscript object
option  an option string like "HE0"
fname  Name of the function
across  arrange histos left-to-right (true) or top-to-bottom
nx  passed to TPad::Divide.
ny  passed to TPad::Divide.
xmargin  passed to TPad::Divide.
ymargin  passed to TPad::Divide.
color  passed to TPad::Divide.
log  determines whether the histos shall be plotted logarithmically
recursive  determines whether histos in Sets and Matrices shall also be plotted
izone  start at this pad

Definition at line 275 of file ROList.C.

References getEntries(), and IndexType.

Referenced by DrawFunc().

int ROList::DrawFunc TPad *  pad,
TVirtualPS *  ps,
Option_t *  option,
const char *  fname,
bool  across,
Int_t  nx,
Int_t  ny,
Int_t  log,
bool  recursive = false,
int  izone = 0
[virtual]
 

Draws all histograms (if they are derived from TH1) and the function fname start at zone izone

Parameters:
pad  usually a TCanvas object and MUST be provided
ps  usually a TPostscript object
option  an option string like "HE0"
fname  Name of the function
across  arrange histos left-to-right (true) or top-to-bottom
nx  passed to TPad::Divide.
ny  passed to TPad::Divide.
log  determines whether the histos shall be plotted logarithmically
recursive  determines whether histos in Sets and Matrices shall also be plotted
izone  start at this pad

Definition at line 341 of file ROList.C.

References DrawFunc().

void ROList::DrawCutFlow TPad *  pad,
TVirtualPS *  ps = 0,
Option_t *  option = 0,
Option_t *  sameoption = 0,
bool  across = true,
Int_t  nx = 1,
Int_t  ny = 1,
Float_t  xmargin = 0.01,
Float_t  ymargin = 0.01,
Int_t  color = 0,
Int_t  log = 0,
bool  recursive = false,
bool  backward = false
[virtual]
 

Draws all histograms (if they are derived from TH1), with the following histogram overlaid.

  • pad is usually a TCanvas object and MUST be provided,
  • ps is usually a TPostscript object
  • option is an option string like "HE0"
  • across determines whether the histograms are arranged left-to-right (across=true) or top-to-bottom on the page
  • nx, ny are the number of histos in horizontal (nx) and vertical (ny) direction on a page
  • xmargin, ymargin are the corresponding values used by TPad::Divide.
  • color is passed to TPad::Divide.
  • log determines whether the histos shall be plotted logarithmically.
Parameters:
pad  usually a TCanvas object and MUST be provided
ps  usually a TPostscript object
option  an option string like "HE0"
sameoption  an option string like "HE0 SAME"
across  arrange histos left-to-right (true) or top-to-bottom
nx  passed to TPad::Divide.
ny  passed to TPad::Divide.
xmargin  passed to TPad::Divide.
ymargin  passed to TPad::Divide.
color  passed to TPad::Divide.
log  determines whether the histos shall be plotted logarithmically
recursive  determines whether histos in Sets and Matrices shall also be plotted
backward  determines whether the cuts are compared "forward" or "backward"

Definition at line 180 of file ROList.C.

References getEntries(), and IndexType.

Referenced by DrawCutFlow().

void ROList::DrawCutFlow TPad *  pad,
TVirtualPS *  ps,
Option_t *  option,
Option_t *  sameoption,
bool  across,
Int_t  nx,
Int_t  ny,
Int_t  log,
bool  recursive = false,
bool  backward = false
[virtual]
 

Draws all histograms (if they are derived from TH1).

Parameters:
pad  usually a TCanvas object and MUST be provided
ps  usually a TPostscript object
option  an option string like "HE0"
sameoption  an option string like "HE0 SAME"
across  arrange histos left-to-right (true) or top-to-bottom
nx  passed to TPad::Divide.
ny  passed to TPad::Divide.
log  determines whether the histos shall be plotted logarithmically
recursive  determines whether histos in Sets and Matrices shall also be plotted
backward  determines whether the cuts are compared "forward" or "backward"

Definition at line 265 of file ROList.C.

References DrawCutFlow().

RegO * ROList::getEntry IndexType  i  )  const [inline]
 

Returns pointer to entry with number i, 0 if entry does not exist.

Parameters:
i  The entry number

Definition at line 314 of file ROList.h.

References theMap.

Referenced by SetOfH::Add(), SFEffSetOfHistograms::Divide(), SetOfH::Divide(), SFEffSetOfHistograms::Draw(), SFSetOfHProf::Fill(), SFSetOfHistograms::Fill(), SFSetOfH2F::Fill(), SFROList::Fill(), SFMatrixOfHProf::Fill(), SFMatrixOfHistograms::Fill(), SFMatrixOfH2F::Fill(), SFEffSetOfHistograms::Fill(), SetOfHProf::getHisto(), SetOfHistograms::getHisto(), SetOfH2F::getHisto(), SetOfH::getHisto(), MatrixOfHProf::getHisto(), MatrixOfHistograms::getHisto(), MatrixOfH2F::getHisto(), MatrixOfH::getHisto(), EventLoop::loop(), and SetOfH::Multiply().

RegO * ROList::getNextEntry IndexType i  )  const [inline]
 

Returns pointer to next entry with number greater than i, 0 if entry does not exist.

Parameters:
i  The entry number (will be increased!)

Definition at line 320 of file ROList.h.

References theMap.

RegO * ROList::getEntry const_iterator  iter  )  const [inline]
 

Returns pointer to entry with number i, 0 if entry does not exist.

Parameters:
iter  An Iterator

Definition at line 329 of file ROList.h.

RegO * ROList::getNextEntry const_iterator &  i  )  const [inline]
 

Returns pointer to next entry with number greater than i, 0 if entry does not exist.

Parameters:
iter  An iterator (will be increased)

Definition at line 333 of file ROList.h.

References theMap.

ROList::IndexType ROList::getIndex iterator  iter  )  const [inline]
 

Get index that corresponds to an iterator.

Parameters:
iter  An Iterator

Definition at line 380 of file ROList.h.

References getHighestEntry(), IndexType, and theMap.

Referenced by SetOfH::Add(), SetOfH::Divide(), SetOfHistograms::getSummary(), and SetOfH::Multiply().

ROList::IndexType ROList::getIndex const_iterator  iter  )  const [inline]
 

Parameters:
iter  An Iterator

Definition at line 384 of file ROList.h.

References getHighestEntry(), IndexType, and theMap.


The documentation for this class was generated from the following files:
Generated on Thu Oct 26 12:55:05 2006 for SFH by doxygen 1.3.2