yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis  1.9.0
YODA::Histo Class Referenceabstract

A base class for all histograms. More...

#include <Histo.h>

Inheritance diagram for YODA::Histo:
YODA::AnalysisObject

Public Member Functions

Constructors
virtual ~Histo1D ()
 Virtual destructor for inheritance. More...
 
virtual size_t dim () const =0
 Fill-dimension of this data object. More...
 
Modifiers
virtual void reset ()=0
 Reset the histogram. More...
 
virtual void fillBin (size_t i, double weight=1.0, double fraction=1.0)=0
 Fill histo bin i with the given weight, optionally as a fractional fill. More...
 
virtual void scaleW (double scalefactor)=0
 Rescale as if all fill weights had been different by factor scalefactor. More...
 
Bin accessors
Todo:
Makes sense for differential histos but not profiles: discriminate the types?
Todo:
These make sense in 1D; less clear about other dimensionalities
virtual size_t numBins () const =0
 Number of bins (not counting under/overflow) More...
 
Bin adding and removal

Check if binning is the same as different Histo1D

Todo:
Needs RTTI for inequivalent types
virtual void rmBin (size_t index)=0
 Remove a bin. More...
 
void eraseBin (size_t index)
 
Whole histo data
virtual double numEntries (bool includeoverflows=true) const =0
 Get the total area (sumW) of the histogram. More...
 
virtual double effNumEntries (bool includeoverflows=true) const =0
 Get the effective number of fills. More...
 
virtual double sumW (bool includeoverflows=true) const =0
 Get sum of weights in histo. More...
 
virtual double sumW2 (bool includeoverflows=true) const =0
 Get sum of squared weights in histo. More...
 
- Public Member Functions inherited from YODA::AnalysisObject
 AnalysisObject ()
 Default constructor. More...
 
 AnalysisObject (const std::string &type, const std::string &path, const std::string &title="")
 Constructor giving a type, a path and an optional title. More...
 
 AnalysisObject (const std::string &type, const std::string &path, const AnalysisObject &ao, const std::string &title="")
 Constructor giving a type, a path, another AO to copy annotation from, and an optional title. More...
 
virtual ~AnalysisObject ()
 Default destructor. More...
 
virtual AnalysisObjectoperator= (const AnalysisObject &ao)
 Default copy assignment operator. More...
 
virtual AnalysisObjectnewclone () const =0
 Make a copy on the heap, via 'new'. More...
 
void parseVariations ()
 
std::vector< std::string > annotations () const
 
bool hasAnnotation (const std::string &name) const
 Check if an annotation is defined. More...
 
const std::string & annotation (const std::string &name) const
 Get an annotation by name (as a string) More...
 
const std::string & annotation (const std::string &name, const std::string &defaultreturn) const
 Get an annotation by name (as a string) with a default in case the annotation is not found. More...
 
template<typename T >
const T annotation (const std::string &name) const
 Get an annotation by name (copied to another type) More...
 
template<typename T >
const T annotation (const std::string &name, const T &defaultreturn) const
 Get an annotation by name (copied to another type) with a default in case the annotation is not found. More...
 
void setAnnotation (const std::string &name, const std::string &value)
 Add or set a string-valued annotation by name. More...
 
void setAnnotation (const std::string &name, double value)
 Add or set a double-valued annotation by name. More...
 
void setAnnotation (const std::string &name, float value)
 Add or set a float-valued annotation by name. More...
 
void setAnnotation (const std::string &name, long double value)
 Add or set a long-double-valued annotation by name. More...
 
template<typename T >
void setAnnotation (const std::string &name, const T &value)
 Add or set an annotation by name (templated for remaining types) More...
 
void setAnnotations (const Annotations &anns)
 Set all annotations at once. More...
 
template<typename T >
void addAnnotation (const std::string &name, const T &value)
 Add or set an annotation by name. More...
 
void rmAnnotation (const std::string &name)
 Delete an annotation by name. More...
 
void clearAnnotations ()
 Delete an annotation by name. More...
 
const std::string title () const
 Get the AO title. More...
 
void setTitle (const std::string &title)
 Set the AO title. More...
 
const std::string path () const
 Get the AO path. More...
 
void setPath (const std::string &path)
 
const std::string name () const
 
virtual std::string type () const
 Get name of the analysis object type. More...
 

Additional Inherited Members

- Public Types inherited from YODA::AnalysisObject
typedef std::map< std::string, std::string > Annotations
 Collection type for annotations, as a string-string map. More...
 

Detailed Description

A base class for all histograms.

Definition at line 16 of file Histo.h.

Constructor & Destructor Documentation

◆ ~Histo1D()

virtual YODA::Histo::~Histo1D ( )
inlinevirtual

Virtual destructor for inheritance.

Definition at line 23 of file Histo.h.

References dim(), fillBin(), numBins(), reset(), rmBin(), and scaleW().

23 { }

Member Function Documentation

◆ dim()

virtual size_t YODA::Histo::dim ( ) const
pure virtual

Fill-dimension of this data object.

Implements YODA::AnalysisObject.

Referenced by ~Histo1D().

◆ effNumEntries()

virtual double YODA::Histo::effNumEntries ( bool  includeoverflows = true) const
pure virtual

Get the effective number of fills.

Referenced by eraseBin().

◆ eraseBin()

void YODA::Histo::eraseBin ( size_t  index)
inline

Remove several bins

Todo:
Implement, cf. Scatter::rmPoints()
Deprecated:
Use rmBin

Definition at line 129 of file Histo.h.

References effNumEntries(), numEntries(), rmBin(), sumW(), and sumW2().

129 { rmBin(index); }
virtual void rmBin(size_t index)=0
Remove a bin.

◆ fillBin()

virtual void YODA::Histo::fillBin ( size_t  i,
double  weight = 1.0,
double  fraction = 1.0 
)
pure virtual

Fill histo bin i with the given weight, optionally as a fractional fill.

Referenced by ~Histo1D().

◆ numBins()

virtual size_t YODA::Histo::numBins ( ) const
pure virtual

Number of bins (not counting under/overflow)

Referenced by ~Histo1D().

◆ numEntries()

virtual double YODA::Histo::numEntries ( bool  includeoverflows = true) const
pure virtual

Get the total area (sumW) of the histogram.

Get the number of fills

Referenced by eraseBin().

◆ reset()

virtual void YODA::Histo::reset ( )
pure virtual

Reset the histogram.

Keep the binning but set all bin contents and related quantities to zero

Implements YODA::AnalysisObject.

Referenced by ~Histo1D().

◆ rmBin()

virtual void YODA::Histo::rmBin ( size_t  index)
pure virtual

Remove a bin.

Referenced by eraseBin(), and ~Histo1D().

◆ scaleW()

virtual void YODA::Histo::scaleW ( double  scalefactor)
pure virtual

Rescale as if all fill weights had been different by factor scalefactor.

Referenced by ~Histo1D().

◆ sumW()

virtual double YODA::Histo::sumW ( bool  includeoverflows = true) const
pure virtual

Get sum of weights in histo.

Referenced by eraseBin().

◆ sumW2()

virtual double YODA::Histo::sumW2 ( bool  includeoverflows = true) const
pure virtual

Get sum of squared weights in histo.

Referenced by eraseBin().


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