ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonConditions
MuonCondCabling
RPC_CondCabling
src
WiredOR.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
RPC_CondCabling/WiredOR.h
"
6
7
#include "
AthenaKernel/errorcheck.h
"
8
#include "
RPC_CondCabling/SectorLogicSetup.h
"
9
10
#include <iomanip>
11
12
using namespace
RPC_CondCabling
;
13
14
WiredOR::WiredOR
(
const
parseParams
& pars) :
CablingObject
{pars,
"WOR"
},
m_params
{pars} {}
15
16
WiredOR::~WiredOR
() =
default
;
17
18
bool
WiredOR::connect
(
SectorLogicSetup
&
setup
) {
19
// Check if RPC chambers exist
20
for
(
int
i =
m_params
.start; i <=
m_params
.stop; ++i) {
21
RPCchamber
* rpc =
setup
.find_chamber(
station
(), i);
22
23
if
(rpc) {
24
rpc->
add_wor
(
this
);
25
m_RPCread
.insert(RPClink::value_type(i, rpc));
26
}
else
{
27
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
) <<
no_connection_error
(
"RPC"
, i);
28
return
false
;
29
}
30
}
31
return
true
;
32
}
33
34
int
WiredOR::give_max_phi_strips
()
const
{
35
if
(
m_params
.side !=
ViewType::Phi
)
return
0;
36
int
max
{0};
37
for
(
const
auto
& it :
m_RPCread
) {
max
= std::max(it.second->phi_strips(),
max
); }
38
return
max
;
39
}
40
41
int
WiredOR::give_max_eta_strips
()
const
{
42
if
(
m_params
.side !=
ViewType::Eta
)
return
0;
43
int
max
{0};
44
for
(
const
auto
& it :
m_RPCread
) {
max
= std::max(
max
, it.second->eta_strips()); }
45
return
max
;
46
}
47
48
const
RPCchamber
*
WiredOR::connected_rpc
(
int
ord)
const
{
49
RPClink::const_iterator rpcs =
m_RPCread
.begin();
50
while
(rpcs !=
m_RPCread
.end()) {
51
if
(!ord)
return
(*rpcs).second;
52
--ord;
53
++rpcs;
54
}
55
return
nullptr
;
56
}
57
58
void
WiredOR::add_cma
(
const
CMAparameters
* cma) {
m_readoutCMAs
.push_back(cma); }
59
60
void
WiredOR::add_even_read_mul
(
ReadoutCh
& mul) {
61
for
(
int
i = 0; i <
give_max_phi_strips
(); ++i)
m_even_read_mul
[i] += mul[i];
62
}
63
64
void
WiredOR::add_odd_read_mul
(
ReadoutCh
& mul) {
65
for
(
int
i = 0; i <
give_max_phi_strips
(); ++i)
m_odd_read_mul
[i] += mul[i];
66
}
67
68
bool
WiredOR::setup
(
SectorLogicSetup
&
setup
) {
69
WiredOR
* prev =
setup
.previousWOR(*
this
);
70
if
(prev && !(
start
() == prev->
stop
() + 1)) {
71
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
) <<
two_obj_error_message
(
"boundary inconsistence"
, prev);
72
return
false
;
73
}
74
75
if
(!
connect
(
setup
))
return
false
;
76
77
int
ch = (
m_params
.side == Eta) ?
give_max_eta_strips
() :
give_max_phi_strips
();
78
m_even_read_mul
.assign(ch, 0);
79
m_odd_read_mul
.assign(ch, 0);
80
return
true
;
81
}
82
83
bool
WiredOR::check
() {
84
WiredOR::CMAlist::const_iterator cma =
m_readoutCMAs
.begin();
85
const
CMAinput
IO = (*cma)->whichCMAinput(
station
());
86
87
int
ch = (
m_params
.side ==
ViewType::Eta
) ?
give_max_eta_strips
() :
give_max_phi_strips
();
88
for
(
int
i = 0; i < ch; ++i) {
89
if
(!
m_even_read_mul
[i]) {
90
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
)
91
<<
error
(
"==> No readout coverage for the full set of even PHI strip!"
);
92
return
false
;
93
}
94
if
(!
m_odd_read_mul
[i]) {
95
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
)
96
<<
error
(
"==> No readout coverage for the full set of odd PHI strip!"
);
97
return
false
;
98
}
99
if
(
m_even_read_mul
[i] > 1 && IO ==
Pivot
) {
100
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
)
101
<<
error
(
"==> Pivot plane even PHI strips must be read only once!"
);
102
return
false
;
103
}
104
if
(
m_odd_read_mul
[i] > 1 && IO ==
Pivot
) {
105
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
)
106
<<
error
(
"==> Pivot plane odd PHI strips must be read only once!"
);
107
return
false
;
108
}
109
if
(
m_even_read_mul
[i] > 2) {
110
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
) <<
111
error
(
"==> Confirm plane even PHI strips can be read only 3 times!"
);
112
return
false
;
113
}
114
if
(
m_odd_read_mul
[i] > 1 && IO ==
Pivot
) {
115
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"WiredOR"
) <<
116
error
(
"==> Confirm plane odd PHI strips can be read only 3 times"
);
117
return
false
;
118
}
119
}
120
121
return
true
;
122
}
123
124
void
WiredOR::Print
(std::ostream& stream,
bool
detail
)
const
{
125
stream <<
" wired OR n. "
<< std::setw(2) <<
number
();
126
stream <<
" (stat "
<<
station
() <<
")"
;
127
stream <<
" connects RPC chamber n. "
<< std::setw(2) <<
start
();
128
stream <<
" to RPC chamber n. "
<< std::setw(2) <<
stop
() << std::endl;
129
130
if
(
detail
) {
131
stream <<
" It reads "
<<
RPCacquired
() <<
" RPC phi pannel:"
<< std::endl;
132
RPClink::const_iterator rpc =
m_RPCread
.begin();
133
while
(rpc !=
m_RPCread
.end()) {
134
stream << *(*rpc).second;
135
++rpc;
136
}
137
138
stream <<
" It gives input to "
<<
m_readoutCMAs
.size() <<
" Phi CMA:"
<< std::endl;
139
CMAlist::const_iterator cma =
m_readoutCMAs
.begin();
140
while
(cma !=
m_readoutCMAs
.end()) {
141
stream << *(*cma);
142
++cma;
143
}
144
int
ch =
give_max_phi_strips
();
145
stream <<
" Phi even sector readout multiplicity:"
<< std::endl;
146
stream <<
"1 5 10 15 20 25 30 35 40 "
147
<<
"45 50 55 60 65 70 75"
<< std::endl;
148
stream <<
"| | | | | | | | | "
149
<<
"| | | | | | |"
<< std::endl;
150
for
(
int
i = 0; i < ch; ++i) stream <<
m_even_read_mul
[i];
151
stream << std::endl;
152
stream <<
" Phi odd sector readout multiplicity:"
<< std::endl;
153
stream <<
"1 5 10 15 20 25 30 35 40 "
154
<<
"45 50 55 60 65 70 75"
<< std::endl;
155
stream <<
"| | | | | | | | | "
156
<<
"| | | | | | |"
<< std::endl;
157
for
(
int
i = 0; i < ch; ++i) stream <<
m_odd_read_mul
[i];
158
stream << std::endl;
159
stream <<
"========================================"
160
<<
"======================================="
<< std::endl;
161
}
162
}
163
164
std::string
WiredOR::two_obj_error_message
(
const
std::string&
msg
,
WiredOR
* wor) {
165
std::ostringstream disp;
166
disp <<
error_header
()
167
<<
" "
<<
msg
<<
" between "
<<
name
() <<
" n. "
<<
number
() <<
" and "
<< wor->
name
() <<
" n. "
<< wor->
number
() << std::endl
168
<< *
this
<< *wor;
169
return
disp.str();
170
}
171
172
std::string
WiredOR::error
(
const
std::string&
msg
) {
173
std::ostringstream disp;
174
disp <<
error_header
() <<
msg
<< std::endl << *
this
;
175
return
disp.str();
176
}
177
178
ViewType
WiredOR::side
()
const
{
return
m_params
.side; }
179
int
WiredOR::start
()
const
{
return
m_params
.start; }
180
int
WiredOR::stop
()
const
{
return
m_params
.stop; }
181
const
WiredOR::ReadoutCh
&
WiredOR::even_read_mul
()
const
{
return
m_even_read_mul
; }
182
const
WiredOR::ReadoutCh
&
WiredOR::odd_read_mul
()
const
{
return
m_odd_read_mul
; }
183
const
WiredOR::RPClink
&
WiredOR::RPCread
()
const
{
return
m_RPCread
; }
184
const
WiredOR::CMAlist
&
WiredOR::readoutCMAs
()
const
{
return
m_readoutCMAs
; }
CMAinput
CMAinput
Definition
CMAparameters.h:19
Pivot
@ Pivot
Definition
CMAparameters.h:19
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
ViewType
ViewType
Definition
RPCdef.h:8
Phi
@ Phi
Definition
RPCdef.h:8
Eta
@ Eta
Definition
RPCdef.h:8
SectorLogicSetup.h
WiredOR.h
max
#define max(a, b)
Definition
cfImp.cxx:41
BaseObject::name
const std::string & name() const
Definition
BaseObject.h:23
CMAparameters
Definition
CMAparameters.h:22
CablingObject::no_connection_error
std::string no_connection_error(const std::string &, int) const
Definition
CablingObject.cxx:30
CablingObject::number
int number() const
Definition
CablingObject.cxx:12
CablingObject::station
int station() const
Definition
CablingObject.cxx:13
CablingObject::error_header
std::string error_header() const
Definition
CablingObject.cxx:22
CablingObject::CablingObject
CablingObject(const cablingParameters &, const std::string &)
Definition
CablingObject.cxx:9
RPC_CondCabling::RPCchamber
Definition
RPCchamber.h:24
RPC_CondCabling::RPCchamber::add_wor
void add_wor(const WiredOR *)
Definition
RPCchamber.cxx:295
RPC_CondCabling::SectorLogicSetup
Definition
SectorLogicSetup.h:27
RPC_CondCabling::WiredOR::ReadoutCh
std::vector< int > ReadoutCh
Definition
WiredOR.h:50
RPC_CondCabling::WiredOR::add_even_read_mul
void add_even_read_mul(ReadoutCh &)
Definition
WiredOR.cxx:60
RPC_CondCabling::WiredOR::even_read_mul
const ReadoutCh & even_read_mul() const
Definition
WiredOR.cxx:181
RPC_CondCabling::WiredOR::error
std::string error(const std::string &)
Definition
WiredOR.cxx:172
RPC_CondCabling::WiredOR::odd_read_mul
const ReadoutCh & odd_read_mul() const
Definition
WiredOR.cxx:182
RPC_CondCabling::WiredOR::WiredOR
WiredOR(const parseParams &)
Definition
WiredOR.cxx:14
RPC_CondCabling::WiredOR::RPCread
const RPClink & RPCread() const
Definition
WiredOR.cxx:183
RPC_CondCabling::WiredOR::check
bool check()
Definition
WiredOR.cxx:83
RPC_CondCabling::WiredOR::m_even_read_mul
ReadoutCh m_even_read_mul
Definition
WiredOR.h:53
RPC_CondCabling::WiredOR::~WiredOR
virtual ~WiredOR()
RPC_CondCabling::WiredOR::two_obj_error_message
std::string two_obj_error_message(const std::string &, WiredOR *)
Definition
WiredOR.cxx:164
RPC_CondCabling::WiredOR::m_odd_read_mul
ReadoutCh m_odd_read_mul
Definition
WiredOR.h:54
RPC_CondCabling::WiredOR::RPClink
std::map< int, const RPCchamber *, std::less< int > > RPClink
Definition
WiredOR.h:28
RPC_CondCabling::WiredOR::RPCacquired
int RPCacquired() const
Definition
WiredOR.h:89
RPC_CondCabling::WiredOR::readoutCMAs
const CMAlist & readoutCMAs() const
Definition
WiredOR.cxx:184
RPC_CondCabling::WiredOR::connected_rpc
const RPCchamber * connected_rpc(int) const
Definition
WiredOR.cxx:48
RPC_CondCabling::WiredOR::setup
bool setup(SectorLogicSetup &)
Definition
WiredOR.cxx:68
RPC_CondCabling::WiredOR::CMAlist
std::list< const CMAparameters * > CMAlist
Definition
WiredOR.h:51
RPC_CondCabling::WiredOR::give_max_eta_strips
int give_max_eta_strips() const
Definition
WiredOR.cxx:41
RPC_CondCabling::WiredOR::connect
bool connect(SectorLogicSetup &)
Definition
WiredOR.cxx:18
RPC_CondCabling::WiredOR::start
int start() const
Definition
WiredOR.cxx:179
RPC_CondCabling::WiredOR::m_params
defineParams m_params
Definition
WiredOR.h:48
RPC_CondCabling::WiredOR::m_RPCread
RPClink m_RPCread
Definition
WiredOR.h:56
RPC_CondCabling::WiredOR::Print
void Print(std::ostream &, bool) const
Definition
WiredOR.cxx:124
RPC_CondCabling::WiredOR::stop
int stop() const
Definition
WiredOR.cxx:180
RPC_CondCabling::WiredOR::add_cma
void add_cma(const CMAparameters *)
Definition
WiredOR.cxx:58
RPC_CondCabling::WiredOR::give_max_phi_strips
int give_max_phi_strips() const
Definition
WiredOR.cxx:34
RPC_CondCabling::WiredOR::m_readoutCMAs
CMAlist m_readoutCMAs
Definition
WiredOR.h:57
RPC_CondCabling::WiredOR::side
ViewType side() const
Definition
WiredOR.cxx:178
RPC_CondCabling::WiredOR::add_odd_read_mul
void add_odd_read_mul(ReadoutCh &)
Definition
WiredOR.cxx:64
RPC_CondCabling
Definition
CMAcablingdata.h:18
detail
Definition
extract_histogram_tag.cxx:14
error
Definition
IImpactPoint3dEstimator.h:72
RPC_CondCabling::WiredOR::parseParams
Definition
WiredOR.h:40
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0