1 #ifndef Protium_Histogram_h_
2 #define Protium_Histogram_h_
11 template<
class BinType=
double>
36 Histogram(
const BinType& lowerEdge,
const BinType& upperEdge,
const unsigned& nBins){
37 for(
unsigned i=0; i<nBins; i++){
39 tempBin.
width=(upperEdge-lowerEdge)/( (
double)nBins );
40 tempBin.
loweredge = double(i)* (upperEdge-lowerEdge)/( (
double)nBins );
41 fContents.insert(std::make_pair<Bin, unsigned>(tempBin,0) );
55 void SetNewBin(
const BinType& lowerEdge,
const BinType& delta ){
59 unsigned newContent =0;
60 typename std::map<Bin,unsigned>::iterator hIt =
fContents.begin();
62 while( hIt->first < newBin ){hIt++;}
70 for(
typename std::map<Bin, unsigned>::const_iterator it =
fContents.begin(); it!=
fContents.end(); ++it){
72 return (*it).first.loweredge;
79 for(
typename std::map<Bin, unsigned>::const_iterator it =
fContents.begin(); it!=
fContents.end(); ++it){
81 return (*it).first.width;
88 for(
typename std::map<Bin, unsigned>::const_iterator it =
fContents.begin(); it!=
fContents.end(); ++it){
127 #endif //Protium_Histogram_h_
void SetNewBin(const BinType &lowerEdge, const BinType &delta)
unsigned GetNBins() const
bool operator>(const Bin &rhs) const
bool operator==(const Bin &rhs) const
BinType GetBinWidthByI(const int &i) const
Histogram< double > Histo1D
unsigned GetBinContentByI(const int &i) const
bool operator<(const Bin &rhs) const
std::map< Bin, unsigned > fContents
Histogram(const BinType &lowerEdge, const BinType &upperEdge, const unsigned &nBins)
Most Basic Histogram instantiation. Creates uniform size bins.
BinType GetLowerEdgeByI(const int &i) const