ATLAS Offline Software
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 
12 using namespace RPC_CondCabling;
13 
14 WiredOR::WiredOR(const parseParams& pars) : CablingObject{pars, "WOR"}, m_params{pars} {}
15 
16 WiredOR::~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 
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 
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 
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 
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; }
183 const WiredOR::RPClink& WiredOR::RPCread() const { return m_RPCread; }
RPC_CondCabling::WiredOR::add_odd_read_mul
void add_odd_read_mul(ReadoutCh &)
Definition: WiredOR.cxx:64
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
RPC_CondCabling::WiredOR::start
int start() const
Definition: WiredOR.cxx:179
max
#define max(a, b)
Definition: cfImp.cxx:41
RPC_CondCabling::WiredOR::m_even_read_mul
ReadoutCh m_even_read_mul
Definition: WiredOR.h:53
RPC_CondCabling::WiredOR::m_readoutCMAs
CMAlist m_readoutCMAs
Definition: WiredOR.h:57
RPC_CondCabling::WiredOR::connected_rpc
const RPCchamber * connected_rpc(int) const
Definition: WiredOR.cxx:48
RPC_CondCabling::WiredOR::defineParams::start
int start
strip type put in wired OR
Definition: WiredOR.h:37
Pivot
@ Pivot
Definition: CMAparameters.h:18
SectorLogicSetup.h
RPC_CondCabling::WiredOR::~WiredOR
virtual ~WiredOR()
skel.it
it
Definition: skel.GENtoEVGEN.py:423
RPC_CondCabling::WiredOR::check
bool check()
Definition: WiredOR.cxx:83
RPC_CondCabling::RPCchamber::add_wor
void add_wor(const WiredOR *)
Definition: RPCchamber.cxx:295
RPC_CondCabling::WiredOR::defineParams::stop
int stop
first RPC chamber to which wired strips belong
Definition: WiredOR.h:38
RPC_CondCabling::WiredOR::add_cma
void add_cma(const CMAparameters *)
Definition: WiredOR.cxx:58
detail
Definition: extract_histogram_tag.cxx:14
Phi
@ Phi
Definition: RPCdef.h:8
RPC_CondCabling::WiredOR::readoutCMAs
const CMAlist & readoutCMAs() const
Definition: WiredOR.cxx:184
RPC_CondCabling
Definition: CMAcablingdata.h:18
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
RPC_CondCabling::WiredOR::m_RPCread
RPClink m_RPCread
Definition: WiredOR.h:56
RPC_CondCabling::WiredOR::odd_read_mul
const ReadoutCh & odd_read_mul() const
Definition: WiredOR.cxx:182
RPC_CondCabling::WiredOR::ReadoutCh
std::vector< int > ReadoutCh
Definition: WiredOR.h:50
RPC_CondCabling::WiredOR::CMAlist
std::list< const CMAparameters * > CMAlist
Definition: WiredOR.h:51
CablingObject::station
int station() const
Definition: CablingObject.cxx:13
RPC_CondCabling::WiredOR::even_read_mul
const ReadoutCh & even_read_mul() const
Definition: WiredOR.cxx:181
RPC_CondCabling::WiredOR::Print
void Print(std::ostream &, bool) const
Definition: WiredOR.cxx:124
lumiFormat.i
int i
Definition: lumiFormat.py:92
ViewType
ViewType
Definition: RPCdef.h:8
RPC_CondCabling::WiredOR::side
ViewType side() const
Definition: WiredOR.cxx:178
RPC_CondCabling::WiredOR::give_max_eta_strips
int give_max_eta_strips() const
Definition: WiredOR.cxx:41
CablingObject::error_header
std::string error_header() const
Definition: CablingObject.cxx:22
BaseObject::name
std::string name() const
Definition: BaseObject.h:23
RPC_CondCabling::WiredOR::add_even_read_mul
void add_even_read_mul(ReadoutCh &)
Definition: WiredOR.cxx:60
RPC_CondCabling::WiredOR::RPCread
const RPClink & RPCread() const
Definition: WiredOR.cxx:183
RPC_CondCabling::WiredOR::m_odd_read_mul
ReadoutCh m_odd_read_mul
Definition: WiredOR.h:54
RPC_CondCabling::SectorLogicSetup
Definition: SectorLogicSetup.h:23
RPC_CondCabling::WiredOR::give_max_phi_strips
int give_max_phi_strips() const
Definition: WiredOR.cxx:34
RPC_CondCabling::WiredOR::connect
bool connect(SectorLogicSetup &)
Definition: WiredOR.cxx:18
CMAinput
CMAinput
Definition: CMAparameters.h:18
WiredOR.h
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
RPC_CondCabling::WiredOR::error
std::string error(const std::string &)
Definition: WiredOR.cxx:172
RPC_CondCabling::WiredOR::m_params
defineParams m_params
Definition: WiredOR.h:48
RPC_CondCabling::WiredOR::WiredOR
WiredOR(const parseParams &)
Definition: WiredOR.cxx:14
errorcheck.h
Helpers for checking error return status codes and reporting errors.
RPC_CondCabling::WiredOR::defineParams::side
ViewType side
Definition: WiredOR.h:36
CablingObject
Definition: CablingObject.h:10
RPC_CondCabling::RPCchamber
Definition: RPCchamber.h:23
CablingObject::number
int number() const
Definition: CablingObject.cxx:12
RPC_CondCabling::WiredOR::stop
int stop() const
Definition: WiredOR.cxx:180
RPC_CondCabling::WiredOR
Definition: WiredOR.h:26
CMAparameters
Definition: CMAparameters.h:21
RPC_CondCabling::WiredOR::setup
bool setup(SectorLogicSetup &)
Definition: WiredOR.cxx:68
setup
bool setup(asg::AnaToolHandle< Interface > &tool, const std::string &type)
mostly useful for athena, which will otherwise re-use the previous tool
Definition: fbtTestBasics.cxx:193
CablingObject::no_connection_error
std::string no_connection_error(const std::string &, int) const
Definition: CablingObject.cxx:30
RPC_CondCabling::WiredOR::RPCacquired
int RPCacquired() const
Definition: WiredOR.h:89
RPC_CondCabling::WiredOR::two_obj_error_message
std::string two_obj_error_message(const std::string &, WiredOR *)
Definition: WiredOR.cxx:164
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
RPC_CondCabling::WiredOR::RPClink
std::map< int, const RPCchamber *, std::less< int > > RPClink
Definition: WiredOR.h:28
Eta
@ Eta
Definition: RPCdef.h:8
RPC_CondCabling::WiredOR::parseParams
Definition: WiredOR.h:40