rivet is hosted by Hepforge, IPPP Durham
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 \f$ p_T \f$ in different \f$ \eta \f$  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                                            Histo1DPtr 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     Histo1DPtr 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<Histo1DPtr>& getHistograms() const { return _histos; }
00043     vector<Histo1DPtr>& getHistograms() { return _histos; }
00044 
00045 
00046   private:
00047 
00048     map<T, Histo1DPtr> _histosByUpperBound;
00049     map<T, Histo1DPtr> _histosByLowerBound;
00050     vector<Histo1DPtr> _histos;
00051     map<Histo1DPtr, T> _binWidths;
00052 
00053   };
00054 
00055 
00056 }
00057 
00058 #endif