6#define MAX_RAWFILE_SiZE 2000000000
9int raw_ofstream::_nHandler = 0;
11pthread_mutex_t raw_ofstream::_pthread_lock = PTHREAD_MUTEX_INITIALIZER;
18 if ( _instance == 0 ) {
33 if ( _nHandler > 0 && --_nHandler == 0 ) {
41raw_ofstream::raw_ofstream(
const std::string& fname)
49raw_ofstream::~raw_ofstream()
56 uint32_t fsize = tellp();
65 (*this) << m_dataSeparatorRecord;
66 std::ofstream::write(pbuf, size);
77 (*this) << m_fileEndRecord;
78 std::ofstream::close();
80 std::cout <<
"[RawFile] Finished writing file: " << real_fname() << std::endl;
84void raw_ofstream::init_fstream()
88 std::string fname = real_fname();
90 if ( access( fname.c_str(), F_OK ) == 0 ) {
91 std::cerr <<
"[RawFile] Attempt to create an exist file: " << fname << std::endl;
95 std::cout <<
"[RawFile] Creating a new file: " << real_fname() << std::endl;
96 open( fname.c_str(), std::ios::binary );
98 (*this) << m_fileStartRecord << m_fileNameStrings << m_runParametersRecord;
101std::string raw_ofstream::real_fname()
103 std::string fname = m_fname;
m_outputFile open("YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app)
void setDataBlockSize(uint32_t ds)
void setDataBlockNumber(uint32_t dn)
void setEventsInFile(uint32_t file_nevt)
int write_event(const char *pbuf, int size)
static raw_ofstream * instance(const std::string &fname)