BCAux Namespace Reference

Some functions not fitting anywhere else. More...

Classes

class  BCTrash
 A trash to keep heap-allocated objects of type T alive until the trash goes out of scope. More...
 
class  RootSideEffectGuard
 A guard object to prevent ROOT from taking over ownership of TNamed objects. More...
 

Enumerations

enum  BCKnowledgeUpdateDrawingStyle { kKnowledgeUpdateDefaultStyle = 0, kKnowledgeUpdateDetailedPosterior = 1, kKnowledgeUpdateDetailedPrior = 2 }
 An enumerator for the knowledge update drawing style presets. More...
 
enum  BCRange {
  kFiniteRange = 1, kNegativeInfiniteRange = 2, kPositiveInfiniteRange = 3, kInfiniteRange = 4,
  kEmptyRange = 5, kReverseRange = 6
}
 Range types. More...
 

Functions

bool AllowedCharacter (char c)
 
void DefaultToPDF (std::string &filename)
 Force file extension to be .pdf if not already .pdf or .ps. More...
 
void DrawKnowledgeUpdate (BCHistogramBase &prior, BCHistogramBase &posterior, bool draw_prior_first, BCTrash< TObject > &trash)
 Draw knowledge update plot into current TPad. More...
 
void MakeFinite (double &xmin, double &xmax)
 Make an infinite range finite by setting inf values to max. More...
 
template<class T >
T * OwnClone (const T *o)
 Create a clone of the input but avoid registering the object with ROOT so it cannot be deleted twice.
 
template<class T >
T * OwnClone (const T *o, const std::string &name)
 Create a clone of the input, change the name but avoid registering the object with ROOT so it cannot be deleted twice.
 
unsigned PrintPlots (std::vector< BCH1D > &h1, std::vector< BCH2D > &h2, const std::string &filename, unsigned hdiv=1, unsigned vdiv=1)
 Print plots. More...
 
BCAux::BCRange RangeType (double xmin, double xmax)
 Return type of range as a BCAux::BCRange enum. More...
 
std::string SafeName (const std::string &name)
 Convert a name into a safe name for use in ROOT object naming. More...
 
void SetKnowledgeUpdateDrawingStyle (BCH1D &prior, BCH1D &posterior, BCAux::BCKnowledgeUpdateDrawingStyle style=BCAux::kKnowledgeUpdateDefaultStyle)
 Use pre-made drawing options for knowledge update plots. More...
 
void SetKnowledgeUpdateDrawingStyle (BCH2D &prior, BCH2D &posterior, BCAux::BCKnowledgeUpdateDrawingStyle style=BCAux::kKnowledgeUpdateDefaultStyle)
 Use pre-made drawing options for knowledge update plots. More...
 
void SetStyle ()
 
TH2 * Transpose (const TH2 *const h, const std::string &name="")
 Transpose a TH2. More...
 

Detailed Description

Some functions not fitting anywhere else.

Author
Daniel Kollar
Kevin Kröninger
Version
1.0
Date
01.2009

A namespace which encapsulates auxiliary functions necessary for BAT.

Enumeration Type Documentation

An enumerator for the knowledge update drawing style presets.

Enumerator
kKnowledgeUpdateDefaultStyle 

Simple line-drawn histograms.

kKnowledgeUpdateDetailedPosterior 

Posterior drawn with detailed info, prior drawn as overlaid line.

kKnowledgeUpdateDetailedPrior 

Prior drawn with detailed info, posterior drawn as overlaid line.

Definition at line 119 of file BCAux.h.

Range types.

Enumerator
kFiniteRange 

lower < upper, lower and upper limits finite

kNegativeInfiniteRange 

lower < upper, lower limit infinite, upper limit finite

kPositiveInfiniteRange 

lower < upper, lower limit finite, upper limit infinite

kInfiniteRange 

lower < upper, lower and upper limits infinite

kEmptyRange 

lower limit == upper limit

kReverseRange 

lower > upper

Definition at line 88 of file BCAux.h.

Function Documentation

bool BCAux::AllowedCharacter ( char  c)
Returns
Whether character is allowed in a safe name.

Definition at line 119 of file BCAux.cxx.

void BCAux::DefaultToPDF ( std::string &  filename)

Force file extension to be .pdf if not already .pdf or .ps.

Parameters
filenameFilename to be altered

Definition at line 36 of file BCAux.cxx.

void BCAux::DrawKnowledgeUpdate ( BCHistogramBase prior,
BCHistogramBase posterior,
bool  draw_prior_first,
BCTrash< TObject > &  trash 
)

Draw knowledge update plot into current TPad.

Parameters
priorBCHistogramBase containing prior
posteriorBCHistogramBase containing posterior
draw_prior_firstFlag for deciding drawing order.
trashWhere to keep references of plot objects for later deletion.

Definition at line 236 of file BCAux.cxx.

void BCAux::MakeFinite ( double &  xmin,
double &  xmax 
)

Make an infinite range finite by setting inf values to max.

Parameters
xminlower limit to coerce
xmaxupper limit to coerce

Definition at line 102 of file BCAux.cxx.

unsigned BCAux::PrintPlots ( std::vector< BCH1D > &  h1,
std::vector< BCH2D > &  h2,
const std::string &  filename,
unsigned  hdiv = 1,
unsigned  vdiv = 1 
)

Print plots.

Parameters
h1Vector of 1D histograms to plot
h2Vector of 2D histograms to plot
filenamePath to file to print to
hdivNumber of columns of plots per page
vdivNumber of rows of plots per page
Returns
Number of plots printed

Definition at line 339 of file BCAux.cxx.

BCAux::BCRange BCAux::RangeType ( double  xmin,
double  xmax 
)

Return type of range as a BCAux::BCRange enum.

Parameters
xminlower limit of range
xmaxupper limit of range
Returns
range type.

Definition at line 85 of file BCAux.cxx.

std::string BCAux::SafeName ( const std::string &  name)

Convert a name into a safe name for use in ROOT object naming.

Definition at line 111 of file BCAux.cxx.

void BCAux::SetKnowledgeUpdateDrawingStyle ( BCH1D prior,
BCH1D posterior,
BCAux::BCKnowledgeUpdateDrawingStyle  style = BCAux::kKnowledgeUpdateDefaultStyle 
)

Use pre-made drawing options for knowledge update plots.

Parameters
priorPrior histogram container
posteriorPosterior histogram container
styleStyle option

Definition at line 132 of file BCAux.cxx.

void BCAux::SetKnowledgeUpdateDrawingStyle ( BCH2D prior,
BCH2D posterior,
BCAux::BCKnowledgeUpdateDrawingStyle  style = BCAux::kKnowledgeUpdateDefaultStyle 
)

Use pre-made drawing options for knowledge update plots.

Parameters
priorPrior histogram container
posteriorPosterior histogram container
styleStyle option

Definition at line 181 of file BCAux.cxx.

void BCAux::SetStyle ( )
Deprecated:
This function is empty but for a warning message.

Please do not call it.

Definition at line 30 of file BCAux.cxx.

TH2 * BCAux::Transpose ( const TH2 *const  h,
const std::string &  name = "" 
)

Transpose a TH2.

Parameters
h2D histogram to transpose
nameName to give to transposed histogram, if empty, "_tr" is added to original hist's name.
Returns
Transposed independent histogram.

Definition at line 55 of file BCAux.cxx.