15#include <boost/filesystem.hpp>
30namespace bf = boost::filesystem;
62 std::string filename = outputPath.filename().string();
63 bf::path dir = outputPath.parent_path();
64 std::string stem = outputPath.stem().string();
65 std::string extension = outputPath.extension().string();
68 if ( !bf::exists( dir ) ) {
69 std::stringstream stream;
70 stream <<
"Directory " << dir <<
" does not exist.";
79 }
catch (
const std::invalid_argument& ) {
80 std::string
msg =
"Filename " + filename +
" is not a number, which was needed.";
84 std::string iFile = std::to_string(
m_iFile );
85 unsigned int length = 0;
87 if ( stem.length() > iFile.length() ) { length = stem.length() - iFile.length(); }
89 std::stringstream
name;
90 if ( !dir.empty() )
name << dir <<
"/";
91 for (
unsigned int i = 0; i < length; ++i ) {
name <<
"0"; }
92 name << iFile << extension;
96 size_t pos = stem.rfind(
"_" );
100 std::string iFile = std::to_string(
m_iFile );
102 unsigned int length = 0;
105 std::stringstream
name;
106 name << dir <<
"/" << stem;
107 for (
unsigned int i = 0; i < length; ++i ) {
108 if ( i == 0 )
name <<
"_";
111 name << iFile << extension;
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
const std::string & name() const override
The identifying name of the algorithm object.
Define general base for Gaudi exception.
virtual const std::string & message() const
error message to be printed
void clearSelection()
Clear list of selected objects.
Gaudi::Property< std::string > m_outputName
virtual StatusCode writeObjects()
Select the different objects and write them to file.
bool isEventAccepted() const
Test whether this event should be output.
Extension of OutputStream to write run records after last event.
StatusCode execute() override
Working entry point.
Gaudi::Property< unsigned int > m_eventsPerFile
Gaudi::Property< unsigned int > m_nNumbersAdded
StatusCode writeObjects() override
OutputStream override: Select the different objects and write them to file.
Gaudi::Property< bool > m_numericFilename
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE