32 #include <boost/cstdint.hpp> 50 Bin1D():breaks_(),begbreaks_(0),endbreaks_(0){}
53 std::vector<double> &
breaks 54 ):breaks_(), begbreaks_(0), endbreaks_(0)
62 ):breaks_(), begbreaks_(0), endbreaks_(0)
69 breaks_.assign( breaks.begin(), breaks.end() );
70 std::sort(breaks_.begin(),breaks_.end());
75 begbreaks_ = &breaks_[0];
76 endbreaks_ = begbreaks_ + breaks_.size();
80 breaks.assign(begbreaks_,endbreaks_);
89 return (dat > breaks_.front() && dat < breaks_.back());
94 double * it2 = std::lower_bound(begbreaks_,endbreaks_,dat);
95 size_t ub = std::distance(begbreaks_,it2);
101 std::vector<int32_t> & idx,
102 std::vector<double> & dist
105 double * it1 = std::lower_bound(begbreaks_,endbreaks_,dat1);
106 double * it2 = std::lower_bound(begbreaks_,endbreaks_,dat2);
108 size_t ub1 = std::distance(begbreaks_,it1);
109 size_t ub2 = std::distance(begbreaks_,it2);
110 int64_t n =
static_cast<int64_t
>(ub2-ub1)+1;
116 dist[0] = dat2 - dat1;
120 for(int64_t i = 0; it1 != (it2+1) ; i++, it1++){
121 idx[i] = ub1 + i - 1;
124 dist[i] = *(it1) - dat1;
128 dist[i] = *(it1) - *(it1-1);
132 dist[i] = dat2 - *(it1-1);
Bin1D(std::vector< double > &breaks)
void operator()(double dat1, double dat2, std::vector< int32_t > &idx, std::vector< double > &dist) const
std::size_t operator()(double dat) const
bool inRange(double dat) const
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...
void getBreaks(std::vector< double > &breaks) const
std::vector< double > breaks_
void setBreaks(const std::vector< double > &breaks)
EQUISPACEINTERPOL Interpolation on a equidistantly spaced grid.
const std::vector< double > & getBreaks() const