3 #include <boost/tokenizer.hpp>
7 #include <boost/version.hpp>
8 #if (__GNUC__ == 4 && __GNUC_MINOR__ == 4 && BOOST_VERSION == 105700)
9 #pragma GCC diagnostic ignored "-Wuninitialized"
10 #pragma message "ignoring bogus gcc warning in boost header lexical_cast.hpp"
11 #include <boost/lexical_cast.hpp>
12 #pragma GCC diagnostic warning "-Wuninitialized"
14 #include <boost/lexical_cast.hpp>
30 boost::char_separator<char> sep(
"-.");
31 boost::tokenizer<boost::char_separator<char> > tok(filename, sep);
34 vector<string> tokens;
43 segment = boost::lexical_cast<
int>((*(tokens.rbegin())));
45 catch (boost::bad_lexical_cast
const&)
47 cout <<
"Cannot extract segment number from filename "
49 cout <<
"Segment string after parsing: input string "
51 <<
" is not valid segment number" << endl;
52 cout <<
"filename " << filename <<
" not standard -runnumber-segment.ext"
54 cout <<
"using " << segment <<
" as segment number" << endl;
60 runnumber = boost::lexical_cast<
int>((*(tokens.rbegin())));
62 catch (boost::bad_lexical_cast
const&)
64 cout <<
"Cannot extract run number from filename "
66 cout <<
"Segment string after parsing: input string "
68 <<
" is not valid run number" << endl;
69 cout <<
"filename " << filename <<
" not standard -runnumber-segment.ext"
71 cout <<
"returning " << runnumber <<
" as run number" << endl;
73 return make_pair(runnumber, segment);