|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
#include <GaudiPI/Generic1D.h>


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 |
Credits: This code is the result of some stripdown implementation of LCG/PI. Credits to them!
Definition at line 29 of file Generic1D.h.
| typedef Generic1D<INTERFACE,IMPLEMENTATION> Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::Base |
Definition at line 31 of file Generic1D.h.
| Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::Generic1D | ( | ) | [inline] |
| virtual Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::~Generic1D | ( | ) | [inline, virtual] |
| virtual const std::string& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::userLevelClassType | ( | ) | const [inline, virtual] |
The AIDA user-level unterface leaf class type.
Definition at line 37 of file Generic1D.h.
00037 { return m_classType; }
| virtual void* Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::cast | ( | const std::string & | cl | ) | const [virtual] |
Manual cast by class name.
| TObject* Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::representation | ( | ) | const [inline, virtual] |
ROOT object implementation.
Implements Gaudi::HistogramBase.
Definition at line 41 of file Generic1D.h.
00041 { return m_rep; }
| virtual void Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::adoptRepresentation | ( | TObject * | rep | ) | [virtual] |
| virtual std::string Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::title | ( | ) | const [inline, virtual] |
Get the title of the object.
Definition at line 45 of file Generic1D.h.
00045 { return m_annotation.value("Title"); }
| bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::setTitle | ( | const std::string & | title | ) | [inline, virtual] |
Set the title of the object.
Definition at line 127 of file Generic1D.h.
00127 { 00128 m_rep->SetTitle(title.c_str()); 00129 if ( !annotation().addItem( "Title", title ) ) 00130 m_annotation.setValue( "Title" , title ); 00131 if ( !annotation().addItem( "title", title ) ) 00132 annotation().setValue( "title", title ); 00133 return true; 00134 }
| std::string Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::name | ( | ) | const [inline] |
| bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::setName | ( | const std::string & | newName | ) | [inline] |
Set the name of the object.
Definition at line 137 of file Generic1D.h.
00137 { 00138 m_rep->SetName(newName.c_str()); 00139 m_annotation.setValue( "Name", newName ); 00140 return true; 00141 }
| virtual AIDA::IAnnotation& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | [inline, virtual] |
| virtual const AIDA::IAnnotation& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::annotation | ( | ) | const [inline, virtual] |
Access annotation object (cons).
Definition at line 55 of file Generic1D.h.
00055 { return m_annotation; }
| Axis& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::axis | ( | ) | [inline] |
| const Axis& Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::axis | ( | ) | const [inline] |
Get the x axis of the IHistogram1D.
Definition at line 59 of file Generic1D.h.
00059 { return m_axis; }
| virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::entries | ( | ) | const [inline, virtual] |
Get the number or all the entries.
Definition at line 62 of file Generic1D.h.
00062 { return (int)m_rep->GetEntries(); }
| 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 64 of file Generic1D.h.
| int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::extraEntries | ( | ) | const [inline, virtual] |
Get the number of entries in the underflow and overflow bins.
Definition at line 164 of file Generic1D.h.
00164 { 00165 return binEntries(AIDA::IAxis::UNDERFLOW_BIN) + 00166 binEntries(AIDA::IAxis::OVERFLOW_BIN); 00167 }
| 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).
| double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binRms | ( | int | index | ) | const [inline, virtual] |
| virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::sumBinHeights | ( | ) | const [inline, virtual] |
Get the sum of in range bin heights in the IProfile.
Definition at line 72 of file Generic1D.h.
00072 { return m_rep->GetSumOfWeights(); }
| 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 74 of file Generic1D.h.
00074 { return m_rep->GetSum(); }
| virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::sumExtraBinHeights | ( | ) | const [inline, virtual] |
Get the sum of the underflow and overflow bin height.
Definition at line 76 of file Generic1D.h.
00076 { return sumAllBinHeights()-sumBinHeights(); }
| virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::minBinHeight | ( | ) | const [inline, virtual] |
Get the minimum height of the in-range bins.
Definition at line 78 of file Generic1D.h.
00078 { return m_rep->GetMinimum(); }
| virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::maxBinHeight | ( | ) | const [inline, virtual] |
Get the maximum height of the in-range bins.
Definition at line 80 of file Generic1D.h.
00080 { return m_rep->GetMaximum(); }
| double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries | ( | ) | const [inline, virtual] |
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ].
Definition at line 176 of file Generic1D.h.
00176 { 00177 if (sumBinHeights() <= 0) return 0; 00178 Stat_t stats[11]; // cover up to 3D... 00179 m_rep->GetStats(stats); 00180 return stats[0]*stats[0]/stats[1]; 00181 }
| bool Gaudi::Generic1D< 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 184 of file Generic1D.h.
00184 { 00185 m_rep->Scale ( scaleFactor ); 00186 return true; 00187 }
| bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::reset | ( | ) | [inline, virtual] |
Reset the Histogram; as if just created.
Definition at line 169 of file Generic1D.h.
00169 { 00170 m_sumEntries = 0; 00171 m_rep->Reset(); 00172 return true; 00173 }
| bool Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::add | ( | const INTERFACE & | profile | ) | [inline, virtual] |
Modifies this IProfile1D by adding the contents of profile to it.
Definition at line 190 of file Generic1D.h.
00190 { 00191 const Generic1D<INTERFACE,IMPLEMENTATION>* p = 00192 dynamic_cast<const Generic1D<INTERFACE,IMPLEMENTATION>*>(&h); 00193 if ( p ) { 00194 m_rep->Add(p->m_rep); 00195 return true; 00196 } 00197 throw std::runtime_error("Cannot add profile histograms of different implementations."); 00198 }
| virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::rIndex | ( | int | index | ) | const [inline, virtual] |
| double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binMean | ( | int | index | ) | const [inline, virtual] |
| double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binHeight | ( | int | index | ) | const [inline, virtual] |
Total height of the corresponding bin (ie the sum of the weights in this bin).
Definition at line 154 of file Generic1D.h.
| double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::binError | ( | int | index | ) | const [inline, virtual] |
| virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::mean | ( | ) | const [inline, virtual] |
The mean of the whole IHistogram1D.
Definition at line 99 of file Generic1D.h.
00099 { return m_rep->GetMean(); }
| virtual double Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::rms | ( | ) | const [inline, virtual] |
The RMS of the whole IHistogram1D.
Definition at line 101 of file Generic1D.h.
00101 { return m_rep->GetRMS(); }
| 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 103 of file Generic1D.h.
| virtual int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::dimension | ( | ) | const [inline, virtual] |
| std::ostream & Gaudi::Generic1D< 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 201 of file Generic1D.h.
| std::ostream & Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::write | ( | std::ostream & | s | ) | const [inline, virtual] |
Write (ASCII) the histogram table into the output stream.
Implements Gaudi::HistogramBase.
Definition at line 209 of file Generic1D.h.
00209 { 00210 s << "\n1D Histogram Table: " << std::endl; 00211 s << "Bin, Height, Error " << std::endl; 00212 for( int i = 0; i < axis().bins(); ++i ) 00213 s << binMean( i ) << ", " 00214 << binHeight( i ) << ", " 00215 << binError ( i ) << std::endl; 00216 s << std::endl; 00217 return s; 00218 }
| int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::write | ( | const char * | file_name | ) | const [inline, virtual] |
Write (ASCII) the histogram table into a file.
Implements Gaudi::HistogramBase.
Definition at line 222 of file Generic1D.h.
00223 { 00224 TFile *f = TFile::Open(file_name,"RECREATE"); 00225 Int_t nbytes = m_rep->Write(); 00226 f->Close(); 00227 return nbytes; 00228 }
| void * Gaudi::Generic1D< AIDA::IHistogram1D, TH1D >::cast | ( | const std::string & | className | ) | const [inline] |
Definition at line 25 of file H1D.cpp.
00025 { 00026 if (className == "AIDA::IHistogram1D") 00027 return const_cast<AIDA::IHistogram1D*>((AIDA::IHistogram1D*)this); 00028 if (className == "AIDA::IHistogram") 00029 return const_cast<AIDA::IHistogram*>((AIDA::IHistogram*)this); 00030 return 0; 00031 }
| int Gaudi::Generic1D< AIDA::IHistogram1D, TH1D >::binEntries | ( | int | index | ) | const [inline] |
| void Gaudi::Generic1D< AIDA::IHistogram1D, TH1D >::adoptRepresentation | ( | TObject * | rep | ) | [inline, virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 40 of file H1D.cpp.
00040 { 00041 TH1D* imp = dynamic_cast<TH1D*>(rep); 00042 if ( imp ) { 00043 if ( m_rep ) delete m_rep; 00044 m_rep = imp; 00045 return; 00046 } 00047 throw std::runtime_error("Cannot adopt native histogram representation."); 00048 }
| int Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::binEntries | ( | int | index | ) | const [inline] |
| void * Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::cast | ( | const std::string & | className | ) | const [inline] |
Definition at line 38 of file P1D.cpp.
00038 { 00039 if (className == "AIDA::IProfile1D") 00040 return const_cast<AIDA::IProfile1D*>((AIDA::IProfile1D*)this); 00041 else if (className == "AIDA::IProfile") 00042 return const_cast<AIDA::IProfile*>((AIDA::IProfile*)this); 00043 else if (className == "AIDA::IBaseHistogram") 00044 return const_cast<AIDA::IBaseHistogram*>((AIDA::IBaseHistogram*)this); 00045 return 0; 00046 }
| void Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::adoptRepresentation | ( | TObject * | rep | ) | [inline, virtual] |
Adopt ROOT histogram representation.
Implements Gaudi::HistogramBase.
Definition at line 49 of file P1D.cpp.
00049 { 00050 TProfile* imp = dynamic_cast<TProfile*>(rep); 00051 if ( imp ) { 00052 if ( m_rep ) delete m_rep; 00053 m_rep = imp; 00054 m_axis.initialize(m_rep->GetXaxis(),true); 00055 const TArrayD* a = m_rep->GetSumw2(); 00056 if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2(); 00057 setTitle(m_rep->GetTitle()); 00058 return; 00059 } 00060 throw std::runtime_error("Cannot adopt native histogram representation."); 00061 }
Axis Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_axis [protected] |
AIDA::Annotation Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_annotation [mutable, protected] |
IMPLEMENTATION* Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_rep [protected] |
std::string Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_classType [protected] |
Definition at line 121 of file Generic1D.h.
int Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >::m_sumEntries [protected] |
Definition at line 123 of file Generic1D.h.