| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Gaudi::Histogram1D Class Reference

AIDA implementation for 1 D histograms using ROOT THD1. More...

`#include <src/HistogramSvc/H1D.h>`

Inheritance diagram for Gaudi::Histogram1D:
[legend]
Collaboration diagram for Gaudi::Histogram1D:
[legend]

## Public Member Functions
| Histogram1D ()
| Standard constructor. More...
| Histogram1D (TH1D *rep)
| Standard constructor with initialization. The histogram representation will be adopted. More...
| ~Histogram1D () override=default
| Destructor. More...
void | adoptRepresentation (TObject *rep) override
| Adopt ROOT histogram representation. More...
virtual bool | setBinContents (int i, int entries, double height, double error, double centre)
| set bin content (entries and centre are not used ) More...
bool | reset () override
| need to overwrite reset to reset the sums More...
virtual bool | setStatistics (int allEntries, double eqBinEntries, double mean, double rms)
| set histogram statistics More...
bool | fill (double x, double weight) override
| Fill the Profile1D with a value and the corresponding weight. More...
bool | setRms (double rms)
| Update histogram RMS. More...
void | copyFromAida (const AIDA::IHistogram1D &h)
| Create new histogram from any AIDA based histogram. More...
const CLID & | clID () const override
| Retrieve reference to class defininition identifier. More...
StreamBuffer & | serialize (StreamBuffer &s)
| Serialization mechanism, Serialize the object for reading. More...
StreamBuffer & | serialize (StreamBuffer &s) const
| Serialization mechanism, Serialize the object for writing. More...
Public Member Functions inherited from DataObject
| DataObject ()
| Standard Constructor. More...
| DataObject (const DataObject &rhs)
| Copy Constructor. More...
DataObject & | operator= (const DataObject &rhs)
| Assignment Operator. More...
| DataObject (DataObject &&rhs)
| Move Constructor. More...
DataObject & | operator= (DataObject &&rhs)
| Move Assignment Operator. More...
virtual | ~DataObject ()
| Standard Destructor. More...
virtual unsigned long | addRef ()
| Add reference to object. More...
virtual unsigned long | release ()
| release reference to object More...
const std::string & | name () const
| Retreive DataObject name. It is the name when registered in the store. More...
virtual StatusCode | update ()
| Provide empty placeholder for internal object reconfiguration callback. More...
void | setRegistry (IRegistry *pRegistry)
| Set pointer to Registry. More...
IRegistry * | registry () const
| Get pointer to Registry. More...
LinkManager * | linkMgr () const
| Retrieve Link manager. More...
unsigned char | version () const
| Retrieve version number of this object representation. More...
void | setVersion (unsigned char vsn)
| Set version number of this object representation. More...
unsigned long | refCount () const
| Return the refcount. More...
virtual std::ostream & | fillStream (std::ostream &s) const
| Fill the output stream (ASCII) More...
Public Member Functions inherited from Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >
| Generic1D ()=default
| Default constructor. More...
| ~Generic1D () override=default
| Default destructor. More...
virtual const std::string & | userLevelClassType () const
| The AIDA user-level unterface leaf class type. More...
void * | cast (const std::string &cl) const override
| Manual cast by class name. More...
TObject * | representation () const override
| ROOT object implementation. More...
std::string | title () const override
| Get the title of the object. More...
bool | setTitle (const std::string &title) override
| Set the title of the object. More...
std::string | name () const
| object name More...
bool | setName (const std::string &newName)
| Set the name of the object. More...
AIDA::IAnnotation & | annotation () override
| Access annotation object. More...
const AIDA::IAnnotation & | annotation () const override
| Access annotation object (cons) More...
Axis & | axis ()
| Access to axis object. More...
const Axis & | axis () const override
| Get the x axis of the IHistogram1D. More...
int | entries () const override
| Get the number or all the entries. More...
int | allEntries () const override
| Get the number or all the entries, both in range and underflow/overflow bins of the IProfile. More...
int | extraEntries () const override
| Get the number of entries in the underflow and overflow bins. More...
int | binEntries (int index) const override
| Number of entries in the corresponding bin (ie the number of times fill was called for this bin). More...
virtual double | binRms (int index) const
double | sumBinHeights () const override
| Get the sum of in range bin heights in the IProfile. More...
double | sumAllBinHeights () const override
| Get the sum of all the bins heights (including underflow and overflow bin). More...
double | sumExtraBinHeights () const override
| Get the sum of the underflow and overflow bin height. More...
double | minBinHeight () const override
| Get the minimum height of the in-range bins. More...
double | maxBinHeight () const override
| Get the maximum height of the in-range bins. More...
virtual double | equivalentBinEntries () const
| Number of equivalent entries, i.e. `SUM[ weight ] ^ 2 / SUM[ weight^2 ]` More...
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. More...
bool | reset () override
| Reset the Histogram; as if just created. More...
bool | add (const INTERFACE &profile) override
| Modifies this IProfile1D by adding the contents of profile to it. More...
virtual int | rIndex (int index) const
| operator methods More...
double | binMean (int index) const override
| The weighted mean of a bin. More...
double | binHeight (int index) const override
| Total height of the corresponding bin (ie the sum of the weights in this bin). More...
double | binError (int index) const override
| The error of a given bin. More...
double | mean () const override
| The mean of the whole IHistogram1D. More...
double | rms () const override
| The RMS of the whole IHistogram1D. More...
int | coordToIndex (double coord) const override
| Get the bin number corresponding to a given coordinate along the x axis. More...
int | dimension () const override
| Get the Histogram's dimension. More...
std::ostream & | print (std::ostream &s) const override
| Print (ASCII) the histogram into the output stream. More...
std::ostream & | write (std::ostream &s) const override
| Write (ASCII) the histogram table into the output stream. More...
int | write (const char *file_name) const override
| Write (ASCII) the histogram table into a file. More...
template<>
void * | cast (const std::string &className) const
template<>
int | binEntries (int index) const
template<>
void | adoptRepresentation (TObject *rep)
| Adopt ROOT histogram representation. More...
template<>
int | binEntries (int index) const
template<>
void * | cast (const std::string &className) const
template<>
void | adoptRepresentation (TObject *rep)
| Adopt ROOT histogram representation. More...
Public Member Functions inherited from Gaudi::HistogramBase
virtual | ~HistogramBase ()=default

## Static Public Member Functions
static const CLID & | classID ()
Static Public Member Functions inherited from DataObject
static const CLID & | classID ()
| Retrieve reference to class definition structure (static access) More...

## Protected Attributes
double | m_sumwx = 0
| cache sumwx when setting contents since I don't have bin mean More...
Protected Attributes inherited from Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >
Axis | m_axis
| Axis member. More...
AIDA::Annotation | m_annotation
| Object annotations. More...
std::unique_ptr< IMPLEMENTATION > | m_rep
| Reference to underlying implementation. More...
std::string | m_classType
int | m_sumEntries

## Private Member Functions
void | init (const std::string &title, bool initialize_axis=true)
void | initSums ()

## Additional Inherited Members
Public Types inherited from Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >
typedef Generic1D< INTERFACE, IMPLEMENTATION > | Base
Protected Member Functions inherited from Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >
| Generic1D (IMPLEMENTATION *p)
| constructor More...

## Detailed Description

AIDA implementation for 1 D histograms using ROOT THD1.

Author
  M.Frank

Definition at line 17 of file H1D.h.

## Constructor & Destructor Documentation

Gaudi::Histogram1D::Histogram1D | ( |  | ) |

Standard constructor.

Definition at line 57 of file H1D.cpp.

58 : Base( new TH1D() )
59 {
60 init("",false);
61 }
Gaudi::Histogram1D::init
void init(const std::string &title, bool initialize_axis=true)
Definition: H1D.cpp:69
Gaudi::Generic1D::Base
Generic1D< INTERFACE, IMPLEMENTATION > Base
Definition: Generic1D.h:36

Gaudi::Histogram1D::Histogram1D | ( | TH1D * | rep | ) |

Standard constructor with initialization. The histogram representation will be adopted.

Definition at line 63 of file H1D.cpp.

63 {
64 m_rep.reset( rep );
65 init(m_rep->GetTitle());
66 initSums();
67 }
Gaudi::Histogram1D::initSums
void initSums()
Definition: H1D.cpp:82
Gaudi::Histogram1D::init
void init(const std::string &title, bool initialize_axis=true)
Definition: H1D.cpp:69
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
std::unique_ptr::reset
T reset(T...args)

