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 37 of file TTUEmulator.h.

Constructor & Destructor Documentation

TTUEmulator::TTUEmulator ( )
inline

Standard constructor.

Definition at line 40 of file TTUEmulator.h.

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

Definition at line 21 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.

22 {
23 
24  m_id = id;
25  m_maxWheels = mxw;
26 
27  int tmp[6] = {1, 2, 0, 0, -1, -2};
28  m_wheelIds = new int[6];
29  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
30 
31  m_Wheels = new RPCWheel[2];
32  for( int k=0; k < m_maxWheels; ++k )
33  m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)] );
34 
35  m_ttuin = new TTUInput[2];
36 
37  m_trigger.reset();
38 
39  m_mode = 1;
40 
41  m_debug = false;
42 
43  m_line = 1;
44 
45 }
std::bitset< 2 > m_trigger
Definition: TTUEmulator.h:83
int m_maxWheels
Definition: TTUEmulator.h:80
int * m_wheelIds
Definition: TTUEmulator.h:123
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:82
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TTUInput * m_ttuin
Definition: TTUEmulator.h:127
TTUEmulator::TTUEmulator ( int  id,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 48 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.

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

Definition at line 76 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.

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

Destructor.

Definition at line 108 of file TTUEmulator.cc.

References m_ttuconf, m_ttuin, m_wheelIds, and m_Wheels.

108  {
109 
110  if ( m_wheelIds ) delete[] m_wheelIds;
111  if ( m_Wheels ) delete[] m_Wheels;
112  if ( m_ttuin ) delete[] m_ttuin;
113  if ( m_ttuconf ) delete m_ttuconf;
114 
115 }
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:129
int * m_wheelIds
Definition: TTUEmulator.h:123
RPCWheel * m_Wheels
Definition: TTUEmulator.h:82
TTUInput * m_ttuin
Definition: TTUEmulator.h:127

Member Function Documentation

void TTUEmulator::clearTriggerResponse ( )

Definition at line 324 of file TTUEmulator.cc.

References m_triggerBxVec.

Referenced by RPCTechnicalTrigger::produce().

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

Definition at line 154 of file TTUEmulator.cc.

References gen::k, m_maxWheels, and m_Wheels.

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

Definition at line 133 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().

134 {
135  bool status(false);
136  for( int k=0; k < m_maxWheels; ++k)
137  status = m_Wheels[k].initialise( );
138 
140 
141  if ( !status ) {
142  if( m_debug ) std::cout << "TTUEmulator> Problem initialising the Configuration \n";
143  return 0; };
144 
145  return status;
146 
147 }
TTUConfiguration * m_ttuconf
Definition: TTUEmulator.h:129
int m_maxWheels
Definition: TTUEmulator.h:80
bool initialise()
Definition: TTUEmulator.cc:133
int k[5][pyjets_maxn]
RPCWheel * m_Wheels
Definition: TTUEmulator.h:82
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 72 of file TTUEmulator.h.

References m_line.

Referenced by SetLineId().

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

Definition at line 64 of file TTUEmulator.h.

References m_mode.

Referenced by setmode().

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

Definition at line 336 of file TTUEmulator.cc.

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

Referenced by RPCTechnicalTrigger::printinfo().

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

Definition at line 162 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().

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

Definition at line 244 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().

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

Definition at line 149 of file TTUEmulator.cc.

References line(), and m_line.

Referenced by RPCTechnicalTrigger::beginRun().

150 {
151  m_line = line;
152 }
int line()
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()
Definition: TTUEmulator.h:64
void TTUEmulator::setSpecifications ( const TTUBoardSpecs ttuspecs,
const RBCBoardSpecs rbcspecs 
)

Definition at line 118 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().

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

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(), and TTUEmulator().

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(), processTtu(), and RPCTechnicalTrigger::produce().

TTUConfiguration* TTUEmulator::m_ttuconf
private

Definition at line 129 of file TTUEmulator.h.

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

TTUInput* TTUEmulator::m_ttuin
private

Definition at line 127 of file TTUEmulator.h.

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

int* TTUEmulator::m_wheelIds
private

Definition at line 123 of file TTUEmulator.h.

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

RPCWheel* TTUEmulator::m_Wheels