35 #ifndef AIMS_HISTOGRAM_REGULARBINNEDHISTO_H 36 #define AIMS_HISTOGRAM_REGULARBINNEDHISTO_H 63 unsigned bins()
const {
return _bins; }
68 size_t abort_max = 0 )
const;
77 template<
typename T>
inline 79 :
Histogram<T>(), _bins( bins ), _minvalue( 0 ), _maxvalue( 0 )
84 template<
typename T>
inline 87 :
Histogram< T >( other ), _bins( other._bins ),
88 _minvalue( other._minvalue ), _maxvalue( other._maxvalue )
93 template<
typename T>
inline 101 template<
typename T >
inline 108 template<
typename T >
inline 123 double scl = (double) _bins / (
double) ( maxi - mini );
127 int iy, iz, it, nx = thing.
dimX(), ny = thing.
dimY(), nz = thing.
dimZ(),
129 for( it=0; it<
nt; ++it )
130 for( iz=0; iz<nz; ++iz )
131 for( iy=0; iy<ny; ++iy )
132 for( iv=&thing( 0, iy, iz, it ), fv=iv+nx; iv!=fv; ++iv )
135 x = (double) ( (
double) (*iv) - mini ) * scl;
139 else if( y >= (
int) _bins )
141 if( x == (
int) _bins )
142 ++this->
_data( _bins-1 );
150 template<
typename T >
inline 153 size_t abort_max )
const 155 std::map<T, unsigned> vals;
161 for( iv=thing.
begin(); iv!=fv; ++iv )
167 if( n % 1000 == 0 && vals.size() >= abort_max )
168 throw std::runtime_error(
"too many values" );
172 std::vector<T> *res =
new std::vector<T>( vals.size() );
173 typename std::map<T, unsigned>::iterator im, e = vals.end();
174 typename std::vector<T>::iterator i = res->begin();
175 for( im=vals.begin(); im!=e; ++im, ++i )
std::vector< T > * unique(const AimsData< T > &thing, size_t abort_max=0) const
virtual ~RegularBinnedHistogram()
Histogram container class, with a specified number of regular bins.
void setBins(unsigned bins)
RegularBinnedHistogram(unsigned bins=0)
void doit(const AimsData< T > &thing)
classical histogram computation function.
Base class of histogram container class.
AimsData< int32_t > _data
histogram datas