Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:56

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuBMTrack
0004 //
0005 //   Description: Muon Track Candidate
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   N. Neumeister            CERN EP
0011 //   J. Troconiz              UAM Madrid
0012 //
0013 //--------------------------------------------------
0014 
0015 //-----------------------
0016 // This Class's Header --
0017 //-----------------------
0018 
0019 #include "DataFormats/L1TMuon/interface/L1MuBMTrack.h"
0020 
0021 //---------------
0022 // C++ Headers --
0023 //---------------
0024 
0025 #include <iostream>
0026 #include <iomanip>
0027 
0028 //-------------------------------
0029 // Collaborating Class Headers --
0030 //-------------------------------
0031 
0032 #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMSecProcId.h"
0033 #include "DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h"
0034 #include "DataFormats/L1TMuon/interface/L1MuBMTrackSegEta.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 //       class L1MuBMTrack
0043 //---------------------------------
0044 
0045 //----------------
0046 // Constructors --
0047 //----------------
0048 L1MuBMTrack::L1MuBMTrack()
0049     :  //L1MuRegionalCand(0,0),-->
0050       l1t::RegionalMuonCand(),
0051       m_spid(L1MuBMSecProcId()),
0052       m_name("L1MuBMTrack"),
0053       m_empty(true),
0054       m_tc(UNDEF),
0055       m_addArray(),
0056       m_tsphiList(),
0057       m_tsetaList() {
0058   m_tsphiList.reserve(4);
0059   m_tsetaList.reserve(3);
0060 
0061   //setType(0);
0062   //setChargeValid(true);
0063   setHwSignValid(1);
0064 }
0065 
0066 L1MuBMTrack::L1MuBMTrack(const L1MuBMSecProcId& spid)
0067     :  //L1MuRegionalCand(0,0),-->
0068       l1t::RegionalMuonCand(),
0069       m_spid(spid),
0070       m_name("L1MuBMTrack"),
0071       m_empty(true),
0072       m_tc(UNDEF),
0073       m_addArray(),
0074       m_tsphiList(),
0075       m_tsetaList() {
0076   m_tsphiList.reserve(4);
0077   m_tsetaList.reserve(3);
0078   //setType(0);
0079   //setChargeValid(true);
0080   setHwSignValid(1);
0081 }
0082 
0083 L1MuBMTrack::L1MuBMTrack(const L1MuBMTrack& id)
0084     :  //L1MuRegionalCand(id),-->
0085       l1t::RegionalMuonCand(id),
0086       m_spid(id.m_spid),
0087       m_name(id.m_name),
0088       m_empty(id.m_empty),
0089       m_tc(id.m_tc),
0090       m_addArray(id.m_addArray),
0091       m_tsphiList(id.m_tsphiList),
0092       m_tsetaList(id.m_tsetaList) {}
0093 
0094 //--------------
0095 // Destructor --
0096 //--------------
0097 L1MuBMTrack::~L1MuBMTrack() {}
0098 
0099 //--------------
0100 // Operations --
0101 //--------------
0102 
0103 //
0104 // reset Muon Track Candidate
0105 //
0106 void L1MuBMTrack::reset() {
0107   //L1MuRegionalCand::reset();
0108   m_empty = true;
0109   m_tc = UNDEF;
0110   m_addArray.reset();
0111   m_tsphiList.clear();
0112   m_tsetaList.clear();
0113 }
0114 
0115 //
0116 // set (packed) eta-code of muon candidate
0117 //
0118 void L1MuBMTrack::setEta(int eta) {
0119   // eta is a signed integer [-115,118],
0120   setHwHF(false);
0121   setHwEta(eta);
0122 }
0123 
0124 //
0125 // return start phi track segment
0126 //
0127 const L1MuBMTrackSegPhi& L1MuBMTrack::getStartTSphi() const { return m_tsphiList.front(); }
0128 
0129 //
0130 // return end phi track segment
0131 //
0132 const L1MuBMTrackSegPhi& L1MuBMTrack::getEndTSphi() const { return m_tsphiList.back(); }
0133 
0134 //
0135 // return start eta track segment
0136 //
0137 const L1MuBMTrackSegEta& L1MuBMTrack::getStartTSeta() const { return m_tsetaList.front(); }
0138 
0139 //
0140 // return end eta track segment
0141 //
0142 const L1MuBMTrackSegEta& L1MuBMTrack::getEndTSeta() const { return m_tsetaList.back(); }
0143 
0144 //
0145 // set phi track segments used to form the muon candidate
0146 //
0147 void L1MuBMTrack::setTSphi(const vector<const L1MuBMTrackSegPhi*>& tsList) {
0148   if (!tsList.empty()) {
0149     vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
0150     for (iter = tsList.begin(); iter != tsList.end(); iter++) {
0151       if (*iter)
0152         m_tsphiList.push_back(**iter);
0153     }
0154   }
0155 }
0156 
0157 //
0158 // set eta track segments used to form the muon candidate
0159 //
0160 void L1MuBMTrack::setTSeta(const vector<const L1MuBMTrackSegEta*>& tsList) {
0161   if (!tsList.empty()) {
0162     vector<const L1MuBMTrackSegEta*>::const_iterator iter;
0163     for (iter = tsList.begin(); iter != tsList.end(); iter++) {
0164       if (*iter)
0165         m_tsetaList.push_back(**iter);
0166     }
0167   }
0168 }
0169 
0170 //
0171 // Assignment operator
0172 //
0173 L1MuBMTrack& L1MuBMTrack::operator=(const L1MuBMTrack& track) {
0174   if (this != &track) {
0175     this->setBx(track.bx());
0176     //this->setDataWord(track.getDataWord());
0177     m_spid = track.m_spid;
0178     m_empty = track.m_empty;
0179     m_name = track.m_name;
0180     m_tc = track.m_tc;
0181     m_addArray = track.m_addArray;
0182     m_tsphiList = track.m_tsphiList;
0183     m_tsetaList = track.m_tsetaList;
0184   }
0185   return *this;
0186 }
0187 
0188 //
0189 // Equal operator
0190 //
0191 bool L1MuBMTrack::operator==(const L1MuBMTrack& track) const {
0192   if (m_spid != track.m_spid)
0193     return false;
0194   if (m_empty != track.m_empty)
0195     return false;
0196   if (m_tc != track.m_tc)
0197     return false;
0198   if (bx() != track.bx())
0199     return false;
0200   if (phi() != track.phi())
0201     return false;
0202   if (eta() != track.eta())
0203     return false;
0204   if (fineEtaBit() != track.fineEtaBit())
0205     return false;
0206   if (pt() != track.pt())
0207     return false;
0208   if (charge() != track.charge())
0209     return false;
0210   if (quality() != track.quality())
0211     return false;
0212   if (m_addArray != track.m_addArray)
0213     return false;
0214   return true;
0215 }
0216 
0217 //
0218 // Unequal operator
0219 //
0220 bool L1MuBMTrack::operator!=(const L1MuBMTrack& track) const {
0221   if (m_spid != track.m_spid)
0222     return true;
0223   if (m_empty != track.m_empty)
0224     return true;
0225   if (m_tc != track.m_tc)
0226     return true;
0227   if (bx() != track.bx())
0228     return true;
0229   if (phi() != track.phi())
0230     return true;
0231   if (eta() != track.eta())
0232     return true;
0233   if (fineEtaBit() != track.fineEtaBit())
0234     return true;
0235   if (pt() != track.pt())
0236     return true;
0237   if (charge() != track.charge())
0238     return true;
0239   if (quality() != track.quality())
0240     return true;
0241   if (m_addArray != track.m_addArray)
0242     return true;
0243   return false;
0244 }
0245 
0246 //
0247 // print parameters of track candidate
0248 //
0249 void L1MuBMTrack::print() const {
0250   if (!empty()) {
0251     cout.setf(ios::showpoint);
0252     cout.setf(ios::right, ios::adjustfield);
0253     cout << setiosflags(ios::showpoint | ios::fixed);
0254     cout << "MUON : "
0255          << "pt = " << setw(3) << hwPt() << "  "
0256          << "charge = " << setw(2) << hwSign() << "  "
0257          << "eta = " << setw(2)
0258          << hwEta()
0259          //<< " ("         << setw(1) << finehalo_packed() << ")  "
0260          << "phi = " << setw(3) << hwPhi() << "  "
0261          << "quality = " << setw(1) << hwQual() << '\t' << "class = " << tc() << "  "
0262          << "bx = " << setw(2) << bx() << endl;
0263     cout << "       found in " << m_spid << " with phi track segments :" << endl;
0264     vector<L1MuBMTrackSegPhi>::const_iterator iter;
0265     for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) {
0266       cout << "       " << (*iter) << endl;
0267     }
0268   }
0269 }
0270 
0271 //
0272 // output stream operator for track candidate
0273 //
0274 ostream& operator<<(ostream& s, const L1MuBMTrack& id) {
0275   if (!id.empty()) {
0276     s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(3) << id.hwPt() << "  "
0277       << "charge = " << setw(2) << id.hwSign() << "  "
0278       << "eta = " << setw(2)
0279       << id.hwEta()
0280       //<< " ("         << setw(1) << id.finehalo_packed() << ")  "
0281       << "phi = " << setw(3) << id.hwPhi() << "  "
0282       << "quality = " << setw(1) << id.hwQual() << '\t' << "bx = " << setw(2) << id.bx();
0283   }
0284   return s;
0285 }