15#include <boost/filesystem.hpp>
31namespace bf = boost::filesystem;
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.";
80 }
catch (
const std::invalid_argument& ) {
81 string msg =
"Filename " + filename +
" is not a number, which was needed.";
85 string iFile = std::to_string(
m_iFile );
86 unsigned int length = 0;
88 if ( stem.length() > iFile.length() ) { length = stem.length() - iFile.length(); }
91 if ( !dir.empty() )
name << dir <<
"/";
92 for (
unsigned int i = 0; i < length; ++i ) {
name <<
"0"; }
93 name << iFile << extension;
97 size_t pos = stem.rfind(
"_" );
101 string iFile = std::to_string(
m_iFile );
103 unsigned int length = 0;
107 name << dir <<
"/" << stem;
108 for (
unsigned int i = 0; i < length; ++i ) {
109 if ( i == 0 )
name <<
"_";
112 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