ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonConditions
MuonCondCabling
RPC_CondCabling
src
RPCchamberdata.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 "
RPC_CondCabling/RPCchamberdata.h
"
6
7
#include "
AthenaKernel/errorcheck.h
"
8
9
#include <iomanip>
10
11
using namespace
RPC_CondCabling
;
12
13
RPCchamberdata::RPCchamberdata
(
DBline
& data,
int
type
) :
BaseObject
(
Logic
,
"RPC Chamber Data"
) {
14
int
chams{0}, stripsInEtaCon{0}, stripsInPhiCon{0};
15
16
reset_data
();
17
18
m_fail
=
false
;
19
if
(!(data(
"station"
) >>
m_station
))
return
;
20
if
(!(data(
"made of"
) >> chams >>
"chamber. Strips in connectors:"
))
return
;
21
if
(!(data(
"eta"
) >> stripsInEtaCon))
return
;
22
if
(!(data(
"phi"
) >> stripsInPhiCon))
return
;
23
assert(stripsInEtaCon !=0);
24
(++data)(
"{"
);
25
do
{
26
RPCchamber::chamberParameters
params{};
27
params.sectorType =
type
;
28
params.station =
m_station
;
29
params.stripsInEtaCon = stripsInEtaCon;
30
params.stripsInPhiCon = stripsInPhiCon;
31
32
if
(
get_data
(data, params)) {
m_rpc
.emplace_back(params); }
33
++data;
34
}
while
(!data(
"}"
));
35
}
36
37
void
RPCchamberdata::reset_data
() {
m_fail
=
true
; }
38
39
bool
RPCchamberdata::confirm_connectors
(
ViewType
side,
RPCchamber::chamberParameters
& params) {
40
int
strips = (side ==
ViewType::Phi
) ? params.phiStrips : params.etaStrips;
41
42
if
(side ==
ViewType::Phi
){
43
if
(params.stripsInPhiCon == 0)
return
false
;
44
params.phiConnectors = strips / params.stripsInPhiCon;
45
}
else
{
46
if
(params.stripsInEtaCon == 0)
return
false
;
47
params.etaConnectors = strips / params.stripsInEtaCon;
48
}
49
50
int
connectors = (side ==
ViewType::Phi
) ? params.phiConnectors : params.etaConnectors;
51
int
strips_in_conn = (side ==
ViewType::Phi
) ? params.stripsInPhiCon : params.stripsInEtaCon;
52
float
str
= (float)strips / (
float
)connectors;
53
std::string view = (side ==
ViewType::Phi
) ?
"phi"
:
"eta"
;
54
55
std::ostringstream disp;
56
57
if
(
str
> strips_in_conn) {
58
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"RPCchamberdata"
)
59
<<
"RPCdata error in configuration for Sector Type "
<< params.sectorType <<
", station "
<< params.station <<
", RPC number "
60
<< params.number << std::endl
61
<<
" "
<< view <<
" strips into connectors must be less than "
<< strips_in_conn <<
" (instead are "
<< std::setprecision(2)
62
<<
str
<<
")"
;
63
return
false
;
64
}
65
if
(params.number == 0 && ((params.etaStrips % 2) || params.etaConnectors % 2)) {
66
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"RPCchamberdata"
)
67
<<
"RPCdata error in configuration for Sector Type "
<< params.sectorType <<
", station "
<< params.station <<
", RPC number "
68
<< params.number << std::endl
69
<<
" "
<< view <<
" strips and/or connectors must be "
70
<<
"multiple of 2 "
71
<<
" (eta_strips "
<< params.etaStrips <<
", eta_conn "
<< params.etaConnectors <<
")"
;
72
return
false
;
73
}
74
if
(strips_in_conn * connectors != strips) {
75
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"RPCchamberdata"
)
76
<<
"RPCdata error in configuration for Sector Type "
<< params.sectorType <<
", station "
<< params.station <<
", RPC number "
77
<< params.number << std::endl
78
<<
" strips into "
<< view <<
" connectors are "
<< std::setprecision(2) <<
str
<<
" instead of "
<< strips_in_conn;
79
return
false
;
80
}
81
return
true
;
82
}
83
84
bool
RPCchamberdata::confirm_ijk
(
ViewType
side,
RPCchamber::chamberParameters
& params) {
85
int
ijk = (side ==
ViewType::Phi
) ? params.ijk_PhiReadOut : params.ijk_EtaReadOut;
86
std::string view = (side ==
ViewType::Phi
) ?
"phi"
:
"eta"
;
87
88
std::ostringstream disp;
89
90
if
(ijk != 1 && ijk != 10) {
91
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"RPCchamberdata"
)
92
<<
"RPCdata error in configuration for Sector Type "
<< params.sectorType <<
", station "
<< params.station <<
", RPC number "
93
<< params.number << std::endl
94
<<
" "
<< view <<
" ijk readout must be 01 or 10; "
95
<<
" on the contrary it is "
<< std::setw(2) << std::setfill(
'0'
) << ijk << std::setfill(
' '
);
96
return
false
;
97
}
98
99
return
true
;
100
}
101
102
bool
RPCchamberdata::get_data
(
DBline
& data,
RPCchamber::chamberParameters
& params) {
103
reset_data
();
104
if
(data(
"cham"
) >> params.number >> params.chamberName >> params.stationEta >> params.doubletR >> params.doubletZ >>
105
params.phiReadOutPanels >>
"Eview"
>> params.etaStrips >> params.ijk_EtaReadOut >>
"Pview"
>> params.phiStrips >>
106
params.ijk_PhiReadOut) {
107
m_fail
=
false
;
108
if
(!
confirm_connectors
(
ViewType::Eta
, params) || !
confirm_connectors
(
ViewType::Phi
, params))
m_fail
=
true
;
109
if
(!
confirm_ijk
(
ViewType::Eta
, params) || !
confirm_ijk
(
ViewType::Phi
, params))
m_fail
=
true
;
110
}
111
112
return
!
m_fail
;
113
}
114
115
std::unique_ptr<RPCchamber>
RPCchamberdata::give_rpc
() {
116
if
(!
m_rpc
.empty()) {
117
std::unique_ptr<RPCchamber> cham = std::make_unique<RPCchamber>(
m_rpc
.front());
118
m_rpc
.pop_front();
119
return
cham;
120
}
121
return
nullptr
;
122
}
123
124
void
RPCchamberdata::Print
(std::ostream& stream,
bool
detail
)
const
{
125
// stream << "RPC data of station n. " << params.station;
126
// stream << " belonging to sector type " << params.sectorType << std::endl;
127
stream <<
"It contains "
<<
m_rpc
.size();
128
stream <<
" RPC chambers:"
<< std::endl;
129
std::list<RPCchamber>::const_iterator it;
130
for
(it =
m_rpc
.begin(); it !=
m_rpc
.end(); ++it) stream << ShowRequest<RPCchamber>(*it,
detail
);
131
}
Logic
@ Logic
Definition
BaseObject.h:11
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:345
RPCchamberdata.h
ViewType
ViewType
Definition
RPCdef.h:8
Phi
@ Phi
Definition
RPCdef.h:8
Eta
@ Eta
Definition
RPCdef.h:8
BaseObject::BaseObject
BaseObject(ObjectType, const std::string &)
Definition
BaseObject.cxx:7
DBline
Definition
dbline.h:255
RPC_CondCabling::RPCchamberdata::give_rpc
std::unique_ptr< RPCchamber > give_rpc()
Definition
RPCchamberdata.cxx:115
RPC_CondCabling::RPCchamberdata::confirm_connectors
bool confirm_connectors(ViewType, RPCchamber::chamberParameters ¶ms)
Definition
RPCchamberdata.cxx:39
RPC_CondCabling::RPCchamberdata::m_fail
bool m_fail
Definition
RPCchamberdata.h:22
RPC_CondCabling::RPCchamberdata::get_data
bool get_data(DBline &, RPCchamber::chamberParameters ¶ms)
Definition
RPCchamberdata.cxx:102
RPC_CondCabling::RPCchamberdata::confirm_ijk
bool confirm_ijk(ViewType, RPCchamber::chamberParameters ¶ms)
Definition
RPCchamberdata.cxx:84
RPC_CondCabling::RPCchamberdata::RPCchamberdata
RPCchamberdata(DBline &, int)
Definition
RPCchamberdata.cxx:13
RPC_CondCabling::RPCchamberdata::m_station
int m_station
Definition
RPCchamberdata.h:21
RPC_CondCabling::RPCchamberdata::Print
virtual void Print(std::ostream &, bool) const override
Definition
RPCchamberdata.cxx:124
RPC_CondCabling::RPCchamberdata::reset_data
void reset_data()
Definition
RPCchamberdata.cxx:37
RPC_CondCabling::RPCchamberdata::m_rpc
RPClist m_rpc
Definition
RPCchamberdata.h:24
RPC_CondCabling
Definition
CMAcablingdata.h:18
detail
Definition
extract_histogram_tag.cxx:14
str
Definition
BTagTrackIpAccessor.cxx:11
type
RPC_CondCabling::RPCchamber::chamberParameters
Definition
RPCchamber.h:59
Generated on
for ATLAS Offline Software by
1.17.0