Manages the I/O of the Rt realtions from/to file.
More...
#include <RtDataFromFile.h>
|
| | RtDataFromFile () |
| | ~RtDataFromFile ()=default |
| unsigned int | nRts () const |
| | return number of rt relations
|
| RtRelation * | getRt (unsigned int regionId) const |
| | retrieve rt-relation for a give regionId
|
| void | setNRts (unsigned int nrts) |
| | set total number of regions
|
| bool | addRt (int regionId, RtRelation *rt) |
| | RtDataFromFile takes ownership of rt.
|
| bool | addRt (int regionId, RtRelation *rt, const RtFullInfo *info) |
| std::istream & | read (std::istream &is) |
| std::ostream & | write (std::ostream &os, int region) const |
| std::ostream & | write (std::ostream &os) const |
| void | write_forDB (FILE *frt, FILE *frtt, FILE *frtr, FILE *frts, int region) const |
| void | write_forDB (FILE *frt, FILE *frtt, FILE *frtr, FILE *frts) const |
| void | setVersion (int major, int minor) |
Manages the I/O of the Rt realtions from/to file.
Definition at line 21 of file RtDataFromFile.h.
◆ RtRelation
◆ RtRelations
◆ RtDataFromFile()
| MuonCalib::RtDataFromFile::RtDataFromFile |
( |
| ) |
|
|
inline |
Definition at line 27 of file RtDataFromFile.h.
int m_major_version
format version
unsigned int m_rts
total number of regions
◆ ~RtDataFromFile()
| MuonCalib::RtDataFromFile::~RtDataFromFile |
( |
| ) |
|
|
default |
◆ addRt() [1/2]
| bool MuonCalib::RtDataFromFile::addRt |
( |
int | regionId, |
|
|
RtRelation * | rt ) |
|
inline |
RtDataFromFile takes ownership of rt.
Definition at line 51 of file RtDataFromFile.h.
51 {
52 if (regionId < 0 || regionId >= (
int)
m_rts) {
54 log << MSG::WARNING <<
"addRt() <regionId out of range> " << regionId <<
" size " <<
m_rts <<
endmsg;
55 return false;
56 }
59 log << MSG::WARNING <<
"addRt() <rt already set>" <<
endmsg;
60 return false;
61 }
62
64
65 return true;
66 }
RtRelations m_rtRelations
rt relations
IMessageSvc * getMessageSvc(bool quiet=false)
◆ addRt() [2/2]
Definition at line 67 of file RtDataFromFile.h.
67 {
71 }
bool addRt(int regionId, RtRelation *rt)
RtDataFromFile takes ownership of rt.
std::vector< const RtFullInfo * > m_fullInfo
◆ getRt()
| RtRelation * MuonCalib::RtDataFromFile::getRt |
( |
unsigned int | regionId | ) |
const |
|
inline |
retrieve rt-relation for a give regionId
Definition at line 34 of file RtDataFromFile.h.
34 {
35 if (regionId >= (
unsigned int)
m_rts) {
37 log << MSG::WARNING <<
"getRt() <regionId out of range> " << regionId <<
" size " <<
m_rts <<
endmsg;
38 return 0;
39 }
41 }
◆ nRts()
| unsigned int MuonCalib::RtDataFromFile::nRts |
( |
| ) |
const |
|
inline |
◆ read()
| std::istream & MuonCalib::RtDataFromFile::read |
( |
std::istream & | is | ) |
|
Definition at line 18 of file RtDataFromFile.cxx.
18 {
20 std::string rts_str;
21
22
24
25 unsigned long int pos = 0;
26 std::string::size_type
start = rts_str.find_first_not_of(
' ', pos);
27 if (start == std::string::npos)
28 throw std::runtime_error(
29 Form("File: %s, Line: %d\nRtDataFromFile::read() - problems extracting m_rts, exiting", __FILE__, __LINE__));
30
31 std::string::size_type
stop = rts_str.find_first_of(
' ', start + 1);
32 if (stop == std::string::npos)
stop = rts_str.size();
33 m_rts = std::stoi(rts_str.substr(start, stop - start),
nullptr);
34
36 for (
unsigned int i = 0;
i <
m_rts; ++
i) {
37 if (version != "v0.0") {
38
39 RtFullInfo fi;
40 is >> fi;
41 }
42
44
45
46 is >> *rt;
47
48
50 }
51
52 return is;
53 }
RtData_t_r_reso RtRelation
◆ setNRts()
| void MuonCalib::RtDataFromFile::setNRts |
( |
unsigned int | nrts | ) |
|
|
inline |
◆ setVersion()
| void MuonCalib::RtDataFromFile::setVersion |
( |
int | major, |
|
|
int | minor ) |
|
inline |
◆ write() [1/2]
| std::ostream & MuonCalib::RtDataFromFile::write |
( |
std::ostream & | os | ) |
const |
Definition at line 71 of file RtDataFromFile.cxx.
71 {
74 log << MSG::WARNING <<
"write() <inconsistent rt count>" <<
endmsg;
75 }
76
78
82 }
84 }
◆ write() [2/2]
| std::ostream & MuonCalib::RtDataFromFile::write |
( |
std::ostream & | os, |
|
|
int | region ) const |
Definition at line 55 of file RtDataFromFile.cxx.
55 {
58 log << MSG::WARNING <<
"write() <inconsistent rt count>" <<
endmsg;
59 }
60 if (region >=
static_cast<int>(
m_rts)) {
62 log << MSG::WARNING <<
"write() <requested not existent region>" <<
endmsg;
63 }
65
69 }
◆ write_forDB() [1/2]
| void MuonCalib::RtDataFromFile::write_forDB |
( |
FILE * | frt, |
|
|
FILE * | frtt, |
|
|
FILE * | frtr, |
|
|
FILE * | frts ) const |
Definition at line 100 of file RtDataFromFile.cxx.
100 {
103 log << MSG::WARNING <<
"write_forDB() <inconsistent rt count>" <<
endmsg;
104 }
105
109 }
110 return;
111 }
void write_forDB(FILE *frt, FILE *frtt, FILE *frtr, FILE *frts, int region) const
◆ write_forDB() [2/2]
| void MuonCalib::RtDataFromFile::write_forDB |
( |
FILE * | frt, |
|
|
FILE * | frtt, |
|
|
FILE * | frtr, |
|
|
FILE * | frts, |
|
|
int | region ) const |
Definition at line 86 of file RtDataFromFile.cxx.
86 {
89 log << MSG::WARNING <<
"write_forDB() <inconsistent rt count>" <<
endmsg;
90 }
91 if (region >=
static_cast<int>(
m_rts)) {
93 log << MSG::WARNING <<
"write_forDB() <requested not existent region>" <<
endmsg;
94 }
97 return;
98 }
◆ m_fullInfo
| std::vector<const RtFullInfo*> MuonCalib::RtDataFromFile::m_fullInfo |
|
private |
◆ m_major_version
| int MuonCalib::RtDataFromFile::m_major_version |
|
private |
◆ m_minor_version
| int MuonCalib::RtDataFromFile::m_minor_version |
|
private |
◆ m_rtRelations
◆ m_rts
| unsigned int MuonCalib::RtDataFromFile::m_rts |
|
private |
The documentation for this class was generated from the following files: