CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
L1MuBMEUX Class Reference

#include <L1MuBMEUX.h>

Classes

class  EUX_Comp
 helper class for finding the best and second best extrapolation More...
 

Public Member Functions

unsigned short int address () const
 return extrapolation address (0-11) (address = 15 indicates negative ext. result) More...
 
int id () const
 return Extrapolation identifier More...
 
 L1MuBMEUX (const L1MuBMSectorProcessor &sp, const L1MuBMSEU &seu, int id)
 constructor More...
 
void load (const L1MuBMTrackSegPhi *start_ts, const L1MuBMTrackSegPhi *target_ts)
 load data into EUX More...
 
bool operator== (const L1MuBMEUX &) const
 equal operator More...
 
unsigned int quality () const
 return extrapolation quality More...
 
void reset ()
 reset Extrapolator More...
 
bool result () const
 return extrapolation result More...
 
void run (const L1TMuonBarrelParams &c)
 run Extrapolator More...
 
std::pair< const L1MuBMTrackSegPhi *, const L1MuBMTrackSegPhi * > ts () const
 return pointer to start and target track segment More...
 
 ~L1MuBMEUX ()
 destructor More...
 

Private Member Functions

int sec_mod (int) const
 output sector numbers in the range -6 to +5 More...
 

Private Attributes

unsigned short int m_address
 
int m_id
 
unsigned short int m_quality
 
bool m_result
 
const L1MuBMSEUm_seu
 
const L1MuBMSectorProcessorm_sp
 
const L1MuBMTrackSegPhim_start
 
const L1MuBMTrackSegPhim_target
 
unsigned short const nbit_phi = 12
 
unsigned short const nbit_phib = 10
 
L1MuDTTFParameters pars
 
int const theExtFilter = 1
 
L1MuBMLUTHandlertheExtLUTs
 

Detailed Description

Extrapolator:

The Extrapolator receives a start and a target track segment and performs the actual extrapolation

N. Neumeister CERN EP

Definition at line 50 of file L1MuBMEUX.h.

Constructor & Destructor Documentation

◆ L1MuBMEUX()

L1MuBMEUX::L1MuBMEUX ( const L1MuBMSectorProcessor sp,
const L1MuBMSEU seu,
int  id 
)

constructor

Definition at line 52 of file L1MuBMEUX.cc.

53  : m_sp(sp),
54  m_seu(seu),
55  m_id(id),
56  m_result(false),
57  m_quality(0),
58  m_address(15),
59  m_start(nullptr),
60  m_target(nullptr),
const L1MuBMSEU & m_seu
Definition: L1MuBMEUX.h:109
static int getNbitsExtPhi()
static int getNbitsExtPhib()
static int getExtTSFilter()
int m_id
Definition: L1MuBMEUX.h:110
unsigned short int m_address
Definition: L1MuBMEUX.h:114
const L1MuBMTrackSegPhi * m_target
Definition: L1MuBMEUX.h:117
const L1MuBMTrackSegPhi * m_start
Definition: L1MuBMEUX.h:116
const L1MuBMSectorProcessor & m_sp
Definition: L1MuBMEUX.h:108
int const theExtFilter
Definition: L1MuBMEUX.h:120
bool m_result
Definition: L1MuBMEUX.h:112
unsigned short const nbit_phi
Definition: L1MuBMEUX.h:121
unsigned short const nbit_phib
Definition: L1MuBMEUX.h:122
unsigned short int m_quality
Definition: L1MuBMEUX.h:113

◆ ~L1MuBMEUX()

L1MuBMEUX::~L1MuBMEUX ( )

destructor

Definition at line 69 of file L1MuBMEUX.cc.

69 {}

Member Function Documentation

◆ address()

unsigned short int L1MuBMEUX::address ( ) const
inline

return extrapolation address (0-11) (address = 15 indicates negative ext. result)

Definition at line 101 of file L1MuBMEUX.h.

References m_address.

