Gaudi Framework, version v23r0 |
Home | Generated: Mon Jan 30 2012 |
Common AIDA implementation stuff for histograms and profiles using ROOT implementations. More...
#include <GaudiPI/Generic3D.h>
Public Types | |
typedef Generic3D< INTERFACE, IMPLEMENTATION > | Base |
Public Member Functions | |
Generic3D () | |
Default constructor. | |
virtual | ~Generic3D () |
Destructor. | |
TObject * | representation () const |
ROOT object implementation. | |
virtual void | adoptRepresentation (TObject *rep) |
Adopt ROOT histogram representation. | |
virtual int | dimension () const |
Get the Histogram's dimension. | |
virtual std::string | title () const |
Get the title of the object. | |
virtual bool | setTitle (const std::string &title) |
Set the title of the object. | |
virtual std::string | name () const |
object name | |
bool | setName (const std::string &newName) |
Sets the name of the object. | |
virtual AIDA::IAnnotation & | annotation () |
Access annotation object. | |
virtual const AIDA::IAnnotation & | annotation () const |
Access annotation object (cons) | |
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 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. | |
int | rIndexX (int index) const |
int | rIndexY (int index) const |
int | rIndexZ (int index) const |
double | binMeanX (int indexX, int, int) const |
The weighted mean along the x axis of a given bin. | |
double | binMeanY (int, int indexY, int) const |
The weighted mean along the y axis of a given bin. | |
double | binMeanZ (int, int, int indexZ) const |
The weighted mean along the z axis of a given bin. | |
int | binEntries (int indexX, int indexY, int indexZ) const |
Number of entries in the corresponding bin (ie the number of times fill was calle d for this bin). | |
virtual int | binEntriesX (int index) const |
Sum of all the entries of the bins along a given x bin. | |
virtual int | binEntriesY (int index) const |
Sum of all the entries of the bins along a given y bin. | |
virtual int | binEntriesZ (int index) const |
Sum of all the entries of the bins along a given z bin. | |
double | binHeight (int indexX, int indexY, int indexZ) const |
Total height of the corresponding bin (ie the sum of the weights in this bin). | |
virtual double | binHeightX (int index) const |
Sum of all the heights of the bins along a given x bin. | |
virtual double | binHeightY (int index) const |
Sum of all the heights of the bins along a given y bin. | |
virtual double | binHeightZ (int index) const |
Sum of all the heights of the bins along a given z bin. | |
virtual double | binError (int indexX, int indexY, int indexZ) const |
The error of a given bin. | |
virtual double | meanX () const |
The mean of the IHistogram3D along the x axis. | |
virtual double | meanY () const |
The mean of the IHistogram3D along the y axis. | |
virtual double | meanZ () const |
The mean of the IHistogram3D along the z axis. | |
virtual double | rmsX () const |
The RMS of the IHistogram3D along the x axis. | |
virtual double | rmsY () const |
The RMS of the IHistogram3D along the y axis. | |
virtual double | rmsZ () const |
The RMS of the IHistogram3D along the z axis. | |
virtual const AIDA::IAxis & | xAxis () const |
Get the x axis of the IHistogram3D. | |
virtual const AIDA::IAxis & | yAxis () const |
Get the y axis of the IHistogram3D. | |
virtual const AIDA::IAxis & | zAxis () const |
Get the z axis of the IHistogram3D. | |
virtual int | coordToIndexX (double coord) const |
Get the bin number corresponding to a given coordinate along the x axis. | |
virtual int | coordToIndexY (double coord) const |
Get the bin number corresponding to a given coordinate along the y axis. | |
virtual int | coordToIndexZ (double coord) const |
Get the bin number corresponding to a given coordinate along the z axis. | |
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 | add (const INTERFACE &hist) |
Add to this Histogram3D the contents of another IHistogram3D. | |
int | extraEntries () const |
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 | adoptRepresentation (TObject *rep) |
Adopt ROOT histogram representation. | |
Protected Attributes | |
Gaudi::Axis | m_xAxis |
Gaudi::Axis | m_yAxis |
Gaudi::Axis | m_zAxis |
AIDA::Annotation | m_annotation |
Object annotations. | |
IMPLEMENTATION * | m_rep |
Reference to underlying implementation. | |
std::string | m_classType |
int | m_sumEntries |
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!
Definition at line 29 of file Generic3D.h.
typedef Generic3D<INTERFACE,IMPLEMENTATION> Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::Base |
Definition at line 31 of file Generic3D.h.
Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::Generic3D | ( | ) | [inline] |
virtual Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::~Generic3D | ( | ) | [inline, virtual] |
virtual bool Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::add | ( | const INTERFACE & | hist ) | [inline, virtual] |
Add to this Histogram3D the contents of another IHistogram3D.
Definition at line 179 of file Generic3D.h.
{ const Base* p = dynamic_cast<const Base*>(&hist); if ( p ) { m_rep->Add(p->m_rep); return true; } throw std::runtime_error("Cannot add profile histograms of different implementations."); }
virtual void Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::adoptRepresentation | ( | TObject * | rep ) | [virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
void Gaudi::Generic3D< AIDA::IHistogram3D, TH3D >::adoptRepresentation | ( | TObject * | rep ) | [virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 61 of file H3D.cpp.
{ TH3D* imp = dynamic_cast<TH3D*>(rep); if ( imp ) { if ( m_rep ) delete m_rep; m_rep = imp; m_xAxis.initialize(m_rep->GetXaxis(),true); m_yAxis.initialize(m_rep->GetYaxis(),true); m_zAxis.initialize(m_rep->GetZaxis(),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."); }
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::allEntries | ( | ) | const [virtual] |
Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.
Definition at line 242 of file Generic3D.h.
virtual const AIDA::IAnnotation& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | const [inline, virtual] |
virtual AIDA::IAnnotation& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | [inline, virtual] |
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binEntries | ( | int | indexX, |
int | indexY, | ||
int | indexZ | ||
) | const [inline] |
Number of entries in the corresponding bin (ie the number of times fill was calle d for this bin).
Definition at line 85 of file Generic3D.h.
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binEntriesX | ( | int | index ) | const [inline, virtual] |
Sum of all the entries of the bins along a given x bin.
Definition at line 91 of file Generic3D.h.
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binEntriesY | ( | int | index ) | const [inline, virtual] |
Sum of all the entries of the bins along a given y bin.
Definition at line 100 of file Generic3D.h.
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binEntriesZ | ( | int | index ) | const [inline, virtual] |
Sum of all the entries of the bins along a given z bin.
Definition at line 109 of file Generic3D.h.
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binError | ( | int | indexX, |
int | indexY, | ||
int | indexZ | ||
) | const [inline, virtual] |
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binHeight | ( | int | indexX, |
int | indexY, | ||
int | indexZ | ||
) | const [inline] |
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binHeightX | ( | int | index ) | const [inline, virtual] |
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binHeightY | ( | int | index ) | const [inline, virtual] |
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binHeightZ | ( | int | index ) | const [inline, virtual] |
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binMeanX | ( | int | indexX, |
int | , | ||
int | |||
) | const [inline] |
The weighted mean along the x axis of a given bin.
Definition at line 76 of file Generic3D.h.
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binMeanY | ( | int | , |
int | indexY, | ||
int | |||
) | const [inline] |
The weighted mean along the y axis of a given bin.
Definition at line 79 of file Generic3D.h.
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binMeanZ | ( | int | , |
int | , | ||
int | indexZ | ||
) | const [inline] |
The weighted mean along the z axis of a given bin.
Definition at line 82 of file Generic3D.h.
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::coordToIndexX | ( | double | coord ) | const [inline, virtual] |
Get the bin number corresponding to a given coordinate along the x axis.
Definition at line 168 of file Generic3D.h.
{ return xAxis().coordToIndex(coord);}
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::coordToIndexY | ( | double | coord ) | const [inline, virtual] |
Get the bin number corresponding to a given coordinate along the y axis.
Definition at line 170 of file Generic3D.h.
{ return yAxis().coordToIndex(coord);}
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::coordToIndexZ | ( | double | coord ) | const [inline, virtual] |
Get the bin number corresponding to a given coordinate along the z axis.
Definition at line 172 of file Generic3D.h.
{ return zAxis().coordToIndex(coord);}
virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::dimension | ( | ) | const [inline, virtual] |
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::entries | ( | ) | const [virtual] |
Get the number or all the entries.
Definition at line 237 of file Generic3D.h.
{ return (int)m_rep->GetEntries(); }
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries | ( | ) | const [virtual] |
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]
Definition at line 267 of file Generic3D.h.
{ if (sumBinHeights() <= 0) return 0; Stat_t stats[11]; // cover up to 3D... m_rep->GetStats(stats); return stats[0]*stats[0]/stats[1]; }
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::extraEntries | ( | ) | const [inline] |
Definition at line 189 of file Generic3D.h.
{ return binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN) + binEntries(AIDA::IAxis::UNDERFLOW_BIN, AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN) + binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + binEntries(AIDA::IAxis::OVERFLOW_BIN, AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN); }
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::maxBinHeight | ( | ) | const [virtual] |
Get the maximum height of the in-range bins.
Definition at line 252 of file Generic3D.h.
{ return m_rep->GetMaximum(); }
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::meanX | ( | ) | const [inline, virtual] |
The mean of the IHistogram3D along the x axis.
Definition at line 149 of file Generic3D.h.
{ return m_rep->GetMean ( 1); }
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::meanY | ( | ) | const [inline, virtual] |
The mean of the IHistogram3D along the y axis.
Definition at line 152 of file Generic3D.h.
{ return m_rep->GetMean ( 2 ); }
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::meanZ | ( | ) | const [inline, virtual] |
The mean of the IHistogram3D along the z axis.
Definition at line 154 of file Generic3D.h.
{ return m_rep->GetMean ( 3 ); }
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::minBinHeight | ( | ) | const [virtual] |
Get the minimum height of the in-range bins.
Definition at line 247 of file Generic3D.h.
{ return m_rep->GetMinimum(); }
virtual std::string Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::name | ( | ) | const [inline, virtual] |
std::ostream & Gaudi::Generic3D< 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 281 of file Generic3D.h.
TObject* Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::representation | ( | ) | const [inline, virtual] |
ROOT object implementation.
Implements Gaudi::HistogramBase.
Definition at line 37 of file Generic3D.h.
{ return m_rep; }
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rIndexX | ( | int | index ) | const [inline] |
Definition at line 71 of file Generic3D.h.
{ return m_xAxis.rIndex(index);}
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rIndexY | ( | int | index ) | const [inline] |
Definition at line 72 of file Generic3D.h.
{ return m_yAxis.rIndex(index);}
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rIndexZ | ( | int | index ) | const [inline] |
Definition at line 73 of file Generic3D.h.
{ return m_zAxis.rIndex(index);}
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rmsX | ( | ) | const [inline, virtual] |
The RMS of the IHistogram3D along the x axis.
Definition at line 156 of file Generic3D.h.
{ return m_rep->GetRMS( 1 ); }
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rmsY | ( | ) | const [inline, virtual] |
The RMS of the IHistogram3D along the y axis.
Definition at line 158 of file Generic3D.h.
{ return m_rep->GetRMS( 2 ); }
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rmsZ | ( | ) | const [inline, virtual] |
The RMS of the IHistogram3D along the z axis.
Definition at line 160 of file Generic3D.h.
{ return m_rep->GetRMS( 3 ); }
bool Gaudi::Generic3D< 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 275 of file Generic3D.h.
{ m_rep->Scale ( scaleFactor ); return true; }
bool Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::setName | ( | const std::string & | newName ) |
Sets the name of the object.
Definition at line 231 of file Generic3D.h.
{ m_rep->SetName(newName.c_str()); m_annotation.setValue( "Name", newName ); return true; }
bool Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::setTitle | ( | const std::string & | title ) | [virtual] |
Set the title of the object.
Definition at line 221 of file Generic3D.h.
{ m_rep->SetTitle(title.c_str()); if ( !annotation().addItem( "Title", title ) ) m_annotation.setValue( "Title" , title ); if ( !annotation().addItem( "title", title ) ) annotation().setValue( "title", title ); return true; }
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::sumAllBinHeights | ( | ) | const [virtual] |
Get the sum of all the bins heights (including underflow and overflow bin).
Definition at line 262 of file Generic3D.h.
{ return m_rep->GetSum(); }
double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::sumBinHeights | ( | ) | const [virtual] |
Get the sum of in range bin heights in the IProfile.
Definition at line 257 of file Generic3D.h.
{ return m_rep->GetSumOfWeights(); }
virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::sumExtraBinHeights | ( | ) | const [inline, virtual] |
Get the sum of the underflow and overflow bin height.
Definition at line 65 of file Generic3D.h.
{ return sumAllBinHeights()-sumBinHeights(); }
virtual std::string Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::title | ( | ) | const [inline, virtual] |
Get the title of the object.
Definition at line 44 of file Generic3D.h.
{ return m_annotation.value("Title");}
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::write | ( | const char * | file_name ) | const [virtual] |
Write (ASCII) the histogram table into a file.
Implements Gaudi::HistogramBase.
Definition at line 309 of file Generic3D.h.
{ TFile *f = TFile::Open(file_name,"RECREATE"); Int_t nbytes = m_rep->Write(); f->Close(); return nbytes; }
std::ostream & Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::write | ( | std::ostream & | s ) | const [virtual] |
Write (ASCII) the histogram table into the output stream.
Implements Gaudi::HistogramBase.
Definition at line 291 of file Generic3D.h.
{ s << "\n3D Histogram Table: " << std::endl; s << "BinX, BinY, BinZ, Height, Error " << std::endl; for ( int i = 0; i < xAxis().bins(); ++i ) for ( int j = 0; j < yAxis().bins(); ++j ) for ( int k = 0; k < zAxis().bins(); ++k ) s << binMeanX( i, j, k ) << ", " << binMeanY( i, j, k ) << ", " << binMeanZ( i, j, k ) << ", " << binHeight( i, j, k ) << ", " << binError ( i, j, k ) << std::endl; s << std::endl; return s; }
virtual const AIDA::IAxis& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::xAxis | ( | ) | const [inline, virtual] |
virtual const AIDA::IAxis& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::yAxis | ( | ) | const [inline, virtual] |
virtual const AIDA::IAxis& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::zAxis | ( | ) | const [inline, virtual] |
AIDA::Annotation Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_annotation [mutable, protected] |
Object annotations.
Definition at line 211 of file Generic3D.h.
std::string Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_classType [protected] |
Definition at line 215 of file Generic3D.h.
IMPLEMENTATION* Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_rep [protected] |
Reference to underlying implementation.
Definition at line 213 of file Generic3D.h.
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_sumEntries [protected] |
Definition at line 217 of file Generic3D.h.
Gaudi::Axis Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_xAxis [protected] |
Definition at line 207 of file Generic3D.h.
Gaudi::Axis Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_yAxis [protected] |
Definition at line 208 of file Generic3D.h.
Gaudi::Axis Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_zAxis [protected] |
Definition at line 209 of file Generic3D.h.