|
Gaudi Framework, version v21r6 |
| Home | Generated: 11 Nov 2009 |
#include <GaudiPI/Generic2D.h>


Credits: This code is the result of some stripdown implementation of LCG/PI. Credits to them!
Definition at line 30 of file 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 | |
| typedef Generic2D<INTERFACE,IMPLEMENTATION> Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Base |
Definition at line 32 of file Generic2D.h.
| Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Generic2D | ( | ) | [inline] |
| virtual Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::~Generic2D | ( | ) | [inline, virtual] |
| TObject* Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::representation | ( | ) | const [inline, virtual] |
ROOT object implementation.
Implements Gaudi::HistogramBase.
Definition at line 40 of file Generic2D.h.
00040 { return m_rep; }
| virtual void Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::adoptRepresentation | ( | TObject * | rep | ) | [virtual] |
| 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.
00044 { return m_annotation.value( "Title" ); }
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::setTitle | ( | const std::string & | title | ) | [inline, virtual] |
Set the title of the object.
Definition at line 151 of file Generic2D.h.
00151 { 00152 m_rep->SetTitle(title.c_str()); 00153 if ( !annotation().addItem( "Title", title ) ) 00154 m_annotation.setValue( "Title" , title ); 00155 if ( !annotation().addItem( "title", title ) ) 00156 annotation().setValue( "title", title ); 00157 return true; 00158 }
| std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::name | ( | ) | const [inline] |
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::setName | ( | const std::string & | newName | ) | [inline] |
Set the name of the object.
Definition at line 161 of file Generic2D.h.
00161 { 00162 m_rep->SetName(newName.c_str()); 00163 m_annotation.setValue( "Name", newName ); 00164 return true; 00165 }
| virtual AIDA::IAnnotation& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | [inline, virtual] |
| virtual const AIDA::IAnnotation& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | const [inline, virtual] |
Access annotation object (cons).
Definition at line 54 of file Generic2D.h.
00054 { return m_annotation; }
| virtual const AIDA::IAxis& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::xAxis | ( | ) | const [inline, virtual] |
| virtual const AIDA::IAxis& Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::yAxis | ( | ) | const [inline, virtual] |
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rIndexX | ( | int | index | ) | const [inline, virtual] |
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rIndexY | ( | int | index | ) | const [inline, virtual] |
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::entries | ( | ) | const [inline, virtual] |
Get the number or all the entries.
Definition at line 168 of file Generic2D.h.
00168 { 00169 return (int)m_rep->GetEntries(); 00170 }
| int Gaudi::Generic2D< 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 173 of file Generic2D.h.
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::extraEntries | ( | ) | const [inline, virtual] |
Get the number of entries in the underflow and overflow bins.
Definition at line 296 of file Generic2D.h.
00296 { 00297 return 00298 binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + 00299 binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN) + 00300 binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + 00301 binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN); 00302 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumBinHeights | ( | ) | const [inline, virtual] |
Get the sum of in range bin heights in the IProfile.
Definition at line 188 of file Generic2D.h.
00188 { 00189 return m_rep->GetSumOfWeights(); 00190 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumAllBinHeights | ( | ) | const [inline, virtual] |
Get the sum of all the bins heights (including underflow and overflow bin).
Definition at line 193 of file Generic2D.h.
00193 { 00194 return m_rep->GetSum(); 00195 }
| 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.
00076 { return sumAllBinHeights()-sumBinHeights(); }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::minBinHeight | ( | ) | const [inline, virtual] |
Get the minimum height of the in-range bins.
Definition at line 178 of file Generic2D.h.
00178 { 00179 return m_rep->GetMinimum(); 00180 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::maxBinHeight | ( | ) | const [inline, virtual] |
Get the maximum height of the in-range bins.
Definition at line 183 of file Generic2D.h.
00183 { 00184 return m_rep->GetMaximum(); 00185 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binMeanX | ( | int | indexX, | |
| int | indexY | |||
| ) | const [inline, virtual] |
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binMeanY | ( | int | indexX, | |
| int | indexY | |||
| ) | const [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< INTERFACE, IMPLEMENTATION >::binEntriesX | ( | int | indexX | ) | const [inline, virtual] |
Equivalent to projectionX().binEntries(indexX).
Definition at line 213 of file Generic2D.h.
00213 { 00214 int n = 0; 00215 for (int iY = -2; iY < yAxis().bins(); ++iY) 00216 n += binEntries(index,iY); 00217 return n; 00218 }
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntriesY | ( | int | indexY | ) | const [inline, virtual] |
Equivalent to projectionY().binEntries(indexY).
Definition at line 221 of file Generic2D.h.
00221 { 00222 int n = 0; 00223 for (int iX = -2; iX < xAxis().bins(); ++iX) 00224 n += binEntries(iX,index); 00225 return n; 00226 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeight | ( | int | indexX, | |
| int | indexY | |||
| ) | const [inline, 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 [inline, virtual] |
Equivalent to projectionX().binHeight(indexX).
Definition at line 234 of file Generic2D.h.
00234 { 00235 double s = 0; 00236 for (int iY = -2; iY < yAxis().bins(); ++iY) { 00237 s += binHeight(index,iY); 00238 } 00239 return s; 00240 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeightY | ( | int | indexY | ) | const [inline, virtual] |
Equivalent to projectionY().binHeight(indexY).
Definition at line 243 of file Generic2D.h.
00243 { 00244 double s = 0; 00245 for (int iX = -2; iX < xAxis().bins(); ++iX) 00246 s += binHeight(iX,index); 00247 return s; 00248 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binError | ( | int | indexX, | |
| int | indexY | |||
| ) | const [inline, virtual] |
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binRms | ( | int | indexX, | |
| int | indexY | |||
| ) | const [inline, virtual] |
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::meanX | ( | ) | const [inline, 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.
00256 { 00257 return m_rep->GetMean(1); 00258 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::meanY | ( | ) | const [inline, 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.
00261 { 00262 return m_rep->GetMean(2); 00263 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rmsX | ( | ) | const [inline, 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.
00266 { 00267 return m_rep->GetRMS(1); 00268 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rmsY | ( | ) | const [inline, 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.
00271 { 00272 return m_rep->GetRMS(2); 00273 }
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::coordToIndexX | ( | double | coordX | ) | const [inline, virtual] |
Convenience method, equivalent to xAxis().coordToIndex(coord).
Definition at line 276 of file Generic2D.h.
00276 { 00277 return xAxis().coordToIndex(coord); 00278 }
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::coordToIndexY | ( | double | coordY | ) | const [inline, virtual] |
Convenience method, equivalent to yAxis().coordToIndex(coord).
Definition at line 281 of file Generic2D.h.
00281 { 00282 return yAxis().coordToIndex(coord); 00283 }
| double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries | ( | ) | const [inline, virtual] |
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ].
Definition at line 305 of file Generic2D.h.
00305 { 00306 if (sumBinHeights() <= 0) return 0; 00307 Stat_t stats[11]; // cover up to 3D... 00308 m_rep->GetStats(stats); 00309 return stats[0]*stats[0]/stats[1]; 00310 }
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::scale | ( | double | scaleFactor | ) | [inline, 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.
00313 { 00314 m_rep->Scale ( scaleFactor ); 00315 return true; 00316 }
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::add | ( | const INTERFACE & | h | ) | [inline, virtual] |
Modifies this profile by adding the contents of profile to it.
Definition at line 286 of file Generic2D.h.
00286 { 00287 const Base* p = dynamic_cast<const Base*>(&hist); 00288 if ( p ) { 00289 m_rep->Add(p->m_rep); 00290 return true; 00291 } 00292 throw std::runtime_error("Cannot add profile histograms of different implementations."); 00293 }
| bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::reset | ( | ) | [inline] |
Reimplemented in Gaudi::Histogram2D.
Definition at line 319 of file Generic2D.h.
00319 { 00320 m_sumEntries = 0; 00321 m_rep->Reset ( ); 00322 return true; 00323 }
| void* Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::cast | ( | const std::string & | className | ) | const |
Introspection method.
| 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.
00125 { return m_classType; }
| virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::dimension | ( | ) | const [inline, virtual] |
| std::ostream & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::print | ( | std::ostream & | s | ) | const [inline, 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.
| std::ostream & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::write | ( | std::ostream & | s | ) | const [inline, virtual] |
Write (ASCII) the histogram table into the output stream.
Implements Gaudi::HistogramBase.
Definition at line 335 of file Generic2D.h.
00336 { 00337 s << std::endl << "2D Histogram Table: " << std::endl; 00338 s << "BinX, BinY, Height, Error " << std::endl; 00339 for ( int i = 0; i < xAxis().bins(); ++i ) { 00340 for ( int j = 0; j < yAxis().bins(); ++j ) { 00341 s << binMeanX( i, j ) << ", " 00342 << binMeanY( i, j ) << ", " 00343 << binHeight( i, j ) << ", " 00344 << binError ( i, j ) << std::endl; 00345 } 00346 } 00347 s << std::endl; 00348 return s; 00349 }
| int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::write | ( | const char * | file_name | ) | const [inline, virtual] |
Write (ASCII) the histogram table into a file.
Implements Gaudi::HistogramBase.
Definition at line 353 of file Generic2D.h.
00354 { 00355 TFile *f = TFile::Open(file_name,"RECREATE"); 00356 Int_t nbytes = m_rep->Write(); 00357 f->Close(); 00358 return nbytes; 00359 }
| void * Gaudi::Generic2D< IHistogram2D, TH2D >::cast | ( | const std::string & | className | ) | const [inline] |
| int Gaudi::Generic2D< IHistogram2D, TH2D >::binEntries | ( | int | indexX, | |
| int | indexY | |||
| ) | const [inline] |
| void Gaudi::Generic2D< AIDA::IHistogram2D, TH2D >::adoptRepresentation | ( | TObject * | rep | ) | [inline, virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 96 of file H2D.cpp.
00096 { 00097 TH2D* imp = dynamic_cast<TH2D*>(rep); 00098 if ( imp ) { 00099 if ( m_rep ) delete m_rep; 00100 m_rep = imp; 00101 m_xAxis.initialize(m_rep->GetXaxis(),true); 00102 m_yAxis.initialize(m_rep->GetYaxis(),true); 00103 const TArrayD* a = m_rep->GetSumw2(); 00104 if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2(); 00105 setTitle(m_rep->GetTitle()); 00106 return; 00107 } 00108 throw std::runtime_error("Cannot adopt native histogram representation."); 00109 }
| void * Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::cast | ( | const std::string & | className | ) | const [inline] |
Definition at line 45 of file P2D.cpp.
00045 { 00046 if (className == "AIDA::IProfile2D") 00047 return const_cast<AIDA::IProfile2D*>((AIDA::IProfile2D*)this); 00048 else if (className == "AIDA::IProfile") 00049 return const_cast<AIDA::IProfile*>((AIDA::IProfile*)this); 00050 else if (className == "AIDA::IBaseHistogram") 00051 return const_cast<AIDA::IBaseHistogram*>((AIDA::IBaseHistogram*)this); 00052 return 0; 00053 }
| int Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::binEntries | ( | int | idX, | |
| int | idY | |||
| ) | const [inline] |
| void Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::adoptRepresentation | ( | TObject * | rep | ) | [inline, virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 62 of file P2D.cpp.
00062 { 00063 TProfile2D* imp = dynamic_cast<TProfile2D*>(rep); 00064 if ( imp ) { 00065 if ( m_rep ) delete m_rep; 00066 m_rep = imp; 00067 m_xAxis.initialize(m_rep->GetXaxis(),true); 00068 m_yAxis.initialize(m_rep->GetYaxis(),true); 00069 setTitle(m_rep->GetTitle()); 00070 return; 00071 } 00072 throw std::runtime_error("Cannot adopt native histogram representation."); 00073 }
Axis Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_xAxis [protected] |
Axis Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_yAxis [protected] |
AIDA::Annotation Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_annotation [mutable, protected] |
IMPLEMENTATION* Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_rep [protected] |
std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_classType [protected] |
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.