ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
RPCdecoder Class Reference

#include <RPCdecoder.h>

Collaboration diagram for RPCdecoder:

Public Types

enum  value_type { Strip_Type, Logic_Sector, LVL1_Station, RPC_Layer }
 

Public Member Functions

 RPCdecoder ()
 
 RPCdecoder (unsigned int)
 
 RPCdecoder (int, int, int, int, int, int)
 
 RPCdecoder (ViewType, int, int, int, int, int)
 
 RPCdecoder (const RPCdecoder &deco)
 
RPCdecoderoperator= (const RPCdecoder &deco)
 
 ~RPCdecoder ()=default
 
RPCdecoderoperator() (unsigned int)
 
RPCdecoderoperator() (ViewType, int, int, int, int, int)
 
RPCdecoderoperator() (int, int, int, int, int, int)
 
 operator bool ()
 
bool OK (int, value_type) const
 
unsigned int code (void) const
 
int strip_type (void) const
 
int logic_sector (void) const
 
int lvl1_station (void) const
 
int rpc_layer (void) const
 
int rpc_z_index (void) const
 
int strip_number (void) const
 
int cabling_code (void) const
 
ViewType view (void) const
 
HalfType half_barrel (void) const
 
int side2type (ViewType side) const
 
void Print (std::ostream &, bool) const
 

Private Member Functions

void reset (void)
 
void reset_status (void)
 
void reset_data (void)
 
void set_indexes (unsigned int)
 
void set_code (int, int, int, int, int, int)
 
void fault_decoding (int, value_type)
 

Private Attributes

bool m_fail = false
 
unsigned int m_code = 0U
 
int m_strip_type = 0
 
int m_logic_sector = 0
 
int m_lvl1_station = 0
 
int m_rpc_layer = 0
 
int m_rpc_z_index = 0
 
int m_strip_number = 0
 

Static Private Attributes

static const int s_value_boundaries [4][2]
 
static const char s_value_descriptions [4][15] = {{"strip_type"}, {"logic_sector"}, {"lvl1_station"}, {"rpc_layer"}}
 

Detailed Description

Definition at line 13 of file RPCdecoder.h.

Member Enumeration Documentation

◆ value_type

Enumerator
Strip_Type 
Logic_Sector 
LVL1_Station 
RPC_Layer 

Definition at line 15 of file RPCdecoder.h.

Constructor & Destructor Documentation

◆ RPCdecoder() [1/5]

RPCdecoder::RPCdecoder ( )

Definition at line 23 of file RPCdecoder.cxx.

23 { this->reset(); }

◆ RPCdecoder() [2/5]

RPCdecoder::RPCdecoder ( unsigned int  code)

Definition at line 25 of file RPCdecoder.cxx.

25  {
26  this->reset();
27  this->set_indexes(code);
28 }

◆ RPCdecoder() [3/5]

RPCdecoder::RPCdecoder ( int  strip_type,
int  logic_sector,
int  lvl1_station,
int  rpc_layer,
int  rpc_z_index,
int  strip_number 
)

Definition at line 30 of file RPCdecoder.cxx.

30  {
31  this->reset();
33 }

◆ RPCdecoder() [4/5]

RPCdecoder::RPCdecoder ( ViewType  side,
int  logic_sector,
int  lvl1_station,
int  rpc_layer,
int  rpc_z_index,
int  strip_number 
)

Definition at line 35 of file RPCdecoder.cxx.

35  {
36  this->reset();
37  int strip_type = this->side2type(side);
39 }

◆ RPCdecoder() [5/5]

RPCdecoder::RPCdecoder ( const RPCdecoder deco)

Definition at line 41 of file RPCdecoder.cxx.

41  {
42  this->reset();
43  this->set_indexes(deco.code());
44 }

◆ ~RPCdecoder()

RPCdecoder::~RPCdecoder ( )
default

Member Function Documentation

◆ cabling_code()

int RPCdecoder::cabling_code ( void  ) const
inline

Definition at line 71 of file RPCdecoder.h.

71 { return m_strip_number + m_rpc_z_index * 100 + m_rpc_layer * 10000; }

◆ code()

unsigned int RPCdecoder::code ( void  ) const
inline

Definition at line 64 of file RPCdecoder.h.

64 { return m_code; }

◆ fault_decoding()

void RPCdecoder::fault_decoding ( int  value,
value_type  type 
)
private

Definition at line 72 of file RPCdecoder.cxx.

72  {
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 }

◆ half_barrel()

HalfType RPCdecoder::half_barrel ( void  ) const

Definition at line 155 of file RPCdecoder.cxx.

155  {
156  if (m_logic_sector == -1) return NoHalf;
157  return (m_logic_sector < 32) ? Negative : Positive;
158 }

◆ logic_sector()

int RPCdecoder::logic_sector ( void  ) const
inline

Definition at line 66 of file RPCdecoder.h.

66 { return m_logic_sector; }

◆ lvl1_station()

int RPCdecoder::lvl1_station ( void  ) const
inline

Definition at line 67 of file RPCdecoder.h.

67 { return m_lvl1_station; }

◆ OK()

bool RPCdecoder::OK ( int  value,
value_type  type 
) const

Definition at line 80 of file RPCdecoder.cxx.

80  {
81  if (value >= s_value_boundaries[type][0] && value <= s_value_boundaries[type][1]) return true;
82  return false;
83 }

◆ operator bool()

RPCdecoder::operator bool ( )
inline

Definition at line 59 of file RPCdecoder.h.

59 { return !m_fail; }

◆ operator()() [1/3]

RPCdecoder & RPCdecoder::operator() ( int  strip_type,
int  logic_sector,
int  lvl1_station,
int  rpc_layer,
int  rpc_z_index,
int  strip_number 
)

Definition at line 135 of file RPCdecoder.cxx.

135  {
136  this->reset();
138  return *this;
139 }

◆ operator()() [2/3]

RPCdecoder & RPCdecoder::operator() ( unsigned int  code)

Definition at line 129 of file RPCdecoder.cxx.

129  {
130  this->reset();
131  this->set_indexes(code);
132  return *this;
133 }

◆ operator()() [3/3]

RPCdecoder & RPCdecoder::operator() ( ViewType  side,
int  logic_sector,
int  lvl1_station,
int  rpc_layer,
int  rpc_z_index,
int  strip_number 
)

Definition at line 141 of file RPCdecoder.cxx.

141  {
142  this->reset();
143  int strip_type = side2type(side);
145  return *this;
146 }

◆ operator=()

RPCdecoder & RPCdecoder::operator= ( const RPCdecoder deco)

Definition at line 48 of file RPCdecoder.cxx.

48  {
49  this->reset();
50  this->set_indexes(deco.code());
51  return *this;
52 }

◆ Print()

void RPCdecoder::Print ( std::ostream &  stream,
bool  detail 
) const

Definition at line 165 of file RPCdecoder.cxx.

165  {
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 }

◆ reset()

void RPCdecoder::reset ( void  )
private

Definition at line 55 of file RPCdecoder.cxx.

55  {
56  this->reset_status();
57  this->reset_data();
58 }

◆ reset_data()

void RPCdecoder::reset_data ( void  )
private

Definition at line 60 of file RPCdecoder.cxx.

60  {
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 }

◆ reset_status()

void RPCdecoder::reset_status ( void  )
private

Definition at line 70 of file RPCdecoder.cxx.

70 { m_fail = false; }

◆ rpc_layer()

int RPCdecoder::rpc_layer ( void  ) const
inline

Definition at line 68 of file RPCdecoder.h.

68 { return m_rpc_layer; }

◆ rpc_z_index()

int RPCdecoder::rpc_z_index ( void  ) const
inline

Definition at line 69 of file RPCdecoder.h.

69 { return m_rpc_z_index; }

◆ set_code()

void RPCdecoder::set_code ( int  strip_type,
int  logic_sector,
int  lvl1_station,
int  rpc_layer,
int  rpc_z_index,
int  strip_number 
)
private

Definition at line 85 of file RPCdecoder.cxx.

◆ set_indexes()

void RPCdecoder::set_indexes ( unsigned int  code)
private

Definition at line 106 of file RPCdecoder.cxx.

106  {
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 }

◆ side2type()

int RPCdecoder::side2type ( ViewType  side) const

Definition at line 160 of file RPCdecoder.cxx.

160  {
161  if (side == NoView) return -1;
162  return (side == Eta) ? 2 : 1;
163 }

◆ strip_number()

int RPCdecoder::strip_number ( void  ) const
inline

Definition at line 70 of file RPCdecoder.h.

70 { return m_strip_number; }

◆ strip_type()

int RPCdecoder::strip_type ( void  ) const
inline

Definition at line 65 of file RPCdecoder.h.

65 { return m_strip_type; }

◆ view()

ViewType RPCdecoder::view ( void  ) const

Definition at line 150 of file RPCdecoder.cxx.

150  {
151  if (m_strip_type == -1) return NoView;
152  return (m_strip_type == 1) ? Phi : Eta;
153 }

Member Data Documentation

◆ m_code

unsigned int RPCdecoder::m_code = 0U
private

Definition at line 25 of file RPCdecoder.h.

◆ m_fail

bool RPCdecoder::m_fail = false
private

Definition at line 22 of file RPCdecoder.h.

◆ m_logic_sector

int RPCdecoder::m_logic_sector = 0
private

Definition at line 28 of file RPCdecoder.h.

◆ m_lvl1_station

int RPCdecoder::m_lvl1_station = 0
private

Definition at line 29 of file RPCdecoder.h.

◆ m_rpc_layer

int RPCdecoder::m_rpc_layer = 0
private