Gaudi::Histogram1D::~Histogram1D | ( |  | ) |
| override default

Destructor.

## Member Function Documentation

void Gaudi::Histogram1D::adoptRepresentation | ( | TObject * | rep | ) |
| override virtual

Adopt ROOT histogram representation.

Reimplemented from Gaudi::Generic1D< INTERFACE, IMPLEMENTATION >.

Definition at line 98 of file H1D.cpp.

98 {
99 Gaudi::Generic1D<AIDA::IHistogram1D,TH1D>::adoptRepresentation(rep);
100 if ( m_rep ) {
101 init(m_rep->GetTitle());
102 initSums();
103 }
104 }
Gaudi::Histogram1D::initSums
void initSums()
Definition: H1D.cpp:82
Gaudi::Histogram1D::init
void init(const std::string &title, bool initialize_axis=true)
Definition: H1D.cpp:69
Gaudi::Generic1D::adoptRepresentation
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128

static const CLID& Gaudi::Histogram1D::classID | ( |  | ) |
| inline static

Definition at line 47 of file H1D.h.

47 { return CLID_H1D; }

const CLID& Gaudi::Histogram1D::clID | ( |  | ) | const
| inline override virtual

Retrieve reference to class defininition identifier.

Reimplemented from DataObject.

Definition at line 46 of file H1D.h.

46 { return classID(); }
Gaudi::Histogram1D::classID
static const CLID & classID()
Definition: H1D.h:47

void Gaudi::Histogram1D::copyFromAida | ( | const AIDA::IHistogram1D & | h | ) |

Create new histogram from any AIDA based histogram.

Definition at line 162 of file H1D.cpp.

162 {
163 // implement here the copy
164 std::string tit = h.title()+"Copy";
165 if (h.axis().isFixedBinning() ) {
166 m_rep.reset( new TH1D(tit.c_str(),tit.c_str(),h.axis().bins(),h.axis().lowerEdge(),h.axis().upperEdge()) );
167 }
168 else {
169 Edges e;
170 for (int i =0; i < h.axis().bins(); ++i) {
171 e.push_back(h.axis().binLowerEdge(i));
172 }
173 // add also upperedges at the end
174 e.push_back(h.axis().upperEdge() );
175 m_rep.reset( new TH1D(tit.c_str(),tit.c_str(),e.size()-1,&e.front()) );
176 }
177 m_axis.initialize(m_rep->GetXaxis(),false);
178 m_rep->Sumw2();
179 m_sumEntries = 0;
180 m_sumwx = 0;
181 // sumw
182 double sumw = h.sumBinHeights();
183 // sumw2
184 double sumw2 = 0;
185 if (h.equivalentBinEntries() != 0)
186 sumw2 = ( sumw * sumw ) /h.equivalentBinEntries();
187
188 double sumwx = h.mean()*h.sumBinHeights();
189 double sumwx2 = (h.mean()*h.mean() + h.rms()*h.rms() )*h.sumBinHeights();
190
191 // copy the contents in
192 for (int i=-2; i < axis().bins(); ++i) {
193 // root binning starts from one !
194 m_rep->SetBinContent(rIndex(i),h.binHeight(i) );
195 m_rep->SetBinError(rIndex(i),h.binError(i) );
196 }
197 // need to do set entries after setting contents otherwise root will recalulate them
198 // taking into account how many time SetBinContents() has been called
199 m_rep->SetEntries(h.allEntries());
200 // stat vector
201 std::vector<double> stat(11);
202 stat[0] = sumw;
203 stat[1] = sumw2;
204 stat[2] = sumwx;
205 stat[3] = sumwx2;
206 m_rep->PutStats(&stat.front());
207 }
Gaudi::Edges
std::vector< double > Edges
Definition: GaudiPI.h:19
std::string
STL class.
Gaudi::Generic1D::axis
Axis & axis()
Access to axis object.
Definition: Generic1D.h:66
std::vector::push_back
T push_back(T...args)
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
HiveAlgSequencer.h
tuple h
Definition: HiveAlgSequencer.py:24
Gaudi::Generic1D::m_axis
Axis m_axis
Axis member.
Definition: Generic1D.h:124
std::unique_ptr::reset
T reset(T...args)
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
Gaudi::Axis::bins
int bins() const override
The number of bins (excluding underflow and overflow) on the IAxis.
Definition: Axis.h:105
std::vector< double >
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:71
std::string::c_str
T c_str(T...args)
Gaudi::Generic1D::rIndex
virtual int rIndex(int index) const
operator methods
Definition: Generic1D.h:100
ana.i
list i
Definition: ana.py:128
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

