CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
RBCEmulator Class Reference

#include <RBCEmulator.h>

Public Member Functions

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

Public Attributes

RBCIdm_rbcinfo
 

Private Attributes

int m_bx
 
bool m_debug
 
std::bitset< 2 > m_decision
 
RBCInputm_input
 
std::bitset< 6 > * m_layersignal [2]
 
std::vector< std::bitset< 6 > * > m_layersignalVec
 
std::string m_logtype
 
RBCConfigurationm_rbcconf
 
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 24 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, m_rbcinfo, m_signal, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

18  {
19 
20  m_signal = NULL;
21  m_logtype = std::string("TestLogic");
22  m_rbcinfo = new RBCId();
23  m_input = new RBCInput();
24 
25  m_layersignal[0] = new std::bitset<6>();
26  m_layersignal[1] = new std::bitset<6>();
27  m_layersignalVec.push_back( m_layersignal[0] );
28  m_layersignalVec.push_back( m_layersignal[1] );
29 
30  m_debug = false;
31 
32 }
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:63
#define NULL
Definition: scimark2.h:8
Definition: RBCId.h:16
std::string m_logtype
Definition: RBCEmulator.h:79
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:81
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
std::vector< std::bitset< 6 > * > m_layersignalVec
Definition: RBCEmulator.h:73
RBCInput * m_input
Definition: RBCEmulator.h:67
RBCEmulator::RBCEmulator ( const char *  logic_type)

Definition at line 34 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcconf, m_rbcinfo, m_signal, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

34  {
35 
36  m_signal = NULL;
37  m_logtype = std::string( logic_type );
38  m_rbcinfo = new RBCId();
39  m_input = new RBCInput();
40  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(logic_type));
41 
42  m_layersignal[0] = new std::bitset<6>();
43  m_layersignal[1] = new std::bitset<6>();
44  m_layersignalVec.push_back( m_layersignal[0] );
45  m_layersignalVec.push_back( m_layersignal[1] );
46 
47  m_debug = false;
48 
49 }
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:63
#define NULL
Definition: scimark2.h:8
Definition: RBCId.h:16
std::string m_logtype
Definition: RBCEmulator.h:79
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:81
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
std::vector< std::bitset< 6 > * > m_layersignalVec
Definition: RBCEmulator.h:73
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65
RBCInput * m_input
Definition: RBCEmulator.h:67
RBCEmulator::RBCEmulator ( const char *  f_name,
const char *  logic_type 
)

Definition at line 51 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcconf, m_rbcinfo, m_signal, and AlCaHLTBitMon_QueryRunRegistry::string.

51  {
52 
53  m_signal = dynamic_cast<ProcessInputSignal*>(new RBCProcessTestSignal( f_name ));
54  m_logtype = std::string( logic_type );
55  m_rbcinfo = new RBCId();
56  m_input = new RBCInput();
57  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(logic_type));
58 
59  m_layersignal[0] = new std::bitset<6>();
60  m_layersignal[1] = new std::bitset<6>();
61  m_layersignalVec.push_back( m_layersignal[0] );
62  m_layersignalVec.push_back( m_layersignal[1] );
63 
64  m_debug = false;
65 
66 }
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:63
Definition: RBCId.h:16
std::string m_logtype
Definition: RBCEmulator.h:79
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:81
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
std::vector< std::bitset< 6 > * > m_layersignalVec
Definition: RBCEmulator.h:73
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65
RBCInput * m_input
Definition: RBCEmulator.h:67
RBCEmulator::RBCEmulator ( const char *  ,
const char *  ,
int  ,
int *   
)
RBCEmulator::~RBCEmulator ( )
virtual

Destructor.

Definition at line 71 of file RBCEmulator.cc.

References m_input, m_layersignalVec, m_rbcconf, m_rbcinfo, and m_signal.

71  {
72 
73  if (m_signal) delete m_signal;
74  if (m_rbcconf) delete m_rbcconf;
75  if (m_rbcinfo) delete m_rbcinfo;
76  if (m_input) delete m_input;
77 
78  std::vector<std::bitset<6>*>::iterator itr;
79  for(itr = m_layersignalVec.begin(); itr != m_layersignalVec.end(); ++itr)
80  delete (*itr);
81 
82 }
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:63
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
std::vector< std::bitset< 6 > * > m_layersignalVec
Definition: RBCEmulator.h:73
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65
RBCInput * m_input
Definition: RBCEmulator.h:67

Member Function Documentation

void RBCEmulator::emulate ( )

Definition at line 112 of file RBCEmulator.cc.

References gather_cfg::cout, data, RBCLogicUnit::getlayersignal(), m_debug, m_input, m_layersignal, m_rbcconf, RBCConfiguration::m_rbclogic, m_signal, ProcessInputSignal::next(), printlayerinfo(), ProcessInputSignal::retrievedata(), and RBCLogicUnit::run().

113 {
114 
115  if( m_debug ) std::cout << "RBCEmulator> starting test emulation" << std::endl;
116 
117  std::bitset<2> decision;
118 
119  while ( m_signal->next() )
120  {
121 
123  (*m_input) = * dynamic_cast<RBCLinkBoardSignal*>( data )->m_linkboardin ;
124 
125  m_rbcconf->m_rbclogic->run( (*m_input) , decision );
126 
129 
130  printlayerinfo();
131 
132  if ( m_debug ) std::cout << decision[0] << " " << decision[1] << std::endl;
133 
134  }
135 
136  if( m_debug ) std::cout << "RBCEmulator> end test emulation" << std::endl;
137 
138 }
void run(const RBCInput &, std::bitset< 2 > &)
Definition: RBCLogicUnit.cc:76
virtual RPCInputSignal * retrievedata()=0
void printlayerinfo()
Definition: RBCEmulator.cc:197
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:63
std::bitset< 6 > * getlayersignal(int _idx)
Definition: RBCLogicUnit.h:36
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
bool m_debug
Definition: RBCEmulator.h:81
RBCLogicUnit * m_rbclogic
virtual int next()=0
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
RBCInput * m_input
Definition: RBCEmulator.h:67
void RBCEmulator::emulate ( RBCInput in)

Definition at line 140 of file RBCEmulator.cc.

References gather_cfg::cout, RBCLogicUnit::getlayersignal(), m_debug, m_decision, m_input, m_layersignal, m_rbcconf, m_rbcinfo, RBCConfiguration::m_rbclogic, RBCConfiguration::preprocess(), printlayerinfo(), RBCLogicUnit::run(), RBCInput::setWheelId(), and RBCId::wheel().

141 {
142 
143  if( m_debug ) std::cout << "RBCEmulator> starting emulation" << std::endl;
144 
145  std::bitset<2> decision;
146 
147  in->setWheelId( m_rbcinfo->wheel() );
148 
149  (*m_input) = (*in);
150 
151  if( m_debug ) std::cout << "RBCEmulator> copied data" << std::endl;
152 
153  //.. mask and force as specified in hardware configuration
155 
156  if( m_debug ) std::cout << "RBCEmulator> preprocessing done" << std::endl;
157 
158  m_rbcconf->m_rbclogic->run( (*m_input) , decision );
159 
160  if( m_debug ) std::cout << "RBCEmulator> applying logic" << std::endl;
161 
164 
165  m_decision.set(0, decision[0] );
166  m_decision.set(1, decision[1] );
167 
168  if( m_debug ) {
169  printlayerinfo();
170  std::cout << decision[0] << " " << decision[1] << std::endl;
171  std::cout << "RBCEmulator> end emulation" << std::endl;
172  }
173 
174  decision.reset();
175 
176 }
void run(const RBCInput &, std::bitset< 2 > &)
Definition: RBCLogicUnit.cc:76
void printlayerinfo()
Definition: RBCEmulator.cc:197
void setWheelId(int wid)
Definition: RBCInput.h:77
std::bitset< 6 > * getlayersignal(int _idx)
Definition: RBCLogicUnit.h:36
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
virtual void preprocess(RBCInput &)=0
bool m_debug
Definition: RBCEmulator.h:81
RBCLogicUnit * m_rbclogic
int wheel() const
Definition: RBCId.h:27
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:71
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65
RBCInput * m_input
Definition: RBCEmulator.h:67
bool RBCEmulator::getdecision ( int  idx)
inline

