| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Public Types | Public Member Functions | Protected Attributes

# Gaudi::Generic1D< INTERFACE, IMPLEMENTATION > Class Template Reference

Common AIDA implementation stuff for histograms and profiles using ROOT implementations. More...

`#include <GaudiPI/Generic1D.h>`

Inheritance diagram for Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >:
[legend]
Collaboration diagram for Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >:
[legend]

List of all members.

## Public Types
typedef Generic1D< INTERFACE, IMPLEMENTATION > | Base
## Public Member Functions
| Generic1D ()
| Default constructor.
virtual | ~Generic1D ()
| Default destructor.
virtual const std::string & | userLevelClassType () const
| The AIDA user-level unterface leaf class type.
virtual void * | cast (const std::string &cl) const
| Manual cast by class name.
TObject * | representation () const
| ROOT object implementation.
virtual void | adoptRepresentation (TObject *rep)
| Adopt ROOT histogram representation.
virtual std::string | title () const
| Get the title of the object.
virtual bool | setTitle (const std::string &title)
| Set the title of the object.
std::string | name () const
| object name
bool | setName (const std::string &newName)
| Set the name of the object.
virtual AIDA::IAnnotation & | annotation ()
| Access annotation object.
virtual const AIDA::IAnnotation & | annotation () const
| Access annotation object (cons)
Axis & | axis ()
| Access to axis object.
const Axis & | axis () const
| Get the x axis of the IHistogram1D.
virtual int | entries () const
| Get the number or all the entries.
virtual int | allEntries () const
| Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.
virtual int | extraEntries () const
| Get the number of entries in the underflow and overflow bins.
virtual int | binEntries (int index) const
| Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
virtual double | binRms (int index) const
virtual double | sumBinHeights () const
| Get the sum of in range bin heights in the IProfile.
virtual double | sumAllBinHeights () const
| Get the sum of all the bins heights (including underflow and overflow bin).
virtual double | sumExtraBinHeights () const
| Get the sum of the underflow and overflow bin height.
virtual double | minBinHeight () const
| Get the minimum height of the in-range bins.
virtual double | maxBinHeight () const
| Get the maximum height of the in-range bins.
virtual double | equivalentBinEntries () const
| Number of equivalent entries, i.e. `SUM[ weight ] ^ 2 / SUM[ weight^2 ]`
virtual bool | scale (double scaleFactor)
| Scale the weights and the errors of all the IHistogram's bins (in-range and out-of-range ones) by a given scale factor.
virtual bool | reset ()
| Reset the Histogram; as if just created.
virtual bool | add (const INTERFACE &profile)
| Modifies this IProfile1D by adding the contents of profile to it.
virtual int | rIndex (int index) const
| operator methods
virtual double | binMean (int index) const
| The weighted mean of a bin.
virtual double | binHeight (int index) const
| Total height of the corresponding bin (ie the sum of the weights in this bin).
virtual double | binError (int index) const
| The error of a given bin.
virtual double | mean () const
| The mean of the whole IHistogram1D.
virtual double | rms () const
| The RMS of the whole IHistogram1D.
virtual int | coordToIndex (double coord) const
| Get the bin number corresponding to a given coordinate along the x axis.
virtual int | dimension () const
| Get the Histogram's dimension.
virtual std::ostream & | print (std::ostream &s) const
| Print (ASCII) the histogram into the output stream.
virtual std::ostream & | write (std::ostream &s) const
| Write (ASCII) the histogram table into the output stream.
virtual int | write (const char *file_name) const
| Write (ASCII) the histogram table into a file.
template<>
void * | cast (const std::string &className) const
template<>
int | binEntries (int index) const
template<>
void | adoptRepresentation (TObject *rep)
| Adopt ROOT histogram representation.
template<>
int | binEntries (int index) const
template<>
void * | cast (const std::string &className) const
template<>
void | adoptRepresentation (TObject *rep)
| Adopt ROOT histogram representation.
## Protected Attributes
Axis | m_axis
| Axis member.
AIDA::Annotation | m_annotation
| Object annotations.
IMPLEMENTATION * | m_rep
| Reference to underlying implementation.
std::string | m_classType
int | m_sumEntries

## Detailed Description

### template<class INTERFACE, class IMPLEMENTATION>
class Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >

Common AIDA implementation stuff for histograms and profiles using ROOT implementations.

Credits: This code is the result of some stripdown implementation of LCG/PI. Credits to them!

Author:
  M.Frank

Definition at line 22 of file Generic1D.h.

