SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Member Functions | Private Attributes
Beam::Drawer Class Reference

Stores the default drawing options and methods to produce ROOT plots. More...

#include <Drawer.hh>

Public Member Functions

 Drawer ()
 Default constructor, intializes the default drawing options. More...
 
 Drawer (const Drawer &dra)
 Copy constructor. More...
 
Drawer & operator= (const Drawer &dra)
 Equality operator. More...
 
 ~Drawer ()
 Destructor. More...
 
void SetVariableSettings (const std::string &var, const VarSet &varset)
 Sets custom settings for the specified variable. More...
 
void SetVariableLimits (const std::string &var, double llim, double ulim)
 Sets the limits of the specified variable. More...
 
TH1F * New1DHistogram (const std::string &name, const std::string &var) const
 Returns an appropriate TH1F to draw one of the phase space component. More...
 
TH2F * New2DHistogram (const std::string &name, const std::string &varx, const std::string &vary) const
 Defines an appropriate TH1F to draw two of the phase space component. More...
 
ScatterGraph * NewAmplitudeScatter (const std::string &name, const std::string &varx, const std::string &vary) const
 Returns a scatter plot with an amplitude color scale. More...
 
THStack * NewStack (std::map< std::string, TH1F * > hists) const
 Initializes a stack of histograms of different data types. More...
 
std::map< std::string,
TPaveStats * > 
NewStackStats (std::map< std::string, TH1F * > hists, const std::string draw_opt="EMR", double *hoffset=NULL) const
 Intializes stat boxes for a stack of histogram of different data types. More...
 
TLegend * NewStackLegend (std::map< std::string, TH1F * > hists, const double hoffset=0) const
 Intializes a legend for a stack of histogram of different data types. More...
 
THStack * DrawStack (std::map< std::string, TH1F * > hists, const std::string &name) const
 Draws superimposed data types histograms. More...
 
void SaveStack (std::map< std::string, TH1F * > hists, const std::string &name, bool ratio=false) const
 Saves superimposed data types histograms. More...
 
TMultiGraph * NewMultiGraph (std::map< std::string, TGraphErrors * > graphs) const
 Initializes a multigraph of graphs of different data types. More...
 
TLegend * NewMultiGraphLegend (std::map< std::string, TGraphErrors * > graphs, const std::string corner="tr") const
 Intializes a legend for a multigraph of different data types. More...
 
TGaxis * NewMultiGraphEmittanceAxis (TF1 *func, const double &miny, const double &maxy, const double &maxx) const
 Intializes an emittance axis for fractional quantities. More...
 
TMultiGraph * DrawMultiGraph (std::map< std::string, TGraphErrors * > graphs, const std::string &name, TF1 *func=NULL)
 Draws superimposed data types histograms. More...
 
void SaveMultiGraph (std::map< std::string, TGraphErrors * > graphs, const std::string &name, TF1 *func=NULL)
 Saves superimposed data types histograms. More...
 
TH1F * ProjectionMeanX (TH2F *hist, bool fit=false) const
 Produces a TH1F of the mean Y as a function of X from a TH2F. More...
 
void SetInfoBox (InfoBox *info)
 Sets the info box. More...
 
InfoBox * GetInfoBox () const
 Returns a pointer to the info box. More...
 

Private Member Functions

void Initialize ()
 Initializes the default drawing options. More...
 
void SetStyle (TH1 *obj, const std::string &type) const
 Sets the histogram style according to the predefined options. More...
 
void SetStyle (TGraph *obj, const std::string &type) const
 Sets the graph style according to the predefined options. More...
 
void DrawMICEModules (const double &miny, const double &maxy) const
 Draws the MICE beam line elements onto an evolution graph. More...
 
std::string FindBestCorner (std::map< std::string, TGraphErrors * > graphs) const
 Finds the corner that leasts overlaps the graph. More...
 
void SaveGIF (const std::string &name, const std::vector< TCanvas * > &canv) const
 Saves the canvases, in order, to a single GIF. More...
 

Private Attributes

