[yoda-svn] r267 - in trunk: include/YODA src

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Aug 17 15:48:17 BST 2011


Author: mkawalec
Date: Wed Aug 17 15:48:17 2011
New Revision: 267

Log:
Dropped Utils::sortedvector from Axis1D, replaced by std::vector and an additional sort() when needed.

Modified:
   trunk/include/YODA/Axis1D.h
   trunk/src/Profile1D.cc

Modified: trunk/include/YODA/Axis1D.h
==============================================================================
--- trunk/include/YODA/Axis1D.h	Wed Aug 17 15:32:00 2011	(r266)
+++ trunk/include/YODA/Axis1D.h	Wed Aug 17 15:48:17 2011	(r267)
@@ -9,7 +9,6 @@
 #include "YODA/AnalysisObject.h"
 #include "YODA/Exceptions.h"
 #include "YODA/Bin.h"
-#include "YODA/Utils/sortedvector.h"
 #include "YODA/Utils/MathUtils.h"
 #include <string>
 #include <cassert>
@@ -28,7 +27,7 @@
 
 
     typedef BIN1D Bin;
-    typedef typename Utils::sortedvector<BIN1D> Bins;
+    typedef typename std::vector<BIN1D> Bins;
 
 
     // /// @name Helper functions to make bin edge vectors (see @file MathUtils.h)
@@ -73,7 +72,7 @@
       assert(!bins.empty());
       Bins sbins;
       for (typename std::vector<BIN1D>::const_iterator b = bins.begin(); b != bins.end(); ++b) {
-        sbins.insert(*b);
+        sbins.push_back(*b);
       }
       _mkAxis(sbins);
     }
@@ -299,8 +298,9 @@
     void _mkAxis(const std::vector<double>& binedges) {
       const size_t nbins = binedges.size() - 1;
       for (size_t i = 0; i < nbins; ++i) {
-        _bins.insert( BIN1D(binedges.at(i), binedges.at(i+1)) );
+        _bins.push_back( BIN1D(binedges.at(i), binedges.at(i+1)) );
       }
+      std::sort(_bins.begin(), _bins.end());
 
       /// @todo Remove
       _cachedBinEdges = binedges;
@@ -311,6 +311,7 @@
 
     void _mkAxis(const Bins& bins) {
       _bins = bins;
+      std::sort(_bins.begin(), _bins.end());
 
       /// @todo Remove
       for (size_t i = 0; i < bins.size(); ++i) {

Modified: trunk/src/Profile1D.cc
==============================================================================
--- trunk/src/Profile1D.cc	Wed Aug 17 15:32:00 2011	(r266)
+++ trunk/src/Profile1D.cc	Wed Aug 17 15:48:17 2011	(r267)
@@ -74,7 +74,7 @@
   {
     Bins bins;
     for (Histo1D::Bins::const_iterator b = h.bins().begin(); b != h.bins().end(); ++b) {
-      bins.insert(ProfileBin1D(b->xMin(), b->xMax()));
+      bins.push_back(ProfileBin1D(b->xMin(), b->xMax()));
     }
     _axis = Profile1DAxis(bins);
 


More information about the yoda-svn mailing list