Index: src/Fragmentation/Histogram/Histogram.cpp
===================================================================
--- src/Fragmentation/Histogram/Histogram.cpp	(revision cf18c56dc21a7e19c3ae8878df1eff00fe51bd99)
+++ src/Fragmentation/Histogram/Histogram.cpp	(revision 6bed1fe65ef0bdadc2c6372942a37e354d44bce8)
@@ -98,14 +98,11 @@
 }
 
-Histogram::Histogram(const samples_t &samples, const int _CountBins) :
-    binwidth(0.5),
-    CountBins(_CountBins)
+Histogram::Histogram(const samples_t &samples, const BinLowerEnd _offset, const double _binwidth) :
+    binwidth(_binwidth),
+    offset(_offset)
 {
   // build histogram from samples
   if (!samples.empty()) {
-    if (CountBins == -1) {
-      CountBins = ceil(pow(samples.size(), 1./3.));
-    }
-    // 2. get min and max and determine width
+    // 1. get min and max and determine width
     samples_t::const_iterator maxiter = max_element(samples.begin(), samples.end());
     samples_t::const_iterator miniter = min_element(samples.begin(), samples.end());
@@ -113,24 +110,22 @@
         "Histogram::Histogram() - cannot find min/max despite non-empty range.");
 //    LOG(1, "DEBUG: min is " << *miniter << " and max is " << *maxiter << ".");
-    // as the logic to calculate is a bit more complex, we cannot (sensibly) place
-    // it in the cstor call in the init list above. However, the binwidth is from
-    // this point on fixed through the existence of this instance. Hence, we rather
-    // keep it constant nonetheless and ust const_cast here.
-    const_cast<double &>(binwidth) = (*maxiter - *miniter)/(CountBins-1);
-
-    // 3. create each bin
-    BinCreator_t BinCreator( *miniter, binwidth );
-    std::vector<Bin_t> vectorbins;
-    // we need one extra bin for get...Bin()'s find to work properly
-    vectorbins.resize(CountBins+1, Bin_t( make_pair(0., 0.) ) );
-    std::generate( vectorbins.begin(), vectorbins.end(), BinCreator );
-    bins.insert(vectorbins.begin(), vectorbins.end());
-
-    // 4. place each sample into bin (make count normalized, i.e. always equal to
-    // surface area of 1)
+
+    // 2. create each bin
+    {
+      std::vector<Bin_t> vectorbins;
+      BinCreator_t BinCreator( getLowerEnd(*miniter), binwidth );
+      // we need one extra bin for get...Bin()'s find to work properly
+      const int CountBins = ceil((*maxiter - getLowerEnd(*miniter))/binwidth)+1;
+      vectorbins.resize(CountBins+1, Bin_t( make_pair(0., 0.) ) );
+      std::generate( vectorbins.begin(), vectorbins.end(), BinCreator );
+      bins.insert(vectorbins.begin(), vectorbins.end());
+    }
+
+    // 3. place each sample into bin
     BOOST_FOREACH( double value, samples) {
       const Bins_t::iterator biniter = getLowerEndBin(value);
       ASSERT( biniter != bins.end(),
           "Histogram::Histogram() - cannot find bin for value from given samples.");
+      // (make bin count normalized, i.e. always equal to surface area of 1)
       biniter->second += 1./binwidth;
     }
@@ -293,6 +288,4 @@
 Histogram::BinLowerEnd Histogram::getLowerEnd(const double _value) const
 {
-  // we need just one bin, to have an offset
-  const double offset = bins.begin()->first;
   BinLowerEnd start = _value - offset;
   // then divide by binwidth
Index: src/Fragmentation/Histogram/Histogram.hpp
===================================================================
--- src/Fragmentation/Histogram/Histogram.hpp	(revision cf18c56dc21a7e19c3ae8878df1eff00fe51bd99)
+++ src/Fragmentation/Histogram/Histogram.hpp	(revision 6bed1fe65ef0bdadc2c6372942a37e354d44bce8)
@@ -49,10 +49,26 @@
   typedef std::map< BinLowerEnd, BinWeight > Bins_t;
 public:
+  Histogram() :
+    binwidth(0.5),
+    offset(0.)
+  {}
+
+  /** Constructor for class Histogram.
+   *
+   * @param offset where the bins should start
+   * @param binwidth width of the bins
+   */
+  Histogram(const BinLowerEnd _offset, const double _binwidth) :
+    binwidth(_binwidth),
+    offset(_offset)
+  {}
+
   /** Constructor for class Histogram.
    *
    * @param samples samples to put in the histogram.
-   * @param CountBins number of bins (if negative, we choose number by statistical means)
+   * @param offset where the bins should start
+   * @param binwidth width of the bins
    */
-  Histogram(const samples_t &samples, const int _CountBins=-1);
+  Histogram(const samples_t &samples, const BinLowerEnd _offset, const double _binwidth);
 
   /** Adding another histogram onto this one.
@@ -142,6 +158,6 @@
   //!> width of bin
   const double binwidth;
-  //!> number of bins
-  int CountBins;
+  //!> offset for the start of the bins
+  const BinLowerEnd offset;
 };
 
Index: src/Fragmentation/Histogram/unittests/HistogramUnitTest.cpp
===================================================================
--- src/Fragmentation/Histogram/unittests/HistogramUnitTest.cpp	(revision cf18c56dc21a7e19c3ae8878df1eff00fe51bd99)
+++ src/Fragmentation/Histogram/unittests/HistogramUnitTest.cpp	(revision 6bed1fe65ef0bdadc2c6372942a37e354d44bce8)
@@ -84,5 +84,5 @@
   sampled_values += 1.,2.,3.,4.;
   CPPUNIT_ASSERT_EQUAL( (size_t)4, sampled_values.size() );
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
   CPPUNIT_ASSERT_EQUAL( (size_t)4+1, histogram->bins.size() );
   CPPUNIT_ASSERT( histogram->bins.end() != histogram->bins.begin() );
@@ -99,5 +99,5 @@
   sampled_values += 1.,2.,3.,4.;
   CPPUNIT_ASSERT_EQUAL( (size_t)4, sampled_values.size() );
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
 
   // check values inside
@@ -133,5 +133,5 @@
   sampled_values += 1.,2.,3.,4.;
   CPPUNIT_ASSERT_EQUAL( (size_t)4, sampled_values.size() );
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
 
   // check values inside
@@ -172,5 +172,5 @@
   Histogram::samples_t sampled_values;
   sampled_values += 1.,2.,3.,4.;
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
 
   // go through each bin and check against getLowerEnd()
@@ -189,5 +189,5 @@
 void HistogramTest::isEmpty_Test()
 {
-  histogram = new Histogram(std::vector<double>());
+  histogram = new Histogram(1., 1.);
   // test on empty histogramgram
   CPPUNIT_ASSERT( histogram->isEmpty() );
@@ -197,5 +197,5 @@
   sampled_values += 1.,2.,3.,4.;
   delete histogram;
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
   CPPUNIT_ASSERT( !histogram->isEmpty() );
 
@@ -206,5 +206,5 @@
 void HistogramTest::areaTest()
 {
-  histogram = new Histogram(std::vector<double>());
+  histogram = new Histogram(1., 1.);
   // test on empty histogramgram
   CPPUNIT_ASSERT_EQUAL( 0., histogram->area() );
@@ -214,9 +214,9 @@
   sampled_values += 1.,2.,3.,4., 4.;
   delete histogram;
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
   CPPUNIT_ASSERT_EQUAL( 5., histogram->area() );
   Histogram::samples_t more_values;
   more_values += 1.75,2.5,3.;
-  Histogram otherhistogram(more_values, 3);
+  Histogram otherhistogram(more_values, 1.75, .625);
   CPPUNIT_ASSERT_EQUAL( 3., otherhistogram.area() );
 
@@ -230,8 +230,8 @@
   Histogram::samples_t sampled_values;
   sampled_values += 1.,2.,3.,4.;
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
   Histogram::samples_t more_values;
   more_values += 1.75,2.5,3.;
-  Histogram otherhistogram(more_values, 3);
+  Histogram otherhistogram(more_values, 1.75, .625);
 
   // check that size increases
@@ -252,5 +252,5 @@
   Histogram::samples_t sampled_values;
   sampled_values += 1.,2.,3.,4.;
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
 
   // add upon larger
@@ -258,5 +258,5 @@
     Histogram::samples_t more_values;
     more_values += 0.5, 1.25, 2.5,3., 4.2;
-    Histogram otherhistogram(more_values, 5);
+    Histogram otherhistogram(more_values, 0.5, .625);
     const double areas = histogram->area() + otherhistogram.area();
 
@@ -271,5 +271,5 @@
     Histogram::samples_t more_values;
     more_values += 1.75,2.5,3.;
-    Histogram otherhistogram(more_values, 3);
+    Histogram otherhistogram(more_values, 1.75, .625);
     const double areas = histogram->area() + otherhistogram.area();
 
@@ -288,11 +288,11 @@
   Histogram::samples_t sampled_values;
   sampled_values += 1.,2.,3.,4.;
-  histogram = new Histogram(sampled_values, 4);
+  histogram = new Histogram(sampled_values, 1., 1.);
 
   // subtract smaller
   {
     Histogram::samples_t more_values;
-    more_values += 1.75,2.5,3.;
-    Histogram otherhistogram(more_values, 3);
+    more_values += 0.5, 1.25, 2.5,3., 4.2;
+    Histogram otherhistogram(more_values, 0.5, .625);
     const double difference = otherhistogram.area() - histogram->area();
 
@@ -306,6 +306,6 @@
   {
     Histogram::samples_t more_values;
-    more_values += 0.5, 1.25, 2.5,3., 4.2;
-    Histogram otherhistogram(more_values, 5);
+    more_values += 1.75,2.5,3.;
+    Histogram otherhistogram(more_values, 1.75, .625);
     const double difference = otherhistogram.area() - histogram->area();
 
