CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
int mode ()
 
void printinfo ()
 
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)
 
virtual ~TTUEmulator ()
 Destructor. More...
 

Public Attributes

int m_maxWheels
 
std::bitset< 2 > m_trigger
 
std::map< int, std::bitset< 2 > > m_triggerBx
 
std::vector< TriggerResponse * > m_triggerBxVec
 
RPCWheelm_Wheels
 

Private Attributes

int m_bx
 
bool m_debug
 
int m_id
 
int m_line
 
std::string m_logtype
 
int m_mode
 
TTUConfigurationm_ttuconf
 
TTUInputm_ttuin
 
int * 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 38 of file TTUEmulator.h.

Constructor & Destructor Documentation

TTUEmulator::TTUEmulator ( )
inline

Standard constructor.

Definition at line 41 of file TTUEmulator.h.

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

Definition at line 22 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_trigger, m_ttuin, m_wheelIds, m_Wheels, and tmp.

23 {
24 
25  m_id = id;
26  m_maxWheels = mxw;
27 
28  int tmp[6] = {1, 2, 0, 0, -1, -2};
29  m_wheelIds = new int[6];
30  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
31 
32  m_Wheels = new RPCWheel[2];
33  for( int k=0; k < m_maxWheels; ++k )
34  m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)] );
35 
36  m_ttuin = new TTUInput[2];
37 
38  m_trigger.reset();
39 
40  m_mode = 1;
41 
42  m_debug = false;
43 
44  m_line = 1;
45 
46 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:84
int m_maxWheels
Definition: TTUEmulator.h:81
int * m_wheelIds
Definition: TTUEmulator.h:124
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TTUInput * m_ttuin
Definition: TTUEmulator.h:128
TTUEmulator::TTUEmulator ( int  id,
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_trigger, m_ttuconf, m_ttuin, m_wheelIds, m_Wheels, and tmp.

50 {
51 
52  m_id = id;
53  m_maxWheels = mxw;
54 
55  int tmp[6] = {1, 2, 0, 0, -1, -2};
56  m_wheelIds = new int[6];
57  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
58 
59  m_Wheels = new RPCWheel[2];
60  for( int k=0; k < m_maxWheels; ++k )
61  m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)], rbclogic_type );
62 
63  m_ttuin = new TTUInput[2];
64 
65  m_ttuconf = dynamic_cast<TTUConfiguration*> (new TTUBasicConfig (ttulogic_type));
66 
67  m_trigger.reset();
68 
69  m_mode = 1;
70 
71  m_debug = false;
72 
73  m_line = 1;
74 
75 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:84
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
int m_maxWheels
Definition: TTUEmulator.h:81
int * m_wheelIds
Definition: TTUEmulator.h:124
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TTUInput * m_ttuin
Definition: TTUEmulator.h:128
TTUEmulator::TTUEmulator ( int  id,
const char *  f_name,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 77 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_trigger, m_ttuconf, m_ttuin, m_wheelIds, m_Wheels, and tmp.

79 {
80 
81  m_id = id;
82  m_maxWheels = mxw;
83 
84  int tmp[6] = {1, 2, 0, 0, -1, -2};
85  m_wheelIds = new int[6];
86  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
87 
88  m_Wheels = new RPCWheel[2];
89  for( int k=0; k < m_maxWheels; ++k )
90  m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)], f_name, rbclogic_type );
91 
92  m_ttuin = new TTUInput[2];
93 
94  m_ttuconf = dynamic_cast<TTUConfiguration*> (new TTUBasicConfig (ttulogic_type));
95 
96  m_trigger.reset();
97 
98  m_mode = 1;
99 
100  m_debug = false;
101 
102  m_line = 1;
103 
104 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:84
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
int m_maxWheels
Definition: TTUEmulator.h:81
int * m_wheelIds
Definition: TTUEmulator.h:124
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TTUInput * m_ttuin
Definition: TTUEmulator.h:128
TTUEmulator::~TTUEmulator ( )
virtual

Destructor.

Definition at line 109 of file TTUEmulator.cc.

References m_ttuconf, m_ttuin, m_wheelIds, and m_Wheels.

109  {
110 
111  if ( m_wheelIds ) delete[] m_wheelIds;
112  if ( m_Wheels ) delete[] m_Wheels;
113  if ( m_ttuin ) delete[] m_ttuin;
114  if ( m_ttuconf ) delete m_ttuconf;
115 
116 }
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
int * m_wheelIds
Definition: TTUEmulator.h:124
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
TTUInput * m_ttuin
Definition: TTUEmulator.h:128

Member Function Documentation

