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, 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.

References clearTriggerResponse(), emulate(), initialise(), printinfo(), processTtu(), and setSpecifications().

42 { };
TTUEmulator::TTUEmulator ( int  id,
int  mxw 
)

Definition at line 25 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, and m_Wheels.

25  :
26  m_maxWheels{mxw},
27  m_id{id},
28  m_mode{1},
29  m_line{1},
30  m_debug{ false }
31 {
32  for( int k=0; k < m_maxWheels; ++k )
33  m_Wheels[k].setProperties( wheelIds[(id*2)+(k-2)] );
34 }
int m_maxWheels
Definition: TTUEmulator.h:80
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
TTUEmulator::TTUEmulator ( int  id,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 37 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_ttuconf, and m_Wheels.

37  :
38  m_maxWheels{mxw},
39  m_id{id},
40  m_mode{1},
41  m_line{1},
42  m_ttuconf{std::make_unique<TTUBasicConfig>(ttulogic_type)},
43  m_debug{false}
44 {
45  for( int k=0; k < m_maxWheels; ++k )
46  m_Wheels[k].setProperties( wheelIds[(id*2)+(k-2)], rbclogic_type );
47 }
int m_maxWheels
Definition: TTUEmulator.h:80
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:129
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
TTUEmulator::TTUEmulator ( int  id,
const char *  f_name,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 49 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_ttuconf, and m_Wheels.

50  :
51  m_maxWheels{mxw},
52  m_id{id},
53  m_mode{1},
54  m_line{1},
55  m_ttuconf{std::make_unique<TTUBasicConfig>(ttulogic_type)},
56  m_debug{false}
57 {
58 
59  for( int k=0; k < m_maxWheels; ++k )
60  m_Wheels[k].setProperties( wheelIds[(id*2)+(k-2)], f_name, rbclogic_type );
61 }
int m_maxWheels
Definition: TTUEmulator.h:80
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:129
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82

Member Function Documentation

void TTUEmulator::clearTriggerResponse ( )

Definition at line 268 of file TTUEmulator.cc.

References m_triggerBxVec.

Referenced by TTUEmulator().

269 {
270  m_triggerBxVec.clear();
271 }
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:112
void TTUEmulator::emulate ( )

Definition at line 100 of file TTUEmulator.cc.

References gen::k, m_maxWheels, and m_Wheels.

Referenced by TTUEmulator().

101 {
102  //... only for testing
103  for( int k=0; k < m_maxWheels; ++k )
104  m_Wheels[k].emulate();
105 
106 }
int m_maxWheels
Definition: TTUEmulator.h:80
void emulate()
Definition: TTUEmulator.cc:100
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
bool TTUEmulator::initialise ( )

Definition at line 79 of file TTUEmulator.cc.

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

Referenced by TTUEmulator().

80 {
81  bool status(false);
82  for( int k=0; k < m_maxWheels; ++k)
84 
85  status = m_ttuconf->initialise( m_line , m_id );
86 
87  if ( !status ) {
88  if( m_debug ) std::cout << "TTUEmulator> Problem initialising the Configuration \n";
89  return false; };
90 
91  return status;
92 
93 }
int m_maxWheels
Definition: TTUEmulator.h:80
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:129
bool initialise()
Definition: TTUEmulator.cc:79
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
int TTUEmulator::line ( ) const
inline

Definition at line 72 of file TTUEmulator.h.

References m_line, SetLineId(), and setSpecs().

Referenced by SetLineId().

72  {
73  return m_line;
74  };
int TTUEmulator::mode ( void  ) const
inline

Definition at line 64 of file TTUEmulator.h.

References m_mode.

Referenced by setmode().

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

Definition at line 275 of file TTUEmulator.cc.

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

Referenced by TTUEmulator().

276 {
277 
278  std::cout << "TTUEmulator: " << m_id << '\n';
279  for( int k=0; k < m_maxWheels; ++k )
280  m_Wheels[k].printinfo();
281 
282 }
void printinfo() const
Definition: TTUEmulator.cc:275
int m_maxWheels
Definition: TTUEmulator.h:80
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
void TTUEmulator::processTtu ( RPCInputSignal signal)

Definition at line 108 of file TTUEmulator.cc.

References gather_cfg::cout, createfilelist::int, gen::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, m_Wheels, LaserDQM_cfg::process, generateDummyData::trg(), and tier0::unique().

Referenced by TTUEmulator().

109 {
110 
111  //.
112  int bx(0);
113  bool trg(false);
114 
115  if( m_debug ) std::cout << "TTUEmulator::processTtu starts" << '\n';
116 
117  m_trigger.reset();
118  m_triggerBx.clear();
119 
120  std::vector<int> bxVec;
121  std::vector<int>::iterator bxItr;
122  std::map<int,RBCInput*> * linkboardin;
123  std::map<int,RBCInput*>::iterator inItr;
124 
125  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>( signal )->m_linkboardin;
126 
127  for( inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr)
128  {
129 
130  if ( (*inItr).first < 0 ) bx = (int) ceil( (*inItr).first / 1000000.0 );
131  else bx = (int) floor( (*inItr).first / 1000000.0 );
132  bxVec.push_back(bx);
133 
134  }
135 
136  bxItr = unique (bxVec.begin(), bxVec.end());
137  bxVec.resize(bxItr - bxVec.begin());
138 
139  m_triggerBxVec.reserve(m_triggerBxVec.size()+bxVec.size());
140  for ( bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
141 
142  for( int k=0; k < m_maxWheels; ++k )
143  {
144 
145  if ( m_Wheels[k].process( (*bxItr) , (*linkboardin) ) ) {
146 
147  m_Wheels[k].createWheelMap();
148 
149  m_Wheels[k].retrieveWheelMap( (m_ttuin[k]) );
150 
151  //.. execute selected logic at Ttu level
152  m_ttuconf->ttulogic()->run( (m_ttuin[k]) );
153 
154  //... and produce a Wheel level trigger
155  trg = m_ttuconf->ttulogic()->isTriggered();
156 
157  m_trigger.set(k,trg);
158 
159  if( m_debug ) std::cout << "TTUEmulator::processTtu ttuid: " << m_id
160  << " bx: " << (*bxItr)
161  << " wheel: " << m_Wheels[k].getid()
162  << " response: " << trg << std::endl;
163 
164  }
165 
166 
167  }
168 
169  auto& triggerResponse = m_triggerBxVec.emplace_back();
170 
171  triggerResponse.setTriggerBits( (*bxItr) , m_trigger );
172  m_triggerBx[ (*bxItr) ] = m_trigger;
173 
174  }
175 
176 
177  if( m_debug ) std::cout << "TTUEmulator::processTtu> size of trigger map "
178  << m_triggerBx.size() << std::endl;
179 
180 
181  if( m_debug ) std::cout << "TTUEmulator::processTtu> done with this TTU: " << m_id << std::endl;
182 
183  bxVec.clear();
184 
185  if( m_debug ) std::cout << "TTUEmulator::processTtu ends" << '\n';
186 
187 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:83
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:112
int m_maxWheels
Definition: TTUEmulator.h:80
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:129
def trg(schema, nls)
def unique(seq, keepstr=True)
Definition: tier0.py:25
std::array< TTUInput, 2 > m_ttuin
Definition: TTUEmulator.h:127
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:84
void TTUEmulator::processTtu ( RPCInputSignal signal,
int  wedgeId 
)

Definition at line 189 of file TTUEmulator.cc.

References gather_cfg::cout, createfilelist::int, gen::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, m_Wheels, LaserDQM_cfg::process, generateDummyData::trg(), and tier0::unique().

190 {
191 
192  //.
193  int bx(0);
194  bool trg(false);
195 
196  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) starts " << '\n';
197 
198  m_trigger.reset();
199  m_triggerBx.clear();
200 
201  std::vector<int> bxVec;
202  std::vector<int>::iterator bxItr;
203  std::map<int,RBCInput*> * linkboardin;
204  std::map<int,RBCInput*>::iterator inItr;
205 
206  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>( signal )->m_linkboardin;
207 
208  for( inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr)
209  {
210 
211  if ( (*inItr).first < 0 ) bx = (int) ceil( (*inItr).first / 1000000.0 );
212  else bx = (int) floor( (*inItr).first / 1000000.0 );
213  bxVec.push_back(bx);
214 
215  }
216 
217  bxItr = unique (bxVec.begin(), bxVec.end());
218  bxVec.resize(bxItr - bxVec.begin());
219 
220  m_triggerBxVec.reserve(m_triggerBxVec.size()+bxVec.size());
221 
222  for ( bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
223 
224  for( int k=0; k < m_maxWheels; ++k )
225  {
226 
227  if ( m_Wheels[k].process( (*bxItr) , (*linkboardin) ) ) { // <- this process uses the default RBC emulation but need a different logic
228 
229  m_Wheels[k].createWheelMap();
230 
231  m_Wheels[k].retrieveWheelMap( (m_ttuin[k]) );
232 
233  //.. execute selected logic at Ttu level
234  m_ttuconf->ttulogic()->run( (m_ttuin[k]) , wedgeId );
235 
236  //... and produce a Wheel-Wedge level trigger
237  trg = m_ttuconf->ttulogic()->isTriggered();
238 
239  m_trigger.set(k,trg);
240 
241  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) ttuid: " << m_id
242  << " bx: " << (*bxItr)
243  << " wheel: " << m_Wheels[k].getid()
244  << " response: " << trg << std::endl;
245 
246  }
247 
248 
249  }
250 
251  auto& triggerResponse = m_triggerBxVec.emplace_back();
252  triggerResponse.setTriggerBits( (*bxItr) , wedgeId, m_trigger );
253  m_triggerBx[ (*bxItr) ] = m_trigger;
254  }
255 
256  if( m_debug ) std::cout << "TTUEmulator::processTtu (Pointing) > size of trigger map "
257  << m_triggerBx.size() << std::endl;
258 
259  if( m_debug ) std::cout << "TTUEmulator::processTtu (Pointing) > done with this TTU: " << m_id << std::endl;
260 
261  bxVec.clear();
262 
263  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) end" << '\n';
264 
265 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:83
std::vector< TriggerResponse > m_triggerBxVec
Definition: TTUEmulator.h:112
int m_maxWheels
Definition: TTUEmulator.h:80
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:129
def trg(schema, nls)
def unique(seq, keepstr=True)
Definition: tier0.py:25
std::array< TTUInput, 2 > m_ttuin
Definition: TTUEmulator.h:127
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:84
void TTUEmulator::SetLineId ( int  line)

Definition at line 95 of file TTUEmulator.cc.

References line(), and m_line.

Referenced by line().

96 {
97  m_line = line;
98 }
int line() const
Definition: TTUEmulator.h:72
void TTUEmulator::setmode ( int  mode)
inline

Definition at line 68 of file TTUEmulator.h.

References m_mode, and mode().

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

Definition at line 64 of file TTUEmulator.cc.

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

Referenced by TTUEmulator().

65 {
66 
67  m_ttuconf = std::make_unique<TTUBasicConfig>(ttuspecs);
68 
69  for( int k=0; k < m_maxWheels; ++k)
70  m_Wheels[k].setSpecifications( rbcspecs );
71 
72  std::vector<TTUBoardSpecs::TTUBoardConfig>::const_iterator itr;
73  itr = m_ttuconf->m_ttuboardspecs->m_boardspecs.begin();
74 
75  m_mode = (*itr).m_triggerMode;
76 
77 }
int m_maxWheels
Definition: TTUEmulator.h:80
std::unique_ptr< TTUConfiguration > m_ttuconf
Definition: TTUEmulator.h:129
int k[5][pyjets_maxn]
std::array< RPCWheel, 2 > m_Wheels
Definition: TTUEmulator.h:82
void setSpecifications(const TTUBoardSpecs *, const RBCBoardSpecs *)
Definition: TTUEmulator.cc:64
void TTUEmulator::setSpecs ( )

Referenced by line().

Member Data Documentation

int TTUEmulator::m_bx
private

Definition at line 119 of file TTUEmulator.h.

bool TTUEmulator::m_debug
private

Definition at line 131 of file TTUEmulator.h.

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

int TTUEmulator::m_id
private

Definition at line 118 of file TTUEmulator.h.

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

int TTUEmulator::m_line
private

Definition at line 121 of file TTUEmulator.h.

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

std::string TTUEmulator::m_logtype
private

Definition at line 125 of file TTUEmulator.h.

int TTUEmulator::m_maxWheels

Definition at line 80 of file TTUEmulator.h.

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

int TTUEmulator::m_mode
private

Definition at line 120 of file TTUEmulator.h.

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

std::bitset<2> TTUEmulator::m_trigger

Definition at line 83 of file TTUEmulator.h.

Referenced by processTtu().

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

Definition at line 84 of file TTUEmulator.h.

Referenced by processTtu().

std::vector<TriggerResponse> TTUEmulator::m_triggerBxVec

Definition at line 112 of file TTUEmulator.h.

Referenced by clearTriggerResponse(), and processTtu().

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

Definition at line 129 of file TTUEmulator.h.

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

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

Definition at line 127 of file TTUEmulator.h.

Referenced by processTtu().

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

Definition at line 123 of file TTUEmulator.h.

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

Definition at line 82 of file TTUEmulator.h.

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