ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
9
10#include <iomanip>
11
12using namespace RPC_CondCabling;
13
14WiredOR::WiredOR(const parseParams& pars) : CablingObject{pars, "WOR"}, m_params{pars} {}
15
16WiredOR::~WiredOR() = default;
17
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
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
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
48const 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
58void WiredOR::add_cma(const CMAparameters* cma) { m_readoutCMAs.push_back(cma); }
59
61 for (int i = 0; i < give_max_phi_strips(); ++i) m_even_read_mul[i] += mul[i];
62}
63
65 for (int i = 0; i < give_max_phi_strips(); ++i) m_odd_read_mul[i] += mul[i];
66}
67
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
84 WiredOR::CMAlist::const_iterator cma = m_readoutCMAs.begin();
85 const CMAinput IO = (*cma)->whichCMAinput(station());
86
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
124void 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
164std::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
172std::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
178ViewType WiredOR::side() const { return m_params.side; }
179int WiredOR::start() const { return m_params.start; }
180int WiredOR::stop() const { return m_params.stop; }
CMAinput
@ Pivot
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
ViewType
Definition RPCdef.h:8
@ Phi
Definition RPCdef.h:8
@ Eta
Definition RPCdef.h:8
#define max(a, b)
Definition cfImp.cxx:41
const std::string & name() const
Definition BaseObject.h:23
std::string no_connection_error(const std::string &, int) const
int number() const
int station() const
std::string error_header() const
CablingObject(const cablingParameters &, const std::string &)
void add_wor(const WiredOR *)
std::vector< int > ReadoutCh
Definition WiredOR.h:50
void add_even_read_mul(ReadoutCh &)
Definition WiredOR.cxx:60
const ReadoutCh & even_read_mul() const
Definition WiredOR.cxx:181
std::string error(const std::string &)
Definition WiredOR.cxx:172
const ReadoutCh & odd_read_mul() const
Definition WiredOR.cxx:182
WiredOR(const parseParams &)
Definition WiredOR.cxx:14
const RPClink & RPCread() const
Definition WiredOR.cxx:183
ReadoutCh m_even_read_mul
Definition WiredOR.h:53
std::string two_obj_error_message(const std::string &, WiredOR *)
Definition WiredOR.cxx:164
ReadoutCh m_odd_read_mul
Definition WiredOR.h:54
std::map< int, const RPCchamber *, std::less< int > > RPClink
Definition WiredOR.h:28
int RPCacquired() const
Definition WiredOR.h:89
const CMAlist & readoutCMAs() const
Definition WiredOR.cxx:184
const RPCchamber * connected_rpc(int) const
Definition WiredOR.cxx:48
bool setup(SectorLogicSetup &)
Definition WiredOR.cxx:68
std::list< const CMAparameters * > CMAlist
Definition WiredOR.h:51
int give_max_eta_strips() const
Definition WiredOR.cxx:41
bool connect(SectorLogicSetup &)
Definition WiredOR.cxx:18
defineParams m_params
Definition WiredOR.h:48
void Print(std::ostream &, bool) const
Definition WiredOR.cxx:124
void add_cma(const CMAparameters *)
Definition WiredOR.cxx:58
int give_max_phi_strips() const
Definition WiredOR.cxx:34
ViewType side() const
Definition WiredOR.cxx:178
void add_odd_read_mul(ReadoutCh &)
Definition WiredOR.cxx:64
MsgStream & msg
Definition testRead.cxx:32