CMS 3D CMS Logo

L1MuDTTrack.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTTrack
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 
38 
39 using namespace std;
40 
41 // --------------------------------
42 // class L1MuDTTrack
43 //---------------------------------
44 
45 //----------------
46 // Constructors --
47 //----------------
49  : L1MuRegionalCand(0, 0),
50  m_spid(L1MuDTSecProcId()),
51  m_name("L1MuDTTrack"),
52  m_empty(true),
53  m_tc(UNDEF),
54  m_addArray(),
55  m_tsphiList(),
56  m_tsetaList() {
57  m_tsphiList.reserve(4);
58  m_tsetaList.reserve(3);
59 
60  setType(0);
61  setChargeValid(true);
62 }
63 
65  : L1MuRegionalCand(0, 0),
66  m_spid(spid),
67  m_name("L1MuDTTrack"),
68  m_empty(true),
69  m_tc(UNDEF),
70  m_addArray(),
71  m_tsphiList(),
72  m_tsetaList() {
73  m_tsphiList.reserve(4);
74  m_tsetaList.reserve(3);
75 
76  setType(0);
77  setChargeValid(true);
78 }
79 
82  m_spid(id.m_spid),
83  m_name(id.m_name),
84  m_empty(id.m_empty),
85  m_tc(id.m_tc),
86  m_addArray(id.m_addArray),
87  m_tsphiList(id.m_tsphiList),
88  m_tsetaList(id.m_tsetaList) {}
89 
90 //--------------
91 // Destructor --
92 //--------------
94 
95 //--------------
96 // Operations --
97 //--------------
98 
99 //
100 // reset Muon Track Candidate
101 //
104  m_empty = true;
105  m_tc = UNDEF;
106  m_addArray.reset();
107  m_tsphiList.clear();
108  m_tsetaList.clear();
109 }
110 
111 //
112 // set (packed) eta-code of muon candidate
113 //
115  // eta is a signed integer [-32,31],
116  // representing 64 bins in an interval [-1.2,+1.2]
117  // first convert eta into an unsigned integer
120 }
121 
122 //
123 // return start phi track segment
124 //
125 const L1MuDTTrackSegPhi& L1MuDTTrack::getStartTSphi() const { return m_tsphiList.front(); }
126 
127 //
128 // return end phi track segment
129 //
130 const L1MuDTTrackSegPhi& L1MuDTTrack::getEndTSphi() const { return m_tsphiList.back(); }
131 
132 //
133 // return start eta track segment
134 //
135 const L1MuDTTrackSegEta& L1MuDTTrack::getStartTSeta() const { return m_tsetaList.front(); }
136 
137 //
138 // return end eta track segment
139 //
140 const L1MuDTTrackSegEta& L1MuDTTrack::getEndTSeta() const { return m_tsetaList.back(); }
141 
142 //
143 // set phi track segments used to form the muon candidate
144 //
145 void L1MuDTTrack::setTSphi(const vector<const L1MuDTTrackSegPhi*>& tsList) {
146  if (!tsList.empty()) {
147  vector<const L1MuDTTrackSegPhi*>::const_iterator iter;
148  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
149  if (*iter)
150  m_tsphiList.push_back(**iter);
151  }
152  }
153 }
154 
155 //
156 // set eta track segments used to form the muon candidate
157 //
158 void L1MuDTTrack::setTSeta(const vector<const L1MuDTTrackSegEta*>& tsList) {
159  if (!tsList.empty()) {
160  vector<const L1MuDTTrackSegEta*>::const_iterator iter;
161  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
162  if (*iter)
163  m_tsetaList.push_back(**iter);
164  }
165  }
166 }
167 
168 //
169 // convert pt value in GeV to pt code
170 //
171 unsigned int L1MuDTTrack::triggerScale(float value, const edm::EventSetup& c) const {
172  const float eps = 1.e-5; // add an epsilon so that setting works with low edge value
173 
174  edm::ESHandle<L1MuTriggerPtScale> theTriggerScales;
175  c.get<L1MuTriggerPtScaleRcd>().get(theTriggerScales);
176  unsigned int t_Scale = theTriggerScales->getPtScale()->getPacked(value + eps);
177 
178  return t_Scale;
179 }
180 
181 //
182 // Assignment operator
183 //
185  if (this != &track) {
186  this->setBx(track.bx());
187  this->setDataWord(track.getDataWord());
188  m_spid = track.m_spid;
189  m_empty = track.m_empty;
190  m_name = track.m_name;
191  m_tc = track.m_tc;
192  m_addArray = track.m_addArray;
193  m_tsphiList = track.m_tsphiList;
194  m_tsetaList = track.m_tsetaList;
195  }
196  return *this;
197 }
198 
199 //
200 // Equal operator
201 //
203  if (m_spid != track.m_spid)
204  return false;
205  if (m_empty != track.m_empty)
206  return false;
207  if (m_tc != track.m_tc)
208  return false;
209  if (bx() != track.bx())
210  return false;
211  if (phi() != track.phi())
212  return false;
213  if (eta() != track.eta())
214  return false;
215  if (fineEtaBit() != track.fineEtaBit())
216  return false;
217  if (pt() != track.pt())
218  return false;
219  if (charge() != track.charge())
220  return false;
221  if (quality() != track.quality())
222  return false;
223  if (m_addArray != track.m_addArray)
224  return false;
225  return true;
226 }
227 
228 //
229 // Unequal operator
230 //
232  if (m_spid != track.m_spid)
233  return true;
234  if (m_empty != track.m_empty)
235  return true;
236  if (m_tc != track.m_tc)
237  return true;
238  if (bx() != track.bx())
239  return true;
240  if (phi() != track.phi())
241  return true;
242  if (eta() != track.eta())
243  return true;
244  if (fineEtaBit() != track.fineEtaBit())
245  return true;
246  if (pt() != track.pt())
247  return true;
248  if (charge() != track.charge())
249  return true;
250  if (quality() != track.quality())
251  return true;
252  if (m_addArray != track.m_addArray)
253  return true;
254  return false;
255 }
256 
257 //
258 // print parameters of track candidate
259 //
260 void L1MuDTTrack::print() const {
261  if (!empty()) {
262  cout.setf(ios::showpoint);
263  cout.setf(ios::right, ios::adjustfield);
264  cout << setiosflags(ios::showpoint | ios::fixed);
265  cout << "MUON : "
266  << "pt = " << setw(2) << pt_packed() << " "
267  << "charge = " << setw(2) << charge_packed() << " "
268  << "eta = " << setw(2) << eta_packed() << " (" << setw(1) << finehalo_packed() << ") "
269  << "phi = " << setw(3) << phi_packed() << " "
270  << "quality = " << setw(1) << quality_packed() << '\t' << "class = " << tc() << " "
271  << "bx = " << setw(2) << bx() << endl;
272  cout << " found in " << m_spid << " with phi track segments :" << endl;
273  vector<L1MuDTTrackSegPhi>::const_iterator iter;
274  for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) {
275  cout << " " << (*iter) << endl;
276  }
277  }
278 }
279 
280 //
281 // output stream operator for track candidate
282 //
283 ostream& operator<<(ostream& s, const L1MuDTTrack& id) {
284  if (!id.empty()) {
285  s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(2) << id.pt_packed() << " "
286  << "charge = " << setw(2) << id.charge_packed() << " "
287  << "eta = " << setw(2) << id.eta_packed() << " (" << setw(1) << id.finehalo_packed() << ") "
288  << "phi = " << setw(3) << id.phi_packed() << " "
289  << "quality = " << setw(1) << id.quality_packed() << '\t' << "bx = " << setw(2) << id.bx();
290  }
291  return s;
292 }
L1MuRegionalCand::bx
int bx() const
return bunch crossing identifier
Definition: L1MuRegionalCand.h:79
L1MuDTTrack::operator==
bool operator==(const L1MuDTTrack &) const
equal operator
Definition: L1MuDTTrack.cc:202
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
L1MuDTTrack::m_empty
bool m_empty
Definition: L1MuDTTrack.h:198
L1MuRegionalCand::setEtaPacked
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
Definition: L1MuRegionalCand.h:135
L1MuDTTrack::m_spid
L1MuDTSecProcId m_spid
Definition: L1MuDTTrack.h:196
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
L1MuDTTrack::print
void print() const override
print parameters of muon candidate
Definition: L1MuDTTrack.cc:260
L1MuDTTrack::getEndTSeta
const L1MuDTTrackSegEta & getEndTSeta() const
return end eta track segment of muon candidate
Definition: L1MuDTTrack.cc:140
L1MuDTSecProcId.h
DiLeptonHelp::UNDEF
Definition: DiLeptonVertexHelpers.h:46
L1MuPacking.h
L1MuRegionalCand::phi_packed
unsigned phi_packed() const
return phi packed as in hardware
Definition: L1MuRegionalCand.h:86
L1MuTriggerPtScaleRcd.h
gpuVertexFinder::eps
WorkSpace int float eps
Definition: gpuClusterTracksDBSCAN.h:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuDTTrack::eta
unsigned int eta() const
get eta-code (6 bits)
Definition: L1MuDTTrack.h:74
L1MuDTTrackSegEta
Definition: L1MuDTTrackSegEta.h:36
L1MuDTTrack::getStartTSeta
const L1MuDTTrackSegEta & getStartTSeta() const
return start eta track segment of muon candidate
Definition: L1MuDTTrack.cc:135
L1MuDTTrack::fineEtaBit
bool fineEtaBit() const
get fine eta bit
Definition: L1MuDTTrack.h:77
L1MuRegionalCand::setType
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
Definition: L1MuRegionalCand.h:114
L1MuDTTrack::m_name
std::string m_name
Definition: L1MuDTTrack.h:197
L1MuDTTrack::setEta
void setEta(int eta)
set eta-code of muon candidate
Definition: L1MuDTTrack.cc:114
L1MuDTTrack::reset
void reset() override
reset muon candidate
Definition: L1MuDTTrack.cc:102
L1MuRegionalCand::getDataWord
unsigned getDataWord() const
return data word
Definition: L1MuRegionalCand.h:107
L1MuDTTrack::getEndTSphi
const L1MuDTTrackSegPhi & getEndTSphi() const
return end phi track segment of muon candidate
Definition: L1MuDTTrack.cc:130
L1MuRegionalCand::quality_packed
unsigned int quality_packed() const
return quality packed as in hardware
Definition: L1MuRegionalCand.h:92
L1MuRegionalCand::setBx
void setBx(int bx)
Set Bunch Crossing.
Definition: L1MuRegionalCand.h:117
L1MuDTTrackSegPhi.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1MuDTAddressArray::reset
void reset()
reset address array
Definition: L1MuDTAddressArray.cc:100
L1MuDTTrack::setTSphi
void setTSphi(const std::vector< const L1MuDTTrackSegPhi * > &tsList)
set phi track segments used to form the muon candidate
Definition: L1MuDTTrack.cc:145
PVValHelper::eta
Definition: PVValidationHelpers.h:70
L1MuDTTrack::operator=
L1MuDTTrack & operator=(const L1MuDTTrack &)
assignment operator
Definition: L1MuDTTrack.cc:184
edm::ESHandle
Definition: DTSurvey.h:22
L1MuRegionalCand
Definition: L1MuRegionalCand.h:26
L1MuDTTrack::triggerScale
unsigned int triggerScale(float value, const edm::EventSetup &c) const
convert pt value in GeV to pt code
Definition: L1MuDTTrack.cc:171
L1MuDTTrack::setTSeta
void setTSeta(const std::vector< const L1MuDTTrackSegEta * > &tsList)
set eta track segments used to form the muon candidate
Definition: L1MuDTTrack.cc:158
funct::true
true
Definition: Factorize.h:173
L1MuDTTrack::m_tsphiList
std::vector< L1MuDTTrackSegPhi > m_tsphiList
Definition: L1MuDTTrack.h:202
L1MuDTTrack::phi
unsigned int phi() const
get phi-code (8 bits)
Definition: L1MuDTTrack.h:71
L1MuDTTrack.h
L1MuDTSecProcId
Definition: L1MuDTSecProcId.h:40
L1MuTriggerPtScale::getPtScale
const L1MuScale * getPtScale() const
get the Pt scale
Definition: L1MuTriggerPtScale.h:59
L1MuRegionalCand::setDataWord
void setDataWord(unsigned dataword)
Set data word.
Definition: L1MuRegionalCand.h:166
L1MuTriggerPtScale.h
L1MuDTTrack
Definition: L1MuDTTrack.h:47
L1MuDTTrack::empty
bool empty() const override
is it an empty muon candidate?
Definition: L1MuDTTrack.h:86
value
Definition: value.py:1
L1MuDTTrack::L1MuDTTrack
L1MuDTTrack()
default constructor
Definition: L1MuDTTrack.cc:48
edm::EventSetup
Definition: EventSetup.h:58
L1MuTriggerPtScaleRcd
Definition: L1MuTriggerPtScaleRcd.h:12
get
#define get
operator<<
ostream & operator<<(ostream &s, const L1MuDTTrack &id)
Definition: L1MuDTTrack.cc:283
L1MuDTTrack::tc
TrackClass tc() const
get track-class
Definition: L1MuDTTrack.h:83
L1MuDTTrack::operator!=
bool operator!=(const L1MuDTTrack &) const
unequal operator
Definition: L1MuDTTrack.cc:231
std
Definition: JetResolutionObject.h:76
L1MuDTTrack::getStartTSphi
const L1MuDTTrackSegPhi & getStartTSphi() const
return start phi track segment of muon candidate
Definition: L1MuDTTrack.cc:125
L1MuDTTrack::charge
int charge() const
get charge (1 bit)
Definition: L1MuDTTrack.h:80
L1MuDTTrackSegEta.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
L1MuRegionalCand::eta_packed
unsigned eta_packed() const
return eta packed as in hardware
Definition: L1MuRegionalCand.h:95
L1MuRegionalCand::finehalo_packed
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
Definition: L1MuRegionalCand.h:98
L1MuRegionalCand::pt_packed
unsigned pt_packed() const
return pt packed as in hardware
Definition: L1MuRegionalCand.h:89
L1MuDTTrackSegPhi
Definition: L1MuDTTrackSegPhi.h:36
L1MuSignedPacking
Definition: L1MuPacking.h:94
L1MuScale::getPacked
virtual unsigned getPacked(float value) const =0
pack a value
L1MuDTTrack::m_tsetaList
std::vector< L1MuDTTrackSegEta > m_tsetaList
Definition: L1MuDTTrack.h:203
L1MuDTTrack::m_addArray
L1MuDTAddressArray m_addArray
Definition: L1MuDTTrack.h:201
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
L1MuRegionalCand::setChargeValid
void setChargeValid(bool valid)
Set Charge Valid.
Definition: L1MuRegionalCand.h:157
L1MuDTTrack::~L1MuDTTrack
~L1MuDTTrack() override
destructor
Definition: L1MuDTTrack.cc:93
L1MuDTTrack::m_tc
TrackClass m_tc
Definition: L1MuDTTrack.h:199
L1MuSignedPacking::packedFromIdx
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check range
Definition: L1MuPacking.h:104
L1MuDTTrack::pt
unsigned int pt() const
get pt-code (5 bits)
Definition: L1MuDTTrack.h:68
L1MuRegionalCand::quality
unsigned int quality() const
return quality
Definition: L1MuRegionalCand.h:73
L1MuRegionalCand::reset
virtual void reset()
reset
Definition: L1MuRegionalCand.cc:72
L1MuRegionalCand::charge_packed
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
Definition: L1MuRegionalCand.h:101