CMS 3D CMS Logo

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

#include <TTUEmulator.h>

Classes

class  TriggerResponse
 

Public Member Functions

void clearTriggerResponse ()
 
void emulate ()
 
bool initialise ()
 
int line () const
 
int mode () const
 
void printinfo () const
 
void processTtu (RPCInputSignal *)
 
void processTtu (RPCInputSignal *, int)
 
void SetLineId (int)
 
void setmode (int mode)
 
void setSpecifications (const TTUBoardSpecs *, const RBCBoardSpecs *)
 
void setSpecs ()
 
 TTUEmulator ()
 Standard constructor. More...
 
 TTUEmulator (int, const char *, const char *, const char *, int)
 
 TTUEmulator (int, const char *, const char *, int)
 
 TTUEmulator (int, int)
 

Public Attributes

int m_maxWheels
 
std::bitset< 2 > m_trigger
 
std::map< int, std::bitset< 2 > > m_triggerBx
 
std::vector< TriggerResponsem_triggerBxVec
 
std::array< RPCWheel, 2 > m_Wheels
 

Private Attributes

int m_bx
 
bool m_debug
 
int m_id
 
int m_line
 
std::string m_logtype
 
int m_mode
 
std::unique_ptr< TTUConfigurationm_ttuconf
 
std::array< TTUInput, 2 > m_ttuin
 
std::array< int, 6 > m_wheelIds
 

Detailed Description

This class performs the following tasks [ref 2]:

The default algorithm is implemented is TrackingAlg [ref 2].

ref 2: "A configurable Tracking Algorithm to detect cosmic muon tracks for the CMS-RPC based Technical Trigger", R.T.Rajan et al

Author
Andres Osorio

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

Date
2008-10-15

Definition at line 39 of file TTUEmulator.h.

Constructor & Destructor Documentation

◆ TTUEmulator() [1/4]

TTUEmulator::TTUEmulator ( )
inline

Standard constructor.

Definition at line 42 of file TTUEmulator.h.

42 {};

◆ TTUEmulator() [2/4]

TTUEmulator::TTUEmulator ( int  id,
int  mxw 
)

Definition at line 24 of file TTUEmulator.cc.

24  : m_maxWheels{mxw}, m_id{id}, m_mode{1}, m_line{1}, m_debug{false} {
25  for (int k = 0; k < m_maxWheels; ++k)
26  m_Wheels[k].setProperties(wheelIds[(id * 2) + (k - 2)]);
27 }

◆ TTUEmulator() [3/4]

TTUEmulator::TTUEmulator ( int  id,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 29 of file TTUEmulator.cc.

30  : m_maxWheels{mxw},
31  m_id{id},
32  m_mode{1},
33  m_line{1},
34  m_ttuconf{std::make_unique<TTUBasicConfig>(ttulogic_type)},
35  m_debug{false} {
36  for (int k = 0; k < m_maxWheels; ++k)
37  m_Wheels[k].setProperties(wheelIds[(id * 2) + (k - 2)], rbclogic_type);
38 }

◆ TTUEmulator() [4/4]

TTUEmulator::TTUEmulator ( int  id,
const char *  f_name,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 40 of file TTUEmulator.cc.

41  : m_maxWheels{mxw},
42  m_id{id},
43  m_mode{1},
44  m_line{1},
45  m_ttuconf{std::make_unique<TTUBasicConfig>(ttulogic_type)},
46  m_debug{false} {
47  for (int k = 0; k < m_maxWheels; ++k)
48  m_Wheels[k].setProperties(wheelIds[(id * 2) + (k - 2)], f_name, rbclogic_type);
49 }

Member Function Documentation

◆ clearTriggerResponse()

void TTUEmulator::clearTriggerResponse ( )

Definition at line 228 of file TTUEmulator.cc.

228 { m_triggerBxVec.clear(); }

References m_triggerBxVec.

◆ emulate()

void TTUEmulator::emulate ( )

Definition at line 82 of file TTUEmulator.cc.

82  {
83  //... only for testing
84  for (int k = 0; k < m_maxWheels; ++k)
85  m_Wheels[k].emulate();
86 }

References dqmdumpme::k, m_maxWheels, and m_Wheels.

◆ initialise()

bool TTUEmulator::initialise ( )

Definition at line 64 of file TTUEmulator.cc.

64  {
65  bool status(false);
66  for (int k = 0; k < m_maxWheels; ++k)
68 
69  status = m_ttuconf->initialise(m_line, m_id);
70 
71  if (!status) {
72  if (m_debug)
73  std::cout << "TTUEmulator> Problem initialising the Configuration \n";
74  return false;
75  };
76 
77  return status;
78 }

References gather_cfg::cout, dqmdumpme::k, m_debug, m_id, m_line, m_maxWheels, m_ttuconf, m_Wheels, and mps_update::status.

◆ line()

int TTUEmulator::line ( ) const
inline

Definition at line 68 of file TTUEmulator.h.

68 { return m_line; };

References m_line.

Referenced by SetLineId().

◆ mode()

int TTUEmulator::mode ( void  ) const
inline

Definition at line 64 of file TTUEmulator.h.

64 { return m_mode; };

References m_mode.

Referenced by setmode().

◆ printinfo()

void TTUEmulator::printinfo ( ) const

Definition at line 232 of file TTUEmulator.cc.

232  {
233  std::cout << "TTUEmulator: " << m_id << '\n';
234  for (int k = 0; k < m_maxWheels; ++k)
235  m_Wheels[k].printinfo();
236 }

References gather_cfg::cout, dqmdumpme::k, m_id, m_maxWheels, and m_Wheels.

◆ processTtu() [1/2]

void TTUEmulator::processTtu ( RPCInputSignal signal)

Definition at line 88 of file TTUEmulator.cc.

88  {
89  //.
90  int bx(0);
91  bool trg(false);
92 
93  if (m_debug)
94  std::cout << "TTUEmulator::processTtu starts" << '\n';
95 
96  m_trigger.reset();
97  m_triggerBx.clear();
98 
99  std::vector<int> bxVec;
100  std::vector<int>::iterator bxItr;
101  std::map<int, RBCInput*>* linkboardin;
102  std::map<int, RBCInput*>::iterator inItr;
103 
104  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>(signal)->m_linkboardin;
105 
106  for (inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr) {
107  if ((*inItr).first < 0)
108  bx = (int)ceil((*inItr).first / 1000000.0);
109  else
110  bx = (int)floor((*inItr).first / 1000000.0);
111  bxVec.push_back(bx);
112  }
113 
114  bxItr = unique(bxVec.begin(), bxVec.end());
115  bxVec.resize(bxItr - bxVec.begin());
116 
117  m_triggerBxVec.reserve(m_triggerBxVec.size() + bxVec.size());
118  for (bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
119  for (int k = 0; k < m_maxWheels; ++k) {
120  if (m_Wheels[k].process((*bxItr), (*linkboardin))) {
121  m_Wheels[k].createWheelMap();
122 
123  m_Wheels[k].retrieveWheelMap((m_ttuin[k]));
124 
125  //.. execute selected logic at Ttu level
126  m_ttuconf->ttulogic()->run((m_ttuin[k]));
127 
128  //... and produce a Wheel level trigger
129  trg = m_ttuconf->ttulogic()->isTriggered();
130 
131  m_trigger.set(k, trg);
132 
133  if (m_debug)
134  std::cout << "TTUEmulator::processTtu ttuid: " << m_id << " bx: " << (*bxItr)
135  << " wheel: " << m_Wheels[k].getid() << " response: " << trg << std::endl;
136  }
137  }
138 
139  auto& triggerResponse = m_triggerBxVec.emplace_back();
140 
141  triggerResponse.setTriggerBits((*bxItr), m_trigger);
142  m_triggerBx[(*bxItr)] = m_trigger;
143  }
144 
145  if (m_debug)
146  std::cout << "TTUEmulator::processTtu> size of trigger map " << m_triggerBx.size() << std::endl;
147 
148  if (m_debug)
149  std::cout << "TTUEmulator::processTtu> done with this TTU: " << m_id << std::endl;
150 
151  bxVec.clear();
152 
153  if (m_debug)
154  std::cout << "TTUEmulator::processTtu ends" << '\n';
155 }

References l1GtPatternGenerator_cfi::bx, reco::ceil(), gather_cfg::cout, createfilelist::int, dqmdumpme::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, m_Wheels, LaserDQM_cfg::process, and tier0::unique().

◆ processTtu() [2/2]

void TTUEmulator::processTtu ( RPCInputSignal signal,
int  wedgeId 
)

Definition at line 157 of file TTUEmulator.cc.

157  {
158  //.
159  int bx(0);
160  bool trg(false);
161 
162  if (m_debug)
163  std::cout << "TTUEmulator::processTtu( Pointing ) starts " << '\n';
164 
165  m_trigger.reset();
166  m_triggerBx.clear();
167 
168  std::vector<int> bxVec;
169  std::vector<int>::iterator bxItr;
170  std::map<int, RBCInput*>* linkboardin;
171  std::map<int, RBCInput*>::iterator inItr;
172 
173  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>(signal)->m_linkboardin;
174 
175  for (inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr) {
176  if ((*inItr).first < 0)
177  bx = (int)ceil((*inItr).first / 1000000.0);
178  else
179  bx = (int)floor((*inItr).first / 1000000.0);
180  bxVec.push_back(bx);
181  }
182 
183  bxItr = unique(bxVec.begin(), bxVec.end());
184  bxVec.resize(bxItr - bxVec.begin());
185 
186  m_triggerBxVec.reserve(m_triggerBxVec.size() + bxVec.size());
187 
188  for (bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
189  for (int k = 0; k < m_maxWheels; ++k) {
190  if (m_Wheels[k].process(
191  (*bxItr), (*linkboardin))) { // <- this process uses the default RBC emulation but need a different logic
192 
193  m_Wheels[k].createWheelMap();
194 
195  m_Wheels[k].retrieveWheelMap((m_ttuin[k]));
196 
197  //.. execute selected logic at Ttu level
198  m_ttuconf->ttulogic()->run((m_ttuin[k]), wedgeId);
199 
200  //... and produce a Wheel-Wedge level trigger
201  trg = m_ttuconf->ttulogic()->isTriggered();
202 
203  m_trigger.set(k, trg);
204 
205  if (m_debug)
206  std::cout << "TTUEmulator::processTtu( Pointing ) ttuid: " << m_id << " bx: " << (*bxItr)
207  << " wheel: " << m_Wheels[k].getid() << " response: " << trg << std::endl;
208  }
209  }
210 
211  auto& triggerResponse = m_triggerBxVec.emplace_back();
212  triggerResponse.setTriggerBits((*bxItr), wedgeId, m_trigger);
213  m_triggerBx[(*bxItr)] = m_trigger;
214  }
215 
216  if (m_debug)
217  std::cout << "TTUEmulator::processTtu (Pointing) > size of trigger map " << m_triggerBx.size() << std::endl;
218 
219  if (m_debug)
220  std::cout << "TTUEmulator::processTtu (Pointing) > done with this TTU: " << m_id << std::endl;
221 
222  bxVec.clear();
223 
224  if (m_debug)
225  std::cout << "TTUEmulator::processTtu( Pointing ) end" << '\n';
226 }

References l1GtPatternGenerator_cfi::bx, reco::ceil(), gather_cfg::cout, createfilelist::int, dqmdumpme::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, m_Wheels, LaserDQM_cfg::process, and tier0::unique().

◆ SetLineId()

void TTUEmulator::SetLineId ( int  line)

Definition at line 80 of file TTUEmulator.cc.

80 { m_line = line; }

References line(), and m_line.

◆ setmode()

void TTUEmulator::setmode ( int  mode)
inline

Definition at line 66 of file TTUEmulator.h.

66 { m_mode = mode; };

References m_mode, and mode().

◆ setSpecifications()

void TTUEmulator::setSpecifications ( const TTUBoardSpecs ttuspecs,
const RBCBoardSpecs rbcspecs 
)

Definition at line 52 of file TTUEmulator.cc.

52  {
53  m_ttuconf = std::make_unique<TTUBasicConfig>(ttuspecs);
54 
55  for (int k = 0; k < m_maxWheels; ++k)
56  m_Wheels[k].setSpecifications(rbcspecs);
57 
58  std::vector<TTUBoardSpecs::TTUBoardConfig>::const_iterator itr;
59  itr = m_ttuconf->m_ttuboardspecs->m_boardspecs.begin();
60 
61  m_mode = (*itr).m_triggerMode;
62 }

References dqmdumpme::k, m_maxWheels, m_mode, m_ttuconf, and m_Wheels.

◆ setSpecs()

void TTUEmulator::setSpecs ( )

Member Data Documentation

◆ m_bx

int TTUEmulator::m_bx
private

Definition at line 110 of file TTUEmulator.h.

◆ m_debug

bool TTUEmulator::m_debug
private

Definition at line 122 of file TTUEmulator.h.

Referenced by initialise(), and processTtu().

◆ m_id

int TTUEmulator::m_id
private

Definition at line 109 of file TTUEmulator.h.

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

◆ m_line

int TTUEmulator::m_line
private

Definition at line 112 of file TTUEmulator.h.

Referenced by initialise(), line(), and SetLineId().

◆ m_logtype

std::string TTUEmulator::m_logtype
private

Definition at line 116 of file TTUEmulator.h.

◆ m_maxWheels

int TTUEmulator::m_maxWheels

Definition at line 74 of file TTUEmulator.h.

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

◆ m_mode

int TTUEmulator::m_mode
private

Definition at line 111 of file TTUEmulator.h.

Referenced by mode(), setmode(), and setSpecifications().

◆ m_trigger

std::bitset<2> TTUEmulator::m_trigger

Definition at line 77 of file TTUEmulator.h.

Referenced by processTtu().

◆ m_triggerBx

std::map<int, std::bitset<2> > TTUEmulator::m_triggerBx

Definition at line 78 of file TTUEmulator.h.

Referenced by processTtu().

◆ m_triggerBxVec

std::vector<TriggerResponse> TTUEmulator::m_triggerBxVec

Definition at line 105 of file TTUEmulator.h.

Referenced by clearTriggerResponse(), and processTtu().

◆ m_ttuconf

std::unique_ptr<TTUConfiguration> TTUEmulator::m_ttuconf
private

Definition at line 120 of file TTUEmulator.h.

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

◆ m_ttuin

std::array<TTUInput, 2> TTUEmulator::m_ttuin
private

Definition at line 118 of file TTUEmulator.h.

Referenced by processTtu().

◆ m_wheelIds

std::array<int, 6> TTUEmulator::m_wheelIds
private

Definition at line 114 of file TTUEmulator.h.

◆ m_Wheels

std::array<RPCWheel, 2> TTUEmulator::m_Wheels

Definition at line 76 of file TTUEmulator.h.

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

TTUEmulator::m_Wheels
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
TTUEmulator::setSpecifications
void setSpecifications(const TTUBoardSpecs *, const RBCBoardSpecs *)
Definition: TTUEmulator.cc:52
TTUEmulator::m_trigger
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:77
mps_update.status
status
Definition: mps_update.py:69
TTUEmulator::mode
int mode() const
Definition: TTUEmulator.h:64
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
TTUEmulator::m_triggerBxVec
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:105
TTUEmulator::printinfo
void printinfo() const
Definition: TTUEmulator.cc:232
TTUEmulator::m_maxWheels
int m_maxWheels
Definition: TTUEmulator.h:74
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
TTUEmulator::m_ttuconf
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120
TTUEmulator::m_mode
int m_mode
Definition: TTUEmulator.h:111
dqmdumpme.k
k
Definition: dqmdumpme.py:60
TTUEmulator::initialise
bool initialise()
Definition: TTUEmulator.cc:64
TTUEmulator::emulate
void emulate()
Definition: TTUEmulator.cc:82
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
createfilelist.int
int
Definition: createfilelist.py:10
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
TTUEmulator::m_id
int m_id
Definition: TTUEmulator.h:109
TTUEmulator::m_debug
bool m_debug
Definition: TTUEmulator.h:122
TTUEmulator::m_line
int m_line
Definition: TTUEmulator.h:112
TTUEmulator::m_triggerBx
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:78
TTUEmulator::m_ttuin
std::array< TTUInput, 2 > m_ttuin
Definition: TTUEmulator.h:118
TTUEmulator::line
int line() const
Definition: TTUEmulator.h:68