herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
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 
16 namespace 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 
65  XML::Element toXML() const;
66 
67  private:
68 
72  std::pair<double,double> theBoundaries;
73 
74  };
75 
76 }
77 
78 #endif // MYSTATISTICS_Bin_hpp_included
void fromXML(const XML::Element &)
Fill bin data from an XML element.
Bin & operator+=(const Bin &other)
Add a bin to this bin.
std::pair< double, double > theBoundaries
The bin boundaries.
Definition: Bin.h:72
virtual ~Bin()
Destruct a bin.
A bin in a (one dimensional) histogram.
Definition: Bin.h:22
XML::Element toXML() const
Return an XML element for the data of this bin.
Definition: Bin.h:16
A (weighted) counter.
Definition: Counter.h:19
Element represents a (tree of) XML elements.
Definition: Element.h:56
Bin(const std::pair< double, double > &newBoundaries=std::make_pair(-DBL_MAX, DBL_MAX))
Construct a bin given boundaries.
Bin & operator-=(const Bin &other)
Subtract a bin from this bin.
const std::pair< double, double > & boundaries() const
Return the bin boundaries.
Definition: Bin.h:41