void TTUEmulator::clearTriggerResponse ( )

Definition at line 325 of file TTUEmulator.cc.

References m_triggerBxVec.

Referenced by RPCTechnicalTrigger::produce().

326 {
327 
328  std::vector<TriggerResponse*>::iterator itr;
329  for ( itr = m_triggerBxVec.begin(); itr != m_triggerBxVec.end(); ++itr)
330  if ( (*itr) ) delete (*itr);
331  m_triggerBxVec.clear();
332 
333 }
std::vector< TriggerResponse * > m_triggerBxVec
Definition: TTUEmulator.h:113
void TTUEmulator::emulate ( )

Definition at line 155 of file TTUEmulator.cc.

References gen::k, m_maxWheels, and m_Wheels.

156 {
157  //... only for testing
158  for( int k=0; k < m_maxWheels; ++k )
159  m_Wheels[k].emulate();
160 
161 }
int m_maxWheels
Definition: TTUEmulator.h:81
void emulate()
Definition: TTUEmulator.cc:155
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
bool TTUEmulator::initialise ( )

Definition at line 134 of file TTUEmulator.cc.

References gather_cfg::cout, TTUConfiguration::initialise(), gen::k, m_debug, m_id, m_line, m_maxWheels, m_ttuconf, m_Wheels, and ntuplemaker::status.

Referenced by RPCTechnicalTrigger::beginRun().

135 {
136  bool status(false);
137  for( int k=0; k < m_maxWheels; ++k)
138  status = m_Wheels[k].initialise( );
139 
141 
142  if ( !status ) {
143  if( m_debug ) std::cout << "TTUEmulator> Problem initialising the Configuration \n";
144  return 0; };
145 
146  return status;
147 
148 }
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
int m_maxWheels
Definition: TTUEmulator.h:81
bool initialise()
Definition: TTUEmulator.cc:134
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
virtual bool initialise(int, int)=0
tuple cout
Definition: gather_cfg.py:121
tuple status
Definition: ntuplemaker.py:245
int TTUEmulator::line ( )
inline

Definition at line 73 of file TTUEmulator.h.

References m_line.

Referenced by SetLineId().

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

Definition at line 65 of file TTUEmulator.h.

References m_mode.

Referenced by setmode().

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

Definition at line 337 of file TTUEmulator.cc.

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

Referenced by RPCTechnicalTrigger::printinfo().

338 {
339 
340  std::cout << "TTUEmulator: " << m_id << '\n';
341  for( int k=0; k < m_maxWheels; ++k )
342  m_Wheels[k].printinfo();
343 
344 }
int m_maxWheels
Definition: TTUEmulator.h:81
int k[5][pyjets_maxn]
void printinfo()
Definition: TTUEmulator.cc:337
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
tuple cout
Definition: gather_cfg.py:121
void TTUEmulator::processTtu ( RPCInputSignal signal)

Definition at line 163 of file TTUEmulator.cc.

References gather_cfg::cout, RPCWheel::createWheelMap(), RPCWheel::getid(), TTULogicUnit::isTriggered(), gen::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, TTUConfiguration::m_ttulogic, m_Wheels, LaserDQM_cfg::process, RPCWheel::retrieveWheelMap(), TTULogicUnit::run(), TTUEmulator::TriggerResponse::setTriggerBits(), and generateDummyData::trg().

Referenced by RPCTechnicalTrigger::produce().