std::vector< std::string > _types
 Data types. More...
 
std::vector< std::string > _vars
 Phase space variables. More...
 
std::map< std::string, DrawOpt > _options
 Drawing options for each data type. More...
 
std::map< std::string, VarSet > _varsets
 Drawing options for each data type. More...
 
InfoBox * _info
 MAUS info box to be drawn. More...
 

Detailed Description

Stores the default drawing options and methods to produce ROOT plots.

Defines a list of default colors, fill styles, etc. for the different data types. Contains a list of methods to produce preformatted plots of the of the phase space data.

Constructor & Destructor Documentation

Beam::Drawer::Drawer ( )

Default constructor, intializes the default drawing options.

Beam::Drawer::Drawer ( const Drawer &  dra)

Copy constructor.

Beam::Drawer::~Drawer ( )

Destructor.

Member Function Documentation

void Beam::Drawer::DrawMICEModules ( const double &  miny,
const double &  maxy 
) const
private

Draws the MICE beam line elements onto an evolution graph.

Parameters
minyMinimum value on the Y axis
maxyMaximum value on the Y axis
TMultiGraph * Beam::Drawer::DrawMultiGraph ( std::map< std::string, TGraphErrors * >  graphs,
const std::string &  name,
TF1 *  func = NULL 
)

Draws superimposed data types histograms.

Parameters
graphsMap of graphs that form the multigraph
nameFile name
funcProportionality function for emittance estimate
Returns
Pointer to the drawn multigraph
THStack * Beam::Drawer::DrawStack ( std::map< std::string, TH1F * >  hists,
const std::string &  name 
) const

Draws superimposed data types histograms.

Parameters
histsMap of histograms that form the stack
nameFile name
Returns
Pointer to the drawn stack
std::string Beam::Drawer::FindBestCorner ( std::map< std::string, TGraphErrors * >  graphs) const
private

Finds the corner that leasts overlaps the graph.

Parameters
mgMap of graphs to not overlap
Returns
Returns "tl", "tr", "bl" or "br" to specify the corner
InfoBox* Beam::Drawer::GetInfoBox ( ) const
inline

Returns a pointer to the info box.

void Beam::Drawer::Initialize ( )
private

Initializes the default drawing options.

TH1F * Beam::Drawer::New1DHistogram ( const std::string &  name,
const std::string &  var 
) const

Returns an appropriate TH1F to draw one of the phase space component.

Parameters
nameName of the histogram
varVariable to be drawn
Returns
Pointer to the initialized histogram
TH2F * Beam::Drawer::New2DHistogram ( const std::string &  name,
const std::string &  varx,
const std::string &  vary 
) const

Defines an appropriate TH1F to draw two of the phase space component.

Parameters
nameName of the histogram
varxFirst variable to be drawn
varySecond variable to be drawn
Returns
Pointer to the initialized histogram
ScatterGraph * Beam::Drawer::NewAmplitudeScatter ( const std::string &  name,
const std::string &  varx,
const std::string &  vary 
) const

Returns a scatter plot with an amplitude color scale.

Parameters
nameName of the scatter plot
varxFirst variable to be drawn
varySecond variable to be drawn
Returns
Pointer to the initialized scatter plot
TMultiGraph * Beam::Drawer::NewMultiGraph ( std::map< std::string, TGraphErrors * >  graphs) const

Initializes a multigraph of graphs of different data types.

Parameters
graphsMap of graphs that form the multigraph
Returns
Pointer to the initialized multigraph
TGaxis * Beam::Drawer::NewMultiGraphEmittanceAxis ( TF1 *  func,
const double &  miny,
const double &  maxy,
const double &  maxx 
) const

Intializes an emittance axis for fractional quantities.

Parameters
funcFunction of the emittance
minyMinimum value on the Y axis
maxyMaximum value on the Y axis
maxxMaximum value on the X axis
Returns
Pointer to the initialized multigraph legend
TLegend * Beam::Drawer::NewMultiGraphLegend ( std::map< std::string, TGraphErrors * >  graphs,
const std::string  corner = "tr" 
) const

