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