164 {
165 
166  //.
167  int bx(0);
168  bool trg(false);
169 
170  if( m_debug ) std::cout << "TTUEmulator::processTtu starts" << '\n';
171 
172  m_trigger.reset();
173  m_triggerBx.clear();
174 
175  std::vector<int> bxVec;
176  std::vector<int>::iterator bxItr;
177  std::map<int,RBCInput*> * linkboardin;
178  std::map<int,RBCInput*>::iterator inItr;
179 
180  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>( signal )->m_linkboardin;
181 
182  for( inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr)
183  {
184 
185  if ( (*inItr).first < 0 ) bx = (int) ceil( (*inItr).first / 1000000.0 );
186  else bx = (int) floor( (*inItr).first / 1000000.0 );
187  bxVec.push_back(bx);
188 
189  }
190 
191  bxItr = unique (bxVec.begin(), bxVec.end());
192  bxVec.resize(bxItr - bxVec.begin());
193 
194  for ( bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
195 
196  TriggerResponse * triggerResponse = new TriggerResponse();
197 
198  for( int k=0; k < m_maxWheels; ++k )
199  {
200 
201  if ( m_Wheels[k].process( (*bxItr) , (*linkboardin) ) ) {
202 
204 
206 
207  //.. execute selected logic at Ttu level
208  m_ttuconf->m_ttulogic->run( (m_ttuin[k]) );
209 
210  //... and produce a Wheel level trigger
212 
213  m_trigger.set(k,trg);
214 
215  if( m_debug ) std::cout << "TTUEmulator::processTtu ttuid: " << m_id
216  << " bx: " << (*bxItr)
217  << " wheel: " << m_Wheels[k].getid()
218  << " response: " << trg << std::endl;
219 
220  }
221 
222 
223  }
224 
225 
226  triggerResponse->setTriggerBits( (*bxItr) , m_trigger );
227  m_triggerBxVec.push_back( triggerResponse );
228  m_triggerBx[ (*bxItr) ] = m_trigger;
229 
230  }
231 
232 
233  if( m_debug ) std::cout << "TTUEmulator::processTtu> size of trigger map "
234  << m_triggerBx.size() << std::endl;
235 
236 
237  if( m_debug ) std::cout << "TTUEmulator::processTtu> done with this TTU: " << m_id << std::endl;
238 
239  bxVec.clear();
240 
241  if( m_debug ) std::cout << "TTUEmulator::processTtu ends" << '\n';
242 
243 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:84
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
bool isTriggered()
Definition: TTULogicUnit.h:41
int getid()
Definition: RPCWheel.h:51
std::vector< TriggerResponse * > m_triggerBxVec
Definition: TTUEmulator.h:113
int m_maxWheels
Definition: TTUEmulator.h:81
void run(const TTUInput &)
Definition: TTULogicUnit.cc:79
void createWheelMap()
Definition: RPCWheel.cc:234
int k[5][pyjets_maxn]
void retrieveWheelMap(TTUInput &)
Definition: RPCWheel.cc:267
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
TTULogicUnit * m_ttulogic
tuple cout
Definition: gather_cfg.py:121
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:85
tuple process
Definition: LaserDQM_cfg.py:3
TTUInput * m_ttuin
Definition: TTUEmulator.h:128
void TTUEmulator::processTtu ( RPCInputSignal signal,
int  wedgeId 
)

Definition at line 245 of file TTUEmulator.cc.

References gather_cfg::cout, RPCWheel::createWheelMap(), RPCWheel::getid(), TTULogicUnit::isTriggered(), gen::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, TTUConfiguration::m_ttulogic, m_Wheels, LaserDQM_cfg::process, RPCWheel::retrieveWheelMap(), TTULogicUnit::run(), TTUEmulator::TriggerResponse::setTriggerBits(), and generateDummyData::trg().

246 {
247 
248  //.
249  int bx(0);
250  bool trg(false);
251 
252  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) starts " << '\n';
253 
254  m_trigger.reset();
255  m_triggerBx.clear();
256 
257  std::vector<int> bxVec;
258  std::vector<int>::iterator bxItr;
259  std::map<int,RBCInput*> * linkboardin;
260  std::map<int,RBCInput*>::iterator inItr;
261 
262  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>( signal )->m_linkboardin;
263 
264  for( inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr)
265  {
266 
267  if ( (*inItr).first < 0 ) bx = (int) ceil( (*inItr).first / 1000000.0 );
268  else bx = (int) floor( (*inItr).first / 1000000.0 );
269  bxVec.push_back(bx);
270 
271  }
272 
273  bxItr = unique (bxVec.begin(), bxVec.end());
274  bxVec.resize(bxItr - bxVec.begin());
275 
276  for ( bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
277 
278  TriggerResponse * triggerResponse = new TriggerResponse();
279 
280  for( int k=0; k < m_maxWheels; ++k )
281  {
282 
283  if ( m_Wheels[k].process( (*bxItr) , (*linkboardin) ) ) { // <- this process uses the default RBC emulation but need a different logic
284 
286 
288 
289  //.. execute selected logic at Ttu level
290  m_ttuconf->m_ttulogic->run( (m_ttuin[k]) , wedgeId );
291 
292  //... and produce a Wheel-Wedge level trigger
294 
295  m_trigger.set(k,trg);
296 
297  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) ttuid: " << m_id
298  << " bx: " << (*bxItr)
299  << " wheel: " << m_Wheels[k].getid()
300  << " response: " << trg << std::endl;
301 
302  }
303 
304 
305  }
306 
307  triggerResponse->setTriggerBits( (*bxItr) , wedgeId, m_trigger );
308  m_triggerBxVec.push_back( triggerResponse );
309  m_triggerBx[ (*bxItr) ] = m_trigger;
310 
311  }
312 
313  if( m_debug ) std::cout << "TTUEmulator::processTtu (Pointing) > size of trigger map "
314  << m_triggerBx.size() << std::endl;
315 
316  if( m_debug ) std::cout << "TTUEmulator::processTtu (Pointing) > done with this TTU: " << m_id << std::endl;
317 
318  bxVec.clear();
319 
320  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) end" << '\n';
321 
322 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:84
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
bool isTriggered()
Definition: TTULogicUnit.h:41
int getid()
Definition: RPCWheel.h:51
std::vector< TriggerResponse * > m_triggerBxVec
Definition: TTUEmulator.h:113
int m_maxWheels
Definition: TTUEmulator.h:81
void run(const TTUInput &)
Definition: TTULogicUnit.cc:79
void createWheelMap()
Definition: RPCWheel.cc:234
int k[5][pyjets_maxn]
void retrieveWheelMap(TTUInput &)
Definition: RPCWheel.cc:267
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
TTULogicUnit * m_ttulogic
tuple cout
Definition: gather_cfg.py:121
std::map< int, std::bitset< 2 > > m_triggerBx
Definition: TTUEmulator.h:85
tuple process
Definition: LaserDQM_cfg.py:3
TTUInput * m_ttuin
Definition: TTUEmulator.h:128
void TTUEmulator::SetLineId ( int  line)

