CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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, int)
 
 TTUEmulator (int, const char *, const char *, int)
 
 TTUEmulator (int, const char *, const char *, const char *, 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::TTUEmulator ( )
inline

Standard constructor.

Definition at line 42 of file TTUEmulator.h.

42 {};
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 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
int m_maxWheels
Definition: TTUEmulator.h:74
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 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
int m_maxWheels
Definition: TTUEmulator.h:74
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120
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 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
int m_maxWheels
Definition: TTUEmulator.h:74
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120

Member Function Documentation

void TTUEmulator::clearTriggerResponse ( )

Definition at line 228 of file TTUEmulator.cc.

References m_triggerBxVec.

228 { m_triggerBxVec.clear(); }
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:105
void TTUEmulator::emulate ( )

Definition at line 82 of file TTUEmulator.cc.

References isotrackApplyRegressor::k, m_maxWheels, and m_Wheels.

82  {
83  //... only for testing
84  for (int k = 0; k < m_maxWheels; ++k)
85  m_Wheels[k].emulate();
86 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
int m_maxWheels
Definition: TTUEmulator.h:74
void emulate()
Definition: TTUEmulator.cc:82
bool TTUEmulator::initialise ( )

Definition at line 64 of file TTUEmulator.cc.

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

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 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
list status
Definition: mps_update.py:107
int m_maxWheels
Definition: TTUEmulator.h:74
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120
bool initialise()
Definition: TTUEmulator.cc:64
tuple cout
Definition: gather_cfg.py:144
int TTUEmulator::line ( ) const
inline

Definition at line 68 of file TTUEmulator.h.

References m_line.

Referenced by SetLineId().

68 { return m_line; };
int TTUEmulator::mode ( void  ) const
inline

Definition at line 64 of file TTUEmulator.h.

References m_mode.

Referenced by setmode().

64 { return m_mode; };
void TTUEmulator::printinfo ( ) const

Definition at line 232 of file TTUEmulator.cc.

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

232  {
233  std::cout << "TTUEmulator: " << m_id << '\n';
234  for (int k = 0; k < m_maxWheels; ++k)
235  m_Wheels[k].printinfo();
236 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
void printinfo() const
Definition: TTUEmulator.cc:232
int m_maxWheels
Definition: TTUEmulator.h:74
tuple cout
Definition: gather_cfg.py:144
void TTUEmulator::processTtu ( RPCInputSignal signal)

Definition at line 88 of file TTUEmulator.cc.

References makePileupJSON::bx, reco::ceil(), gather_cfg::cout, isotrackApplyRegressor::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().

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 }
constexpr int32_t ceil(float num)
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:77
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:105
def unique
Definition: tier0.py:24
int m_maxWheels
Definition: TTUEmulator.h:74
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120
tuple cout
Definition: gather_cfg.py:144
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:78
tuple process
Definition: LaserDQM_cfg.py:3
std::array< TTUInput, 2 > m_ttuin
Definition: TTUEmulator.h:118
void TTUEmulator::processTtu ( RPCInputSignal signal,
int  wedgeId 
)

Definition at line 157 of file TTUEmulator.cc.

References makePileupJSON::bx, reco::ceil(), gather_cfg::cout, isotrackApplyRegressor::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().

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 }
constexpr int32_t ceil(float num)
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:77
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:105
def unique
Definition: tier0.py:24
int m_maxWheels
Definition: TTUEmulator.h:74
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120
tuple cout
Definition: gather_cfg.py:144
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:78
tuple process
Definition: LaserDQM_cfg.py:3
std::array< TTUInput, 2 > m_ttuin
Definition: TTUEmulator.h:118
void TTUEmulator::SetLineId ( int  line)

Definition at line 80 of file TTUEmulator.cc.

References line(), and m_line.

80 { m_line = line; }
int line() const
Definition: TTUEmulator.h:68
void TTUEmulator::setmode ( int  mode)
inline

Definition at line 66 of file TTUEmulator.h.

References m_mode, and mode().

66 { m_mode = mode; };
int mode() const
Definition: TTUEmulator.h:64
void TTUEmulator::setSpecifications ( const TTUBoardSpecs ttuspecs,
const RBCBoardSpecs rbcspecs 
)

Definition at line 52 of file TTUEmulator.cc.

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

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 }
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:76
int m_maxWheels
Definition: TTUEmulator.h:74
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:120
void setSpecifications(const TTUBoardSpecs *, const RBCBoardSpecs *)
Definition: TTUEmulator.cc:52
void TTUEmulator::setSpecs ( )

Member Data Documentation

int TTUEmulator::m_bx
private

Definition at line 110 of file TTUEmulator.h.

bool TTUEmulator::m_debug
private

Definition at line 122 of file TTUEmulator.h.

Referenced by initialise(), and processTtu().

int TTUEmulator::m_id
private

Definition at line 109 of file TTUEmulator.h.

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

int TTUEmulator::m_line
private

Definition at line 112 of file TTUEmulator.h.

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

std::string TTUEmulator::m_logtype
private

Definition at line 116 of file TTUEmulator.h.

int TTUEmulator::m_maxWheels

Definition at line 74 of file TTUEmulator.h.

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

int TTUEmulator::m_mode
private

Definition at line 111 of file TTUEmulator.h.

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

std::bitset<2> TTUEmulator::m_trigger

Definition at line 77 of file TTUEmulator.h.

Referenced by processTtu().

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

Definition at line 78 of file TTUEmulator.h.

Referenced by processTtu().

std::vector<TriggerResponse> TTUEmulator::m_triggerBxVec

Definition at line 105 of file TTUEmulator.h.

Referenced by clearTriggerResponse(), and processTtu().

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

Definition at line 120 of file TTUEmulator.h.

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

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

Definition at line 118 of file TTUEmulator.h.

Referenced by processTtu().

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

Definition at line 114 of file TTUEmulator.h.

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

Definition at line 76 of file TTUEmulator.h.

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