## Member Typedef Documentation

template<class INTERFACE, class IMPLEMENTATION>

typedef Generic1D<INTERFACE,IMPLEMENTATION> Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::Base

Definition at line 24 of file Generic1D.h.

## Constructor & Destructor Documentation

template<class INTERFACE, class IMPLEMENTATION>

Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::Generic1D | ( | ) | `[inline]`

Default constructor.

Definition at line 26 of file Generic1D.h.

    : virtual public INTERFACE, virtual public HistogramBase {

template<class INTERFACE, class IMPLEMENTATION>

virtual Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::~Generic1D | ( | ) | `[inline, virtual]`

Default destructor.

Definition at line 28 of file Generic1D.h.

    : virtual public INTERFACE, virtual public HistogramBase {

## Member Function Documentation

template<class INTERFACE, class IMPLEMENTATION >

bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::add | ( | const INTERFACE & | profile ) | `[virtual]`

Modifies this IProfile1D by adding the contents of profile to it.

Definition at line 183 of file Generic1D.h.

                                                                          {
        m_rep->Scale ( scaleFactor );
        return true;
      }

      template <class INTERFACE, class IMPLEMENTATION>
      bool Generic1D<INTERFACE,IMPLEMENTATION>::add(const INTERFACE & h)  {
        const Generic1D<INTERFACE,IMPLEMENTATION>* p =

template<>

void Gaudi::Generic1D< AIDA::IHistogram1D, TH1D >::adoptRepresentation | ( | TObject * | rep ) | `[virtual]`

Adopt ROOT histogram representation.

Implements Gaudi::HistogramBase.

Reimplemented in Gaudi::Histogram1D.

Definition at line 49 of file H1D.cpp.

                                                                              {
        TH1D* imp = dynamic_cast<TH1D*>(rep);
        if ( imp )  {
          if ( m_rep ) delete m_rep;
          m_rep = imp;
          return;
        }
        throw std::runtime_error("Cannot adopt native histogram representation.");
      }

template<>

void Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::adoptRepresentation | ( | TObject * | rep ) | `[virtual]`

Adopt ROOT histogram representation.

Implements Gaudi::HistogramBase.

Reimplemented in Gaudi::Histogram1D.

Definition at line 59 of file P1D.cpp.

                                                                                {
        TProfile* imp = dynamic_cast<TProfile*>(rep);
        if ( imp )  {
        if ( m_rep ) delete m_rep;
          m_rep = imp;
          m_axis.initialize(m_rep->GetXaxis(),true);
          const TArrayD* a = m_rep->GetSumw2();
          if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2();
          setTitle(m_rep->GetTitle());
          return;
        }
        throw std::runtime_error("Cannot adopt native histogram representation.");
      }

template<class INTERFACE, class IMPLEMENTATION>

virtual void Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::adoptRepresentation | ( | TObject * | rep ) | `[virtual]`

Adopt ROOT histogram representation.

Implements Gaudi::HistogramBase.

Reimplemented in Gaudi::Histogram1D.

template<class INTERFACE, class IMPLEMENTATION>

virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::allEntries | ( | ) | const`[inline, virtual]`

Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.

Definition at line 57 of file Generic1D.h.

    { return m_axis;                      }

template<class INTERFACE, class IMPLEMENTATION>

virtual AIDA::IAnnotation& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | `[inline, virtual]`

Access annotation object.

Definition at line 46 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

virtual const AIDA::IAnnotation& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | const`[inline, virtual]`

Access annotation object (cons)

Definition at line 48 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

Axis& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::axis | ( | ) | `[inline]`

Access to axis object.

Definition at line 50 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

const Axis& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::axis | ( | ) | const`[inline]`

Get the x axis of the IHistogram1D.

Definition at line 52 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binEntries | ( | int | index ) | const`[virtual]`

Number of entries in the corresponding bin (ie the number of times fill was called for this bin).

template<>

int Gaudi::Generic1D< AIDA::IHistogram1D, TH1D >::binEntries | ( | int | index ) | const

Definition at line 42 of file H1D.cpp.

                                                                                   {
        if (binHeight(index)<=0) return 0;
        double xx =  binHeight(index)/binError(index);
        return int(xx*xx+0.5);
      }

template<>

int Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::binEntries | ( | int | index ) | const

Definition at line 44 of file P1D.cpp.

                                                                          {
        return int(m_rep->GetBinEntries( rIndex(index) )+0.5);
      }

template<class INTERFACE , class IMPLEMENTATION >

double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binError | ( | int | index ) | const`[virtual]`

The error of a given bin.

Definition at line 152 of file Generic1D.h.

                                                                               {

template<class INTERFACE , class IMPLEMENTATION >

double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binHeight | ( | int | index ) | const`[virtual]`

Total height of the corresponding bin (ie the sum of the weights in this bin).

Definition at line 147 of file Generic1D.h.

                                                                             {

template<class INTERFACE , class IMPLEMENTATION >

double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binMean | ( | int | index ) | const`[virtual]`

The weighted mean of a bin.

Definition at line 142 of file Generic1D.h.

                                                                        {

template<class INTERFACE , class IMPLEMENTATION >

double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binRms | ( | int | index ) | const`[virtual]`

Definition at line 137 of file Generic1D.h.

                                                                                  {
        m_rep->SetName(newName.c_str());
        m_annotation.setValue( "Name", newName );

template<class INTERFACE, class IMPLEMENTATION>

virtual void* Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::cast | ( | const std::string & | cl ) | const`[virtual]`

Manual cast by class name.

template<>

void * Gaudi::Generic1D< AIDA::IHistogram1D, TH1D >::cast | ( | const std::string & | className ) | const

Definition at line 34 of file H1D.cpp.

                                                                                                {
        if (className == "AIDA::IHistogram1D")
          return const_cast<AIDA::IHistogram1D*>((AIDA::IHistogram1D*)this);
        if (className == "AIDA::IHistogram")
          return const_cast<AIDA::IHistogram*>((AIDA::IHistogram*)this);
        return 0;
      }

template<>

void * Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::cast | ( | const std::string & | className ) | const

Definition at line 48 of file P1D.cpp.

                                                                                                 {
        if (className == "AIDA::IProfile1D")
          return const_cast<AIDA::IProfile1D*>((AIDA::IProfile1D*)this);
        else if (className == "AIDA::IProfile")
          return const_cast<AIDA::IProfile*>((AIDA::IProfile*)this);
        else if (className == "AIDA::IBaseHistogram")
          return const_cast<AIDA::IBaseHistogram*>((AIDA::IBaseHistogram*)this);
        return 0;
      }

template<class INTERFACE, class IMPLEMENTATION>

virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::coordToIndex | ( | double | coord ) | const`[inline, virtual]`

Get the bin number corresponding to a given coordinate along the x axis.

Definition at line 96 of file Generic1D.h.

    { return m_rep->GetMean();                    }

template<class INTERFACE, class IMPLEMENTATION>

virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::dimension | ( | ) | const`[inline, virtual]`

Get the Histogram's dimension.

Definition at line 98 of file Generic1D.h.

    { return m_rep->GetMean();                    }

template<class INTERFACE, class IMPLEMENTATION>

virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::entries | ( | ) | const`[inline, virtual]`

Get the number or all the entries.

Definition at line 55 of file Generic1D.h.

    { return m_annotation;                }

template<class INTERFACE , class IMPLEMENTATION >

double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries | ( | ) | const`[virtual]`

Number of equivalent entries, i.e. `SUM[ weight ] ^ 2 / SUM[ weight^2 ]`

Definition at line 169 of file Generic1D.h.

                                                        {
        m_sumEntries = 0;
        m_rep->Reset();
        return true;
      }

template<class INTERFACE , class IMPLEMENTATION >

int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::extraEntries | ( | ) | const`[virtual]`

Get the number of entries in the underflow and overflow bins.

Definition at line 157 of file Generic1D.h.

                                                                              {
        return m_rep->GetBinError ( rIndex(index) );

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::maxBinHeight | ( | ) | const`[inline, virtual]`

Get the maximum height of the in-range bins.

Definition at line 73 of file Generic1D.h.

    { return m_rep->GetSum();                     }

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::mean | ( | ) | const`[inline, virtual]`

The mean of the whole IHistogram1D.

Definition at line 92 of file Generic1D.h.

    { return m_rep->GetMean();                    }

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::minBinHeight | ( | ) | const`[inline, virtual]`

Get the minimum height of the in-range bins.

Definition at line 71 of file Generic1D.h.

    { return m_rep->GetSumOfWeights();            }

template<class INTERFACE, class IMPLEMENTATION>

std::string Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::name | ( | ) | const`[inline]`

object name

Definition at line 42 of file Generic1D.h.

template<class INTERFACE , class IMPLEMENTATION >

std::ostream & Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::print | ( | std::ostream & | s ) | const`[virtual]`

Print (ASCII) the histogram into the output stream.

bin contents and errors are printed for all bins including under and overflows

Implements Gaudi::HistogramBase.

Definition at line 194 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

TObject* Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::representation | ( | ) | const`[inline, virtual]`

ROOT object implementation.

Implements Gaudi::HistogramBase.

Definition at line 34 of file Generic1D.h.

    { delete m_rep;                       }

template<class INTERFACE , class IMPLEMENTATION >

bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::reset | ( | ) | `[virtual]`

Reset the Histogram; as if just created.

Reimplemented in Gaudi::Histogram1D.

Definition at line 162 of file Generic1D.h.

                                                                  {
        return binEntries(AIDA::IAxis::UNDERFLOW_BIN) +
              binEntries(AIDA::IAxis::OVERFLOW_BIN);

template<class INTERFACE, class IMPLEMENTATION>

virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::rIndex | ( | int | index ) | const`[inline, virtual]`

operator methods

Definition at line 84 of file Generic1D.h.

    { return m_axis.rIndex(index);}

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::rms | ( | ) | const`[inline, virtual]`

The RMS of the whole IHistogram1D.

Definition at line 94 of file Generic1D.h.

    { return m_rep->GetMean();                    }

template<class INTERFACE , class IMPLEMENTATION >

bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::scale | ( | double | scaleFactor ) | `[virtual]`

Scale the weights and the errors of all the IHistogram's bins (in-range and out-of-range ones) by a given scale factor.

Definition at line 177 of file Generic1D.h.

template<class INTERFACE , class IMPLEMENTATION >

bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::setName | ( | const std::string & | newName ) |

Set the name of the object.

Definition at line 130 of file Generic1D.h.

template<class INTERFACE , class IMPLEMENTATION >

bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::setTitle | ( | const std::string & | title ) | `[virtual]`

Set the title of the object.

Definition at line 120 of file Generic1D.h.

                                                                                 {

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::sumAllBinHeights | ( | ) | const`[inline, virtual]`

Get the sum of all the bins heights (including underflow and overflow bin).

Definition at line 67 of file Generic1D.h.

    { return m_rep->GetSumOfWeights();            }

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::sumBinHeights | ( | ) | const`[inline, virtual]`

Get the sum of in range bin heights in the IProfile.

Definition at line 65 of file Generic1D.h.

    { return m_rep->GetSumOfWeights();            }

template<class INTERFACE, class IMPLEMENTATION>

virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::sumExtraBinHeights | ( | ) | const`[inline, virtual]`

Get the sum of the underflow and overflow bin height.

Definition at line 69 of file Generic1D.h.

    { return m_rep->GetSumOfWeights();            }

template<class INTERFACE, class IMPLEMENTATION>

virtual std::string Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::title | ( | ) | const`[inline, virtual]`

Get the title of the object.

Definition at line 38 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

virtual const std::string& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::userLevelClassType | ( | ) | const`[inline, virtual]`

The AIDA user-level unterface leaf class type.

Definition at line 30 of file Generic1D.h.

    :
        typedef Generic1D<INTERFACE,IMPLEMENTATION> Base;

template<class INTERFACE , class IMPLEMENTATION >

std::ostream & Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::write | ( | std::ostream & | s ) | const`[virtual]`

Write (ASCII) the histogram table into the output stream.

Implements Gaudi::HistogramBase.

Definition at line 202 of file Generic1D.h.

                                                                                   {
        s << "\n1D Histogram Table: " << std::endl;
        s << "Bin, Height, Error "  << std::endl;

template<class INTERFACE , class IMPLEMENTATION >

int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::write | ( | const char * | file_name ) | const`[virtual]`

Write (ASCII) the histogram table into a file.

Implements Gaudi::HistogramBase.

Definition at line 215 of file Generic1D.h.

## Member Data Documentation

template<class INTERFACE, class IMPLEMENTATION>

AIDA::Annotation Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_annotation`[mutable, protected]`

Object annotations.

Definition at line 110 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

Axis Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_axis`[protected]`

Axis member.

Definition at line 108 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

std::string Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_classType`[protected]`

Definition at line 114 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

IMPLEMENTATION* Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_rep`[protected]`

Reference to underlying implementation.

Definition at line 112 of file Generic1D.h.

template<class INTERFACE, class IMPLEMENTATION>

int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_sumEntries`[protected]`

Definition at line 116 of file Generic1D.h.

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

- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r2/GaudiSvc/src/HistogramSvc/Generic1D.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines