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() [1/4]

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 }

◆ RBCEmulator() [2/4]

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 }

◆ RBCEmulator() [3/4]

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 }

◆ RBCEmulator() [4/4]

RBCEmulator::RBCEmulator ( const char *  ,
const char *  ,
int  ,
int *   
)

Member Function Documentation

◆ emulate() [1/2]

void RBCEmulator::emulate ( )

Definition at line 66 of file RBCEmulator.cc.

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 }

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

◆ emulate() [2/2]

void RBCEmulator::emulate ( RBCInput in)

Definition at line 91 of file RBCEmulator.cc.

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 }

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

◆ getdecision()

bool RBCEmulator::getdecision ( int  idx) const
inline

Definition at line 50 of file RBCEmulator.h.

50 { return m_decision[idx]; };

References heavyIonCSV_trainingSettings::idx, and m_decision.

◆ getlayersignal()

std::bitset<6>* RBCEmulator::getlayersignal ( int  idx)
inline

Definition at line 48 of file RBCEmulator.h.

48 { return m_layersignal[idx]; };

References heavyIonCSV_trainingSettings::idx, and m_layersignal.

◆ initialise()

bool RBCEmulator::initialise ( )

Definition at line 50 of file RBCEmulator.cc.

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 }

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

◆ printinfo()

void RBCEmulator::printinfo ( ) const

Definition at line 136 of file RBCEmulator.cc.

136  {
137  if (m_debug) {
138  std::cout << "RBC --> \n";
140  }
141 }

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

◆ printlayerinfo()

void RBCEmulator::printlayerinfo ( ) const

Definition at line 143 of file RBCEmulator.cc.

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 }

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

Referenced by emulate().

◆ rbcinfo()

const RBCId& RBCEmulator::rbcinfo ( ) const
inline

Definition at line 56 of file RBCEmulator.h.

56 { return m_rbcinfo; }

References m_rbcinfo.

◆ reset()

void RBCEmulator::reset ( void  )

Definition at line 130 of file RBCEmulator.cc.

130  {
131  m_decision.reset();
132  m_layersignal[0]->reset();
133  m_layersignal[1]->reset();
134 }

References m_decision, and m_layersignal.

◆ setid()

void RBCEmulator::setid ( int  wh,
int *  sec 
)

Definition at line 64 of file RBCEmulator.cc.

64 { m_rbcinfo.setid(wh, sec); }

References m_rbcinfo, fileinputsource_cfi::sec, and RBCId::setid().

◆ setSpecifications()

void RBCEmulator::setSpecifications ( const RBCBoardSpecs rbcspecs)

Definition at line 46 of file RBCEmulator.cc.

46  {
47  m_rbcconf = std::make_unique<RBCBasicConfig>(rbcspecs, &m_rbcinfo);
48 }

References m_rbcconf, and m_rbcinfo.

Member Data Documentation

◆ m_debug

bool RBCEmulator::m_debug
private

Definition at line 77 of file RBCEmulator.h.

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

◆ m_decision

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

Definition at line 70 of file RBCEmulator.h.

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

◆ m_input

RBCInput RBCEmulator::m_input
private

Definition at line 66 of file RBCEmulator.h.

Referenced by emulate().

◆ m_layersignal

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

Definition at line 68 of file RBCEmulator.h.

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

◆ m_layersignalVec

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

Definition at line 72 of file RBCEmulator.h.

◆ m_logtype

std::string RBCEmulator::m_logtype
private

Definition at line 75 of file RBCEmulator.h.

◆ m_rbcconf

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

Definition at line 64 of file RBCEmulator.h.

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

◆ m_rbcinfo

RBCId RBCEmulator::m_rbcinfo
private

Definition at line 60 of file RBCEmulator.h.

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

◆ m_signal

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

Definition at line 62 of file RBCEmulator.h.

Referenced by emulate().

RBCEmulator::printlayerinfo
void printlayerinfo() const
Definition: RBCEmulator.cc:143
mps_fire.i
i
Definition: mps_fire.py:428
RBCEmulator::m_signal
std::unique_ptr< ProcessInputSignal > m_signal
Definition: RBCEmulator.h:62
mps_update.status
status
Definition: mps_update.py:69
gather_cfg.cout
cout
Definition: gather_cfg.py:144
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
RBCId::printinfo
void printinfo() const
Definition: RBCId.cc:28
RBCEmulator::m_rbcconf
std::unique_ptr< RBCConfiguration > m_rbcconf
Definition: RBCEmulator.h:64
RBCEmulator::m_logtype
std::string m_logtype
Definition: RBCEmulator.h:75
RBCEmulator::m_layersignal
std::bitset< 6 > * m_layersignal[2]
Definition: RBCEmulator.h:68
RBCId::wheel
int wheel() const
Definition: RBCId.h:28
RBCEmulator::m_debug
bool m_debug
Definition: RBCEmulator.h:77
RBCEmulator::m_layersignalVec
std::array< std::bitset< 6 >, 2 > m_layersignalVec
Definition: RBCEmulator.h:72
RPCInputSignal
Definition: RPCInputSignal.h:12
RBCEmulator::m_input
RBCInput m_input
Definition: RBCEmulator.h:66
recoMuon::in
Definition: RecoMuonEnumerators.h:6
RBCEmulator::m_decision
std::bitset< 2 > m_decision
Definition: RBCEmulator.h:70
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
RBCId::setid
void setid(int _wh, int *_sec)
Definition: RBCId.h:34
RBCEmulator::m_rbcinfo
RBCId m_rbcinfo
Definition: RBCEmulator.h:60
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79