Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

RebinHist.cxx

Go to the documentation of this file.
00001 // RebinHist.cxx
00002 
00003 #include "analysis/RebinHist.h"
00004 
00005 #include <algorithm>
00006 
00007 using namespace std;
00008 
00009 RebinHist::RebinHist(const char * title, double from, double to, double step)
00010 :Histogram(title, from, to, step)
00011 {
00012     m_data.reserve(500);
00013 }
00014 
00015 void RebinHist::fill(double x)
00016 {
00017     Histogram::fill(x,1.0);
00018     m_data.push_back(x);
00019 }
00020 
00021 void RebinHist::rebin(double from, double to, double step )
00022 {
00023     setRange(from, to ,step);
00024     FloatList::iterator dat = m_data.begin();
00025     for(; dat !=m_data.end(); Histogram::fill(*dat++) );
00026 }
00027 
00028 double RebinHist::percentile(double level)
00029 {
00030     sort(m_data.begin(), m_data.end());
00031     int n = m_data.size();
00032     int m =  static_cast<int>(n * level/100.);
00033     if( m > n-1) m = n-1;
00034     return m_data[m];
00035 }

Generated at Wed Nov 21 12:20:52 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000