CMS 3D CMS Logo

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

#include <L1MuBMExtrapolationUnit.h>

Inheritance diagram for L1MuBMExtrapolationUnit:
L1AbstractProcessor

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 &)
 constructor More...
 
int numberOfExt () const
 return number of successful extrapolations More...
 
void print (int level=0) const
 print all successful extrapolations More...
 
virtual void reset ()
 reset Extrapolation Unit More...
 
void reset (Extrapolation ext, unsigned int startAdr, unsigned int relAdr)
 reset a single extrapolation More...
 
virtual void run (const edm::EventSetup &c)
 run Extrapolation Unit More...
 
virtual ~L1MuBMExtrapolationUnit ()
 destructor More...
 
- Public Member Functions inherited from L1AbstractProcessor
virtual void run ()
 run processor logic More...
 
virtual void run ()
 run processor logic More...
 
virtual ~L1AbstractProcessor ()
 destructor More...
 
virtual ~L1AbstractProcessor ()
 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::ESHandle< L1TMuonBarrelParamsbmtfParamsHandle
 
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 54 of file L1MuBMExtrapolationUnit.h.

Member Typedef Documentation

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

Definition at line 58 of file L1MuBMExtrapolationUnit.h.

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

Definition at line 59 of file L1MuBMExtrapolationUnit.h.

Constructor & Destructor Documentation

L1MuBMExtrapolationUnit::L1MuBMExtrapolationUnit ( const L1MuBMSectorProcessor sp)

constructor

Definition at line 54 of file L1MuBMExtrapolationUnit.cc.

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

54  :
55  m_sp(sp), m_SEUs() {
56 
57  for ( int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++ ) {
58 
59  Extrapolation ext = static_cast<Extrapolation>(ext_idx);
60 
61  if ( ext == EX12 || ext == EX13 || ext == EX14 ||
62  ext == EX21 || ext == EX23 || ext == EX24 || ext == EX34 ) {
63 
64  unsigned int maxaddr = 4;
65 
66  if ( ext == EX12 || ext == EX13 || ext == EX14 ) maxaddr = 2;
67 
68  for ( unsigned int startAddress = 0; startAddress < maxaddr; startAddress++ ) {
69  SEUId id = make_pair(ext, startAddress);
70  m_SEUs[id] = new L1MuBMSEU(sp,ext,startAddress);
71  if ( L1MuBMTFConfig::Debug(6) ) cout << " creating SEU " << ext << " " << startAddress << endl;
72  }
73  }
74  }
75 
76 }
const int MAX_EXT
const L1MuBMSectorProcessor & m_sp
Extrapolation
std::pair< Extrapolation, unsigned int > SEUId
static bool Debug()
Definition: memstream.h:15
L1MuBMExtrapolationUnit::~L1MuBMExtrapolationUnit ( )
virtual

destructor

Definition at line 83 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

83  {
84 
85  for ( SEUmap::iterator iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
86  delete (*iter).second;
87  (*iter).second = 0;
88  }
89  m_SEUs.clear();
90 
91 }

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 192 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

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

get Extrapolator table for a given SEU

Definition at line 238 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

Referenced by run().

