CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 25 of file RBCEmulator.h.

Constructor & Destructor Documentation

RBCEmulator::RBCEmulator ( )

Standard constructor.

Definition at line 19 of file RBCEmulator.cc.

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

19  {
20 
21  m_signal = NULL;
22  m_logtype = std::string("TestLogic");
23  m_rbcinfo = new RBCId();
24  m_input = new RBCInput();
25 
26  m_layersignal[0] = new std::bitset<6>();
27  m_layersignal[1] = new std::bitset<6>();
28  m_layersignalVec.push_back( m_layersignal[0] );
29  m_layersignalVec.push_back( m_layersignal[1] );
30 
31  m_debug = false;
32 
33 }
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:64
#define NULL
Definition: scimark2.h:8
Definition: RBCId.h:17
std::string m_logtype
Definition: RBCEmulator.h:80
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:70
bool m_debug
Definition: RBCEmulator.h:82
RBCId * m_rbcinfo
Definition: RBCEmulator.h:58
std::vector< std::bitset< 6 > * > m_layersignalVec
Definition: RBCEmulator.h:74
RBCInput * m_input
Definition: RBCEmulator.h:68
RBCEmulator::RBCEmulator ( const char *  logic_type)

Definition at line 35 of file RBCEmulator.cc.

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

35  {
36 
37  m_signal = NULL;
38  m_logtype = std::string( logic_type );
39  m_rbcinfo = new RBCId();
40  m_input = new RBCInput();
41  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(logic_type));
42 
43  m_layersignal[0] = new std::bitset<6>();
44  m_layersignal[1] = new std::bitset<6>();
45  m_layersignalVec.push_back( m_layersignal[0] );
46  m_layersignalVec.push_back( m_layersignal[1] );
47 
48  m_debug = false;
49 
50 }
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:64
#define NULL
Definition: scimark2.h:8
Definition: RBCId.h:17
std::string m_logtype
Definition: RBCEmulator.h:80
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:70
bool m_debug
Definition: RBCEmulator.h:82
RBCId * m_rbcinfo
Definition: RBCEmulator.h:58
std::vector< std::bitset< 6 > * > m_layersignalVec
Definition: RBCEmulator.h:74
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:66
RBCInput * m_input
Definition: RBCEmulator.h:68
RBCEmulator::RBCEmulator ( const char *  f_name,
const char *  logic_type 
)

Definition at line 52 of file RBCEmulator.cc.

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

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

Destructor.

Definition at line 72 of file RBCEmulator.cc.

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

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

Member Function Documentation

void RBCEmulator::emulate ( )

Definition at line 113 of file RBCEmulator.cc.

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

114 {
115 
116  if( m_debug ) std::cout << "RBCEmulator> starting test emulation" << std::endl;
117 
118  std::bitset<2> decision;
119 
120  while ( m_signal->next() )
121  {
122 
124  (*m_input) = * dynamic_cast<RBCLinkBoardSignal*>( data )->m_linkboardin ;
125 
126  m_rbcconf->m_rbclogic->run( (*m_input) , decision );
127 
130 
131  printlayerinfo();
132 
133  if ( m_debug ) std::cout << decision[0] << " " << decision[1] << std::endl;
134 
135  }
136 
137  if( m_debug ) std::cout << "RBCEmulator> end test emulation" << std::endl;
138 
139 }
void run(const RBCInput &, std::bitset< 2 > &)
Definition: RBCLogicUnit.cc:77
virtual RPCInputSignal * retrievedata()=0
void printlayerinfo()
Definition: RBCEmulator.cc:198
ProcessInputSignal * m_signal
Definition: RBCEmulator.h:64
std::bitset< 6 > * getlayersignal(int _idx)
Definition: RBCLogicUnit.h:37
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:70
bool m_debug
Definition: RBCEmulator.h:82
RBCLogicUnit * m_rbclogic
virtual int next()=0
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:66
tuple cout
Definition: gather_cfg.py:41
RBCInput * m_input
Definition: RBCEmulator.h:68
void RBCEmulator::emulate ( RBCInput in)

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

