BinnedHistogram.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_BINNEDHISTOGRAM_HH
00003 #define RIVET_BINNEDHISTOGRAM_HH
00004 #include "Rivet/Rivet.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /**
00010    * BinnedHistogram contains a series of histograms of the same quantity
00011    * each in a different region of a second quantity.  For example, a
00012    * BinnedHistogram may contain histograms of the cross section differential
00013    * in PT in different eta regions.
00014    **/
00015   template<typename T> 
00016   class BinnedHistogram {
00017   public:
00018     
00019     /// Create a new empty BinnedHistogram
00020     BinnedHistogram() {
00021       return;
00022     }
00023  
00024     ///  Add a histogram in the region between @a binMin and @a binMax to this
00025     ///  set of BinnedHistograms.
00026     const BinnedHistogram<T>& addHistogram(const T& binMin,
00027                                            const T& binMax,
00028                                            AIDA::IHistogram1D* histo);
00029     
00030     /// Fill the histogram that lies in the same region as @a bin with the value
00031     /// @a val of weight @a weight.
00032     AIDA::IHistogram1D* fill(const T& bin,
00033                              const T& val,
00034                              double weight);
00035     
00036     const vector<AIDA::IHistogram1D*>& getHistograms() const { return _histos; }
00037     vector<AIDA::IHistogram1D*>& getHistograms() { return _histos; }
00038  
00039 
00040   private:
00041  
00042     map<T, AIDA::IHistogram1D*> _histosByUpperBound;
00043     map<T, AIDA::IHistogram1D*> _histosByLowerBound;
00044     vector<AIDA::IHistogram1D*> _histos;
00045  
00046   };
00047 
00048 
00049 }
00050 
00051 #endif