33 if ( is.read( (
char*)( &record.m_record.
marker ),
sizeof( uint32_t ) ).fail() )
40 if ( record.m_record.
marker != 0x1234aabb )
47 if ( is.read( (
char*)( &record.m_record.
length1 ),
sizeof( uint32_t ) ).fail() )
53 uint32_t length1_word = ( record.m_record.
length1 + 3 ) / 4;
54 char* appName =
new char[length1_word * 4 + 1];
55 if ( is.read( appName, length1_word * 4 ).fail() )
60 appName[length1_word * 4] =
'\0';
61 record.m_appName = appName;
64 if ( is.read( (
char*)( &record.m_record.
length2 ),
sizeof( uint32_t ) ).fail() )
70 uint32_t length2_word = ( record.m_record.
length2 + 3 ) / 4;
71 char* usrTag =
new char[length2_word * 4 + 1];
72 if ( is.read( usrTag, length2_word * 4 ).fail() )
77 usrTag[length2_word * 4] =
'\0';
78 record.m_usrTag = usrTag;
212 os.write( (
char*)( &record.m_record ),
sizeof( uint32_t ) * 2 );
213 uint32_t sizebyte = record.m_record.
length1;
214 uint32_t sizeword = ( sizebyte + 3 ) / 4;
215 os.write( record.m_appName.c_str(), sizeword * 4 );
216 os.write( (
char*)( &record.m_record.
length2 ),
sizeof( uint32_t ) );
217 sizebyte = record.m_record.
length2;
218 sizeword = ( sizebyte + 3 ) / 4;
219 os.write( record.m_usrTag.c_str(), sizeword * 4 );
222 std::cerr <<
"[RawFile] Error occurred while writing file" << std::endl;
302 m_record.marker = 0x1234dddd;
303 m_record.record_size = 10;
308 m_record.data_in_file = 0;
309 m_record.events_in_run = 0;
310 m_record.data_in_run = 0;
312 m_record.end_marker = 0x1234eeee;
316 os <<
"[RawFile] FileStartRecord:" << std::endl
317 << std::hex <<
"[RawFile] \tmarker : 0x" << m_record.marker << std::endl
318 <<
"[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
319 <<
"[RawFile] \tversion : 0x" << m_record.version << std::endl
320 <<
"[RawFile] \tfile_number : 0x" << m_record.file_number << std::endl
321 <<
"[RawFile] \tdate : 0x" << m_record.date << std::endl
322 <<
"[RawFile] \ttime : 0x" << m_record.time << std::endl
323 <<
"[RawFile] \tsizeLimit_dataBlocks : 0x" << m_record.sizeLimit_dataBlocks << std::endl
324 <<
"[RawFile] \tsizeLimit_MB : 0x" << m_record.sizeLimit_MB << std::dec
329 os <<
"[RawFile] FileNameStrings:" << std::endl
330 << std::hex <<
"[RawFile] \tmarker : 0x" << m_record.marker << std::endl
331 <<
"[RawFile] \tAppName length : 0x" << m_record.length1 << std::endl
332 <<
"[RawFile] \tAppName : " << m_appName << std::endl
333 <<
"[RawFile] \tUsrTag length : 0x" << m_record.length2 << std::endl
334 <<
"[RawFile] \tUsrTag : " << m_usrTag << std::dec << std::endl;
338 os <<
"[RawFile] RunParametersRecord:" << std::endl
339 << std::hex <<
"[RawFile] \tmarker : 0x" << m_record.marker << std::endl
340 <<
"[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
341 <<
"[RawFile] \trun_number : 0x" << m_record.run_number << std::endl
342 <<
"[RawFile] \tmax_events : 0x" << m_record.max_events << std::endl
343 <<
"[RawFile] \trec_enable : 0x" << m_record.rec_enable << std::endl
344 <<
"[RawFile] \ttrigger_type : 0x" << m_record.trigger_type << std::endl
345 <<
"[RawFile] \tdetector_mask : 0x" << m_record.detector_mask << std::endl
346 <<
"[RawFile] \tbeam_type : 0x" << m_record.beam_type << std::endl
347 <<
"[RawFile] \tbeam_energy : 0x" << m_record.beam_energy << std::dec
361 os <<
"[RawFile] FileEndRecord:" << std::endl
362 << std::hex <<
"[RawFile] \tmarker : 0x" << m_record.marker << std::endl
363 <<
"[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
364 <<
"[RawFile] \tdate : 0x" << m_record.date << std::endl
365 <<
"[RawFile] \ttime : 0x" << m_record.time << std::endl
366 <<
"[RawFile] \tevents_in_file : 0x" << m_record.events_in_file << std::endl
367 <<
"[RawFile] \tdata_in_file : 0x" << m_record.data_in_file << std::endl
368 <<
"[RawFile] \tevents_in_run : 0x" << m_record.events_in_run << std::endl
369 <<
"[RawFile] \tdata_in_run : 0x" << m_record.data_in_run << std::endl
370 <<
"[RawFile] \tstatus : 0x" << m_record.status << std::endl
371 <<
"[RawFile] \tend_marker : 0x" << m_record.end_marker << std::dec