238  {
239 
240  // startAdr = 0, 1 : own wheel
241  // startAdr = 2, 3 : next wheel neighbour
242 
243  // assert( startAdr >= 0 && startAdr <= 3 );
244 
245  SEUId seuid = make_pair(ext, startAdr);
246  return m_SEUs[seuid]->exTable();
247 
248 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15
const bitset< 12 > & L1MuBMExtrapolationUnit::getQSTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Quality Sorter table for a given SEU

Definition at line 254 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuBMTrackAssembler::run().

254  {
255 
256  // startAdr = 0, 1 : own wheel
257  // startAdr = 2, 3 : next wheel neighbour
258 
259  // assert( startAdr >= 0 && startAdr <= 3 );
260 
261  SEUId seuid = make_pair(ext, startAdr);
262  return m_SEUs[seuid]->qsTable();
263 
264 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15
unsigned short int L1MuBMExtrapolationUnit::getQuality ( Extrapolation  ext,
unsigned int  startAdr,
int  id 
) const

get extrapolation quality from a given ERS

Definition at line 215 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs, and btvTracks_cfi::quality.

215  {
216 
217  // get extrapolation quality from ERS
218  // startAdr = 0, 1 : own wheel
219  // startAdr = 2, 3 : next wheel neighbour
220 
221  // assert( startAdr >= 0 && startAdr <= 3 );
222  // assert( id == 0 || id == 1 );
223 
224  unsigned short int quality = 0;
225 
226  SEUId seuid = make_pair(ext, startAdr);
227  SEUmap::const_iterator iter = m_SEUs.find(seuid);
228  if ( iter != m_SEUs.end() ) quality = ((*iter).second)->ers()->quality(id);
229 
230  return quality;
231 
232 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15
int L1MuBMExtrapolationUnit::numberOfExt ( ) const

return number of successful extrapolations

Definition at line 270 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuBMSectorProcessor::run().

270  {
271 
272  int number = 0;
273  SEUmap::const_iterator iter;
274  for ( iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
275  number += ((*iter).second)->numberOfExt();
276  }
277 
278  return number;
279 
280 }
int numberOfExt() const
return number of successful extrapolations
void L1MuBMExtrapolationUnit::print ( int  level = 0) const

print all successful extrapolations

Definition at line 286 of file L1MuBMExtrapolationUnit.cc.

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

Referenced by L1MuBMSectorProcessor::run().

286  {
287 
288  SEUmap::const_iterator iter_seu;
289 
290  if ( level == 0 ) {
291  for ( iter_seu = m_SEUs.begin(); iter_seu != m_SEUs.end(); iter_seu++ ) {
292  vector<L1MuBMEUX*> vec_eux = ((*iter_seu).second)->eux();
293  vector<L1MuBMEUX*>::const_iterator iter_eux;
294  for ( iter_eux = vec_eux.begin();
295  iter_eux != vec_eux.end(); iter_eux++ ) {
296  if ( (*iter_eux)->result() ) {
297  cout << ((*iter_seu).second)->ext() << " "
298  << ((*iter_seu).second)->tsId() << " "
299  << (*iter_eux)->id() << endl;
300  cout << "start : " << *(*iter_eux)->ts().first << endl;
301  cout << "target : " << *(*iter_eux)->ts().second << endl;
302  cout << "result : " << "quality = " << (*iter_eux)->quality() << '\t'
303  << "address = " << (*iter_eux)->address() << endl;
304  }
305  }
306  }
307  }
308 
309  //
310  // print all results from Extrapolator and Quality Sorter
311  //
312  if ( level == 1 ) {
313  cout << "Results from Extrapolator and Quality Sorter of " << m_sp.id()
314  << " : \n" << endl;
315 
316  cout << " EXT QSU " << endl;
317  cout << " S E U 11 11 " << endl;
318  cout << " 109876543210 109876543210 " << endl;
319  cout << "-------------------------------------" << endl;
320  for ( iter_seu = m_SEUs.begin(); iter_seu != m_SEUs.end(); iter_seu++ ) {
321 
322  cout << ((*iter_seu).second)->ext() << "_ "
323  << ((*iter_seu).second)->tsId() << ": "
324  << ((*iter_seu).second)->exTable() << " "
325  << ((*iter_seu).second)->qsTable() << endl;
326 
327  }
328 
329  cout << endl;
330  }
331 
332 }
const L1MuBMSectorProcessor & m_sp
const L1MuBMSecProcId & id() const
return Sector Processor identifier
Definition: memstream.h:15
void L1MuBMExtrapolationUnit::reset ( void  )
virtual

reset Extrapolation Unit

Implements L1AbstractProcessor.

Definition at line 164 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

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

164  {
165 
166  SEUmap::const_iterator iter;
167  for ( iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
168  ((*iter).second)->reset();
169  }
170 
171 }
virtual void reset()
reset Extrapolation Unit
void L1MuBMExtrapolationUnit::reset ( Extrapolation  ext,
unsigned int  startAdr,
unsigned int  relAdr 
)

reset a single extrapolation

Definition at line 177 of file L1MuBMExtrapolationUnit.cc.

References m_SEUs.

177  {
178 
179  // assert( startAdr >= 0 && startAdr <= 3 );
180  // assert( relAdr >= 0 && relAdr <= 12 );
181 
182  SEUId seuid = make_pair(ext, startAdr);
183  SEUmap::const_iterator iter = m_SEUs.find(seuid);
184  if ( iter != m_SEUs.end() ) ((*iter).second)->reset(relAdr);
185 
186 }
std::pair< Extrapolation, unsigned int > SEUId
Definition: memstream.h:15
void L1MuBMExtrapolationUnit::run ( const edm::EventSetup c)
virtual

run Extrapolation Unit

Reimplemented from L1AbstractProcessor.

Definition at line 101 of file L1MuBMExtrapolationUnit.cc.

References bmtfParamsHandle, gather_cfg::cout, L1MuBMSectorProcessor::data(), L1MuBMTFConfig::Debug(), L1MuBMTrackSegPhi::empty(), EX12, EX21, L1MuBMSEU::ext(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), L1MuDTTFParameters::get_soc_run_21(), getEXTable(), L1MuBMDataBuffer::getTSphi(), L1MuBMTFConfig::getUseEX21(), L1MuBMSectorProcessor::id(), L1TMuonBarrelParams::l1mudttfparams, svgfig::load(), m_SEUs, m_sp, pars, edm::ESHandle< T >::product(), reset(), L1AbstractProcessor::run(), L1MuBMSecProcId::sector(), L1MuBMSEU::tsId(), L1MuBMSecProcId::wheel(), and which_ext().

Referenced by L1MuBMSectorProcessor::run().

101  {
102 
103  //c.get< L1MuDTTFParametersRcd >().get( pars );
104  const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get<L1TMuonBarrelParamsRcd>();
105  bmtfParamsRcd.get(bmtfParamsHandle);
106  const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product();
107  pars = bmtfParams.l1mudttfparams;
108 
109  SEUmap::const_iterator iter;
110  for ( iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
111 
112  pair<int,int> ext_pair = which_ext(((*iter).second)->ext());
113  int start = ext_pair.first;
114 
115  const L1MuBMTrackSegPhi* ts = 0;
116 
117  //get start track segment
118  ts = m_sp.data()->getTSphi(start, ((*iter).second)->tsId() );
119 
120  if ( ts != 0 && !ts->empty() ) {
121  ((*iter).second)->load(ts);
122  ((*iter).second)->run(c);
123  }
124 
125  }
126 
127  //
128  // use EX21 to cross-check EX12
129  //
130  bool run_21 = pars.get_soc_run_21(m_sp.id().wheel(), m_sp.id().sector());
131  if ( L1MuBMTFConfig::getUseEX21() || run_21 ) {
132 
133  // search for EX12 + EX21 single extrapolation units
134  for ( unsigned int startAdr = 0; startAdr < 2; startAdr++ ) {
135 
136  bitset<12> extab12 = this->getEXTable( EX12, startAdr );
137  bitset<12> extab21 = this->getEXTable( EX21, startAdr );
138 
139  for ( int eux = 0; eux < 12; eux++ ) {
140  if ( extab12.test(eux) && !extab21.test(eux) ) {
141  reset(EX12,startAdr,eux);
142  if ( L1MuBMTFConfig::Debug(6) ) {
143  SEUId seuid = make_pair(EX12, startAdr);
144  L1MuBMSEU* SEU12 = m_SEUs[seuid];
145  cout << " EX12 - EX21 mismatch : "
146  << " EX12 : " << extab12 << " , "
147  << " EX21 : " << extab21 << endl
148  << " Cancel: " << SEU12->ext()
149  << " start addr = " << SEU12->tsId()
150  << " target addr = " << eux << endl;
151  }
152  }
153  }
154 
155  }
156  }
157 
158 }
Extrapolation ext() const
return extrapolation type
Definition: L1MuBMSEU.h:80
Definition: start.py:1
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()
int sector() const
return sector number
virtual void run()
run processor logic
void get(HolderT &iHolder) const
virtual void reset()
reset Extrapolation Unit
const L1MuBMSectorProcessor & m_sp
unsigned int tsId() const
return start track segment identifier (relative address)
Definition: L1MuBMSEU.h:83
const L1MuBMSecProcId & id() const
return Sector Processor identifier
std::pair< Extrapolation, unsigned int > SEUId
def load(fileName)
Definition: svgfig.py:546
const T & get() const
Definition: EventSetup.h:56
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
edm::ESHandle< L1TMuonBarrelParams > bmtfParamsHandle
T const * product() const
Definition: ESHandle.h:86
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 340 of file L1MuBMExtrapolationUnit.cc.

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

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

340  {
341 
342  int source = 0;
343  int target = 0;
344 
345  // assert( ext >= 0 && ext < MAX_EXT );
346 
347  switch ( ext ) {
348  case EX12 : { source = 1; target = 2; break; }
349  case EX13 : { source = 1; target = 3; break; }
350  case EX14 : { source = 1; target = 4; break; }
351  case EX21 : { source = 1; target = 2; break; }
352  case EX23 : { source = 2; target = 3; break; }
353  case EX24 : { source = 2; target = 4; break; }
354  case EX34 : { source = 3; target = 4; break; }
355  case EX15 : { source = 1; target = 3; break; }
356  case EX25 : { source = 2; target = 3; break; }
357  default : { source = 1; target = 2; break; }
358  }
359 
360  return pair<int,int>(source,target);
361 
362 }
Definition: memstream.h:15
static std::string const source
Definition: EdmProvDump.cc:43

Member Data Documentation

edm::ESHandle< L1TMuonBarrelParams > L1MuBMExtrapolationUnit::bmtfParamsHandle
private

Definition at line 104 of file L1MuBMExtrapolationUnit.h.

Referenced by run().

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

Definition at line 99 of file L1MuBMExtrapolationUnit.h.

Referenced by print(), and run().

L1MuDTTFParameters L1MuBMExtrapolationUnit::pars
private

Definition at line 105 of file L1MuBMExtrapolationUnit.h.

Referenced by run().