CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
RBCEmulator Class Reference

#include <RBCEmulator.h>

Public Member Functions

void emulate ()
 
void emulate (RBCInput *)
 
bool getdecision (int idx) const
 
std::bitset< 6 > * getlayersignal (int idx)
 
bool initialise ()
 
void printinfo () const
 
void printlayerinfo () const
 
 RBCEmulator ()
 Standard constructor. More...
 
 RBCEmulator (const char *)
 
 RBCEmulator (const char *, const char *)
 
 RBCEmulator (const char *, const char *, int, int *)
 
const RBCIdrbcinfo () const
 
void reset ()
 
void setid (int, int *)
 
void setSpecifications (const RBCBoardSpecs *)
 

Private Attributes

bool m_debug
 
std::bitset< 2 > m_decision
 
RBCInput m_input
 
std::bitset< 6 > * m_layersignal [2]
 
std::array< std::bitset< 6 >, 2 > m_layersignalVec
 
std::string m_logtype
 
std::unique_ptr< RBCConfigurationm_rbcconf
 
RBCId m_rbcinfo
 
std::unique_ptr
< ProcessInputSignal
m_signal
 

Detailed Description

Author
Andres Osorio, Flavio Loddo, Marcello Maggi

email: aosor.nosp@m.io@u.nosp@m.niand.nosp@m.es.e.nosp@m.du.co

Date
2008-10-10

Definition at line 25 of file RBCEmulator.h.

Constructor & Destructor Documentation

RBCEmulator::RBCEmulator ( )

Standard constructor.

Definition at line 18 of file RBCEmulator.cc.

