CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
L1MuBMExtrapolationUnit Class Reference

#include <L1MuBMExtrapolationUnit.h>

Public Types

typedef std::pair
< Extrapolation, unsigned int > 
SEUId
 
typedef std::map< SEUId,
L1MuBMSEU *, std::less< SEUId > > 
SEUmap
 

Public Member Functions

unsigned short int getAddress (Extrapolation ext, unsigned int startAdr, int id) const
 get extrapolation address from a given ERS More...
 
const std::bitset< 12 > & getEXTable (Extrapolation ext, unsigned int startAdr) const
 get Extrapolator table for a given SEU More...
 
const std::bitset< 12 > & getQSTable (Extrapolation ext, unsigned int startAdr) const
 get Quality Sorter table for a given SEU More...
 
unsigned short int getQuality (Extrapolation ext, unsigned int startAdr, int id) const
 get extrapolation quality from a given ERS More...
 
 L1MuBMExtrapolationUnit (const L1MuBMSectorProcessor &, edm::ConsumesCollector iC)
 constructor More...
 
int numberOfExt () const
 return number of successful extrapolations More...
 
void print (int level=0) const
 print all successful extrapolations More...
 
void reset ()
 reset Extrapolation Unit More...
 
void reset (Extrapolation ext, unsigned int startAdr, unsigned int relAdr)
 reset a single extrapolation More...
 
void run (const edm::EventSetup &c)
 run Extrapolation Unit More...
 
 ~L1MuBMExtrapolationUnit ()
 destructor More...
 

Static Public Member Functions

static std::pair< int, int > which_ext (Extrapolation ext)
 return station of start and target track segment for a given extrapolation More...
 

Private Attributes

edm::ESGetToken
< L1TMuonBarrelParams,
L1TMuonBarrelParamsRcd
m_paramsToken
 
SEUmap m_SEUs
 
const L1MuBMSectorProcessorm_sp
 
L1MuDTTFParameters pars
 

Detailed Description

Extrapolation Unit:

The Extrapolation Unit attempts to join track segment pairs of different stations. it contains 12 Single Extrapolation Units to perform all extrapolations in its own wheel and 6 Single Extrapolation Units to perform all extrapolations in the adjacent wheel (next wheel neighbour)

N. Neumeister CERN EP

Definition at line 53 of file L1MuBMExtrapolationUnit.h.

Member Typedef Documentation

typedef std::pair<Extrapolation, unsigned int> L1MuBMExtrapolationUnit::SEUId

Definition at line 55 of file L1MuBMExtrapolationUnit.h.

typedef std::map<SEUId, L1MuBMSEU*, std::less<SEUId> > L1MuBMExtrapolationUnit::SEUmap

Definition at line 56 of file L1MuBMExtrapolationUnit.h.

Constructor & Destructor Documentation

L1MuBMExtrapolationUnit::L1MuBMExtrapolationUnit ( const L1MuBMSectorProcessor sp,
edm::ConsumesCollector  iC 
)

constructor

Definition at line 55 of file L1MuBMExtrapolationUnit.cc.

References gather_cfg::cout, L1MuBMTFConfig::Debug(), EX12, EX13, EX14, EX21, EX23, EX24, EX34, gpuClustering::id, m_SEUs, and MAX_EXT.

56  : m_sp(sp), m_SEUs(), m_paramsToken(cc.esConsumes()) {
57  for (int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++) {
58  Extrapolation ext = static_cast<Extrapolation>(ext_idx);
59 
60  if (ext == EX12 || ext == EX13 || ext == EX14 || ext == EX21 || ext == EX23 || ext == EX24 || ext == EX34) {
61  unsigned int maxaddr = 4;
62 
63  if (ext == EX12 || ext == EX13 || ext == EX14)
64  maxaddr = 2;
65 
66  for (unsigned int startAddress = 0; startAddress < maxaddr; startAddress++) {
67  SEUId id = make_pair(ext, startAddress);
68  m_SEUs[id] = new L1MuBMSEU(sp, ext, startAddress);
69  if (L1MuBMTFConfig::Debug(6))
70  cout << " creating SEU " << ext << " " << startAddress << endl;
71  }
72  }
73  }
74 }
edm::ESGetToken< L1TMuonBarrelParams, L1TMuonBarrelParamsRcd > m_paramsToken
uint16_t *__restrict__ id
const int MAX_EXT
const L1MuBMSectorProcessor & m_sp
Extrapolation
std::pair< Extrapolation, unsigned int > SEUId
static bool Debug()
tuple cout
Definition: gather_cfg.py:144
L1MuBMExtrapolationUnit::~L1MuBMExtrapolationUnit ( )

