30 : filename_m(filename)
39 std::ifstream histfile;
41 histfile.open(
filename_m.c_str(), std::ios::in);
50 std::istream_iterator<size_t> it(histfile);
51 while ( it != std::istream_iterator<size_t>() ) {
58 if (histfile.is_open()) {
71 "Lower index >= upper index: " + std::to_string(lidx) +
72 " >= " + std::to_string(uidx));
77 "Index >= number of bins: " + std::to_string(uidx) +
82 std::advance(beg, lidx);
85 std::advance(
end, uidx);
91 "No minimum between " + std::to_string(lower) +
92 " and " + std::to_string(upper) +
" found.");
95 return double(*result);
101 std::getline(ifs, header);
103 if (header.find(
"# Histogram bin counts") == std::string::npos) {
108 const std::regex
re(
"\\.*\\) (.*) mm (.*) mm (.*) (.*) mm");
110 std::regex_search(header, match,
re);
112 if ( match.size() != 5 ) {
114 "Error parsing header of file " +
filename_m);
117 rmin_m = getValue<double>(match[1].str());
118 double rmax = getValue<double>(match[2].str());
119 size_t nbins = getValue<size_t>(match[3].str());
120 binwidth_m = getValue<double>(match[4].str());
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
MMatrix< double > re(MMatrix< m_complex > mc)
std::string::iterator iterator
size_t minimum(double lower, double upper)
std::string filename_m
Histogram file.
ProbeHistReader(std::string filename)
void parseHeader(std::ifstream &ifs)