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


Credits: This code is the result of some stripdown implementation of LCG/PI. Credits to them!
Definition at line 29 of file 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 |
| 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] |
| TObject* Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::representation | ( | ) | const [inline, virtual] |
ROOT object implementation.
Implements Gaudi::HistogramBase.
Definition at line 37 of file Generic3D.h.
00037 { return m_rep; }
| virtual void Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::adoptRepresentation | ( | TObject * | rep | ) | [virtual] |
| virtual int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::dimension | ( | ) | const [inline, virtual] |
| 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.
00044 { return m_annotation.value("Title");}
| bool Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::setTitle | ( | const std::string & | title | ) | [inline, virtual] |
Set the title of the object.
Definition at line 221 of file Generic3D.h.
00221 { 00222 m_rep->SetTitle(title.c_str()); 00223 if ( !annotation().addItem( "Title", title ) ) 00224 m_annotation.setValue( "Title" , title ); 00225 if ( !annotation().addItem( "title", title ) ) 00226 annotation().setValue( "title", title ); 00227 return true; 00228 }
| virtual std::string Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::name | ( | ) | const [inline, virtual] |
| bool Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::setName | ( | const std::string & | newName | ) | [inline] |
Sets the name of the object.
Definition at line 231 of file Generic3D.h.
00231 { 00232 m_rep->SetName(newName.c_str()); 00233 m_annotation.setValue( "Name", newName ); 00234 return true; 00235 }
| virtual AIDA::IAnnotation& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | [inline, virtual] |
| virtual const AIDA::IAnnotation& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | const [inline, virtual] |
Access annotation object (cons).
Definition at line 54 of file Generic3D.h.
00054 { return m_annotation; }
| int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::entries | ( | ) | const [inline, virtual] |
Get the number or all the entries.
Definition at line 237 of file Generic3D.h.
00237 { 00238 return (int)m_rep->GetEntries(); 00239 }
| int Gaudi::Generic3D< 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 242 of file Generic3D.h.
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::sumBinHeights | ( | ) | const [inline, virtual] |
Get the sum of in range bin heights in the IProfile.
Definition at line 257 of file Generic3D.h.
00257 { 00258 return m_rep->GetSumOfWeights(); 00259 }
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::sumAllBinHeights | ( | ) | const [inline, virtual] |
Get the sum of all the bins heights (including underflow and overflow bin).
Definition at line 262 of file Generic3D.h.
00262 { 00263 return m_rep->GetSum(); 00264 }
| 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.
00065 { return sumAllBinHeights()-sumBinHeights(); }
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::minBinHeight | ( | ) | const [inline, virtual] |
Get the minimum height of the in-range bins.
Definition at line 247 of file Generic3D.h.
00247 { 00248 return m_rep->GetMinimum(); 00249 }
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::maxBinHeight | ( | ) | const [inline, virtual] |
Get the maximum height of the in-range bins.
Definition at line 252 of file Generic3D.h.
00252 { 00253 return m_rep->GetMaximum(); 00254 }
| int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rIndexX | ( | int | index | ) | const [inline] |
| int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rIndexY | ( | int | index | ) | const [inline] |
| int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::rIndexZ | ( | int | index | ) | const [inline] |
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binMeanX | ( | int | indexX, | |
| int | , | |||
| int | ||||
| ) | const [inline] |
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binMeanY | ( | int | , | |
| int | indexY, | |||
| int | ||||
| ) | const [inline] |
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binMeanZ | ( | int | , | |
| int | , | |||
| int | indexZ | |||
| ) | const [inline] |
| 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.
00085 { 00086 if (binHeight(indexX, indexY, indexZ)<=0) return 0; 00087 double xx = binHeight(indexX, indexY, indexZ)/binError(indexX, indexY, indexZ); 00088 return int(xx*xx+0.5); 00089 }
| 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.
00091 { 00092 int n = 0; 00093 for (int i = -2; i < yAxis().bins(); ++i) 00094 for (int j = -2; j < zAxis().bins(); ++j) 00095 n += binEntries(index,i,j); 00096 return n; 00097 00098 }
| 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.
00100 { 00101 int n = 0; 00102 for (int i = -2; i < xAxis().bins(); ++i) 00103 for (int j = -2; j < zAxis().bins(); ++j) 00104 n += binEntries(i,index,j); 00105 return n; 00106 }
| 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.
00109 { 00110 int n = 0; 00111 for (int i = -2; i < xAxis().bins(); ++i) 00112 for (int j = -2; j < yAxis().bins(); ++j) 00113 n += binEntries(i,j,index); 00114 return n; 00115 }
| 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] |
| virtual double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::binError | ( | int | indexX, | |
| int | indexY, | |||
| int | indexZ | |||
| ) | const [inline, virtual] |
| 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.
00149 { 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.
00152 { 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.
00154 { return m_rep->GetMean ( 3 ); }
| 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.
00156 { 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.
00158 { 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.
00160 { return m_rep->GetRMS( 3 ); }
| virtual const AIDA::IAxis& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::xAxis | ( | ) | const [inline, virtual] |
Get the x axis of the IHistogram3D.
Definition at line 162 of file Generic3D.h.
00162 { return m_xAxis; }
| virtual const AIDA::IAxis& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::yAxis | ( | ) | const [inline, virtual] |
Get the y axis of the IHistogram3D.
Definition at line 164 of file Generic3D.h.
00164 { return m_yAxis; }
| virtual const AIDA::IAxis& Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::zAxis | ( | ) | const [inline, virtual] |
Get the z axis of the IHistogram3D.
Definition at line 166 of file Generic3D.h.
00166 { return m_zAxis; }
| 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.
00168 { 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.
00170 { 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.
00172 { return zAxis().coordToIndex(coord);}
| double Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries | ( | ) | const [inline, virtual] |
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ].
Definition at line 267 of file Generic3D.h.
00267 { 00268 if (sumBinHeights() <= 0) return 0; 00269 Stat_t stats[11]; // cover up to 3D... 00270 m_rep->GetStats(stats); 00271 return stats[0]*stats[0]/stats[1]; 00272 }
| bool Gaudi::Generic3D< 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 275 of file Generic3D.h.
00275 { 00276 m_rep->Scale ( scaleFactor ); 00277 return true; 00278 }
| 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.
00179 { 00180 const Base* p = dynamic_cast<const Base*>(&hist); 00181 if ( p ) { 00182 m_rep->Add(p->m_rep); 00183 return true; 00184 } 00185 throw std::runtime_error("Cannot add profile histograms of different implementations."); 00186 }
| int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::extraEntries | ( | ) | const [inline] |
Definition at line 189 of file Generic3D.h.
00189 { 00190 return 00191 binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + 00192 binEntries(AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN) + 00193 binEntries(AIDA::IAxis::UNDERFLOW_BIN, AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + 00194 binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + 00195 binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN) + 00196 binEntries(AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::UNDERFLOW_BIN) + 00197 binEntries(AIDA::IAxis::OVERFLOW_BIN, AIDA::IAxis::OVERFLOW_BIN,AIDA::IAxis::OVERFLOW_BIN); 00198 }
| std::ostream & Gaudi::Generic3D< 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 281 of file Generic3D.h.
| std::ostream & Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::write | ( | std::ostream & | s | ) | const [inline, virtual] |
Write (ASCII) the histogram table into the output stream.
Implements Gaudi::HistogramBase.
Definition at line 291 of file Generic3D.h.
00292 { 00293 s << "\n3D Histogram Table: " << std::endl; 00294 s << "BinX, BinY, BinZ, Height, Error " << std::endl; 00295 for ( int i = 0; i < xAxis().bins(); ++i ) 00296 for ( int j = 0; j < yAxis().bins(); ++j ) 00297 for ( int k = 0; k < zAxis().bins(); ++k ) 00298 s << binMeanX( i, j, k ) << ", " 00299 << binMeanY( i, j, k ) << ", " 00300 << binMeanZ( i, j, k ) << ", " 00301 << binHeight( i, j, k ) << ", " 00302 << binError ( i, j, k ) << std::endl; 00303 s << std::endl; 00304 return s; 00305 }
| int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::write | ( | const char * | file_name | ) | const [inline, virtual] |
Write (ASCII) the histogram table into a file.
Implements Gaudi::HistogramBase.
Definition at line 309 of file Generic3D.h.
00310 { 00311 TFile *f = TFile::Open(file_name,"RECREATE"); 00312 Int_t nbytes = m_rep->Write(); 00313 f->Close(); 00314 return nbytes; 00315 }
| void Gaudi::Generic3D< AIDA::IHistogram3D, TH3D >::adoptRepresentation | ( | TObject * | rep | ) | [inline, virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 51 of file H3D.cpp.
00051 { 00052 TH3D* imp = dynamic_cast<TH3D*>(rep); 00053 if ( imp ) { 00054 if ( m_rep ) delete m_rep; 00055 m_rep = imp; 00056 m_xAxis.initialize(m_rep->GetXaxis(),true); 00057 m_yAxis.initialize(m_rep->GetYaxis(),true); 00058 m_zAxis.initialize(m_rep->GetZaxis(),true); 00059 const TArrayD* a = m_rep->GetSumw2(); 00060 if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2(); 00061 setTitle(m_rep->GetTitle()); 00062 return; 00063 } 00064 throw std::runtime_error("Cannot adopt native histogram representation."); 00065 }
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.
AIDA::Annotation Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_annotation [mutable, protected] |
IMPLEMENTATION* Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_rep [protected] |
std::string Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_classType [protected] |
Definition at line 215 of file Generic3D.h.
int Gaudi::Generic3D< INTERFACE, IMPLEMENTATION >::m_sumEntries [protected] |
Definition at line 217 of file Generic3D.h.