|
Gaudi Framework, version v22r4 |
| Home | Generated: Fri Sep 2 2011 |
Common AIDA implementation stuff for histograms and profiles using ROOT implementations. More...
#include <GaudiPI/Generic2D.h>


Public Types | |
| typedef Generic2D< INTERFACE, IMPLEMENTATION > | Base |
Public Member Functions | |
| Generic2D () | |
| virtual | ~Generic2D () |
| Destructor. | |
| 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) | |
| virtual const AIDA::IAxis & | xAxis () const |
| Return the X axis. | |
| virtual const AIDA::IAxis & | yAxis () const |
| Return the Y axis. | |
| virtual int | rIndexX (int index) const |
| operator methods | |
| virtual int | rIndexY (int index) const |
| operator methods | |
| 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 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 | binMeanX (int indexX, int indexY) const |
| The weighted mean along x of a given bin. | |
| virtual double | binMeanY (int indexX, int indexY) const |
| The weighted mean along y of a given bin. | |
| virtual int | binEntries (int indexX, int indexY) const |
| The number of entries (ie the number of times fill was called for this bin). | |
| virtual int | binEntriesX (int indexX) const |
Equivalent to projectionX().binEntries(indexX). | |
| virtual int | binEntriesY (int indexY) const |
Equivalent to projectionY().binEntries(indexY). | |
| virtual double | binHeight (int indexX, int indexY) const |
| Total height of the corresponding bin (ie the sum of the weights in this bin). | |
| virtual double | binHeightX (int indexX) const |
Equivalent to projectionX().binHeight(indexX). | |
| virtual double | binHeightY (int indexY) const |
Equivalent to projectionY().binHeight(indexY). | |
| virtual double | binError (int indexX, int indexY) const |
| The error on this bin. | |
| virtual double | binRms (int indexX, int indexY) const |
| The spread (RMS) of this bin. | |
| virtual double | meanX () const |
| Returns the mean of the profile, as calculated on filling-time projected on the X axis. | |
| virtual double | meanY () const |
| Returns the mean of the profile, as calculated on filling-time projected on the Y axis. | |
| virtual double | rmsX () const |
| Returns the rms of the profile as calculated on filling-time projected on the X axis. | |
| virtual double | rmsY () const |
| Returns the rms of the profile as calculated on filling-time projected on the Y axis. | |
| virtual int | coordToIndexX (double coordX) const |
Convenience method, equivalent to xAxis().coordToIndex(coord). | |
| virtual int | coordToIndexY (double coordY) const |
Convenience method, equivalent to yAxis().coordToIndex(coord). | |
| 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 &h) |
| Modifies this profile by adding the contents of profile to it. | |
| bool | reset () |
| void * | cast (const std::string &className) const |
| Introspection method. | |
| const std::string & | userLevelClassType () const |
| The AIDA user-level unterface leaf class type. | |
| 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 indexX, int indexY) const |
| template<> | |
| void | adoptRepresentation (TObject *rep) |
| Adopt ROOT histogram representation. | |
| template<> | |
| void * | cast (const std::string &className) const |
| template<> | |
| int | binEntries (int idX, int idY) const |
| template<> | |
| void | adoptRepresentation (TObject *rep) |
| Adopt ROOT histogram representation. | |
Protected Attributes | |
| Axis | m_xAxis |
| X axis member. | |
| Axis | m_yAxis |
| Y axis member. | |
| AIDA::Annotation | m_annotation |
| Object annotations. | |
| IMPLEMENTATION * | m_rep |
| Reference to underlying implementation. | |
| std::string | m_classType |
| class type | |
| int | m_sumEntries |
| cache sumEntries (allEntries) when setting contents since Root can't compute by himself | |
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 30 of file Generic2D.h.
| typedef Generic2D<INTERFACE,IMPLEMENTATION> Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Base |
Definition at line 32 of file Generic2D.h.
| Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Generic2D | ( | ) | [inline] |
Definition at line 34 of file Generic2D.h.
: m_rep(0) {}
| virtual Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::~Generic2D | ( | ) | [inline, virtual] |
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::add | ( | const INTERFACE & | h ) | [virtual] |
Modifies this profile by adding the contents of profile to it.
Definition at line 286 of file Generic2D.h.
| virtual void Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::adoptRepresentation | ( | TObject * | rep ) | [virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
| void Gaudi::Generic2D< AIDA::IHistogram2D, TH2D >::adoptRepresentation | ( | TObject * | rep ) | [virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 105 of file H2D.cpp.
{
TH2D* imp = dynamic_cast<TH2D*>(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);
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.");
}
| void Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::adoptRepresentation | ( | TObject * | rep ) | [virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 71 of file P2D.cpp.
{
TProfile2D* imp = dynamic_cast<TProfile2D*>(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);
setTitle(m_rep->GetTitle());
return;
}
throw std::runtime_error("Cannot adopt native histogram representation.");
}
| int Gaudi::Generic2D< 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 173 of file Generic2D.h.
| virtual const AIDA::IAnnotation& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | const [inline, virtual] |
| virtual AIDA::IAnnotation& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | [inline, virtual] |
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntries | ( | int | indexX, |
| int | indexY | ||
| ) | const [virtual] |
The number of entries (ie the number of times fill was called for this bin).
| int Gaudi::Generic2D< IHistogram2D, TH2D >::binEntries | ( | int | indexX, |
| int | indexY | ||
| ) | const |
| int Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::binEntries | ( | int | idX, |
| int | idY | ||
| ) | const |
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntriesX | ( | int | indexX ) | const [virtual] |
Equivalent to projectionX().binEntries(indexX).
Definition at line 213 of file Generic2D.h.
{
int n = 0;
for (int iY = -2; iY < yAxis().bins(); ++iY)
n += binEntries(index,iY);
return n;
}
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntriesY | ( | int | indexY ) | const [virtual] |
Equivalent to projectionY().binEntries(indexY).
Definition at line 221 of file Generic2D.h.
{
int n = 0;
for (int iX = -2; iX < xAxis().bins(); ++iX)
n += binEntries(iX,index);
return n;
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binError | ( | int | indexX, |
| int | indexY | ||
| ) | const [virtual] |
The error on this bin.
Definition at line 251 of file Generic2D.h.
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeight | ( | int | indexX, |
| int | indexY | ||
| ) | const [virtual] |
Total height of the corresponding bin (ie the sum of the weights in this bin).
Definition at line 229 of file Generic2D.h.
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeightX | ( | int | indexX ) | const [virtual] |
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeightY | ( | int | indexY ) | const [virtual] |
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binMeanX | ( | int | indexX, |
| int | indexY | ||
| ) | const [virtual] |
The weighted mean along x of a given bin.
Definition at line 203 of file Generic2D.h.
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binMeanY | ( | int | indexX, |
| int | indexY | ||
| ) | const [virtual] |
The weighted mean along y of a given bin.
Definition at line 208 of file Generic2D.h.
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binRms | ( | int | indexX, |
| int | indexY | ||
| ) | const [virtual] |
The spread (RMS) of this bin.
Definition at line 198 of file Generic2D.h.
| void* Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::cast | ( | const std::string & | className ) | const |
Introspection method.
| void * Gaudi::Generic2D< IHistogram2D, TH2D >::cast | ( | const std::string & | className ) | const |
| void * Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::cast | ( | const std::string & | className ) | const |
Definition at line 54 of file P2D.cpp.
{
if (className == "AIDA::IProfile2D")
return const_cast<AIDA::IProfile2D*>((AIDA::IProfile2D*)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;
}
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::coordToIndexX | ( | double | coordX ) | const [virtual] |
Convenience method, equivalent to xAxis().coordToIndex(coord).
Definition at line 276 of file Generic2D.h.
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::coordToIndexY | ( | double | coordY ) | const [virtual] |
Convenience method, equivalent to yAxis().coordToIndex(coord).
Definition at line 281 of file Generic2D.h.
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::dimension | ( | ) | const [inline, virtual] |
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::entries | ( | ) | const [virtual] |
Get the number or all the entries.
Definition at line 168 of file Generic2D.h.
{
return (int)m_rep->GetEntries();
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries | ( | ) | const [virtual] |
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]
Definition at line 305 of file Generic2D.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::Generic2D< INTERFACE, IMPLEMENTATION >::extraEntries | ( | ) | const [virtual] |
Get the number of entries in the underflow and overflow bins.
Definition at line 296 of file Generic2D.h.
{
return
binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) +
binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN) +
binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) +
binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN);
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::maxBinHeight | ( | ) | const [virtual] |
Get the maximum height of the in-range bins.
Definition at line 183 of file Generic2D.h.
{
return m_rep->GetMaximum();
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::meanX | ( | ) | const [virtual] |
Returns the mean of the profile, as calculated on filling-time projected on the X axis.
Definition at line 256 of file Generic2D.h.
{
return m_rep->GetMean(1);
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::meanY | ( | ) | const [virtual] |
Returns the mean of the profile, as calculated on filling-time projected on the Y axis.
Definition at line 261 of file Generic2D.h.
{
return m_rep->GetMean(2);
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::minBinHeight | ( | ) | const [virtual] |
Get the minimum height of the in-range bins.
Definition at line 178 of file Generic2D.h.
{
return m_rep->GetMinimum();
}
| std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::name | ( | ) | const [inline] |
| std::ostream & Gaudi::Generic2D< 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 326 of file Generic2D.h.
| TObject* Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::representation | ( | ) | const [inline, virtual] |
ROOT object implementation.
Implements Gaudi::HistogramBase.
Definition at line 40 of file Generic2D.h.
{ return m_rep; }
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::reset | ( | ) |
Reimplemented in Gaudi::Histogram2D.
Definition at line 319 of file Generic2D.h.
{
m_sumEntries = 0;
m_rep->Reset ( );
return true;
}
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rIndexX | ( | int | index ) | const [inline, virtual] |
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rIndexY | ( | int | index ) | const [inline, virtual] |
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rmsX | ( | ) | const [virtual] |
Returns the rms of the profile as calculated on filling-time projected on the X axis.
Definition at line 266 of file Generic2D.h.
{
return m_rep->GetRMS(1);
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rmsY | ( | ) | const [virtual] |
Returns the rms of the profile as calculated on filling-time projected on the Y axis.
Definition at line 271 of file Generic2D.h.
{
return m_rep->GetRMS(2);
}
| bool Gaudi::Generic2D< 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 313 of file Generic2D.h.
{
m_rep->Scale ( scaleFactor );
return true;
}
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::setName | ( | const std::string & | newName ) |
Set the name of the object.
Definition at line 161 of file Generic2D.h.
{
m_rep->SetName(newName.c_str());
m_annotation.setValue( "Name", newName );
return true;
}
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::setTitle | ( | const std::string & | title ) | [virtual] |
Set the title of the object.
Definition at line 151 of file Generic2D.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::Generic2D< INTERFACE, IMPLEMENTATION >::sumAllBinHeights | ( | ) | const [virtual] |
Get the sum of all the bins heights (including underflow and overflow bin).
Definition at line 193 of file Generic2D.h.
{
return m_rep->GetSum();
}
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumBinHeights | ( | ) | const [virtual] |
Get the sum of in range bin heights in the IProfile.
Definition at line 188 of file Generic2D.h.
{
return m_rep->GetSumOfWeights();
}
| virtual double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumExtraBinHeights | ( | ) | const [inline, virtual] |
Get the sum of the underflow and overflow bin height.
Definition at line 76 of file Generic2D.h.
{ return sumAllBinHeights()-sumBinHeights(); }
| virtual std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::title | ( | ) | const [inline, virtual] |
Get the title of the object.
Definition at line 44 of file Generic2D.h.
{ return m_annotation.value( "Title" ); }
| const std::string& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::userLevelClassType | ( | ) | const [inline] |
The AIDA user-level unterface leaf class type.
Definition at line 125 of file Generic2D.h.
{ return m_classType; }
| std::ostream & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::write | ( | std::ostream & | s ) | const [virtual] |
Write (ASCII) the histogram table into the output stream.
Implements Gaudi::HistogramBase.
Definition at line 335 of file Generic2D.h.
{
s << std::endl << "2D Histogram Table: " << std::endl;
s << "BinX, BinY, Height, Error " << std::endl;
for ( int i = 0; i < xAxis().bins(); ++i ) {
for ( int j = 0; j < yAxis().bins(); ++j ) {
s << binMeanX( i, j ) << ", "
<< binMeanY( i, j ) << ", "
<< binHeight( i, j ) << ", "
<< binError ( i, j ) << std::endl;
}
}
s << std::endl;
return s;
}
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::write | ( | const char * | file_name ) | const [virtual] |
Write (ASCII) the histogram table into a file.
Implements Gaudi::HistogramBase.
Definition at line 353 of file Generic2D.h.
| virtual const AIDA::IAxis& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::xAxis | ( | ) | const [inline, virtual] |
| virtual const AIDA::IAxis& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::yAxis | ( | ) | const [inline, virtual] |
AIDA::Annotation Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_annotation [mutable, protected] |
Object annotations.
Definition at line 141 of file Generic2D.h.
std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_classType [protected] |
class type
Definition at line 145 of file Generic2D.h.
IMPLEMENTATION* Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_rep [protected] |
Reference to underlying implementation.
Definition at line 143 of file Generic2D.h.
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_sumEntries [protected] |
cache sumEntries (allEntries) when setting contents since Root can't compute by himself
Definition at line 147 of file Generic2D.h.
Axis Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_xAxis [protected] |
X axis member.
Definition at line 137 of file Generic2D.h.
Axis Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_yAxis [protected] |
Y axis member.
Definition at line 139 of file Generic2D.h.