CMS 3D CMS Logo

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< ProcessInputSignalm_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.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, and m_signal.

18  :
19  m_rbcinfo{},
20  m_signal{},
21  m_input{},
22  m_logtype{"TestLogic"},
23  m_debug{false}
24  {
27 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:63
std::string m_logtype
Definition: RBCEmulator.h:76
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:78
RBCInput m_input
Definition: RBCEmulator.h:67
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:73
RBCId m_rbcinfo
Definition: RBCEmulator.h:61
RBCEmulator::RBCEmulator ( const char *  logic_type)

Definition at line 29 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcconf, and m_signal.

29  :
30  m_rbcinfo{},
31  m_signal{},
32  m_rbcconf{std::make_unique<RBCBasicConfig>(logic_type)},
33  m_input{},
34  m_logtype{logic_type},
35  m_debug{false}
36  {
39 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:63
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:65
std::string m_logtype
Definition: RBCEmulator.h:76
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:78
RBCInput m_input
Definition: RBCEmulator.h:67
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:73
RBCId m_rbcinfo
Definition: RBCEmulator.h:61
RBCEmulator::RBCEmulator ( const char *  f_name,
const char *  logic_type 
)

Definition at line 41 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcconf, and m_signal.

41  :
42  m_rbcinfo{},
43  m_signal{std::make_unique<RBCProcessTestSignal>( f_name )},
44  m_rbcconf{std::make_unique<RBCBasicConfig>(logic_type)},
45  m_input{},
46  m_logtype{ logic_type },
47  m_debug{false}
48  {
51 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:63
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:65
std::string m_logtype
Definition: RBCEmulator.h:76
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:78
RBCInput m_input
Definition: RBCEmulator.h:67
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:73
RBCId m_rbcinfo
Definition: RBCEmulator.h:61
RBCEmulator::RBCEmulator ( const char *  ,
const char *  ,
int  ,
int *   
)

Member Function Documentation

void RBCEmulator::emulate ( )

Definition at line 81 of file RBCEmulator.cc.

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

82 {
83 
84  if( m_debug ) std::cout << "RBCEmulator> starting test emulation" << std::endl;
85 
86  std::bitset<2> decision;
87 
88  while ( m_signal->next() )
89  {
90 
91  RPCInputSignal * data = m_signal->retrievedata();
92  m_input = dynamic_cast<RBCLinkBoardSignal*>( data )->m_linkboardin ;
93 
94  m_rbcconf->rbclogic()->run( m_input , decision );
95 
96  m_layersignal[0] = m_rbcconf->rbclogic()->getlayersignal( 0 );
97  m_layersignal[1] = m_rbcconf->rbclogic()->getlayersignal( 1 );
98 
100 
101  if ( m_debug ) std::cout << decision[0] << " " << decision[1] << std::endl;
102 
103  }
104 
105  if( m_debug ) std::cout << "RBCEmulator> end test emulation" << std::endl;
106 
107 }
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:63
void printlayerinfo() const
Definition: RBCEmulator.cc:166
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:65
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:78
RBCInput m_input
Definition: RBCEmulator.h:67
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void RBCEmulator::emulate ( RBCInput in)

Definition at line 109 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().

110 {
111 
112  if( m_debug ) std::cout << "RBCEmulator> starting emulation" << std::endl;
113 
114  std::bitset<2> decision;
115 
116  in->setWheelId( m_rbcinfo.wheel() );
117 
118  m_input = (*in);
119 
120  if( m_debug ) std::cout << "RBCEmulator> copied data" << std::endl;
121 
122  //.. mask and force as specified in hardware configuration
123  m_rbcconf->preprocess( m_input );
124 
125  if( m_debug ) std::cout << "RBCEmulator> preprocessing done" << std::endl;
126 
127  m_rbcconf->rbclogic()->run( m_input , decision );
128 
129  if( m_debug ) std::cout << "RBCEmulator> applying logic" << std::endl;
130 
131  m_layersignal[0] = m_rbcconf->rbclogic()->getlayersignal( 0 );
132  m_layersignal[1] = m_rbcconf->rbclogic()->getlayersignal( 1 );
133 
134  m_decision.set(0, decision[0] );
135  m_decision.set(1, decision[1] );
136 
137  if( m_debug ) {
138  printlayerinfo();
139  std::cout << decision[0] << " " << decision[1] << std::endl;
140  std::cout << "RBCEmulator> end emulation" << std::endl;
141  }
142 
143  decision.reset();
144 
145 }
void printlayerinfo() const
Definition: RBCEmulator.cc:166
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:65
void setWheelId(int wid)
Definition: RBCInput.h:54
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:78
RBCInput m_input
Definition: RBCEmulator.h:67
int wheel() const
Definition: RBCId.h:28
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:71
RBCId m_rbcinfo
Definition: RBCEmulator.h:61
bool RBCEmulator::getdecision ( int  idx) const
inline

Definition at line 50 of file RBCEmulator.h.

References training_settings::idx, m_decision, printinfo(), and printlayerinfo().

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

Definition at line 48 of file RBCEmulator.h.

References training_settings::idx, and m_layersignal.

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

Definition at line 61 of file RBCEmulator.cc.

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

62 {
63 
64  bool status(true);
65 
66  status = m_rbcconf->initialise();
67 
68  if ( !status ) {
69  if( m_debug ) std::cout << "RBCEmulator> Problem initialising the Configuration \n";
70  return false; };
71 
72  return true;
73 
74 }
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:65
bool m_debug
Definition: RBCEmulator.h:78
void RBCEmulator::printinfo ( ) const

Definition at line 156 of file RBCEmulator.cc.

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

Referenced by getdecision().

157 {
158 
159  if( m_debug ) {
160  std::cout << "RBC --> \n";
162  }
163 
164 }
bool m_debug
Definition: RBCEmulator.h:78
void printinfo() const
Definition: RBCId.cc:29
RBCId m_rbcinfo
Definition: RBCEmulator.h:61
void RBCEmulator::printlayerinfo ( ) const

Definition at line 166 of file RBCEmulator.cc.

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

Referenced by emulate(), and getdecision().

167 {
168 
169  std::cout << "Sector summary by layer: \n";
170  for(int i=0; i < 6; ++i)
171  std::cout << (*m_layersignal[0])[i] << '\t'
172  << (*m_layersignal[1])[i] << '\n';
173 
174 }
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
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:61
void RBCEmulator::reset ( void  )

Definition at line 147 of file RBCEmulator.cc.

References m_decision, and m_layersignal.

148 {
149 
150  m_decision.reset();
151  m_layersignal[0]->reset();
152  m_layersignal[1]->reset();
153 
154 }
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:71
void RBCEmulator::setid ( int  wh,
int *  sec 
)

Definition at line 76 of file RBCEmulator.cc.

References m_rbcinfo, and RBCId::setid().

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

Definition at line 54 of file RBCEmulator.cc.

References m_rbcconf, and m_rbcinfo.

55 {
56 
57  m_rbcconf = std::make_unique<RBCBasicConfig>(rbcspecs, &m_rbcinfo);
58 
59 }
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:65
RBCId m_rbcinfo
Definition: RBCEmulator.h:61

Member Data Documentation

bool RBCEmulator::m_debug
private

Definition at line 78 of file RBCEmulator.h.

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

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

Definition at line 71 of file RBCEmulator.h.

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

RBCInput RBCEmulator::m_input
private

Definition at line 67 of file RBCEmulator.h.

Referenced by emulate(), and RBCEmulator().

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

Definition at line 69 of file RBCEmulator.h.

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

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

Definition at line 73 of file RBCEmulator.h.

Referenced by RBCEmulator().

std::string RBCEmulator::m_logtype
private

Definition at line 76 of file RBCEmulator.h.

Referenced by RBCEmulator().

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

Definition at line 65 of file RBCEmulator.h.

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

RBCId RBCEmulator::m_rbcinfo
private

Definition at line 61 of file RBCEmulator.h.

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

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

Definition at line 63 of file RBCEmulator.h.

Referenced by emulate(), and RBCEmulator().