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   class Analysis;
00009 
00010 
00011   /**
00012    * BinnedHistogram contains a series of histograms of the same quantity
00013    * each in a different region of a second quantity.  For example, a
00014    * BinnedHistogram may contain histograms of the cross section differential
00015    * in PT in different eta regions.
00016    **/
00017   template<typename T> 
00018   class BinnedHistogram {
00019   public:
00020     
00021     /// Create a new empty BinnedHistogram
00022     BinnedHistogram() {
00023       return;
00024     }
00025  
00026     ///  Add a histogram in the region between @a binMin and @a binMax to this
00027     ///  set of BinnedHistograms.
00028     const BinnedHistogram<T>& addHistogram(const T& binMin,
00029                                            const T& binMax,
00030                                            AIDA::IHistogram1D* histo);
00031     
00032     /// Fill the histogram that lies in the same region as @a bin with the value
00033     /// @a val of weight @a weight.
00034     AIDA::IHistogram1D* fill(const T& bin,
00035                              const T& val,
00036                              double weight);
00037     
00038     /// Scale histograms taking into account its "external" binwidth, i.e. by
00039     /// scale/binWidth
00040     void scale(const T& scale, Analysis* ana);
00041     
00042     const vector<AIDA::IHistogram1D*>& getHistograms() const { return _histos; }
00043     vector<AIDA::IHistogram1D*>& getHistograms() { return _histos; }
00044  
00045 
00046   private:
00047  
00048     map<T, AIDA::IHistogram1D*> _histosByUpperBound;
00049     map<T, AIDA::IHistogram1D*> _histosByLowerBound;
00050     vector<AIDA::IHistogram1D*> _histos;
00051     map<AIDA::IHistogram1D*, T> _binWidths;
00052  
00053   };
00054 
00055 
00056 }
00057 
00058 #endif