142 {
143 
144  if( m_debug ) std::cout << "RBCEmulator> starting emulation" << std::endl;
145 
146  std::bitset<2> decision;
147 
148  in->setWheelId( m_rbcinfo->wheel() );
149 
150  (*m_input) = (*in);
151 
152  if( m_debug ) std::cout << "RBCEmulator> copied data" << std::endl;
153 
154  //.. mask and force as specified in hardware configuration
156 
157  if( m_debug ) std::cout << "RBCEmulator> preprocessing done" << std::endl;
158 
159  m_rbcconf->m_rbclogic->run( (*m_input) , decision );
160 
161  if( m_debug ) std::cout << "RBCEmulator> applying logic" << std::endl;
162 
165 
166  m_decision.set(0, decision[0] );
167  m_decision.set(1, decision[1] );
168 
169  if( m_debug ) {
170  printlayerinfo();
171  std::cout << decision[0] << " " << decision[1] << std::endl;
172  std::cout << "RBCEmulator> end emulation" << std::endl;
173  }
174 
175  decision.reset();
176 
177 }
void run(const RBCInput &, std::bitset< 2 > &)
Definition: RBCLogicUnit.cc:77
void printlayerinfo()
Definition: RBCEmulator.cc:198
void setWheelId(int wid)
Definition: RBCInput.h:78
std::bitset< 6 > * getlayersignal(int _idx)
Definition: RBCLogicUnit.h:37
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:70
virtual void preprocess(RBCInput &)=0
bool m_debug
Definition: RBCEmulator.h:82
RBCLogicUnit * m_rbclogic
int wheel() const
Definition: RBCId.h:28
RBCId * m_rbcinfo
Definition: RBCEmulator.h:58
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:72
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:66
tuple cout
Definition: gather_cfg.py:41
RBCInput * m_input
Definition: RBCEmulator.h:68
bool RBCEmulator::getdecision ( int  idx)
inline

Definition at line 52 of file RBCEmulator.h.

References m_decision.

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

Definition at line 50 of file RBCEmulator.h.

References m_layersignal.

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

Definition at line 93 of file RBCEmulator.cc.

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

94 {
95 
96  bool status(true);
97 
99 
100  if ( !status ) {
101  if( m_debug ) std::cout << "RBCEmulator> Problem initialising the Configuration \n";
102  return 0; };
103 
104  return 1;
105 
106 }
bool m_debug
Definition: RBCEmulator.h:82
virtual bool initialise()=0
RBCConfiguration * m_rbcconf
Definition: RBCEmulator.h:66
tuple cout
Definition: gather_cfg.py:41
tuple status
Definition: ntuplemaker.py:245
void RBCEmulator::printinfo ( )

Definition at line 188 of file RBCEmulator.cc.

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

189 {
190 
191  if( m_debug ) {
192  std::cout << "RBC --> \n";
193  m_rbcinfo->printinfo();
194  }
195 
196 }
void printinfo()
Definition: RBCId.cc:42
bool m_debug
Definition: RBCEmulator.h:82
RBCId * m_rbcinfo
Definition: RBCEmulator.h:58
tuple cout
Definition: gather_cfg.py:41
void RBCEmulator::printlayerinfo ( )

Definition at line 198 of file RBCEmulator.cc.

References gather_cfg::cout, i, and m_layersignal.

Referenced by emulate().

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

Definition at line 179 of file RBCEmulator.cc.

References m_decision, and m_layersignal.

180 {
181 
182  m_decision.reset();
183  m_layersignal[0]->reset();
184  m_layersignal[1]->reset();
185 
186 }
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:70
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:72
void RBCEmulator::setid ( int  wh,
int *  sec 
)

Definition at line 108 of file RBCEmulator.cc.

References m_rbcinfo, and RBCId::setid().

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

Definition at line 86 of file RBCEmulator.cc.

References m_rbcconf, and m_rbcinfo.

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

Member Data Documentation

int RBCEmulator::m_bx
private

Definition at line 78 of file RBCEmulator.h.

bool RBCEmulator::m_debug
private

Definition at line 82 of file RBCEmulator.h.

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

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

Definition at line 72 of file RBCEmulator.h.

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

RBCInput* RBCEmulator::m_input
private

Definition at line 68 of file RBCEmulator.h.

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

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

Definition at line 70 of file RBCEmulator.h.

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

std::vector< std::bitset<6> *> RBCEmulator::m_layersignalVec
private

Definition at line 74 of file RBCEmulator.h.

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

std::string RBCEmulator::m_logtype
private

Definition at line 80 of file RBCEmulator.h.

Referenced by RBCEmulator().

RBCConfiguration* RBCEmulator::m_rbcconf
private

Definition at line 66 of file RBCEmulator.h.

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

RBCId* RBCEmulator::m_rbcinfo

Definition at line 58 of file RBCEmulator.h.

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

ProcessInputSignal* RBCEmulator::m_signal
private

Definition at line 64 of file RBCEmulator.h.

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