Definition at line 30 of file RPCdecoder.h.

◆ m_rpc_z_index

int RPCdecoder::m_rpc_z_index = 0
private

Definition at line 31 of file RPCdecoder.h.

◆ m_strip_number

int RPCdecoder::m_strip_number = 0
private

Definition at line 32 of file RPCdecoder.h.

◆ m_strip_type

int RPCdecoder::m_strip_type = 0
private

Definition at line 27 of file RPCdecoder.h.

◆ s_value_boundaries

const int RPCdecoder::s_value_boundaries
staticprivate
Initial value:
= {
{1, 2},
{0, 63},
{1, 3},
{0, 1}
}

Definition at line 18 of file RPCdecoder.h.

◆ s_value_descriptions

const char RPCdecoder::s_value_descriptions = {{"strip_type"}, {"logic_sector"}, {"lvl1_station"}, {"rpc_layer"}}
staticprivate

Definition at line 19 of file RPCdecoder.h.


The documentation for this class was generated from the following files:
RPCdecoder::OK
bool OK(int, value_type) const
Definition: RPCdecoder.cxx:80
RPCdecoder::rpc_layer
int rpc_layer(void) const
Definition: RPCdecoder.h:68
RPCdecoder::reset
void reset(void)
Definition: RPCdecoder.cxx:55
RPCdecoder::m_logic_sector
int m_logic_sector
Definition: RPCdecoder.h:28
RPCdecoder::RPC_Layer
@ RPC_Layer
Definition: RPCdecoder.h:15
RPCdecoder::strip_number
int strip_number(void) const
Definition: RPCdecoder.h:70
RPCdecoder::Strip_Type
@ Strip_Type
Definition: RPCdecoder.h:15
RPCdecoder::set_indexes
void set_indexes(unsigned int)
Definition: RPCdecoder.cxx:106
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
RPCdecoder::Logic_Sector
@ Logic_Sector
Definition: RPCdecoder.h:15
NoHalf
@ NoHalf
Definition: RPCdef.h:9
athena.value
value
Definition: athena.py:124
RPCdecoder::m_strip_number
int m_strip_number
Definition: RPCdecoder.h:32
detail
Definition: extract_histogram_tag.cxx:14
Phi
@ Phi
Definition: RPCdef.h:8
RPCdecoder::m_rpc_layer
int m_rpc_layer
Definition: RPCdecoder.h:30
RPCdecoder::m_rpc_z_index
int m_rpc_z_index
Definition: RPCdecoder.h:31
RPCdecoder::rpc_z_index
int rpc_z_index(void) const
Definition: RPCdecoder.h:69
RPCdecoder::LVL1_Station
@ LVL1_Station
Definition: RPCdecoder.h:15
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
RPCdecoder::side2type
int side2type(ViewType side) const
Definition: RPCdecoder.cxx:160
RPCdecoder::fault_decoding
void fault_decoding(int, value_type)
Definition: RPCdecoder.cxx:72
RPCdecoder::s_value_descriptions
static const char s_value_descriptions[4][15]
Definition: RPCdecoder.h:19
TRT::Hit::side
@ side
Definition: HitInfo.h:83
RPCdecoder::m_lvl1_station
int m_lvl1_station
Definition: RPCdecoder.h:29
RPCdecoder::strip_type
int strip_type(void) const
Definition: RPCdecoder.h:65
RPCdecoder::code
unsigned int code(void) const
Definition: RPCdecoder.h:64
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
RPCdecoder::set_code
void set_code(int, int, int, int, int, int)
Definition: RPCdecoder.cxx:85
Negative
@ Negative
Definition: RPCdef.h:9
RPCdecoder::lvl1_station
int lvl1_station(void) const
Definition: RPCdecoder.h:67
NoView
@ NoView
Definition: RPCdef.h:8
RPCdecoder::reset_data
void reset_data(void)
Definition: RPCdecoder.cxx:60
RPCdecoder::s_value_boundaries
static const int s_value_boundaries[4][2]
Definition: RPCdecoder.h:18
Positive
@ Positive
Definition: RPCdef.h:9
RPCdecoder::reset_status
void reset_status(void)
Definition: RPCdecoder.cxx:70
RPCdecoder::m_fail
bool m_fail
Definition: RPCdecoder.h:22
RPCdecoder::m_code
unsigned int m_code
Definition: RPCdecoder.h:25
RPCdecoder::half_barrel
HalfType half_barrel(void) const
Definition: RPCdecoder.cxx:155
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
RPCdecoder::cabling_code
int cabling_code(void) const
Definition: RPCdecoder.h:71
RPCdecoder::logic_sector
int logic_sector(void) const
Definition: RPCdecoder.h:66
RPCdecoder::m_strip_type
int m_strip_type
Definition: RPCdecoder.h:27
Eta
@ Eta
Definition: RPCdef.h:8