28 #include <boost/cstdint.hpp> 51 std::vector<double> &
breaks,
52 std::vector<uint32_t> & indic
53 ):breaks_(), indicator_(), begbreaks_(0), endbreaks_(0), indicatorptr_(0)
61 ):breaks_(), indicator_(), begbreaks_(0), endbreaks_(0), indicatorptr_(0)
68 void set(
const std::vector<double> &
breaks,
69 const std::vector<uint32_t> & indic )
71 if(( breaks.size() - 1 ) != indic.size()){
72 throw std::out_of_range(
"breaks.size == inic + 1 , failed!" );
75 begbreaks_ = &breaks_[0];
76 endbreaks_ = begbreaks_ + breaks_.size();
78 indicatorptr_ = &indicator_[0];
95 template<
typename InputIterator>
99 std::vector<std::pair<std::size_t, std::size_t> > & bucketPairs
102 std::size_t index(0);
103 std::pair<std::size_t, bool> res;
104 for(;beg !=end; ++beg, ++index)
109 bucketPairs.push_back(std::make_pair(res.first , index ));
121 double * it2 = std::lower_bound(begbreaks_,endbreaks_,dat);
122 std::size_t ub = std::distance(begbreaks_,it2);
124 if(ub > 0 && ub <= indicator_.size())
127 if(*(indicatorptr_ + ub) > 0)
128 return std::make_pair(ub,
true);
130 return std::make_pair(ub,
false);
133 return std::make_pair(0,
false);
Bucket1D(std::vector< double > &breaks, std::vector< uint32_t > &indic)
CTor.
Bucket1D(const Bucket1D &rhs)
CCTor.
std::vector< uint32_t > indicator_
std::vector< double > breaks_
void breaks(double minMass, double maxMass, TMassComparator tmassComp, std::vector< double > &breaks, bool exact=false)
Segment mass range according to Mass Compare functor could be used to histogram a dataset or to compu...
Bucket1D & operator=(const Bucket1D &rhs)
std::pair< std::size_t, bool > operator()(double dat)
the std::size_t indicates to which bucket dat belongs too. The bool indicates if a new bucket is of i...
EQUISPACEINTERPOL Interpolation on a equidistantly spaced grid.
void operator()(InputIterator beg, InputIterator end, std::vector< std::pair< std::size_t, std::size_t > > &bucketPairs)
The result tells you in which bucket which input should end up.