Referenced by operator==().

101 { return m_address; }
unsigned short int m_address
Definition: L1MuBMEUX.h:114

◆ id()

int L1MuBMEUX::id ( void  ) const
inline

return Extrapolation identifier

Definition at line 92 of file L1MuBMEUX.h.

References m_id.

Referenced by operator==().

92 { return m_id; }
int m_id
Definition: L1MuBMEUX.h:110

◆ load()

void L1MuBMEUX::load ( const L1MuBMTrackSegPhi start_ts,
const L1MuBMTrackSegPhi target_ts 
)

load data into EUX

Definition at line 218 of file L1MuBMEUX.cc.

References EX21, EX34, L1MuBMSEU::ext(), m_seu, m_start, and m_target.

218  {
219  m_start = start_ts;
220  m_target = target_ts;
221 
222  // in case of EX34 and EX21 exchange start and target
223  if ((m_seu.ext() == EX34) || (m_seu.ext() == EX21)) {
224  m_start = target_ts;
225  m_target = start_ts;
226  }
227 }
const L1MuBMSEU & m_seu
Definition: L1MuBMEUX.h:109
const L1MuBMTrackSegPhi * m_target
Definition: L1MuBMEUX.h:117
const L1MuBMTrackSegPhi * m_start
Definition: L1MuBMEUX.h:116
Extrapolation ext() const
return extrapolation type
Definition: L1MuBMSEU.h:78

◆ operator==()

bool L1MuBMEUX::operator== ( const L1MuBMEUX eux) const

equal operator

Definition at line 78 of file L1MuBMEUX.cc.

References address(), id(), m_address, m_id, m_quality, m_result, quality(), and result().

78  {
79  if (m_id != eux.id())
80  return false;
81  if (m_result != eux.result())
82  return false;
83  if (m_quality != eux.quality())
84  return false;
85  if (m_address != eux.address())
86  return false;
87  return true;
88 }
unsigned int quality() const
return extrapolation quality
Definition: L1MuBMEUX.h:98
int m_id
Definition: L1MuBMEUX.h:110
unsigned short int m_address
Definition: L1MuBMEUX.h:114
bool m_result
Definition: L1MuBMEUX.h:112
bool result() const
return extrapolation result
Definition: L1MuBMEUX.h:95
unsigned short int m_quality
Definition: L1MuBMEUX.h:113
unsigned short int address() const
return extrapolation address (0-11) (address = 15 indicates negative ext. result) ...
Definition: L1MuBMEUX.h:101
int id() const
return Extrapolation identifier
Definition: L1MuBMEUX.h:92

◆ quality()

unsigned int L1MuBMEUX::quality ( void  ) const
inline

return extrapolation quality

Definition at line 98 of file L1MuBMEUX.h.

References m_quality.

Referenced by operator==().

98 { return m_quality; }
unsigned short int m_quality
Definition: L1MuBMEUX.h:113

◆ reset()

void L1MuBMEUX::reset ( void  )

reset Extrapolator

Definition at line 233 of file L1MuBMEUX.cc.

References m_address, m_quality, m_result, m_start, and m_target.

233  {
234  m_result = false;
235  m_quality = 0;
236  m_address = 15;
237 
238  m_start = nullptr;
239  m_target = nullptr;
240 }
unsigned short int m_address
Definition: L1MuBMEUX.h:114
const L1MuBMTrackSegPhi * m_target
Definition: L1MuBMEUX.h:117
const L1MuBMTrackSegPhi * m_start
Definition: L1MuBMEUX.h:116
bool m_result
Definition: L1MuBMEUX.h:112
unsigned short int m_quality
Definition: L1MuBMEUX.h:113

◆ result()

bool L1MuBMEUX::result ( ) const
inline

return extrapolation result

Definition at line 95 of file L1MuBMEUX.h.

References m_result.

Referenced by operator==().

95 { return m_result; }
bool m_result
Definition: L1MuBMEUX.h:112

◆ run()

void L1MuBMEUX::run ( const L1TMuonBarrelParams c)

run Extrapolator

< ext look-up tables

Definition at line 93 of file L1MuBMEUX.cc.

References funct::abs(), l1t::bitShift(), gather_cfg::cout, L1MuBMTFConfig::Debug(), change_name::diff, EX12, EX13, EX14, EX15, EX21, EX23, EX24, EX25, EX34, L1MuBMSEU::ext(), L1MuDTTFParameters::get_soc_openlut_extr(), L1MuDTTFParameters::get_soc_qcut_st1(), L1MuDTTFParameters::get_soc_qcut_st2(), L1MuDTTFParameters::get_soc_qcut_st4(), L1MuBMLUTHandler::getHigh(), L1MuBMLUTHandler::getLow(), L1MuBMTFConfig::getopenLUTs(), LaserClient_cfi::high, L1MuBMSectorProcessor::id(), L1TMuonBarrelParams::l1mudttfparams, LaserClient_cfi::low, m_address, m_id, m_quality, m_result, m_seu, m_sp, m_start, m_target, nbit_phi, nbit_phib, hltrates_dqm_sourceclient-live_cfg::offset, pars, L1MuBMTrackSegPhi::phi(), L1MuBMTrackSegPhi::phib(), L1MuBMTrackSegPhi::quality(), sec_mod(), L1MuBMSecProcId::sector(), L1MuBMTrackSegPhi::sector(), theExtLUTs, L1MuBMSecProcId::wheel(), and L1MuBMTrackSegPhi::wheel().

93  {
94  pars = bmtfParams.l1mudttfparams;
95  theExtLUTs = new L1MuBMLUTHandler(bmtfParams);
96 
97  if (L1MuBMTFConfig::Debug(4))
98  cout << "Run EUX " << m_id << endl;
99  if (L1MuBMTFConfig::Debug(4))
100  cout << "start : " << *m_start << endl;
101  if (L1MuBMTFConfig::Debug(4))
102  cout << "target : " << *m_target << endl;
103 
104  if (m_start == nullptr || m_target == nullptr) {
105  if (L1MuBMTFConfig::Debug(4))
106  cout << "Error: EUX has no data loaded" << endl;
107  delete theExtLUTs;
108  return;
109  }
110 
111  // start sector
112  int sector_st = m_start->sector();
113 
114  // target sector
115  int sector_ta = m_target->sector();
116 
117  // get index of look-up table
118  int lut_idx = m_seu.ext();
119  if (abs(m_target->wheel()) == 3) {
120  switch (m_seu.ext()) {
121  case EX13: {
122  lut_idx = EX15;
123  break;
124  }
125  case EX23: {
126  lut_idx = EX25;
127  break;
128  }
129  default: {
130  lut_idx = m_seu.ext();
131  break;
132  }
133  }
134  }
135 
136  if (L1MuBMTFConfig::Debug(5))
137  cout << "EUX : using look-up table : " << static_cast<Extrapolation>(lut_idx) << endl;
138 
139  // Extrapolation TS quality filter
140  int qcut = 0;
141  if (m_seu.ext() == EX12)
142  qcut = pars.get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector());
143  if (m_seu.ext() == EX13)
144  qcut = pars.get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector());
145  if (m_seu.ext() == EX14)
146  qcut = pars.get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector());
147  if (m_seu.ext() == EX21)
148  qcut = pars.get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector());
149  if (m_seu.ext() == EX23)
150  qcut = pars.get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector());
151  if (m_seu.ext() == EX24)
152  qcut = pars.get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector());
153  if (m_seu.ext() == EX34)
154  qcut = pars.get_soc_qcut_st4(m_sp.id().wheel(), m_sp.id().sector());
155 
156  if (m_start->quality() < qcut) {
157  delete theExtLUTs;
158  return;
159  }
160  // calculate bit shift
161  int sh_phi = 12 - nbit_phi;
162  int sh_phib = 10 - nbit_phib;
163 
164  int phi_target = m_target->phi() >> sh_phi;
165  int phi_start = m_start->phi() >> sh_phi;
166  int phib_start = l1t::bitShift((m_start->phib() >> sh_phib), sh_phib);
167  if (phib_start < 0)
168  phib_start += (1 << sh_phib) - 1;
169 
170  // compute difference in phi
171  int diff = phi_target - phi_start;
172 
173  // get low and high values from look-up table
174  // and add offset (30 degrees ) for extrapolation to adjacent sector
175  int offset = -2144 >> sh_phi;
176  offset *= sec_mod(sector_ta - sector_st);
177  int low = theExtLUTs->getLow(lut_idx, phib_start);
178  int high = theExtLUTs->getHigh(lut_idx, phib_start);
179  if (low < 0)
180  low += (1 << sh_phi) - 1;
181  if (high < 0)
182  high += (1 << sh_phi) - 1;
183  low = (low >> sh_phi) + offset;
184  high = (high >> sh_phi) + offset;
185 
186  int phi_offset = phi_target - offset;
187  if ((lut_idx == EX34) || (lut_idx == EX21))
188  phi_offset = phi_start + offset;
189  if (phi_offset >= (1 << (nbit_phi - 1)) - 1) {
190  delete theExtLUTs;
191  return;
192  }
193  if (phi_offset < -(1 << (nbit_phi - 1)) + 1) {
194  delete theExtLUTs;
195  return;
196  }
197  // is phi-difference within the extrapolation window?
198  bool openlut = pars.get_soc_openlut_extr(m_sp.id().wheel(), m_sp.id().sector());
199  if ((diff >= low && diff <= high) || L1MuBMTFConfig::getopenLUTs() || openlut) {
200  m_result = true;
201  int qual_st = m_start->quality();
202  int qual_ta = m_target->quality();
203  if (m_seu.ext() == EX34 || m_seu.ext() == EX21) {
204  m_quality = (qual_st == 7) ? 0 : qual_st + 1;
205  } else {
206  m_quality = (qual_ta == 7) ? 0 : qual_ta + 1;
207  }
208  m_address = m_id;
209  }
210  delete theExtLUTs;
211  if (L1MuBMTFConfig::Debug(5))
212  cout << "diff : " << low << " " << diff << " " << high << " : " << m_result << " " << endl;
213 }
const L1MuBMSEU & m_seu
Definition: L1MuBMEUX.h:109
L1MuBMLUTHandler * theExtLUTs
Definition: L1MuBMEUX.h:119
const L1MuBMSecProcId & id() const
return Sector Processor identifier
static bool getopenLUTs()
int m_id
Definition: L1MuBMEUX.h:110
unsigned short int m_address
Definition: L1MuBMEUX.h:114
int wheel() const
return wheel
int wheel() const
return wheel number
const L1MuBMTrackSegPhi * m_target
Definition: L1MuBMEUX.h:117
L1MuDTTFParameters pars
Definition: L1MuBMEUX.h:124
unsigned short int get_soc_qcut_st2(int wh, int sc) const
unsigned short int get_soc_qcut_st1(int wh, int sc) const
const L1MuBMTrackSegPhi * m_start
Definition: L1MuBMEUX.h:116
unsigned short int get_soc_qcut_st4(int wh, int sc) const
int quality() const
return quality code
const L1MuBMSectorProcessor & m_sp
Definition: L1MuBMEUX.h:108
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int phib() const
return phib
Extrapolation
int getHigh(int ext_ind, int address) const
get high_value for a given address
int sector() const
return sector number
int getLow(int ext_ind, int address) const
get low_value for a given address
int sec_mod(int) const
output sector numbers in the range -6 to +5
Definition: L1MuBMEUX.cc:253
bool m_result
Definition: L1MuBMEUX.h:112
static bool Debug()
unsigned short const nbit_phi
Definition: L1MuBMEUX.h:121
unsigned short const nbit_phib
Definition: L1MuBMEUX.h:122
int sector() const
return sector
int phi() const
return phi
unsigned short int m_quality
Definition: L1MuBMEUX.h:113
Extrapolation ext() const
return extrapolation type
Definition: L1MuBMSEU.h:78
int bitShift(int num, int bits)
Definition: BitShift.h:6
bool get_soc_openlut_extr(int wh, int sc) const

◆ sec_mod()

int L1MuBMEUX::sec_mod ( int  sector) const
private

output sector numbers in the range -6 to +5

Definition at line 253 of file L1MuBMEUX.cc.

References hgcalTBTopologyTester_cfi::sector.

Referenced by run().

253  {
254  int new_sector = sector % 12;
255  if (new_sector >= 6)
256  new_sector = new_sector - 12;
257  if (new_sector < -6)
258  new_sector = new_sector + 12;
259 
260  return new_sector;
261 }

◆ ts()

pair< const L1MuBMTrackSegPhi *, const L1MuBMTrackSegPhi * > L1MuBMEUX::ts ( ) const

return pointer to start and target track segment

Definition at line 245 of file L1MuBMEUX.cc.

References m_start, and m_target.

245  {
246  return pair<const L1MuBMTrackSegPhi*, const L1MuBMTrackSegPhi*>(m_start, m_target);
247 }
const L1MuBMTrackSegPhi * m_target
Definition: L1MuBMEUX.h:117
const L1MuBMTrackSegPhi * m_start
Definition: L1MuBMEUX.h:116

Member Data Documentation

◆ m_address

unsigned short int L1MuBMEUX::m_address
private

Definition at line 114 of file L1MuBMEUX.h.

Referenced by address(), operator==(), reset(), and run().

◆ m_id

int L1MuBMEUX::m_id
private

Definition at line 110 of file L1MuBMEUX.h.

Referenced by id(), operator==(), and run().

◆ m_quality

unsigned short int L1MuBMEUX::m_quality
private

Definition at line 113 of file L1MuBMEUX.h.

Referenced by operator==(), quality(), reset(), and run().

◆ m_result

bool L1MuBMEUX::m_result
private

Definition at line 112 of file L1MuBMEUX.h.

Referenced by operator==(), reset(), result(), and run().

◆ m_seu

const L1MuBMSEU& L1MuBMEUX::m_seu
private

Definition at line 109 of file L1MuBMEUX.h.

Referenced by load(), and run().

◆ m_sp

const L1MuBMSectorProcessor& L1MuBMEUX::m_sp
private

Definition at line 108 of file L1MuBMEUX.h.

Referenced by run().

◆ m_start

const L1MuBMTrackSegPhi* L1MuBMEUX::m_start
private

Definition at line 116 of file L1MuBMEUX.h.

Referenced by load(), reset(), run(), and ts().

◆ m_target

const L1MuBMTrackSegPhi* L1MuBMEUX::m_target
private

Definition at line 117 of file L1MuBMEUX.h.

Referenced by load(), reset(), run(), and ts().

◆ nbit_phi

unsigned short const L1MuBMEUX::nbit_phi = 12
private

Definition at line 121 of file L1MuBMEUX.h.

Referenced by run().

◆ nbit_phib

unsigned short const L1MuBMEUX::nbit_phib = 10
private

Definition at line 122 of file L1MuBMEUX.h.

Referenced by run().

◆ pars

L1MuDTTFParameters L1MuBMEUX::pars
private

Definition at line 124 of file L1MuBMEUX.h.

Referenced by run().

◆ theExtFilter

int const L1MuBMEUX::theExtFilter = 1
private

Definition at line 120 of file L1MuBMEUX.h.

◆ theExtLUTs

L1MuBMLUTHandler* L1MuBMEUX::theExtLUTs
private

Definition at line 119 of file L1MuBMEUX.h.

Referenced by run().