CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
L1MuDTExtrapolationUnit Class Reference

#include <L1MuDTExtrapolationUnit.h>

Public Types

typedef std::pair< Extrapolation, unsigned int > SEUId
 
typedef std::map< SEUId, L1MuDTSEU *, 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...
 
 L1MuDTExtrapolationUnit (const L1MuDTSectorProcessor &, edm::ConsumesCollector)
 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...
 
 ~L1MuDTExtrapolationUnit ()
 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

const edm::ESGetToken< L1MuDTExtLut, L1MuDTExtLutRcdm_extLUTsToken
 
const edm::ESGetToken< L1MuDTTFParameters, L1MuDTTFParametersRcdm_parsToken
 
SEUmap m_SEUs
 
const L1MuDTSectorProcessorm_sp
 

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 54 of file L1MuDTExtrapolationUnit.h.

Member Typedef Documentation

◆ SEUId

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

Definition at line 56 of file L1MuDTExtrapolationUnit.h.

◆ SEUmap

typedef std::map<SEUId, L1MuDTSEU*, std::less<SEUId> > L1MuDTExtrapolationUnit::SEUmap

Definition at line 57 of file L1MuDTExtrapolationUnit.h.

Constructor & Destructor Documentation

◆ L1MuDTExtrapolationUnit()

L1MuDTExtrapolationUnit::L1MuDTExtrapolationUnit ( const L1MuDTSectorProcessor sp,
edm::ConsumesCollector  iC 
)

constructor

Definition at line 56 of file L1MuDTExtrapolationUnit.cc.

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

58  for (int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++) {
59  Extrapolation ext = static_cast<Extrapolation>(ext_idx);
60 
61  if (ext == EX12 || ext == EX13 || ext == EX14 || ext == EX21 || ext == EX23 || ext == EX24 || ext == EX34) {
62  unsigned int maxaddr = 4;
63 
64  if (ext == EX12 || ext == EX13 || ext == EX14)
65  maxaddr = 2;
66 
67  for (unsigned int startAddress = 0; startAddress < maxaddr; startAddress++) {
68  SEUId id = make_pair(ext, startAddress);
69  m_SEUs[id] = new L1MuDTSEU(sp, ext, startAddress);
70  if (L1MuDTTFConfig::Debug(6))
71  cout << " creating SEU " << ext << " " << startAddress << endl;
72  }
73  }
74  }
75 }
std::pair< Extrapolation, unsigned int > SEUId
const edm::ESGetToken< L1MuDTTFParameters, L1MuDTTFParametersRcd > m_parsToken
const L1MuDTSectorProcessor & m_sp
const int MAX_EXT
static bool Debug()
Extrapolation
const edm::ESGetToken< L1MuDTExtLut, L1MuDTExtLutRcd > m_extLUTsToken
Definition: memstream.h:15

◆ ~L1MuDTExtrapolationUnit()

L1MuDTExtrapolationUnit::~L1MuDTExtrapolationUnit ( )

destructor

Definition at line 81 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

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

Member Function Documentation

◆ getAddress()

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

get extrapolation address from a given ERS

Definition at line 171 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

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

◆ getEXTable()

const bitset< 12 > & L1MuDTExtrapolationUnit::getEXTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Extrapolator table for a given SEU

Definition at line 213 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

Referenced by run().

