File indexing completed on 2024-04-06 12:19:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h"
0020
0021
0022
0023
0024
0025 #include <iostream>
0026 #include <iomanip>
0027
0028
0029
0030
0031
0032 #include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h"
0033 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h"
0034 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h"
0035 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
0036 #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
0037 #include "CondFormats/L1TObjects/interface/L1MuPacking.h"
0038
0039 using namespace std;
0040
0041
0042
0043
0044
0045
0046
0047
0048 L1MuDTTrack::L1MuDTTrack()
0049 : L1MuRegionalCand(0, 0),
0050 m_spid(L1MuDTSecProcId()),
0051 m_name("L1MuDTTrack"),
0052 m_empty(true),
0053 m_tc(UNDEF),
0054 m_addArray(),
0055 m_tsphiList(),
0056 m_tsetaList() {
0057 m_tsphiList.reserve(4);
0058 m_tsetaList.reserve(3);
0059
0060 setType(0);
0061 setChargeValid(true);
0062 }
0063
0064 L1MuDTTrack::L1MuDTTrack(const L1MuDTSecProcId& spid)
0065 : L1MuRegionalCand(0, 0),
0066 m_spid(spid),
0067 m_name("L1MuDTTrack"),
0068 m_empty(true),
0069 m_tc(UNDEF),
0070 m_addArray(),
0071 m_tsphiList(),
0072 m_tsetaList() {
0073 m_tsphiList.reserve(4);
0074 m_tsetaList.reserve(3);
0075
0076 setType(0);
0077 setChargeValid(true);
0078 }
0079
0080 L1MuDTTrack::L1MuDTTrack(const L1MuDTTrack& id)
0081 : L1MuRegionalCand(id),
0082 m_spid(id.m_spid),
0083 m_name(id.m_name),
0084 m_empty(id.m_empty),
0085 m_tc(id.m_tc),
0086 m_addArray(id.m_addArray),
0087 m_tsphiList(id.m_tsphiList),
0088 m_tsetaList(id.m_tsetaList) {}
0089
0090
0091
0092
0093 L1MuDTTrack::~L1MuDTTrack() {}
0094
0095
0096
0097
0098
0099
0100
0101
0102 void L1MuDTTrack::reset() {
0103 L1MuRegionalCand::reset();
0104 m_empty = true;
0105 m_tc = UNDEF;
0106 m_addArray.reset();
0107 m_tsphiList.clear();
0108 m_tsetaList.clear();
0109 }
0110
0111
0112
0113
0114 void L1MuDTTrack::setEta(int eta) {
0115
0116
0117
0118 L1MuSignedPacking<6> pEta;
0119 setEtaPacked(pEta.packedFromIdx(eta));
0120 }
0121
0122
0123
0124
0125 const L1MuDTTrackSegPhi& L1MuDTTrack::getStartTSphi() const { return m_tsphiList.front(); }
0126
0127
0128
0129
0130 const L1MuDTTrackSegPhi& L1MuDTTrack::getEndTSphi() const { return m_tsphiList.back(); }
0131
0132
0133
0134
0135 const L1MuDTTrackSegEta& L1MuDTTrack::getStartTSeta() const { return m_tsetaList.front(); }
0136
0137
0138
0139
0140 const L1MuDTTrackSegEta& L1MuDTTrack::getEndTSeta() const { return m_tsetaList.back(); }
0141
0142
0143
0144
0145 void L1MuDTTrack::setTSphi(const vector<const L1MuDTTrackSegPhi*>& tsList) {
0146 if (!tsList.empty()) {
0147 vector<const L1MuDTTrackSegPhi*>::const_iterator iter;
0148 for (iter = tsList.begin(); iter != tsList.end(); iter++) {
0149 if (*iter)
0150 m_tsphiList.push_back(**iter);
0151 }
0152 }
0153 }
0154
0155
0156
0157
0158 void L1MuDTTrack::setTSeta(const vector<const L1MuDTTrackSegEta*>& tsList) {
0159 if (!tsList.empty()) {
0160 vector<const L1MuDTTrackSegEta*>::const_iterator iter;
0161 for (iter = tsList.begin(); iter != tsList.end(); iter++) {
0162 if (*iter)
0163 m_tsetaList.push_back(**iter);
0164 }
0165 }
0166 }
0167
0168
0169
0170
0171 L1MuDTTrack& L1MuDTTrack::operator=(const L1MuDTTrack& track) {
0172 if (this != &track) {
0173 this->setBx(track.bx());
0174 this->setDataWord(track.getDataWord());
0175 m_spid = track.m_spid;
0176 m_empty = track.m_empty;
0177 m_name = track.m_name;
0178 m_tc = track.m_tc;
0179 m_addArray = track.m_addArray;
0180 m_tsphiList = track.m_tsphiList;
0181 m_tsetaList = track.m_tsetaList;
0182 }
0183 return *this;
0184 }
0185
0186
0187
0188
0189 bool L1MuDTTrack::operator==(const L1MuDTTrack& track) const {
0190 if (m_spid != track.m_spid)
0191 return false;
0192 if (m_empty != track.m_empty)
0193 return false;
0194 if (m_tc != track.m_tc)
0195 return false;
0196 if (bx() != track.bx())
0197 return false;
0198 if (phi() != track.phi())
0199 return false;
0200 if (eta() != track.eta())
0201 return false;
0202 if (fineEtaBit() != track.fineEtaBit())
0203 return false;
0204 if (pt() != track.pt())
0205 return false;
0206 if (charge() != track.charge())
0207 return false;
0208 if (quality() != track.quality())
0209 return false;
0210 if (m_addArray != track.m_addArray)
0211 return false;
0212 return true;
0213 }
0214
0215
0216
0217
0218 bool L1MuDTTrack::operator!=(const L1MuDTTrack& track) const {
0219 if (m_spid != track.m_spid)
0220 return true;
0221 if (m_empty != track.m_empty)
0222 return true;
0223 if (m_tc != track.m_tc)
0224 return true;
0225 if (bx() != track.bx())
0226 return true;
0227 if (phi() != track.phi())
0228 return true;
0229 if (eta() != track.eta())
0230 return true;
0231 if (fineEtaBit() != track.fineEtaBit())
0232 return true;
0233 if (pt() != track.pt())
0234 return true;
0235 if (charge() != track.charge())
0236 return true;
0237 if (quality() != track.quality())
0238 return true;
0239 if (m_addArray != track.m_addArray)
0240 return true;
0241 return false;
0242 }
0243
0244
0245
0246
0247 void L1MuDTTrack::print() const {
0248 if (!empty()) {
0249 cout.setf(ios::showpoint);
0250 cout.setf(ios::right, ios::adjustfield);
0251 cout << setiosflags(ios::showpoint | ios::fixed);
0252 cout << "MUON : "
0253 << "pt = " << setw(2) << pt_packed() << " "
0254 << "charge = " << setw(2) << charge_packed() << " "
0255 << "eta = " << setw(2) << eta_packed() << " (" << setw(1) << finehalo_packed() << ") "
0256 << "phi = " << setw(3) << phi_packed() << " "
0257 << "quality = " << setw(1) << quality_packed() << '\t' << "class = " << tc() << " "
0258 << "bx = " << setw(2) << bx() << endl;
0259 cout << " found in " << m_spid << " with phi track segments :" << endl;
0260 vector<L1MuDTTrackSegPhi>::const_iterator iter;
0261 for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) {
0262 cout << " " << (*iter) << endl;
0263 }
0264 }
0265 }
0266
0267
0268
0269
0270 ostream& operator<<(ostream& s, const L1MuDTTrack& id) {
0271 if (!id.empty()) {
0272 s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(2) << id.pt_packed() << " "
0273 << "charge = " << setw(2) << id.charge_packed() << " "
0274 << "eta = " << setw(2) << id.eta_packed() << " (" << setw(1) << id.finehalo_packed() << ") "
0275 << "phi = " << setw(3) << id.phi_packed() << " "
0276 << "quality = " << setw(1) << id.quality_packed() << '\t' << "bx = " << setw(2) << id.bx();
0277 }
0278 return s;
0279 }