bool Gaudi::Histogram1D::fill | ( | double | x,
|  | double | weight
| ) |  |
| override

Fill the Profile1D with a value and the corresponding weight.

Definition at line 157 of file H1D.cpp.

157 {
158 (weight == 1.) ? m_rep->Fill(x) : m_rep->Fill(x,weight);
159 return true;
160 }
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128

void Gaudi::Histogram1D::init | ( | const std::string & | title,
|  | bool | initialize_axis = `true`
| ) |  |
| private

Definition at line 69 of file H1D.cpp.

69 {
70 m_classType = "IHistogram1D";
71 if ( initialize_axis ) {
72 m_axis.initialize(m_rep->GetXaxis(),false);
73 }
74 const TArrayD* a = m_rep->GetSumw2();
75 if ( !a || (a && a->GetSize()==0) ) m_rep->Sumw2();
76 setTitle(title);
77 m_rep->SetDirectory(nullptr);
78 m_sumEntries = 0;
79 m_sumwx = 0;
80 }
Gaudi::Generic1D::m_classType
std::string m_classType
Definition: Generic1D.h:130
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Generic1D::setTitle
bool setTitle(const std::string &title) override
Set the title of the object.
Definition: Generic1D.h:136
Gaudi::Generic1D::m_axis
Axis m_axis
Axis member.
Definition: Generic1D.h:124
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:71
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

void Gaudi::Histogram1D::initSums | ( |  | ) |
| private

Definition at line 82 of file H1D.cpp.

82 {
83 m_sumwx = 0;
84 m_sumEntries = 0;
85 for(int i=1, n=m_rep->GetNbinsX(); i<=n; ++i) {
86 m_sumwx += m_rep->GetBinContent(i)*m_rep->GetBinCenter(i);
87 m_sumEntries += m_rep->GetBinContent(i);
88 }
89 }
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
ana.i
list i
Definition: ana.py:128
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

bool Gaudi::Histogram1D::reset | ( |  | ) |
| override

need to overwrite reset to reset the sums

Definition at line 91 of file H1D.cpp.

91 {
92 m_sumwx = 0;
93 m_sumEntries = 0;
94 return Base::reset();
95 }
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

StreamBuffer & Gaudi::Histogram1D::serialize | ( | StreamBuffer & | s | ) |

Serialization mechanism, Serialize the object for reading.

Parameters

  s | the StreamBuffer containing the data to be read

Returns
  the resulting StreamBuffer, after reading

Definition at line 214 of file H1D.cpp.

214 {
215 //DataObject::serialize(s);
216 std::string title;
217 int size;
218 s >> size;
219 for (int j = 0; j < size; j++) {
220 std::string key, value;
221 s >> key >> value;
222 annotation().addItem (key, value);
223 if ("Title" == key) {
224 title = value;
225 }
226 }
227 double lowerEdge, upperEdge, binHeight, binError;
228 int isFixedBinning, bins;
229 s >> isFixedBinning >> bins;
230
231 if ( isFixedBinning ) {
232 s >> lowerEdge >> upperEdge;
233 m_rep.reset( new TH1D(title.c_str(),title.c_str(),bins,lowerEdge,upperEdge) );
234 } else {
235 Edges edges;
236 edges.resize(bins);
237 for ( int i = 0; i <= bins; ++i )
238 s >> *(double*)&edges[i];
239 m_rep.reset( new TH1D(title.c_str(),title.c_str(),edges.size()-1,&edges.front()) );
240 }
241 m_axis.initialize(m_rep->GetXaxis(),true);
242 m_rep->Sumw2();
243 m_sumEntries = 0;
244 m_sumwx = 0;
245
246 for ( int i = 0; i <= bins + 1; ++i ) {
247 s >> binHeight >> binError;
248 m_rep->SetBinContent( i, binHeight );
249 m_rep->SetBinError( i, binError );
250 }
251 Stat_t allEntries;
252 s >> allEntries;
253 m_rep->SetEntries( allEntries );
254 Stat_t stats[4]; // stats array
255 s >> stats[0] >> stats[1] >> stats[2] >> stats[3];
256 m_rep->PutStats( stats );
257 return s;
258 }
Gaudi::Edges
std::vector< double > Edges
Definition: GaudiPI.h:19
std::vector::resize
T resize(T...args)
std::string
STL class.
Gaudi::Generic1D::binError
double binError(int index) const override
The error of a given bin.
Definition: Generic1D.h:168
Gaudi::Generic1D::allEntries
int allEntries() const override
Get the number or all the entries, both in range and underflow/overflow bins of the IProfile...
Definition: Generic1D.h:73
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Generic1D::m_axis
Axis m_axis
Axis member.
Definition: Generic1D.h:124
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
std::unique_ptr::reset
T reset(T...args)
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:71
std::string::c_str
T c_str(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
Gaudi::Generic1D::binHeight
double binHeight(int index) const override
Total height of the corresponding bin (ie the sum of the weights in this bin).
Definition: Generic1D.h:163
Gaudi::Generic1D::annotation
AIDA::IAnnotation & annotation() override
Access annotation object.
Definition: Generic1D.h:62
ana.i
list i
Definition: ana.py:128
Gaudi::Generic1D::title
std::string title() const override
Get the title of the object.
Definition: Generic1D.h:54
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

StreamBuffer & Gaudi::Histogram1D::serialize | ( | StreamBuffer & | s | ) | const

Serialization mechanism, Serialize the object for writing.

Parameters

  s | the StreamBuffer where to write the data

Returns
  the resulting StreamBuffer, after wrinting

Definition at line 260 of file H1D.cpp.

260 {
261 //DataObject::serialize(s);
262 s << static_cast<int>( annotation().size() );
263 for (int i = 0; i < annotation().size(); i++) {
264 s << annotation().key(i);
265 s << annotation().value(i);
266 }
267 const AIDA::IAxis & axis( this->axis() );
268 const int isFixedBinning = axis.isFixedBinning();
269 const int bins = axis.bins();
270 s << isFixedBinning << bins;
271 if ( isFixedBinning ) {
272 s << axis.lowerEdge();
273 }
274 else {
275 for ( int i = 0; i < bins; ++i )
276 s << axis.binLowerEdge(i);
277 }
278 s << axis.upperEdge();
279 for ( int i = 0; i <= bins + 1; ++i )
280 s << m_rep->GetBinContent(i) << m_rep->GetBinError( i );
281
282 s << m_rep->GetEntries();
283 Stat_t stats[4]; // stats array
284 m_rep->GetStats( stats );
285 s << stats[0] << stats[1] << stats[2] << stats[3];
286 return s;
287 }
Gaudi::Axis::binLowerEdge
double binLowerEdge(int index) const override
Get the lower edge of the specified bin.
Definition: Axis.h:113
Gaudi::Axis::isFixedBinning
bool isFixedBinning() const override
Check if the IAxis has fixed binning, i.e.
Definition: Axis.h:81
Gaudi::Generic1D::axis
Axis & axis()
Access to axis object.
Definition: Generic1D.h:66
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Axis::lowerEdge
double lowerEdge() const override
Get the lower edge of the IAxis.
Definition: Axis.h:91
Gaudi::Axis::bins
int bins() const override
The number of bins (excluding underflow and overflow) on the IAxis.
Definition: Axis.h:105
gaudirun.s
string s
Definition: gaudirun.py:245
Gaudi::Generic1D::annotation
AIDA::IAnnotation & annotation() override
Access annotation object.
Definition: Generic1D.h:62
ana.i
list i
Definition: ana.py:128
Gaudi::Axis::upperEdge
double upperEdge() const override
Get the upper edge of the IAxis.
Definition: Axis.h:98

bool Gaudi::Histogram1D::setBinContents | ( | int | i,
|  | int | entries,
|  | double | height,
|  | double | error,
|  | double | centre
| ) |  |
| virtual

set bin content (entries and centre are not used )

Definition at line 106 of file H1D.cpp.

106 {
107 m_rep->SetBinContent(rIndex(i),height);
108 m_rep->SetBinError(rIndex(i),error);
109 // accumulate sumwx for in range bins
110 if (i != AIDA::IAxis::UNDERFLOW_BIN && i != AIDA::IAxis::OVERFLOW_BIN )
111 m_sumwx += centre*height;
112 m_sumEntries += entries;
113 return true;
114 }
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
Gaudi::Generic1D::entries
int entries() const override
Get the number or all the entries.
Definition: Generic1D.h:71
Gaudi::Generic1D::rIndex
virtual int rIndex(int index) const
operator methods
Definition: Generic1D.h:100
ana.i
list i
Definition: ana.py:128
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

bool Gaudi::Histogram1D::setRms | ( | double | rms | ) |

Update histogram RMS.

Definition at line 122 of file H1D.cpp.

122 {
123 m_rep->SetEntries(m_sumEntries);
124 std::vector<double> stat(11);
125 // sum weights
126 stat[0] = sumBinHeights();
127 stat[1] = 0;
128 if (equivalentBinEntries() != 0)
129 stat[1] = ( sumBinHeights() * sumBinHeights() ) / equivalentBinEntries();
130 stat[2] = m_sumwx;
131 double mean = 0;
132 if ( sumBinHeights() != 0 ) mean = m_sumwx/ sumBinHeights();
133 stat[3] = ( mean*mean + rms*rms )* sumBinHeights();
134 m_rep->PutStats(&stat.front());
135 return true;
136 }
Gaudi::Generic1D::rms
double rms() const override
The RMS of the whole IHistogram1D.
Definition: Generic1D.h:110
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Generic1D::sumBinHeights
double sumBinHeights() const override
Get the sum of in range bin heights in the IProfile.
Definition: Generic1D.h:81
Gaudi::Generic1D::mean
double mean() const override
The mean of the whole IHistogram1D.
Definition: Generic1D.h:108
Gaudi::Generic1D::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:132
std::vector< double >
Gaudi::Generic1D::equivalentBinEntries
virtual double equivalentBinEntries() const
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]
Definition: Generic1D.h:185
Gaudi::Histogram1D::m_sumwx
double m_sumwx
cache sumwx when setting contents since I don't have bin mean
Definition: H1D.h:23

