ATLAS Offline Software
Loading...
Searching...
No Matches
RPCdecoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <string>
8
10#include "GaudiKernel/MsgStream.h"
11
13
14const int RPCdecoder::s_value_boundaries[4][2] = {
15 {1, 2}, // Min-Max of strip_type value
16 {0, 63}, // Min-Max of logic_sector value
17 {1, 3}, // Min-Max of station value
18 {0, 1} // Min_max of rpc_layer value
19};
20const char RPCdecoder::s_value_descriptions[4][15] = {{"strip_type"}, {"logic_sector"}, {"lvl1_station"}, {"rpc_layer"}};
21
24
26 this->reset();
27 this->set_indexes(code);
28}
29
34
40
42 this->reset();
43 this->set_indexes(deco.code());
44}
45
47
49 this->reset();
50 this->set_indexes(deco.code());
51 return *this;
52}
53
56 this->reset_status();
57 this->reset_data();
58}
59
61 m_code = 0;
62 m_strip_type = -1;
63 m_logic_sector = -1;
64 m_lvl1_station = -1;
65 m_rpc_layer = -1;
66 m_rpc_z_index = -1;
67 m_strip_number = -1;
68}
69
71
73 MsgStream log(Athena::getMessageSvc(), "RPCdecoder");
74 log << MSG::INFO << "fault_decoding() - RPC decoder error: received " << s_value_descriptions[type] << " = " << value
75 << " (min = " << s_value_boundaries[type][0] << ", max = " << s_value_boundaries[type][1] << ")" << endmsg;
76
77 m_fail = true;
78}
79
80bool RPCdecoder::OK(int value, value_type type) const {
81 if (value >= s_value_boundaries[type][0] && value <= s_value_boundaries[type][1]) return true;
82 return false;
83}
84
105
106void RPCdecoder::set_indexes(unsigned int code) {
107 m_strip_number = code % 100;
108 m_rpc_z_index = (code / 100) % 100;
109 m_rpc_layer = (code / 10000) % 10;
110 m_lvl1_station = (code / 100000) % 10;
111 m_logic_sector = (code / 1000000) % 100;
112 m_strip_type = code / 100000000;
113
118
119 if (m_fail) {
120 this->reset_data();
121 return;
122 }
123
124 m_code = code;
125}
126
128
130 this->reset();
131 this->set_indexes(code);
132 return *this;
133}
134
140
142 this->reset();
143 int strip_type = side2type(side);
145 return *this;
146}
147
149
151 if (m_strip_type == -1) return NoView;
152 return (m_strip_type == 1) ? Phi : Eta;
153}
154
156 if (m_logic_sector == -1) return NoHalf;
157 return (m_logic_sector < 32) ? Negative : Positive;
158}
159
161 if (side == NoView) return -1;
162 return (side == Eta) ? 2 : 1;
163}
164
165void RPCdecoder::Print(std::ostream& stream, bool detail) const {
166 unsigned int div = 247;
167 std::string half = (half_barrel() == Negative) ? "Negative" : "Positive";
168
169 stream << "RPC strip hash code " << code() << ":" << std::endl;
170 if (detail) {
171 stream << " half barrel = " << half << std::endl;
172 stream << " type (1=Phi/2=Eta) = " << strip_type() << std::endl;
173 stream << " logic sector (0" << (char)div << "63) = " << logic_sector() << std::endl;
174 stream << " level-1 station (1" << (char)div << "n) = " << lvl1_station() << std::endl;
175 stream << " RPC layer (0/1) = " << rpc_layer() << std::endl;
176 stream << " RPC z index (0" << (char)div << "n) = " << rpc_z_index() << std::endl;
177 stream << " RPC strip number (0" << (char)div << "n) = " << strip_number() << std::endl;
178 stream << " strip cabling code = " << cabling_code() << std::endl;
179 }
180}
#define endmsg
ViewType
Definition RPCdef.h:8
@ NoView
Definition RPCdef.h:8
HalfType
Definition RPCdef.h:9
@ NoHalf
Definition RPCdef.h:9
@ Positive
Definition RPCdef.h:9
@ Negative
Definition RPCdef.h:9
int cabling_code(void) const
Definition RPCdecoder.h:71
unsigned int code(void) const
Definition RPCdecoder.h:64
void reset_status(void)
int m_rpc_z_index
Definition RPCdecoder.h:31
void fault_decoding(int, value_type)
int m_strip_type
Definition RPCdecoder.h:27
RPCdecoder & operator()(unsigned int)
int strip_type(void) const
Definition RPCdecoder.h:65
int m_rpc_layer
Definition RPCdecoder.h:30
static const int s_value_boundaries[4][2]
Definition RPCdecoder.h:14
void set_indexes(unsigned int)
int side2type(ViewType side) const
int rpc_layer(void) const
Definition RPCdecoder.h:68
static const char s_value_descriptions[4][15]
Definition RPCdecoder.h:20
int m_lvl1_station
Definition RPCdecoder.h:29
int strip_number(void) const
Definition RPCdecoder.h:70
int lvl1_station(void) const
Definition RPCdecoder.h:67
int m_logic_sector
Definition RPCdecoder.h:28
int logic_sector(void) const
Definition RPCdecoder.h:66
HalfType half_barrel(void) const
int m_strip_number
Definition RPCdecoder.h:32
void set_code(int, int, int, int, int, int)
void reset_data(void)
unsigned int m_code
Definition RPCdecoder.h:25
void Print(std::ostream &, bool) const
RPCdecoder & operator=(const RPCdecoder &deco)
void reset(void)
int rpc_z_index(void) const
Definition RPCdecoder.h:69
ViewType view(void) const
bool m_fail
Definition RPCdecoder.h:22
bool OK(int, value_type) const
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)