Definition at line 51 of file RBCEmulator.h.

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

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

Definition at line 49 of file RBCEmulator.h.

References training_settings::idx, and m_layersignal.

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

Definition at line 92 of file RBCEmulator.cc.

References gather_cfg::cout, RBCConfiguration::initialise(), m_debug, m_rbcconf, and mps_update::status.

93 {
94 
95  bool status(true);
96 
98 
99  if ( !status ) {
100  if( m_debug ) std::cout << "RBCEmulator> Problem initialising the Configuration \n";
101  return 0; };
102 
103  return 1;
104 
105 }
bool m_debug
Definition: RBCEmulator.h:81
virtual bool initialise()=0
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65
void RBCEmulator::printinfo ( )

Definition at line 187 of file RBCEmulator.cc.

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

Referenced by getdecision().

188 {
189 
190  if( m_debug ) {
191  std::cout << "RBC --> \n";
192  m_rbcinfo->printinfo();
193  }
194 
195 }
void printinfo()
Definition: RBCId.cc:41
bool m_debug
Definition: RBCEmulator.h:81
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
void RBCEmulator::printlayerinfo ( )

Definition at line 197 of file RBCEmulator.cc.

References gather_cfg::cout, i, and m_layersignal.

Referenced by emulate(), and getdecision().

198 {
199 
200  std::cout << "Sector summary by layer: \n";
201  for(int i=0; i < 6; ++i)
202  std::cout << (*m_layersignal[0])[i] << '\t'
203  << (*m_layersignal[1])[i] << '\n';
204 
205 }
int i
Definition: DBlmapReader.cc:9
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:69
void RBCEmulator::reset ( void  )

Definition at line 178 of file RBCEmulator.cc.

References m_decision, and m_layersignal.

179 {
180 
181  m_decision.reset();
182  m_layersignal[0]->reset();
183  m_layersignal[1]->reset();
184 
185 }
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 107 of file RBCEmulator.cc.

References m_rbcinfo, and RBCId::setid().

108 {
109  m_rbcinfo->setid ( wh, sec);
110 }
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
void setid(int _wh, int *_sec)
Definition: RBCId.h:33
void RBCEmulator::setSpecifications ( const RBCBoardSpecs rbcspecs)

Definition at line 85 of file RBCEmulator.cc.

References m_rbcconf, and m_rbcinfo.

86 {
87 
88  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(rbcspecs, m_rbcinfo));
89 
90 }
RBCId * m_rbcinfo
Definition: RBCEmulator.h:57
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:65

Member Data Documentation

int RBCEmulator::m_bx
private

Definition at line 77 of file RBCEmulator.h.

bool RBCEmulator::m_debug
private

Definition at line 81 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(), RBCEmulator(), 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::vector< std::bitset<6> *> RBCEmulator::m_layersignalVec
private

Definition at line 73 of file RBCEmulator.h.

Referenced by RBCEmulator(), and ~RBCEmulator().

std::string RBCEmulator::m_logtype
private

Definition at line 79 of file RBCEmulator.h.

Referenced by RBCEmulator().

RBCConfiguration* RBCEmulator::m_rbcconf
private

Definition at line 65 of file RBCEmulator.h.

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

RBCId* RBCEmulator::m_rbcinfo

Definition at line 57 of file RBCEmulator.h.

Referenced by emulate(), printinfo(), RBCEmulator(), setid(), setSpecifications(), and ~RBCEmulator().

ProcessInputSignal* RBCEmulator::m_signal
private

Definition at line 63 of file RBCEmulator.h.

Referenced by emulate(), RBCEmulator(), and ~RBCEmulator().