bool Gaudi::Histogram1D::setStatistics | ( | int | allEntries,
|  | double | eqBinEntries,
|  | double | mean,
|  | double | rms
| ) |  |
| virtual

set histogram statistics

Definition at line 139 of file H1D.cpp.

139 {
140 m_rep->SetEntries(allEntries);
141 // fill statistcal vector for Root
142 std::vector<double> stat(11);
143 // sum weights
144 stat[0] = sumBinHeights();
145 // sum weights **2
146 stat[1] = 0;
147 if (eqBinEntries != 0)
148 stat[1] = ( sumBinHeights() * sumBinHeights() ) / eqBinEntries;
149 // sum weights * x
150 stat[2] = mean*sumBinHeights();
151 // sum weight * x **2
152 stat[3] = ( mean*mean + rms*rms )* sumBinHeights();
153 m_rep->PutStats(&stat.front());
154 return true;
155 }
Gaudi::Generic1D::rms
double rms() const override
The RMS of the whole IHistogram1D.
Definition: Generic1D.h:110
Gaudi::Generic1D::allEntries
int allEntries() const override
Get the number or all the entries, both in range and underflow/overflow bins of the IProfile...
Definition: Generic1D.h:73
Gaudi::Generic1D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:128
Gaudi::Generic1D::sumBinHeights
double sumBinHeights() const override
Get the sum of in range bin heights in the IProfile.
Definition: Generic1D.h:81
Gaudi::Generic1D::mean
double mean() const override
The mean of the whole IHistogram1D.
Definition: Generic1D.h:108
std::vector< double >

## Member Data Documentation

double Gaudi::Histogram1D::m_sumwx = 0
| protected

cache sumwx when setting contents since I don't have bin mean

Definition at line 23 of file H1D.h.

The documentation for this class was generated from the following files:

- GaudiCommonSvc/src/HistogramSvc/H1D.h
- GaudiCommonSvc/src/HistogramSvc/H1D.cpp