destructor

Definition at line 80 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

80  {
81  for (SEUmap::iterator iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) {
82  delete (*iter).second;
83  (*iter).second = nullptr;
84  }
85  m_SEUs.clear();
86 }

Member Function Documentation

unsigned short int L1MuBMExtrapolationUnit::getAddress ( Extrapolation  ext,
unsigned int  startAdr,
int  id 
) const

get extrapolation address from a given ERS

Definition at line 169 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

169  {
170  // get extrapolation address from ERS
171  // startAdr = 0, 1 : own wheel
172  // startAdr = 2, 3 : next wheel neighbour
173 
174  // assert( startAdr >= 0 && startAdr <= 3 );
175  // assert( id == 0 || id == 1 );
176 
177  unsigned short int address = 15;
178 
179  SEUId seuid = make_pair(ext, startAdr);
180  SEUmap::const_iterator iter = m_SEUs.find(seuid);
181  if (iter != m_SEUs.end())
182  address = ((*iter).second)->ers()->address(id);
183 
184  return address;
185 }
std::pair< Extrapolation, unsigned int > SEUId
const bitset< 12 > & L1MuBMExtrapolationUnit::getEXTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Extrapolator table for a given SEU

Definition at line 211 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

Referenced by run().

211  {
212  // startAdr = 0, 1 : own wheel
213  // startAdr = 2, 3 : next wheel neighbour
214 
215  // assert( startAdr >= 0 && startAdr <= 3 );
216 
217  SEUId seuid = make_pair(ext, startAdr);
218  return m_SEUs[seuid]->exTable();
219 }
std::pair< Extrapolation, unsigned int > SEUId
const bitset< 12 > & L1MuBMExtrapolationUnit::getQSTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Quality Sorter table for a given SEU

Definition at line 224 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuBMTrackAssembler::run().

224  {
225  // startAdr = 0, 1 : own wheel
226  // startAdr = 2, 3 : next wheel neighbour
227 
228  // assert( startAdr >= 0 && startAdr <= 3 );
229 
230  SEUId seuid = make_pair(ext, startAdr);
231  return m_SEUs[seuid]->qsTable();
232 }
std::pair< Extrapolation, unsigned int > SEUId
unsigned short int L1MuBMExtrapolationUnit::getQuality ( Extrapolation  ext,
unsigned int  startAdr,
int  id 
) const

get extrapolation quality from a given ERS

Definition at line 190 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs, and quality.

190  {
191  // get extrapolation quality from ERS
192  // startAdr = 0, 1 : own wheel
193  // startAdr = 2, 3 : next wheel neighbour
194 
195  // assert( startAdr >= 0 && startAdr <= 3 );
196  // assert( id == 0 || id == 1 );
197 
198  unsigned short int quality = 0;
199 
200  SEUId seuid = make_pair(ext, startAdr);
201  SEUmap::const_iterator iter = m_SEUs.find(seuid);
202  if (iter != m_SEUs.end())
203  quality = ((*iter).second)->ers()->quality(id);
204 
205  return quality;
206 }
uint32_t const *__restrict__ Quality * quality
std::pair< Extrapolation, unsigned int > SEUId
int L1MuBMExtrapolationUnit::numberOfExt ( ) const

return number of successful extrapolations

Definition at line 237 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs, and contentValuesFiles::number.

Referenced by L1MuBMSectorProcessor::run().

237  {
238  int number = 0;
239  SEUmap::const_iterator iter;
240  for (iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) {
241  number += ((*iter).second)->numberOfExt();
242  }
243 
244  return number;
245 }
int numberOfExt() const
return number of successful extrapolations
void L1MuBMExtrapolationUnit::print ( int  level = 0) const

print all successful extrapolations

Definition at line 250 of file L1MuBMExtrapolationUnit.cc.

References gather_cfg::cout, L1MuBMSectorProcessor::id(), m_SEUs, and m_sp.

Referenced by L1MuBMSectorProcessor::run().

250  {
251  SEUmap::const_iterator iter_seu;
252 
253  if (level == 0) {
254  for (iter_seu = m_SEUs.begin(); iter_seu != m_SEUs.end(); iter_seu++) {
255  vector<L1MuBMEUX*> vec_eux = ((*iter_seu).second)->eux();
256  vector<L1MuBMEUX*>::const_iterator iter_eux;
257  for (iter_eux = vec_eux.begin(); iter_eux != vec_eux.end(); iter_eux++) {
258  if ((*iter_eux)->result()) {
259  cout << ((*iter_seu).second)->ext() << " " << ((*iter_seu).second)->tsId() << " " << (*iter_eux)->id()
260  << endl;
261  cout << "start : " << *(*iter_eux)->ts().first << endl;
262  cout << "target : " << *(*iter_eux)->ts().second << endl;
263  cout << "result : "
264  << "quality = " << (*iter_eux)->quality() << '\t' << "address = " << (*iter_eux)->address() << endl;
265  }
266  }
267  }
268  }
269 
270  //
271  // print all results from Extrapolator and Quality Sorter
272  //
273  if (level == 1) {
274  cout << "Results from Extrapolator and Quality Sorter of " << m_sp.id() << " : \n" << endl;
275 
276  cout << " EXT QSU " << endl;
277  cout << " S E U 11 11 " << endl;
278  cout << " 109876543210 109876543210 " << endl;
279  cout << "-------------------------------------" << endl;
280  for (iter_seu = m_SEUs.begin(); iter_seu != m_SEUs.end(); iter_seu++) {
281  cout << ((*iter_seu).second)->ext() << "_ " << ((*iter_seu).second)->tsId() << ": "
282  << ((*iter_seu).second)->exTable() << " " << ((*iter_seu).second)->qsTable() << endl;
283  }
284 
285  cout << endl;
286  }
287 }
const L1MuBMSectorProcessor & m_sp
const L1MuBMSecProcId & id() const
return Sector Processor identifier
tuple cout
Definition: gather_cfg.py:144
tuple level
Definition: testEve_cfg.py:47
void L1MuBMExtrapolationUnit::reset ( void  )

reset Extrapolation Unit

Definition at line 146 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuBMSectorProcessor::reset(), and run().

146  {
147  SEUmap::const_iterator iter;
148  for (iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) {
149  ((*iter).second)->reset();
150  }
151 }
void reset()
reset Extrapolation Unit
void L1MuBMExtrapolationUnit::reset ( Extrapolation  ext,
unsigned int  startAdr,
unsigned int  relAdr 
)

reset a single extrapolation

Definition at line 156 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

156  {
157  // assert( startAdr >= 0 && startAdr <= 3 );
158  // assert( relAdr >= 0 && relAdr <= 12 );
159 
160  SEUId seuid = make_pair(ext, startAdr);
161  SEUmap::const_iterator iter = m_SEUs.find(seuid);
162  if (iter != m_SEUs.end())
163  ((*iter).second)->reset(relAdr);
164 }
std::pair< Extrapolation, unsigned int > SEUId
void L1MuBMExtrapolationUnit::run ( const edm::EventSetup c)

run Extrapolation Unit

Definition at line 95 of file L1MuBMExtrapolationUnit.cc.

References gather_cfg::cout, L1MuBMSectorProcessor::data(), L1MuBMTFConfig::Debug(), L1MuBMTrackSegPhi::empty(), EX12, EX21, L1MuBMSEU::ext(), L1MuDTTFParameters::get_soc_run_21(), edm::EventSetup::getData(), getEXTable(), L1MuBMDataBuffer::getTSphi(), L1MuBMTFConfig::getUseEX21(), L1MuBMSectorProcessor::id(), L1TMuonBarrelParams::l1mudttfparams, svgfig::load(), m_paramsToken, m_SEUs, m_sp, pars, reset(), L1MuBMSecProcId::sector(), command_line::start, L1MuBMSEU::tsId(), L1MuBMSecProcId::wheel(), and which_ext().

Referenced by L1MuBMSectorProcessor::run().