18  : m_rbcinfo{}, m_signal{}, m_input{}, m_logtype{"TestLogic"}, m_debug{false} {
21 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:62
std::string m_logtype
Definition: RBCEmulator.h:75
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
bool m_debug
Definition: RBCEmulator.h:77
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:72
RBCInput m_input
Definition: RBCEmulator.h:66
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
RBCEmulator::RBCEmulator ( const char *  logic_type)

Definition at line 23 of file RBCEmulator.cc.

24  : m_rbcinfo{},
25  m_signal{},
26  m_rbcconf{std::make_unique<RBCBasicConfig>(logic_type)},
27  m_input{},
28  m_logtype{logic_type},
29  m_debug{false} {
32 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:62
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
std::string m_logtype
Definition: RBCEmulator.h:75
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
bool m_debug
Definition: RBCEmulator.h:77
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:72
RBCInput m_input
Definition: RBCEmulator.h:66
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
RBCEmulator::RBCEmulator ( const char *  f_name,
const char *  logic_type 
)

Definition at line 34 of file RBCEmulator.cc.

35  : m_rbcinfo{},
36  m_signal{std::make_unique<RBCProcessTestSignal>(f_name)},
37  m_rbcconf{std::make_unique<RBCBasicConfig>(logic_type)},
38  m_input{},
39  m_logtype{logic_type},
40  m_debug{false} {
43 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:62
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
std::string m_logtype
Definition: RBCEmulator.h:75
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
bool m_debug
Definition: RBCEmulator.h:77
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:72
RBCInput m_input
Definition: RBCEmulator.h:66
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
RBCEmulator::RBCEmulator ( const char *  ,
const char *  ,
int  ,
int *   
)

Member Function Documentation

void RBCEmulator::emulate ( )

Definition at line 66 of file RBCEmulator.cc.

References gather_cfg::cout, data, m_debug, m_input, m_layersignal, m_rbcconf, m_signal, and printlayerinfo().

66  {
67  if (m_debug)
68  std::cout << "RBCEmulator> starting test emulation" << std::endl;
69 
70  std::bitset<2> decision;
71 
72  while (m_signal->next()) {
73  RPCInputSignal* data = m_signal->retrievedata();
74  m_input = dynamic_cast<RBCLinkBoardSignal*>(data)->m_linkboardin;
75 
76  m_rbcconf->rbclogic()->run(m_input, decision);
77 
78  m_layersignal[0] = m_rbcconf->rbclogic()->getlayersignal(0);
79  m_layersignal[1] = m_rbcconf->rbclogic()->getlayersignal(1);
80 
82 
83  if (m_debug)
84  std::cout << decision[0] << " " << decision[1] << std::endl;
85  }
86 
87  if (m_debug)
88  std::cout << "RBCEmulator> end test emulation" << std::endl;
89 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:62
void printlayerinfo() const
Definition: RBCEmulator.cc:143
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
bool m_debug
Definition: RBCEmulator.h:77
RBCInput m_input
Definition: RBCEmulator.h:66
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
tuple cout
Definition: gather_cfg.py:144
void RBCEmulator::emulate ( RBCInput in)

Definition at line 91 of file RBCEmulator.cc.

References gather_cfg::cout, m_debug, m_decision, m_input, m_layersignal, m_rbcconf, m_rbcinfo, printlayerinfo(), RBCInput::setWheelId(), and RBCId::wheel().

91  {
92  if (m_debug)
93  std::cout << "RBCEmulator> starting emulation" << std::endl;
94 
95  std::bitset<2> decision;
96 
97  in->setWheelId(m_rbcinfo.wheel());
98 
99  m_input = (*in);
100 
101  if (m_debug)
102  std::cout << "RBCEmulator> copied data" << std::endl;
103 
104  //.. mask and force as specified in hardware configuration
105  m_rbcconf->preprocess(m_input);
106 
107  if (m_debug)
108  std::cout << "RBCEmulator> preprocessing done" << std::endl;
109 
110  m_rbcconf->rbclogic()->run(m_input, decision);
111 
112  if (m_debug)
113  std::cout << "RBCEmulator> applying logic" << std::endl;
114 
115  m_layersignal[0] = m_rbcconf->rbclogic()->getlayersignal(0);
116  m_layersignal[1] = m_rbcconf->rbclogic()->getlayersignal(1);
117 
118  m_decision.set(0, decision[0]);
119  m_decision.set(1, decision[1]);
120 
121  if (m_debug) {
122  printlayerinfo();
123  std::cout << decision[0] << " " << decision[1] << std::endl;
124  std::cout << "RBCEmulator> end emulation" << std::endl;
125  }
126 
127  decision.reset();
128 }
void printlayerinfo() const
Definition: RBCEmulator.cc:143
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
void setWheelId(int wid)
Definition: RBCInput.h:52
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
bool m_debug
Definition: RBCEmulator.h:77
RBCInput m_input
Definition: RBCEmulator.h:66
int wheel() const
Definition: RBCId.h:28
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:70
tuple cout
Definition: gather_cfg.py:144
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
bool RBCEmulator::getdecision ( int  idx) const
inline

Definition at line 50 of file RBCEmulator.h.

References m_decision.

50 { return m_decision[idx]; };
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:70
std::bitset<6>* RBCEmulator::getlayersignal ( int  idx)
inline

Definition at line 48 of file RBCEmulator.h.

References m_layersignal.

48 { return m_layersignal[idx]; };
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
bool RBCEmulator::initialise ( )

Definition at line 50 of file RBCEmulator.cc.

References gather_cfg::cout, m_debug, m_rbcconf, and mps_update::status.

50  {
51  bool status(true);
52 
53  status = m_rbcconf->initialise();
54 
55  if (!status) {
56  if (m_debug)
57  std::cout << "RBCEmulator> Problem initialising the Configuration \n";
58  return false;
59  };
60 
61  return true;
62 }
list status
Definition: mps_update.py:107
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
bool m_debug
Definition: RBCEmulator.h:77
tuple cout
Definition: gather_cfg.py:144
void RBCEmulator::printinfo ( ) const

Definition at line 136 of file RBCEmulator.cc.

References gather_cfg::cout, m_debug, m_rbcinfo, and RBCId::printinfo().

136  {
137  if (m_debug) {
138  std::cout << "RBC --> \n";
140  }
141 }
bool m_debug
Definition: RBCEmulator.h:77
void printinfo() const
Definition: RBCId.cc:28
tuple cout
Definition: gather_cfg.py:144
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
void RBCEmulator::printlayerinfo ( ) const

Definition at line 143 of file RBCEmulator.cc.

References gather_cfg::cout, mps_fire::i, and m_layersignal.

Referenced by emulate().

143  {
144  std::cout << "Sector summary by layer: \n";
145  for (int i = 0; i < 6; ++i)
146  std::cout << (*m_layersignal[0])[i] << '\t' << (*m_layersignal[1])[i] << '\n';
147 }
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
tuple cout
Definition: gather_cfg.py:144
const RBCId& RBCEmulator::rbcinfo ( ) const
inline

Definition at line 56 of file RBCEmulator.h.

References m_rbcinfo.

56 { return m_rbcinfo; }
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
void RBCEmulator::reset ( void  )

Definition at line 130 of file RBCEmulator.cc.

References m_decision, and m_layersignal.

130  {
131  m_decision.reset();
132  m_layersignal[0]->reset();
133  m_layersignal[1]->reset();
134 }
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:70
void RBCEmulator::setid ( int  wh,
int *  sec 
)

Definition at line 64 of file RBCEmulator.cc.

References m_rbcinfo, and RBCId::setid().

64 { m_rbcinfo.setid(wh, sec); }
void setid(int _wh, int *_sec)
Definition: RBCId.h:34
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
void RBCEmulator::setSpecifications ( const RBCBoardSpecs rbcspecs)

Definition at line 46 of file RBCEmulator.cc.

References m_rbcconf, and m_rbcinfo.

46  {
47  m_rbcconf = std::make_unique<RBCBasicConfig>(rbcspecs, &m_rbcinfo);
48 }
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
RBCId m_rbcinfo
Definition: RBCEmulator.h:60

Member Data Documentation

bool RBCEmulator::m_debug
private

Definition at line 77 of file RBCEmulator.h.

Referenced by emulate(), initialise(), and printinfo().

std::bitset<2> RBCEmulator::m_decision
private

Definition at line 70 of file RBCEmulator.h.

Referenced by emulate(), getdecision(), and reset().

RBCInput RBCEmulator::m_input
private

Definition at line 66 of file RBCEmulator.h.

Referenced by emulate().

std::bitset<6>* RBCEmulator::m_layersignal[2]
private

Definition at line 68 of file RBCEmulator.h.

Referenced by emulate(), getlayersignal(), printlayerinfo(), and reset().

std::array<std::bitset<6>, 2> RBCEmulator::m_layersignalVec
private

Definition at line 72 of file RBCEmulator.h.

std::string RBCEmulator::m_logtype
private

Definition at line 75 of file RBCEmulator.h.

std::unique_ptr<RBCConfiguration> RBCEmulator::m_rbcconf
private

Definition at line 64 of file RBCEmulator.h.

Referenced by emulate(), initialise(), and setSpecifications().

RBCId RBCEmulator::m_rbcinfo
private

Definition at line 60 of file RBCEmulator.h.

Referenced by emulate(), printinfo(), rbcinfo(), setid(), and setSpecifications().

std::unique_ptr<ProcessInputSignal> RBCEmulator::m_signal
private

Definition at line 62 of file RBCEmulator.h.

Referenced by emulate().