213  {
214  // startAdr = 0, 1 : own wheel
215  // startAdr = 2, 3 : next wheel neighbour
216 
217  // assert( startAdr >= 0 && startAdr <= 3 );
218 
219  SEUId seuid = make_pair(ext, startAdr);
220  return m_SEUs.find(seuid)->second->exTable();
221 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15

◆ getQSTable()

const bitset< 12 > & L1MuDTExtrapolationUnit::getQSTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Quality Sorter table for a given SEU

Definition at line 226 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuDTTrackAssembler::run().

226  {
227  // startAdr = 0, 1 : own wheel
228  // startAdr = 2, 3 : next wheel neighbour
229 
230  // assert( startAdr >= 0 && startAdr <= 3 );
231 
232  SEUId seuid = make_pair(ext, startAdr);
233  return m_SEUs.find(seuid)->second->qsTable();
234 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15

◆ getQuality()

unsigned short int L1MuDTExtrapolationUnit::getQuality ( Extrapolation  ext,
unsigned int  startAdr,
int  id 
) const

get extrapolation quality from a given ERS

Definition at line 192 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs, and quality.

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

◆ numberOfExt()

int L1MuDTExtrapolationUnit::numberOfExt ( ) const

return number of successful extrapolations

Definition at line 239 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs, and contentValuesFiles::number.

Referenced by L1MuDTSectorProcessor::run().

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

◆ print()

void L1MuDTExtrapolationUnit::print ( int  level = 0) const

print all successful extrapolations

Definition at line 252 of file L1MuDTExtrapolationUnit.cc.

References gather_cfg::cout, L1MuDTSectorProcessor::id(), personalPlayback::level, m_SEUs, and m_sp.

Referenced by L1MuDTSectorProcessor::run().

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

◆ reset() [1/2]

void L1MuDTExtrapolationUnit::reset ( void  )

reset Extrapolation Unit

Definition at line 148 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

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

148  {
149  SEUmap::const_iterator iter;
150  for (iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) {
151  ((*iter).second)->reset();
152  }
153 }
void reset()
reset Extrapolation Unit

◆ reset() [2/2]

void L1MuDTExtrapolationUnit::reset ( Extrapolation  ext,
unsigned int  startAdr,
unsigned int  relAdr 
)

reset a single extrapolation

Definition at line 158 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

158  {
159  // assert( startAdr >= 0 && startAdr <= 3 );
160  // assert( relAdr >= 0 && relAdr <= 12 );
161 
162  SEUId seuid = make_pair(ext, startAdr);
163  SEUmap::const_iterator iter = m_SEUs.find(seuid);
164  if (iter != m_SEUs.end())
165  ((*iter).second)->reset(relAdr);
166 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15

◆ run()

void L1MuDTExtrapolationUnit::run ( const edm::EventSetup c)

run Extrapolation Unit

Definition at line 96 of file L1MuDTExtrapolationUnit.cc.

References c, L1MuDTTrackFinder::config(), gather_cfg::cout, L1MuDTSectorProcessor::data(), L1MuDTTFConfig::Debug(), L1MuDTTrackSegPhi::empty(), EX12, EX21, L1MuDTSEU::ext(), getEXTable(), L1MuDTDataBuffer::getTSphi(), L1MuDTTFConfig::getUseEX21(), L1MuDTSectorProcessor::id(), svgfig::load(), m_extLUTsToken, m_parsToken, m_SEUs, m_sp, reset(), L1MuDTSecProcId::sector(), L1MuDTSectorProcessor::tf(), L1MuDTSEU::tsId(), L1MuDTSecProcId::wheel(), and which_ext().

Referenced by L1MuDTSectorProcessor::run().

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

◆ which_ext()

pair< int, int > L1MuDTExtrapolationUnit::which_ext ( Extrapolation  ext)
static

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

Definition at line 296 of file L1MuDTExtrapolationUnit.cc.

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

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

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

Member Data Documentation

◆ m_extLUTsToken

const edm::ESGetToken<L1MuDTExtLut, L1MuDTExtLutRcd> L1MuDTExtrapolationUnit::m_extLUTsToken
private

Definition at line 101 of file L1MuDTExtrapolationUnit.h.

Referenced by run().

◆ m_parsToken

const edm::ESGetToken<L1MuDTTFParameters, L1MuDTTFParametersRcd> L1MuDTExtrapolationUnit::m_parsToken
private

Definition at line 100 of file L1MuDTExtrapolationUnit.h.

Referenced by run().

◆ m_SEUs

SEUmap L1MuDTExtrapolationUnit::m_SEUs
private

◆ m_sp

const L1MuDTSectorProcessor& L1MuDTExtrapolationUnit::m_sp
private

Definition at line 96 of file L1MuDTExtrapolationUnit.h.

Referenced by print(), and run().