Intializes a legend for a multigraph of different data types.

Parameters
graphsMap of graphs that form the multigraph
cornerCorner in which to draw the legend
Returns
Pointer to the initialized multigraph legend
THStack * Beam::Drawer::NewStack ( std::map< std::string, TH1F * >  hists) const

Initializes a stack of histograms of different data types.

Parameters
histsMap of histograms that form the stack
Returns
Pointer to the initialized stack
TLegend * Beam::Drawer::NewStackLegend ( std::map< std::string, TH1F * >  hists,
const double  hoffset = 0 
) const

Intializes a legend for a stack of histogram of different data types.

Parameters
histsMap of histograms that form the stack
hoffsetHeight offset due to the presence of a statbox
Returns
Pointer to the initialized stack legend
std::map< std::string, TPaveStats * > Beam::Drawer::NewStackStats ( std::map< std::string, TH1F * >  hists,
const std::string  draw_opt = "EMR",
double *  hoffset = NULL 
) const

Intializes stat boxes for a stack of histogram of different data types.

Parameters
histsMap of histograms that form the stack
draw_optDrawing options ("E" for entries, "M" for mean, "R" for RMS)
hoffsetHeight offset due to the presence of a statbox
Returns
Map of pointers to each initialized stack stat box
Drawer & Beam::Drawer::operator= ( const Drawer &  dra)

Equality operator.

TH1F * Beam::Drawer::ProjectionMeanX ( TH2F *  hist,
bool  fit = false 
) const

Produces a TH1F of the mean Y as a function of X from a TH2F.

Parameters
histInput 2D histogram
fitFlag for Gaussian peak fitting
Returns
Pointer to the initialized projected histogram
void Beam::Drawer::SaveGIF ( const std::string &  name,
const std::vector< TCanvas * > &  canv 
) const
private

Saves the canvases, in order, to a single GIF.

Parameters
nameName of the object to print
canvArray of canvases to save
void Beam::Drawer::SaveMultiGraph ( std::map< std::string, TGraphErrors * >  graphs,
const std::string &  name,
TF1 *  func = NULL 
)

Saves superimposed data types histograms.

Parameters
graphsMap of graphs that form the multigraph
nameFile name
funcProportionality function for emittance estimate
void Beam::Drawer::SaveStack ( std::map< std::string, TH1F * >  hists,
const std::string &  name,
bool  ratio = false 
) const

Saves superimposed data types histograms.

Parameters
histsMap of histograms that form the stack
nameFile name
ratioDraws the ratio data/simulation
void Beam::Drawer::SetInfoBox ( InfoBox *  info)
inline

Sets the info box.

Parameters
objMAUS info box object
void Beam::Drawer::SetStyle ( TH1 *  obj,
const std::string &  type 
) const
private

Sets the histogram style according to the predefined options.

Parameters
objROOT histogram (may be TH1, TH2 or TH3)
typeData type
void Beam::Drawer::SetStyle ( TGraph *  obj,
const std::string &  type 
) const
private

Sets the graph style according to the predefined options.

Parameters
objROOT graph (may be TGraph or TGraphErrors)
typeData type
void Beam::Drawer::SetVariableLimits ( const std::string &  var,
double  llim,
double  ulim 
)

Sets the limits of the specified variable.

Parameters
varName of the variable
llimLower limit
ulimUpper limit
void Beam::Drawer::SetVariableSettings ( const std::string &  var,
const VarSet &  varset 
)
inline

Sets custom settings for the specified variable.

Parameters
varName of the variable
varsetVariable settings

Field Documentation

InfoBox* Beam::Drawer::_info
private

MAUS info box to be drawn.

std::map<std::string, DrawOpt> Beam::Drawer::_options
private

Drawing options for each data type.

std::vector<std::string> Beam::Drawer::_types
private

Data types.

std::vector<std::string> Beam::Drawer::_vars
private

Phase space variables.

std::map<std::string, VarSet> Beam::Drawer::_varsets
private

Drawing options for each data type.


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