ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MdtCalib
MdtCalibUtils
src
RtData_t_r_reso.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MdtCalibUtils/RtData_t_r_reso.h
"
6
7
#include <stdio.h>
8
9
#include "
AthenaKernel/getMessageSvc.h
"
10
#include "GaudiKernel/MsgStream.h"
11
12
#define M_MAX_PARS 1000
13
14
namespace
MuonCalib
{
15
16
std::istream&
RtData_t_r_reso::read
(std::istream& is) {
17
std::string dummy;
18
19
double
t(0),
r
(0), reso(0);
20
21
// read region id and number of points in rt
22
is >> dummy >>
m_regionId
>>
m_npars
;
23
m_npars
= (
m_npars
>
M_MAX_PARS
) ?
M_MAX_PARS
:
m_npars
;
24
// reseve space in vectors
25
m_timeVec
.reserve(
m_npars
);
26
m_radiusVec
.reserve(
m_npars
);
27
m_resoVec
.reserve(
m_npars
);
28
29
// read data from file
30
for
(
int
i = 0; i < static_cast<int>(
m_npars
); ++i) {
31
// check if eof reached before last entry was read
32
if
(is.eof()) {
33
MsgStream log(
Athena::getMessageSvc
(),
"RtData_t_r_reso"
);
34
log << MSG::WARNING <<
"read() <unexpected eof> -> exit after "
<< i - 1 <<
" entries out of "
<<
m_npars
35
<<
" were read from file"
<<
endmsg
;
36
reset
();
37
return
is;
38
}
39
40
// read next entry
41
is >>
r
>> t >> reso;
42
m_timeVec
.push_back(t);
43
m_radiusVec
.push_back(
r
);
44
m_resoVec
.push_back(reso);
45
}
46
47
// reading success, data valid
48
m_isValid
=
true
;
49
50
return
is;
51
}
52
53
std::ostream&
RtData_t_r_reso::write
(std::ostream& os)
const
{
54
if
(
m_isValid
) {
55
os <<
" dummy "
<<
m_regionId
<<
" "
<<
m_npars
<< std::endl;
56
for
(
unsigned
int
i = 0; i <
m_npars
; ++i) {
57
os <<
" "
<<
m_radiusVec
[i] <<
" "
<<
m_timeVec
[i] <<
" "
<<
m_resoVec
[i] << std::endl;
58
}
59
}
else
{
60
MsgStream log(
Athena::getMessageSvc
(),
"RtData_t_r_reso"
);
61
log << MSG::WARNING <<
"write() <data not valid>"
<<
endmsg
;
62
}
63
64
return
os;
65
}
66
67
void
RtData_t_r_reso::write_forDB
(FILE* frtt, FILE* frtr, FILE* frts)
const
{
68
if
(
m_isValid
) {
69
fprintf(frtt,
"%u"
,
m_npars
);
70
fprintf(frtr,
"%u"
,
m_npars
);
71
fprintf(frts,
"%u"
,
m_npars
);
72
73
// loop over data and write to std::ostream
74
for
(
unsigned
int
i = 0; i <
m_npars
; ++i) {
75
fprintf(frtt,
",%f"
,
m_timeVec
[i]);
76
fprintf(frtr,
",%f"
,
m_radiusVec
[i]);
77
fprintf(frts,
",%f"
,
m_resoVec
[i]);
78
}
79
fprintf(frtt,
"\n"
);
80
fprintf(frtr,
"\n"
);
81
fprintf(frts,
"\n"
);
82
}
else
{
83
MsgStream log(
Athena::getMessageSvc
(),
"RtData_t_r_reso"
);
84
log << MSG::WARNING <<
"write_forDB() <data not valid>"
<<
endmsg
;
85
}
86
87
return
;
88
}
89
90
void
RtData_t_r_reso::reset
() {
91
m_isValid
=
false
;
92
m_timeVec
.clear();
93
m_radiusVec
.clear();
94
m_resoVec
.clear();
95
}
96
97
std::istream&
operator>>
(std::istream& is,
RtData_t_r_reso
& data) {
return
data.read(is); }
98
99
std::ostream&
operator<<
(std::ostream& os,
const
RtData_t_r_reso
& data) {
return
data.write(os); }
100
101
}
// namespace MuonCalib
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
M_MAX_PARS
#define M_MAX_PARS
Definition
RtData_t_r_reso.cxx:12
RtData_t_r_reso.h
MuonCalib::RtData_t_r_reso
Represents an Rt relation in the form of a set of (time,radius,resolution) points.
Definition
RtData_t_r_reso.h:16
MuonCalib::RtData_t_r_reso::m_regionId
int m_regionId
Definition
RtData_t_r_reso.h:52
MuonCalib::RtData_t_r_reso::reset
void reset()
Definition
RtData_t_r_reso.cxx:90
MuonCalib::RtData_t_r_reso::write
std::ostream & write(std::ostream &os) const
Definition
RtData_t_r_reso.cxx:53
MuonCalib::RtData_t_r_reso::write_forDB
void write_forDB(FILE *frtt, FILE *frtr, FILE *frts) const
Definition
RtData_t_r_reso.cxx:67
MuonCalib::RtData_t_r_reso::m_resoVec
DataVec m_resoVec
Definition
RtData_t_r_reso.h:56
MuonCalib::RtData_t_r_reso::m_isValid
bool m_isValid
Definition
RtData_t_r_reso.h:49
MuonCalib::RtData_t_r_reso::m_npars
unsigned int m_npars
Definition
RtData_t_r_reso.h:51
MuonCalib::RtData_t_r_reso::m_timeVec
DataVec m_timeVec
Definition
RtData_t_r_reso.h:54
MuonCalib::RtData_t_r_reso::m_radiusVec
DataVec m_radiusVec
Definition
RtData_t_r_reso.h:55
MuonCalib::RtData_t_r_reso::read
std::istream & read(std::istream &is)
Definition
RtData_t_r_reso.cxx:16
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
r
int r
Definition
globals.cxx:22
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition
CscCalcPed.cxx:21
MuonCalib::operator>>
std::istream & operator>>(std::istream &is, RtFullInfo &data)
Definition
RtFullInfo.cxx:11
MuonCalib::operator<<
std::ostream & operator<<(std::ostream &os, const RtFullInfo &data)
Definition
RtFullInfo.cxx:13
Generated on
for ATLAS Offline Software by
1.17.0