CMS 3D CMS Logo

L1Track.cc

Go to the documentation of this file.
00001 #include <DataFormats/L1CSCTrackFinder/interface/L1Track.h>
00002 
00003 namespace csc {
00004 
00005   L1Track::L1Track(const csc::L1TrackId& id): m_name("csc::L1Track")
00006   {
00007     m_endcap = id.endcap();
00008     m_sector = id.sector();
00009     m_lphi = 0;
00010     m_ptAddress = 0;
00011     m_empty = true;
00012     setType(2);
00013     setPtPacked(0);
00014     m_rank = 0;
00015     me1_id = 0;
00016     me2_id = 0;
00017     me3_id = 0;
00018     me4_id = 0;
00019     mb1_id = 0;
00020     m_output_link = 0;
00021     m_winner = false;
00022   }
00023 
00024   L1Track::L1Track(const csc::L1Track& rhs) : L1MuRegionalCand(rhs.type_idx(),rhs.phi_packed(),rhs.eta_packed(),
00025                                                       rhs.pt_packed(),rhs.charge_packed(),
00026                                                       rhs.charge_valid_packed(),rhs.finehalo_packed(),
00027                                                       rhs.quality_packed(),rhs.bx()),
00028                                               m_name(rhs.m_name)
00029   {
00030     m_empty = rhs.m_empty;
00031     m_lphi = rhs.m_lphi;
00032     m_endcap = rhs.m_endcap;
00033     m_sector = rhs.m_sector;
00034     m_ptAddress = rhs.m_ptAddress;
00035     m_rank = rhs.m_rank;
00036     me1_id = rhs.me1_id;
00037     me2_id = rhs.me2_id;
00038     me3_id = rhs.me3_id;
00039     me4_id = rhs.me4_id;
00040     mb1_id = rhs.mb1_id;
00041     m_output_link = rhs.m_output_link;
00042     m_winner = rhs.m_winner;
00043   }
00044 
00045   L1Track::~L1Track()
00046   {
00047   }
00048 
00049   const csc::L1Track& L1Track::operator=(const csc::L1Track& rhs)
00050   {
00051     if(this != &rhs)
00052       {
00053         m_empty = rhs.m_empty;
00054         this->setBx(rhs.bx());
00055         this->setDataWord(rhs.getDataWord());
00056         m_name    = rhs.m_name;
00057         m_lphi    = rhs.m_lphi;
00058         this->setType(rhs.type_idx());
00059         this->setPhiPacked(rhs.phi_packed());
00060         this->setEtaPacked(rhs.eta_packed());
00061         this->setPtPacked(rhs.pt_packed());
00062         this->setChargePacked(rhs.charge_packed());
00063         this->setChargeValidPacked(rhs.charge_valid_packed());
00064         this->setFineHaloPacked(rhs.finehalo_packed());
00065         this->setQualityPacked(rhs.quality_packed());
00066         m_endcap = rhs.m_endcap;
00067         m_sector = rhs.m_sector;
00068         m_ptAddress = rhs.m_ptAddress;
00069         m_rank = rhs.m_rank;
00070         me1_id = rhs.me1_id;
00071         me2_id = rhs.me2_id;
00072         me3_id = rhs.me3_id;
00073         me4_id = rhs.me4_id;
00074         mb1_id = rhs.mb1_id;
00075         m_output_link = rhs.m_output_link;
00076     m_winner = rhs.m_winner;
00077           }
00078     return *this;
00079   }
00080 
00081   unsigned L1Track::rank() const
00082   {
00083     return m_rank;
00084   }
00085 
00086   void L1Track::setStationIds(const unsigned& me1, const unsigned& me2,
00087                               const unsigned& me3, const unsigned& me4,
00088                               const unsigned& mb1)
00089   {
00090     me1_id = me1;
00091     me2_id = me2;
00092     me3_id = me3;
00093     me4_id = me4;
00094     mb1_id = mb1;
00095   }
00096 
00097   unsigned L1Track::encodeRank(const unsigned& pt, const unsigned& quality)
00098   {
00099     if(pt == 0) return 0;
00100     return pt | (quality << L1MuRegionalCand::PT_LENGTH);
00101   }
00102 
00103   void L1Track::decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality)
00104   {
00105     if(rank == 0)
00106       {
00107         quality = 0;
00108         pt = 0;
00109       }
00110     else
00111       {
00112         quality = rank >> L1MuRegionalCand::PT_LENGTH;
00113         pt = rank & ( (1<<L1MuRegionalCand::PT_LENGTH) - 1);
00114       }
00115   }
00116 
00117   bool L1Track::operator>(const csc::L1Track &rhs) const
00118   {
00119     return (rank() > rhs.rank());
00120   }
00121 
00122   bool L1Track::operator<(const csc::L1Track& rhs) const
00123   {
00124     return (rank() < rhs.rank());
00125   }
00126 
00127   bool L1Track::operator>=(const csc::L1Track& rhs) const
00128   {
00129     return (rank() >= rhs.rank());
00130   }
00131 
00132   bool L1Track::operator<=(const csc::L1Track& rhs) const
00133   {
00134     return (rank() <= rhs.rank());
00135   }
00136 
00137   bool L1Track::operator==(const csc::L1Track& rhs) const
00138   {
00139     return (rank() == rhs.rank());
00140   }
00141 
00142   bool L1Track::operator!=(const csc::L1Track& rhs) const
00143   {
00144     return (rank() != rhs.rank());
00145   }
00146 
00147   void L1Track::Print() const
00148   {
00149     if (!empty())
00150       {
00151         std::cout << "\t  Pt(int): "  << " " << pt_packed()
00152                   << " Phi(int): " << " " << phi_packed()
00153                   << " Eta(int): " << " " << eta_packed()
00154                   << " Quality: "  << " " << quality_packed()
00155                   << " charge: "   << " " << charge_packed()
00156                   << " side: "   << " " << endcap()
00157                   << " bx: "       << " " << BX()
00158           << " Winner: "   << " " << winner()
00159                   << std::endl;
00160       }
00161     else
00162       {
00163         std::cout <<"\t  Empty track!\n";
00164         std::cout << "\t  Pt(int): "  << " " << "unassigned or zero"
00165                   << " Phi(int): " << " " << phi_packed()
00166                   << " Eta(int): " << " " << eta_packed()
00167                   << " Quality: "  << " " << "unassigned or zero"
00168                   << " charge: "   << " " << charge_packed()
00169                   << " side: "   << " " << endcap()
00170                   << " bx: "       << " " << BX()
00171           << " Winner: "   << " " << winner()
00172                   << std::endl;
00173       }
00174   }
00175 }

Generated on Tue Jun 9 17:31:09 2009 for CMSSW by  doxygen 1.5.4