CMS 3D CMS Logo

L1MuDTEUX.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTEUX
4 //
5 // Description: Extrapolator
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 
26 //-------------------------------
27 // Collaborating Class Headers --
28 //-------------------------------
29 
40 
41 using namespace std;
42 
43 // --------------------------------
44 // class L1MuDTEUX
45 //---------------------------------
46 
47 //----------------
48 // Constructors --
49 //----------------
50 
52  : m_sp(sp),
53  m_seu(seu),
54  m_id(id),
55  m_result(false),
56  m_quality(0),
57  m_address(15),
58  m_start(nullptr),
59  m_target(nullptr),
60  theExtFilter(sp.tf().config()->getExtTSFilter()),
61  nbit_phi(sp.tf().config()->getNbitsExtPhi()),
62  nbit_phib(sp.tf().config()->getNbitsExtPhib()) {}
63 
64 //--------------
65 // Destructor --
66 //--------------
67 
69 
70 //--------------
71 // Operations --
72 //--------------
73 
74 //
75 // Equal operator
76 //
77 bool L1MuDTEUX::operator==(const L1MuDTEUX& eux) const {
78  if (m_id != eux.id())
79  return false;
80  if (m_result != eux.result())
81  return false;
82  if (m_quality != eux.quality())
83  return false;
84  if (m_address != eux.address())
85  return false;
86  return true;
87 }
88 
89 //
90 // run EUX
91 //
95 
96  const bool debug4 = m_sp.tf().config()->Debug(4);
97  if (debug4)
98  cout << "Run EUX " << m_id << endl;
99  if (debug4)
100  cout << "start : " << *m_start << endl;
101  if (debug4)
102  cout << "target : " << *m_target << endl;
103 
104  if (m_start == nullptr || m_target == nullptr) {
105  if (debug4)
106  cout << "Error: EUX has no data loaded" << endl;
107  return;
108  }
109 
110  // start sector
111  int sector_st = m_start->sector();
112 
113  // target sector
114  int sector_ta = m_target->sector();
115 
116  // get index of look-up table
117  int lut_idx = m_seu.ext();
118  if (abs(m_target->wheel()) == 3) {
119  switch (m_seu.ext()) {
120  case EX13: {
121  lut_idx = EX15;
122  break;
123  }
124  case EX23: {
125  lut_idx = EX25;
126  break;
127  }
128  default: {
129  lut_idx = m_seu.ext();
130  break;
131  }
132  }
133  }
134 
135  if (m_sp.tf().config()->Debug(5))
136  cout << "EUX : using look-up table : " << static_cast<Extrapolation>(lut_idx) << endl;
137 
138  // Extrapolation TS quality filter
139  int qcut = 0;
140  if (m_seu.ext() == EX12)
141  qcut = pars->get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector());
142  if (m_seu.ext() == EX13)
143  qcut = pars->get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector());
144  if (m_seu.ext() == EX14)
145  qcut = pars->get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector());
146  if (m_seu.ext() == EX21)
147  qcut = pars->get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector());
148  if (m_seu.ext() == EX23)
149  qcut = pars->get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector());
150  if (m_seu.ext() == EX24)
151  qcut = pars->get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector());
152  if (m_seu.ext() == EX34)
153  qcut = pars->get_soc_qcut_st4(m_sp.id().wheel(), m_sp.id().sector());
154 
155  if (m_start->quality() < qcut)
156  return;
157 
158  // calculate bit shift
159  int sh_phi = 12 - nbit_phi;
160  int sh_phib = 10 - nbit_phib;
161 
162  int phi_target = m_target->phi() >> sh_phi;
163  int phi_start = m_start->phi() >> sh_phi;
164  int phib_start = (m_start->phib() >> sh_phib) << sh_phib;
165  if (phib_start < 0)
166  phib_start += (1 << sh_phib) - 1;
167 
168  // compute difference in phi
169  int diff = phi_target - phi_start;
170 
171  // get low and high values from look-up table
172  // and add offset (30 degrees ) for extrapolation to adjacent sector
173  int offset = -2144 >> sh_phi;
174  offset *= sec_mod(sector_ta - sector_st);
175  int low = theExtLUTs->getLow(lut_idx, phib_start);
176  int high = theExtLUTs->getHigh(lut_idx, phib_start);
177  if (low < 0)
178  low += (1 << sh_phi) - 1;
179  if (high < 0)
180  high += (1 << sh_phi) - 1;
181  low = (low >> sh_phi) + offset;
182  high = (high >> sh_phi) + offset;
183 
184  int phi_offset = phi_target - offset;
185  if ((lut_idx == EX34) || (lut_idx == EX21))
186  phi_offset = phi_start + offset;
187  if (phi_offset >= (1 << (nbit_phi - 1)) - 1)
188  return;
189  if (phi_offset < -(1 << (nbit_phi - 1)) + 1)
190  return;
191 
192  // is phi-difference within the extrapolation window?
193  bool openlut = pars->get_soc_openlut_extr(m_sp.id().wheel(), m_sp.id().sector());
194  if ((diff >= low && diff <= high) || m_sp.tf().config()->getopenLUTs() || openlut) {
195  m_result = true;
196  int qual_st = m_start->quality();
197  int qual_ta = m_target->quality();
198  if (m_seu.ext() == EX34 || m_seu.ext() == EX21) {
199  m_quality = (qual_st == 7) ? 0 : qual_st + 1;
200  } else {
201  m_quality = (qual_ta == 7) ? 0 : qual_ta + 1;
202  }
203  m_address = m_id;
204  }
205 
206  if (m_sp.tf().config()->Debug(5))
207  cout << "diff : " << low << " " << diff << " " << high << " : " << m_result << " " << endl;
208 }
209 
210 //
211 // load data into EUX
212 //
213 void L1MuDTEUX::load(const L1MuDTTrackSegPhi* start_ts, const L1MuDTTrackSegPhi* target_ts) {
214  m_start = start_ts;
215  m_target = target_ts;
216 
217  // in case of EX34 and EX21 exchange start and target
218  if ((m_seu.ext() == EX34) || (m_seu.ext() == EX21)) {
219  m_start = target_ts;
220  m_target = start_ts;
221  }
222 }
223 
224 //
225 // reset this EUX
226 //
227 
229  m_result = false;
230  m_quality = 0;
231  m_address = 15;
232 
233  m_start = nullptr;
234  m_target = nullptr;
235 }
236 
237 //
238 // return pointer to start and target track segment
239 //
240 pair<const L1MuDTTrackSegPhi*, const L1MuDTTrackSegPhi*> L1MuDTEUX::ts() const {
241  return pair<const L1MuDTTrackSegPhi*, const L1MuDTTrackSegPhi*>(m_start, m_target);
242 }
243 
244 //
245 // symmetric modulo function for sectors
246 // output values in the range -6 to +5
247 //
248 int L1MuDTEUX::sec_mod(int sector) const {
249  int new_sector = sector % 12;
250  if (new_sector >= 6)
251  new_sector = new_sector - 12;
252  if (new_sector < -6)
253  new_sector = new_sector + 12;
254 
255  return new_sector;
256 }
change_name.diff
diff
Definition: change_name.py:13
EX13
Definition: L1MuDTExtParam.h:22
funct::false
false
Definition: Factorize.h:29
L1MuDTTFConfig.h
L1MuDTTFParameters::get_soc_openlut_extr
bool get_soc_openlut_extr(int wh, int sc) const
Definition: L1MuDTTFParameters.cc:270
L1MuDTEUX
Definition: L1MuDTEUX.h:48
L1MuDTEUX::m_start
const L1MuDTTrackSegPhi * m_start
Definition: L1MuDTEUX.h:114
L1MuDTTFParameters.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuDTSectorProcessor.h
L1MuDTExtLut.h
L1MuDTEUX::L1MuDTEUX
L1MuDTEUX(const L1MuDTSectorProcessor &sp, const L1MuDTSEU &seu, int id)
constructor
Definition: L1MuDTEUX.cc:51
L1MuDTExtLutRcd.h
L1MuDTTrackSegPhi::phib
int phib() const
return phib
Definition: L1MuDTTrackSegPhi.h:95
L1MuDTEUX::reset
void reset() override
reset Extrapolator
Definition: L1MuDTEUX.cc:228
L1MuDTEUX::quality
unsigned int quality() const
return extrapolation quality
Definition: L1MuDTEUX.h:96
L1MuDTEUX::result
bool result() const
return extrapolation result
Definition: L1MuDTEUX.h:93
L1MuDTTrackFinder.h
L1MuDTSectorProcessor::tf
const L1MuDTTrackFinder & tf() const
return reference to barrel MTTF
Definition: L1MuDTSectorProcessor.h:77
L1MuDTEUX::pars
edm::ESHandle< L1MuDTTFParameters > pars
Definition: L1MuDTEUX.h:122
EX34
Definition: L1MuDTExtParam.h:22
EX15
Definition: L1MuDTExtParam.h:22
L1MuDTEUX::sec_mod
int sec_mod(int) const
output sector numbers in the range -6 to +5
Definition: L1MuDTEUX.cc:248
config
Definition: config.py:1
L1MuDTTrackSegPhi.h
L1MuDTSectorProcessor::id
const L1MuDTSecProcId & id() const
return Sector Processor identifier
Definition: L1MuDTSectorProcessor.h:74
L1MuDTEUX::load
void load(const L1MuDTTrackSegPhi *start_ts, const L1MuDTTrackSegPhi *target_ts)
load data into EUX
Definition: L1MuDTEUX.cc:213
L1MuDTTFParameters::get_soc_qcut_st4
unsigned short int get_soc_qcut_st4(int wh, int sc) const
Definition: L1MuDTTFParameters.cc:210
L1MuDTSecProcId::wheel
int wheel() const
return wheel number
Definition: L1MuDTSecProcId.h:55
L1MuDTEUX::address
unsigned short int address() const
return extrapolation address (0-11) (address = 15 indicates negative ext. result)
Definition: L1MuDTEUX.h:99
L1MuDTEUX::id
int id() const
return Extrapolation identifier
Definition: L1MuDTEUX.h:90
L1MuDTEUX::nbit_phi
unsigned const short nbit_phi
Definition: L1MuDTEUX.h:119
L1MuDTExtParam.h
EX21
Definition: L1MuDTExtParam.h:22
L1MuDTTrackSegPhi::phi
int phi() const
return phi
Definition: L1MuDTTrackSegPhi.h:92
L1MuDTSEU::ext
Extrapolation ext() const
return extrapolation type
Definition: L1MuDTSEU.h:78
L1MuDTSecProcId::sector
int sector() const
return sector number
Definition: L1MuDTSecProcId.h:58
EX23
Definition: L1MuDTExtParam.h:22
L1MuDTTrackSegPhi::sector
int sector() const
return sector
Definition: L1MuDTTrackSegPhi.h:83
EX12
Definition: L1MuDTExtParam.h:22
L1MuDTEUX::m_target
const L1MuDTTrackSegPhi * m_target
Definition: L1MuDTEUX.h:115
L1MuDTEUX::m_seu
const L1MuDTSEU & m_seu
Definition: L1MuDTEUX.h:107
L1MuDTEUX::nbit_phib
unsigned const short nbit_phib
Definition: L1MuDTEUX.h:120
L1MuDTEUX::~L1MuDTEUX
~L1MuDTEUX() override
destructor
Definition: L1MuDTEUX.cc:68
EX25
Definition: L1MuDTExtParam.h:22
L1MuDTEUX.h
L1AbstractProcessor::run
virtual void run()
run processor logic
Definition: L1AbstractProcessor.h:40
EX24
Definition: L1MuDTExtParam.h:22
L1MuDTTFConfig::getopenLUTs
bool getopenLUTs() const
Definition: L1MuDTTFConfig.h:61
L1MuDTSEU.h
edm::EventSetup
Definition: EventSetup.h:57
L1MuDTTrackFinder::config
static L1MuDTTFConfig * config()
return configuration
Definition: L1MuDTTrackFinder.h:102
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1MuDTEUX::operator==
bool operator==(const L1MuDTEUX &) const
equal operator
Definition: L1MuDTEUX.cc:77
get
#define get
L1MuDTTFParameters::get_soc_qcut_st2
unsigned short int get_soc_qcut_st2(int wh, int sc) const
Definition: L1MuDTTFParameters.cc:198
L1MuDTEUX::m_sp
const L1MuDTSectorProcessor & m_sp
Definition: L1MuDTEUX.h:106
L1MuDTEUX::m_result
bool m_result
Definition: L1MuDTEUX.h:110
L1MuDTEUX::m_id
int m_id
Definition: L1MuDTEUX.h:108
LaserClient_cfi.high
high
Definition: LaserClient_cfi.py:50
L1MuDTSectorProcessor
Definition: L1MuDTSectorProcessor.h:53
std
Definition: JetResolutionObject.h:76
L1MuDTExtLut::getLow
int getLow(int ext_ind, int address) const
get low_value for a given address
Definition: L1MuDTExtLut.cc:264
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
L1MuDTEUX::ts
std::pair< const L1MuDTTrackSegPhi *, const L1MuDTTrackSegPhi * > ts() const
return pointer to start and target track segment
Definition: L1MuDTEUX.cc:240
L1MuDTTrackSegPhi
Definition: L1MuDTTrackSegPhi.h:36
EX14
Definition: L1MuDTExtParam.h:22
L1MuDTTrackSegPhi::quality
int quality() const
return quality code
Definition: L1MuDTTrackSegPhi.h:98
L1MuDTTFConfig::Debug
static bool Debug()
Definition: L1MuDTTFConfig.h:49
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuDTSEU
Definition: L1MuDTSEU.h:48
L1MuDTTFParametersRcd.h
L1MuDTTrackSegPhi::wheel
int wheel() const
return wheel
Definition: L1MuDTTrackSegPhi.h:80
L1MuDTExtLut::getHigh
int getHigh(int ext_ind, int address) const
get high_value for a given address
Definition: L1MuDTExtLut.cc:277
L1MuDTEUX::m_quality
unsigned short int m_quality
Definition: L1MuDTEUX.h:111
L1MuDTEUX::theExtLUTs
edm::ESHandle< L1MuDTExtLut > theExtLUTs
Definition: L1MuDTEUX.h:117
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
L1MuDTExtLutRcd
Definition: L1MuDTExtLutRcd.h:12
L1MuDTEUX::m_address
unsigned short int m_address
Definition: L1MuDTEUX.h:112
L1MuDTTFParameters::get_soc_qcut_st1
unsigned short int get_soc_qcut_st1(int wh, int sc) const
Definition: L1MuDTTFParameters.cc:186
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
L1MuDTTFParametersRcd
Definition: L1MuDTTFParametersRcd.h:10