10 #ifdef SPLIT_WRITER_NDIGITS
11 #define NDIGITS SPLIT_WRITER_NDIGITS
16 #if defined(__CYGWIN__) || defined(__APPLE_CC__)
24 using namespace EVENT ;
33 setBaseFilename( filename ) ;
34 _wrt->open( getFilename() ) ;
38 throw Exception(
" LCSplitWriter doesn't support NEW and APPEND mode ! "
39 " Please remove your old file(s) and use the default mode." ) ;
45 if( fileSize() > _maxBytes ) {
48 _wrt->open( getFilename() ) ;
51 _wrt->writeRunHeader( hdr ) ;
58 if( fileSize() > _maxBytes ) {
64 _wrt->open( getFilename() ) ;
70 _wrt->writeEvent( evt ) ;
73 void LCSplitWriter::close() {
77 void LCSplitWriter::flush() {
86 if( _count != _lastCount )
87 _filename =
std::string( _baseFilename +
"." + getCountingString( _count ) + _extension ) ;
96 long64 LCSplitWriter::file_size(
const char *fname) {
100 int ret =
STAT64(fname, &sbuf);
105 return sbuf.st_size ;
119 return file_size( getFilename().c_str() ) ;
123 void LCSplitWriter::setBaseFilename(
const std::string& filename ) {
127 if( ( dotPos > 0 ) &&
128 ( dotPos == filename.
length() - 6 ) &&
129 ( filename.
rfind(
"lcio") == dotPos + 2 ) ) {
131 _baseFilename = filename.
substr( 0 , filename.
length() - 6 ) ;
136 throw Exception(
" LCSplitWriter only works with complete file names including extension, e.g. myfile.slcio" ) ;
151 return countStream.
str() ;
Base exception class for LCIO - all other exceptions extend this.
long long long64
64 bit signed integer,e.g.to be used for timestamps
The main event interface.