5 #include <boost/filesystem.hpp> 21 namespace bf = boost::filesystem;
39 if ( isEventAccepted() ) {
50 if ( m_events % m_eventsPerFile != 0 )
return;
54 bf::path dir = outputPath.parent_path();
55 string stem = outputPath.stem().string();
56 string extension = outputPath.extension().string();
59 if ( !bf::exists( dir ) ) {
61 stream <<
"Directory " << dir <<
" does not exist.";
66 if ( m_numericFilename ) {
67 if ( m_events == 0 ) {
71 string msg =
"Filename " +
filename +
" is not a number, which was needed.";
76 unsigned int length = 0;
81 if ( !dir.empty() )
name << dir <<
"/";
82 for (
unsigned int i = 0; i < length; ++i ) {
name <<
"0"; }
83 name << iFile << extension;
84 m_outputName =
name.str();
87 size_t pos = stem.
rfind(
"_" );
88 stem = stem.
substr( 0, pos );
93 unsigned int length = 0;
94 if ( m_nNumbersAdded > iFile.
length() ) { length = m_nNumbersAdded - iFile.
length(); }
97 name << dir <<
"/" << stem;
98 for (
unsigned int i = 0; i < length; ++i ) {
99 if ( i == 0 )
name <<
"_";
102 name << iFile << extension;
103 m_outputName =
name.str();
Define general base for Gaudi exception.
StatusCode writeObjects() override
OutputStream override: Select the different objects and write them to file.
virtual const std::string & message() const
error message to be printed
constexpr static const auto SUCCESS
#define DECLARE_COMPONENT(type)
virtual StatusCode writeObjects()
Select the different objects and write them to file.
StatusCode execute() override
Working entry point.
This class is used for returning status codes from appropriate routines.
constexpr static const auto FAILURE
Extension of OutputStream to write run records after last event.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.