15 #include <boost/filesystem.hpp>
31 namespace bf = boost::filesystem;
49 if ( isEventAccepted() ) {
60 if ( m_events % m_eventsPerFile != 0 )
return;
62 bf::path outputPath( m_outputName.value() );
63 string filename = outputPath.filename().string();
64 bf::path dir = outputPath.parent_path();
65 string stem = outputPath.stem().string();
66 string extension = outputPath.extension().string();
69 if ( !bf::exists( dir ) ) {
71 stream <<
"Directory " << dir <<
" does not exist.";
76 if ( m_numericFilename ) {
77 if ( m_events == 0 ) {
81 string msg =
"Filename " +
filename +
" is not a number, which was needed.";
86 unsigned int length = 0;
91 if ( !dir.empty() )
name << dir <<
"/";
92 for (
unsigned int i = 0; i < length; ++i ) {
name <<
"0"; }
93 name << iFile << extension;
94 m_outputName =
name.str();
97 size_t pos = stem.
rfind(
"_" );
103 unsigned int length = 0;
104 if ( m_nNumbersAdded > iFile.
length() ) { length = m_nNumbersAdded - iFile.
length(); }
107 name << dir <<
"/" << stem;
108 for (
unsigned int i = 0; i < length; ++i ) {
109 if ( i == 0 )
name <<
"_";
112 name << iFile << extension;
113 m_outputName =
name.str();