95  {
96  const L1TMuonBarrelParams& bmtfParams = c.getData(m_paramsToken);
97  pars = bmtfParams.l1mudttfparams;
98 
99  SEUmap::const_iterator iter;
100  for (iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) {
101  pair<int, int> ext_pair = which_ext(((*iter).second)->ext());
102  int start = ext_pair.first;
103 
104  const L1MuBMTrackSegPhi* ts = nullptr;
105 
106  //get start track segment
107  ts = m_sp.data()->getTSphi(start, ((*iter).second)->tsId());
108 
109  if (ts != nullptr && !ts->empty()) {
110  ((*iter).second)->load(ts);
111  ((*iter).second)->run(bmtfParams);
112  }
113  }
114 
115  //
116  // use EX21 to cross-check EX12
117  //
118  bool run_21 = pars.get_soc_run_21(m_sp.id().wheel(), m_sp.id().sector());
119  if (L1MuBMTFConfig::getUseEX21() || run_21) {
120  // search for EX12 + EX21 single extrapolation units
121  for (unsigned int startAdr = 0; startAdr < 2; startAdr++) {
122  bitset<12> extab12 = this->getEXTable(EX12, startAdr);
123  bitset<12> extab21 = this->getEXTable(EX21, startAdr);
124 
125  for (int eux = 0; eux < 12; eux++) {
126  if (extab12.test(eux) && !extab21.test(eux)) {
127  reset(EX12, startAdr, eux);
128  if (L1MuBMTFConfig::Debug(6)) {
129  SEUId seuid = make_pair(EX12, startAdr);
130  L1MuBMSEU* SEU12 = m_SEUs[seuid];
131  cout << " EX12 - EX21 mismatch : "
132  << " EX12 : " << extab12 << " , "
133  << " EX21 : " << extab21 << endl
134  << " Cancel: " << SEU12->ext() << " start addr = " << SEU12->tsId() << " target addr = " << eux
135  << endl;
136  }
137  }
138  }
139  }
140  }
141 }
edm::ESGetToken< L1TMuonBarrelParams, L1TMuonBarrelParamsRcd > m_paramsToken
Extrapolation ext() const
return extrapolation type
Definition: L1MuBMSEU.h:78
static std::pair< int, int > which_ext(Extrapolation ext)
return station of start and target track segment for a given extrapolation
L1MuDTTFParameters l1mudttfparams
static bool getUseEX21()
bool getData(T &iHolder) const
Definition: EventSetup.h:122
int sector() const
return sector number
void reset()
reset Extrapolation Unit
def load
Definition: svgfig.py:547
const L1MuBMSectorProcessor & m_sp
unsigned int tsId() const
return start track segment identifier (relative address)
Definition: L1MuBMSEU.h:81
const L1MuBMSecProcId & id() const
return Sector Processor identifier
std::pair< Extrapolation, unsigned int > SEUId
static bool Debug()
bool get_soc_run_21(int wh, int sc) const
const TSPhivector & getTSphi() const
get all track segments from the buffer
const L1MuBMDataBuffer * data() const
return pointer to Data Buffer
const std::bitset< 12 > & getEXTable(Extrapolation ext, unsigned int startAdr) const
get Extrapolator table for a given SEU
tuple cout
Definition: gather_cfg.py:144
void run(const edm::EventSetup &c)
run Extrapolation Unit
bool empty() const
is it an empty phi track segment?
int wheel() const
return wheel number
pair< int, int > L1MuBMExtrapolationUnit::which_ext ( Extrapolation  ext)
static

return station of start and target track segment for a given extrapolation

Definition at line 294 of file L1MuBMExtrapolationUnit.cc.

References EX12, EX13, EX14, EX15, EX21, EX23, EX24, EX25, EX34, source, and filterCSVwithJSON::target.

Referenced by L1MuBMSEU::run(), and run().

294  {
295  int source = 0;
296  int target = 0;
297 
298  // assert( ext >= 0 && ext < MAX_EXT );
299 
300  switch (ext) {
301  case EX12: {
302  source = 1;
303  target = 2;
304  break;
305  }
306  case EX13: {
307  source = 1;
308  target = 3;
309  break;
310  }
311  case EX14: {
312  source = 1;
313  target = 4;
314  break;
315  }
316  case EX21: {
317  source = 1;
318  target = 2;
319  break;
320  }
321  case EX23: {
322  source = 2;
323  target = 3;
324  break;
325  }
326  case EX24: {
327  source = 2;
328  target = 4;
329  break;
330  }
331  case EX34: {
332  source = 3;
333  target = 4;
334  break;
335  }
336  case EX15: {
337  source = 1;
338  target = 3;
339  break;
340  }
341  case EX25: {
342  source = 2;
343  target = 3;
344  break;
345  }
346  default: {
347  source = 1;
348  target = 2;
349  break;
350  }
351  }
352 
353  return pair<int, int>(source, target);
354 }
static std::string const source
Definition: EdmProvDump.cc:46

Member Data Documentation

edm::ESGetToken<L1TMuonBarrelParams, L1TMuonBarrelParamsRcd> L1MuBMExtrapolationUnit::m_paramsToken
private

Definition at line 99 of file L1MuBMExtrapolationUnit.h.

Referenced by run().

SEUmap L1MuBMExtrapolationUnit::m_SEUs
mutableprivate
const L1MuBMSectorProcessor& L1MuBMExtrapolationUnit::m_sp
private

Definition at line 95 of file L1MuBMExtrapolationUnit.h.

Referenced by print(), and run().

L1MuDTTFParameters L1MuBMExtrapolationUnit::pars
private

Definition at line 100 of file L1MuBMExtrapolationUnit.h.

Referenced by run().