BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
RunParametersRecord Class Reference

#include <RawFileUtil.h>

Public Member Functions

 RunParametersRecord ()
 
const run_parameters_recordgetRecord () const
 
void dump (std::ostream &os=std::cout) const
 
void setRunNumber (uint32_t runId)
 

Friends

raw_ifstreamoperator>> (raw_ifstream &is, RunParametersRecord &record)
 
raw_ofstreamoperator<< (raw_ofstream &os, RunParametersRecord &record)
 

Detailed Description

Definition at line 99 of file RawFileUtil.h.

Constructor & Destructor Documentation

◆ RunParametersRecord()

RunParametersRecord::RunParametersRecord ( )

Definition at line 254 of file RawFileUtil.cxx.

255{
256 m_record.marker = 0x1234bbbb;
257 m_record.record_size = 9;
258 // following members are not meaningful @ offline
259 m_record.run_number = 0;
260 m_record.max_events = 0;
261 m_record.rec_enable = 0;
262 m_record.trigger_type = 0;
263 m_record.detector_mask = 0;
264 m_record.beam_type = 0;
265 m_record.beam_energy = 0;
266}

Member Function Documentation

◆ dump()

void RunParametersRecord::dump ( std::ostream & os = std::cout) const

Definition at line 314 of file RawFileUtil.cxx.

314 {
315 os << "[RawFile] RunParametersRecord:" << std::endl << std::hex
316 << "[RawFile] \tmarker : 0x" << m_record.marker << std::endl
317 << "[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
318 << "[RawFile] \trun_number : 0x" << m_record.run_number << std::endl
319 << "[RawFile] \tmax_events : 0x" << m_record.max_events << std::endl
320 << "[RawFile] \trec_enable : 0x" << m_record.rec_enable << std::endl
321 << "[RawFile] \ttrigger_type : 0x" << m_record.trigger_type << std::endl
322 << "[RawFile] \tdetector_mask : 0x" << m_record.detector_mask << std::endl
323 << "[RawFile] \tbeam_type : 0x" << m_record.beam_type << std::endl
324 << "[RawFile] \tbeam_energy : 0x" << m_record.beam_energy
325 << std::dec << std::endl;
326}

◆ getRecord()

const run_parameters_record & RunParametersRecord::getRecord ( ) const
inline

Definition at line 106 of file RawFileUtil.h.

106{ return m_record; }

Referenced by raw_ifstream::runNo().

◆ setRunNumber()

void RunParametersRecord::setRunNumber ( uint32_t runId)
inline

Definition at line 109 of file RawFileUtil.h.

109{ m_record.run_number = runId; }

Friends And Related Symbol Documentation

◆ operator<<

raw_ofstream & operator<< ( raw_ofstream & os,
RunParametersRecord & record )
friend

Definition at line 202 of file RawFileUtil.cxx.

202 {
203 // write data block
204 if (os.write((char*)(&record.m_record), sizeof(run_parameters_record)).fail()) {
205 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
206 throw FailedToWrite("RunParametersRecord");
207 }
208
209 return os;
210}

◆ operator>>

raw_ifstream & operator>> ( raw_ifstream & is,
RunParametersRecord & record )
friend

Definition at line 75 of file RawFileUtil.cxx.

75 {
76 // read data block
77 if (is.read((char*)(&record.m_record), sizeof(run_parameters_record)).fail()) {
78 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
79 throw BadInputStream("RunParametersRecord");
80 }
81
82 // data validation checks
83 if (record.m_record.marker != 0x1234bbbb) {
84 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
85 throw WrongMarker(0x1234bbbb, record.m_record.marker);
86 }
87
88 if (record.m_record.record_size != 9) {
89 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
90 throw UnexpectedRecordSize("RunParametersRecord", 9, record.m_record.record_size);
91 }
92
93 return is;
94}

The documentation for this class was generated from the following files: