CMS 3D CMS Logo

L1MuBMTrack.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMTrack
4 //
5 // Description: Muon Track Candidate
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 // J. Troconiz UAM Madrid
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
18 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 #include <iostream>
26 #include <iomanip>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
35 //#include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
36 //#include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
37 //#include "CondFormats/L1TObjects/interface/L1MuPacking.h"
38 
39 using namespace std;
40 
41 // --------------------------------
42 // class L1MuBMTrack
43 //---------------------------------
44 
45 //----------------
46 // Constructors --
47 //----------------
49  : //L1MuRegionalCand(0,0),-->
50  l1t::RegionalMuonCand(),
51  m_spid(L1MuBMSecProcId()),
52  m_name("L1MuBMTrack"),
53  m_empty(true),
54  m_tc(UNDEF),
55  m_addArray(),
56  m_tsphiList(),
57  m_tsetaList() {
58  m_tsphiList.reserve(4);
59  m_tsetaList.reserve(3);
60 
61  //setType(0);
62  //setChargeValid(true);
63  setHwSignValid(1);
64 }
65 
67  : //L1MuRegionalCand(0,0),-->
68  l1t::RegionalMuonCand(),
69  m_spid(spid),
70  m_name("L1MuBMTrack"),
71  m_empty(true),
72  m_tc(UNDEF),
73  m_addArray(),
74  m_tsphiList(),
75  m_tsetaList() {
76  m_tsphiList.reserve(4);
77  m_tsetaList.reserve(3);
78  //setType(0);
79  //setChargeValid(true);
80  setHwSignValid(1);
81 }
82 
84  : //L1MuRegionalCand(id),-->
85  l1t::RegionalMuonCand(id),
86  m_spid(id.m_spid),
87  m_name(id.m_name),
88  m_empty(id.m_empty),
89  m_tc(id.m_tc),
90  m_addArray(id.m_addArray),
91  m_tsphiList(id.m_tsphiList),
92  m_tsetaList(id.m_tsetaList) {}
93 
94 //--------------
95 // Destructor --
96 //--------------
98 
99 //--------------
100 // Operations --
101 //--------------
102 
103 //
104 // reset Muon Track Candidate
105 //
107  //L1MuRegionalCand::reset();
108  m_empty = true;
109  m_tc = UNDEF;
110  m_addArray.reset();
111  m_tsphiList.clear();
112  m_tsetaList.clear();
113 }
114 
115 //
116 // set (packed) eta-code of muon candidate
117 //
119  // eta is a signed integer [-115,118],
120  setHwHF(false);
121  setHwEta(eta);
122 }
123 
124 //
125 // return start phi track segment
126 //
127 const L1MuBMTrackSegPhi& L1MuBMTrack::getStartTSphi() const { return m_tsphiList.front(); }
128 
129 //
130 // return end phi track segment
131 //
132 const L1MuBMTrackSegPhi& L1MuBMTrack::getEndTSphi() const { return m_tsphiList.back(); }
133 
134 //
135 // return start eta track segment
136 //
137 const L1MuBMTrackSegEta& L1MuBMTrack::getStartTSeta() const { return m_tsetaList.front(); }
138 
139 //
140 // return end eta track segment
141 //
142 const L1MuBMTrackSegEta& L1MuBMTrack::getEndTSeta() const { return m_tsetaList.back(); }
143 
144 //
145 // set phi track segments used to form the muon candidate
146 //
147 void L1MuBMTrack::setTSphi(const vector<const L1MuBMTrackSegPhi*>& tsList) {
148  if (!tsList.empty()) {
149  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
150  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
151  if (*iter)
152  m_tsphiList.push_back(**iter);
153  }
154  }
155 }
156 
157 //
158 // set eta track segments used to form the muon candidate
159 //
160 void L1MuBMTrack::setTSeta(const vector<const L1MuBMTrackSegEta*>& tsList) {
161  if (!tsList.empty()) {
162  vector<const L1MuBMTrackSegEta*>::const_iterator iter;
163  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
164  if (*iter)
165  m_tsetaList.push_back(**iter);
166  }
167  }
168 }
169 
170 //
171 // convert pt value in GeV to pt code
172 //
173 unsigned int L1MuBMTrack::triggerScale(float value, const edm::EventSetup& c) const {
174  /*const float eps = 1.e-5; // add an epsilon so that setting works with low edge value
175 
176  edm::ESHandle< L1MuTriggerPtScale > theTriggerScales;
177  c.get< L1MuTriggerPtScaleRcd >().get( theTriggerScales );
178  unsigned int t_Scale = theTriggerScales->getPtScale()->getPacked( value + eps );
179 
180  return t_Scale;*/
181  return (unsigned int)0.5;
182 }
183 
184 //
185 // Assignment operator
186 //
188  if (this != &track) {
189  this->setBx(track.bx());
190  //this->setDataWord(track.getDataWord());
191  m_spid = track.m_spid;
192  m_empty = track.m_empty;
193  m_name = track.m_name;
194  m_tc = track.m_tc;
195  m_addArray = track.m_addArray;
196  m_tsphiList = track.m_tsphiList;
197  m_tsetaList = track.m_tsetaList;
198  }
199  return *this;
200 }
201 
202 //
203 // Equal operator
204 //
206  if (m_spid != track.m_spid)
207  return false;
208  if (m_empty != track.m_empty)
209  return false;
210  if (m_tc != track.m_tc)
211  return false;
212  if (bx() != track.bx())
213  return false;
214  if (phi() != track.phi())
215  return false;
216  if (eta() != track.eta())
217  return false;
218  if (fineEtaBit() != track.fineEtaBit())
219  return false;
220  if (pt() != track.pt())
221  return false;
222  if (charge() != track.charge())
223  return false;
224  if (quality() != track.quality())
225  return false;
226  if (m_addArray != track.m_addArray)
227  return false;
228  return true;
229 }
230 
231 //
232 // Unequal operator
233 //
235  if (m_spid != track.m_spid)
236  return true;
237  if (m_empty != track.m_empty)
238  return true;
239  if (m_tc != track.m_tc)
240  return true;
241  if (bx() != track.bx())
242  return true;
243  if (phi() != track.phi())
244  return true;
245  if (eta() != track.eta())
246  return true;
247  if (fineEtaBit() != track.fineEtaBit())
248  return true;
249  if (pt() != track.pt())
250  return true;
251  if (charge() != track.charge())
252  return true;
253  if (quality() != track.quality())
254  return true;
255  if (m_addArray != track.m_addArray)
256  return true;
257  return false;
258 }
259 
260 //
261 // print parameters of track candidate
262 //
263 void L1MuBMTrack::print() const {
264  if (!empty()) {
265  cout.setf(ios::showpoint);
266  cout.setf(ios::right, ios::adjustfield);
267  cout << setiosflags(ios::showpoint | ios::fixed);
268  cout << "MUON : "
269  << "pt = " << setw(3) << hwPt() << " "
270  << "charge = " << setw(2) << hwSign() << " "
271  << "eta = " << setw(2)
272  << hwEta()
273  //<< " (" << setw(1) << finehalo_packed() << ") "
274  << "phi = " << setw(3) << hwPhi() << " "
275  << "quality = " << setw(1) << hwQual() << '\t' << "class = " << tc() << " "
276  << "bx = " << setw(2) << bx() << endl;
277  cout << " found in " << m_spid << " with phi track segments :" << endl;
278  vector<L1MuBMTrackSegPhi>::const_iterator iter;
279  for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) {
280  cout << " " << (*iter) << endl;
281  }
282  }
283 }
284 
285 //
286 // output stream operator for track candidate
287 //
288 ostream& operator<<(ostream& s, const L1MuBMTrack& id) {
289  if (!id.empty()) {
290  s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(3) << id.hwPt() << " "
291  << "charge = " << setw(2) << id.hwSign() << " "
292  << "eta = " << setw(2)
293  << id.hwEta()
294  //<< " (" << setw(1) << id.finehalo_packed() << ") "
295  << "phi = " << setw(3) << id.hwPhi() << " "
296  << "quality = " << setw(1) << id.hwQual() << '\t' << "bx = " << setw(2) << id.bx();
297  }
298  return s;
299 }
L1MuBMTrack::empty
bool empty() const
is it an empty muon candidate?
Definition: L1MuBMTrack.h:93
L1MuBMTrack::getEndTSeta
const L1MuBMTrackSegEta & getEndTSeta() const
return end eta track segment of muon candidate
Definition: L1MuBMTrack.cc:142
L1MuBMTrackSegEta
Definition: L1MuBMTrackSegEta.h:41
L1MuBMTrack::eta
int eta() const
get eta-code (6 bits)
Definition: L1MuBMTrack.h:78
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
L1MuBMTrack::L1MuBMTrack
L1MuBMTrack()
default constructor
Definition: L1MuBMTrack.cc:48
l1t::RegionalMuonCand::hwPhi
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
Definition: RegionalMuonCand.h:167
L1MuBMTrackSegPhi
Definition: L1MuBMTrackSegPhi.h:41
L1MuBMTrack::getStartTSphi
const L1MuBMTrackSegPhi & getStartTSphi() const
return start phi track segment of muon candidate
Definition: L1MuBMTrack.cc:127
L1MuBMTrack::pt
unsigned int pt() const
get pt-code (5 bits)
Definition: L1MuBMTrack.h:72
L1MuBMSecProcId
Definition: L1MuBMSecProcId.h:40
L1MuBMTrack::fineEtaBit
bool fineEtaBit() const
get fine eta bit
Definition: L1MuBMTrack.h:81
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuBMTrackSegPhi.h
L1MuBMTrack::tc
TrackClass tc() const
get track-class
Definition: L1MuBMTrack.h:90
L1MuBMTrack::m_spid
L1MuBMSecProcId m_spid
Definition: L1MuBMTrack.h:206
l1t::RegionalMuonCand::hwQual
const int hwQual() const
Get quality code.
Definition: RegionalMuonCand.h:175
L1MuBMAddressArray::reset
void reset()
reset address array
Definition: L1MuBMAddressArray.cc:100
l1t::RegionalMuonCand::hwEta
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
Definition: RegionalMuonCand.h:169
L1MuBMTrack::m_empty
bool m_empty
Definition: L1MuBMTrack.h:208
L1MuBMTrack::operator==
bool operator==(const L1MuBMTrack &) const
equal operator
Definition: L1MuBMTrack.cc:205
L1MuBMTrack::print
void print() const
print parameters of muon candidate
Definition: L1MuBMTrack.cc:263
l1t::RegionalMuonCand::hwPt
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
Definition: RegionalMuonCand.h:161
L1MuBMTrack::m_tsetaList
std::vector< L1MuBMTrackSegEta > m_tsetaList
Definition: L1MuBMTrack.h:214
alignCSCRings.s
s
Definition: alignCSCRings.py:92
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1MuBMTrack::charge
int charge() const
get charge (1 bit)
Definition: L1MuBMTrack.h:84
L1MuBMTrack::quality
unsigned int quality() const
get quality
Definition: L1MuBMTrack.h:87
L1MuBMTrack::bx
int bx() const
get the bunch crossing for this muon candidate
Definition: L1MuBMTrack.h:105
l1t::RegionalMuonCand::setHwHF
void setHwHF(bool bit)
Set HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1)
Definition: RegionalMuonCand.h:142
L1MuBMTrack::getStartTSeta
const L1MuBMTrackSegEta & getStartTSeta() const
return start eta track segment of muon candidate
Definition: L1MuBMTrack.cc:137
funct::true
true
Definition: Factorize.h:173
L1MuBMTrack::setTSeta
void setTSeta(const std::vector< const L1MuBMTrackSegEta * > &tsList)
set eta track segments used to form the muon candidate
Definition: L1MuBMTrack.cc:160
l1t
delete x;
Definition: CaloConfig.h:22
l1t::RegionalMuonCand::setHwEta
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
Definition: RegionalMuonCand.h:134
L1MuBMTrack
Definition: L1MuBMTrack.h:51
L1MuBMSecProcId.h
value
Definition: value.py:1
L1MuBMTrack::reset
void reset()
reset muon candidate
Definition: L1MuBMTrack.cc:106
L1MuBMTrack::setEta
void setEta(int eta)
set eta-code of muon candidate
Definition: L1MuBMTrack.cc:118
L1MuBMTrack::setTSphi
void setTSphi(const std::vector< const L1MuBMTrackSegPhi * > &tsList)
set phi track segments used to form the muon candidate
Definition: L1MuBMTrack.cc:147
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1MuBMTrack::setBx
void setBx(int bx)
set charge of muon candidate
Definition: L1MuBMTrack.h:162
l1t::RegionalMuonCand::setHwSignValid
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
Definition: RegionalMuonCand.h:138
L1MuBMTrack::m_tsphiList
std::vector< L1MuBMTrackSegPhi > m_tsphiList
Definition: L1MuBMTrack.h:213
l1t::RegionalMuonCand::hwSign
const int hwSign() const
Get charge sign bit (charge = (-1)^(sign))
Definition: RegionalMuonCand.h:171
std
Definition: JetResolutionObject.h:76
L1MuBMTrack::m_tc
TrackClass m_tc
Definition: L1MuBMTrack.h:209
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
L1MuBMTrack::triggerScale
unsigned int triggerScale(float value, const edm::EventSetup &c) const
convert pt value in GeV to pt code
Definition: L1MuBMTrack.cc:173
L1MuBMTrack::phi
unsigned int phi() const
get phi-code (8 bits)
Definition: L1MuBMTrack.h:75
L1MuBMTrackSegEta.h
L1MuBMTrack::m_name
std::string m_name
Definition: L1MuBMTrack.h:207
L1MuBMTrack::getEndTSphi
const L1MuBMTrackSegPhi & getEndTSphi() const
return end phi track segment of muon candidate
Definition: L1MuBMTrack.cc:132
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
UNDEF
Definition: L1MuBMTrackAssParam.h:21
L1MuBMTrack.h
L1MuBMTrack::operator!=
bool operator!=(const L1MuBMTrack &) const
unequal operator
Definition: L1MuBMTrack.cc:234
L1MuBMTrack::m_addArray
L1MuBMAddressArray m_addArray
Definition: L1MuBMTrack.h:212
operator<<
ostream & operator<<(ostream &s, const L1MuBMTrack &id)
Definition: L1MuBMTrack.cc:288
L1MuBMTrack::operator=
L1MuBMTrack & operator=(const L1MuBMTrack &)
assignment operator
Definition: L1MuBMTrack.cc:187
L1MuBMTrack::~L1MuBMTrack
~L1MuBMTrack() override
destructor
Definition: L1MuBMTrack.cc:97