Definition at line 150 of file TTUEmulator.cc.

References line(), and m_line.

Referenced by RPCTechnicalTrigger::beginRun().

151 {
152  m_line = line;
153 }
int line()
Definition: TTUEmulator.h:73
void TTUEmulator::setmode ( int  mode)
inline

Definition at line 69 of file TTUEmulator.h.

References m_mode, and mode().

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

Definition at line 119 of file TTUEmulator.cc.

References gen::k, TTUBoardSpecs::m_boardspecs, m_maxWheels, m_mode, TTUConfiguration::m_ttuboardspecs, m_ttuconf, and m_Wheels.

Referenced by RPCTechnicalTrigger::beginRun().

120 {
121 
122  m_ttuconf = dynamic_cast<TTUConfiguration*> (new TTUBasicConfig (ttuspecs));
123 
124  for( int k=0; k < m_maxWheels; ++k)
125  m_Wheels[k].setSpecifications( rbcspecs );
126 
127  std::vector<TTUBoardSpecs::TTUBoardConfig>::const_iterator itr;
128  itr = m_ttuconf->m_ttuboardspecs->m_boardspecs.begin();
129 
130  m_mode = (*itr).m_triggerMode;
131 
132 }
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:130
const TTUBoardSpecs * m_ttuboardspecs
int m_maxWheels
Definition: TTUEmulator.h:81
std::vector< TTUBoardConfig > m_boardspecs
Definition: TTUBoardSpecs.h:43
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:83
void setSpecifications(const TTUBoardSpecs *, const RBCBoardSpecs *)
Definition: TTUEmulator.cc:119
void TTUEmulator::setSpecs ( )

Member Data Documentation

int TTUEmulator::m_bx
private

Definition at line 120 of file TTUEmulator.h.

bool TTUEmulator::m_debug
private

Definition at line 132 of file TTUEmulator.h.

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

int TTUEmulator::m_id
private

Definition at line 119 of file TTUEmulator.h.

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

int TTUEmulator::m_line
private

Definition at line 122 of file TTUEmulator.h.

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

std::string TTUEmulator::m_logtype
private

Definition at line 126 of file TTUEmulator.h.

int TTUEmulator::m_maxWheels

Definition at line 81 of file TTUEmulator.h.

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

int TTUEmulator::m_mode
private

Definition at line 121 of file TTUEmulator.h.

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

std::bitset<2> TTUEmulator::m_trigger

Definition at line 84 of file TTUEmulator.h.

Referenced by processTtu(), and TTUEmulator().

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

Definition at line 85 of file TTUEmulator.h.

Referenced by processTtu().

std::vector<TriggerResponse*> TTUEmulator::m_triggerBxVec

Definition at line 113 of file TTUEmulator.h.

Referenced by clearTriggerResponse(), processTtu(), and RPCTechnicalTrigger::produce().

TTUConfiguration* TTUEmulator::m_ttuconf
private

Definition at line 130 of file TTUEmulator.h.

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

TTUInput* TTUEmulator::m_ttuin
private

Definition at line 128 of file TTUEmulator.h.

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

int* TTUEmulator::m_wheelIds
private

Definition at line 124 of file TTUEmulator.h.

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

RPCWheel* TTUEmulator::m_Wheels