Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:27

0001 // -*- C++ -*-
0002 //
0003 // Bin.hpp is a part of myStatistics
0004 // Copyright (C) 2012-2019 Simon Platzer, The Herwig Collaboration
0005 //
0006 // myStatistics is licenced under version 3 of the GPL, see COPYING for details.
0007 //
0008 #ifndef MYSTATISTICS_Bin_hpp_included
0009 #define MYSTATISTICS_Bin_hpp_included
0010 
0011 #include <utility>
0012 #include <cfloat>
0013 
0014 #include "Counter.h"
0015 
0016 namespace Statistics {
0017 
0018   /**
0019    * \brief A bin in a (one dimensional) histogram
0020    * \author Simon Platzer
0021    */
0022   class Bin 
0023     : public Counter {
0024 
0025   public:
0026 
0027     /**
0028      * Construct a bin given boundaries
0029      */
0030     explicit Bin(const std::pair<double,double>& newBoundaries =
0031          std::make_pair(-DBL_MAX,DBL_MAX));
0032 
0033     /**
0034      * Destruct a bin
0035      */
0036     virtual ~Bin();
0037 
0038     /**
0039      * Return the bin boundaries
0040      */
0041     const std::pair<double,double>& boundaries() const { return theBoundaries; }
0042 
0043   public:
0044 
0045     /**
0046      * Add a bin to this bin
0047      */
0048     Bin& operator+=(const Bin& other);
0049 
0050     /**
0051      * Subtract a bin from this bin
0052      */
0053     Bin& operator-=(const Bin& other);
0054 
0055   public:
0056 
0057     /**
0058      * Fill bin data from an XML element
0059      */
0060     void fromXML(const XML::Element&);
0061 
0062     /**
0063      * Return an XML element for the data of this bin
0064      */
0065     XML::Element toXML() const;
0066 
0067   private:
0068 
0069     /**
0070      * The bin boundaries
0071      */
0072     std::pair<double,double> theBoundaries;
0073 
0074   };
0075 
0076 }
0077 
0078 #endif // MYSTATISTICS_Bin_hpp_included