herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
Bin.h
1// -*- C++ -*-
2//
3// Bin.hpp is a part of myStatistics
4// Copyright (C) 2012-2019 Simon Platzer, The Herwig Collaboration
5//
6// myStatistics is licenced under version 3 of the GPL, see COPYING for details.
7//
8#ifndef MYSTATISTICS_Bin_hpp_included
9#define MYSTATISTICS_Bin_hpp_included
10
11#include <utility>
12#include <cfloat>
13
14#include "Counter.h"
15
16namespace Statistics {
17
22 class Bin
23 : public Counter {
24
25 public:
26
30 explicit Bin(const std::pair<double,double>& newBoundaries =
31 std::make_pair(-DBL_MAX,DBL_MAX));
32
36 virtual ~Bin();
37
41 const std::pair<double,double>& boundaries() const { return theBoundaries; }
42
43 public:
44
48 Bin& operator+=(const Bin& other);
49
53 Bin& operator-=(const Bin& other);
54
55 public:
56
60 void fromXML(const XML::Element&);
61
66
67 private:
68
72 std::pair<double,double> theBoundaries;
73
74 };
75
76}
77
78#endif // MYSTATISTICS_Bin_hpp_included
A bin in a (one dimensional) histogram.
Definition: Bin.h:23
Bin & operator+=(const Bin &other)
Add a bin to this bin.
virtual ~Bin()
Destruct a bin.
Bin & operator-=(const Bin &other)
Subtract a bin from this bin.
void fromXML(const XML::Element &)
Fill bin data from an XML element.
XML::Element toXML() const
Return an XML element for the data of this bin.
const std::pair< double, double > & boundaries() const
Return the bin boundaries.
Definition: Bin.h:41
Bin(const std::pair< double, double > &newBoundaries=std::make_pair(-DBL_MAX, DBL_MAX))
Construct a bin given boundaries.
std::pair< double, double > theBoundaries
The bin boundaries.
Definition: Bin.h:72
A (weighted) counter.
Definition: Counter.h:19
Element represents a (tree of) XML elements.
Definition: Element.h:56