Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 /**  \class L1MuBMTrack
0004  *
0005  *   L1 Muon Track Candidate
0006  *
0007  *
0008  *
0009  *   N. Neumeister            CERN EP
0010  *   J. Troconiz              UAM Madrid
0011  */
0012 //
0013 //--------------------------------------------------
0014 #ifndef L1MUBM_TRACK_H
0015 #define L1MUBM_TRACK_H
0016 
0017 //---------------
0018 // C++ Headers --
0019 //---------------
0020 
0021 #include <iosfwd>
0022 #include <string>
0023 #include <vector>
0024 
0025 //----------------------
0026 // Base Class Headers --
0027 //----------------------
0028 
0029 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0030 
0031 //------------------------------------
0032 // Collaborating Class Declarations --
0033 //------------------------------------
0034 
0035 #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMTrackAssParam.h"
0036 #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMAddressArray.h"
0037 #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMSecProcId.h"
0038 #include "DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h"
0039 #include "DataFormats/L1TMuon/interface/L1MuBMTrackSegEta.h"
0040 
0041 //              ---------------------
0042 //              -- Class Interface --
0043 //              ---------------------
0044 
0045 class L1MuBMTrack;
0046 
0047 typedef std::vector<L1MuBMTrack> L1MuBMTrackCollection;
0048 
0049 class L1MuBMTrack : public l1t::RegionalMuonCand {
0050 public:
0051   /// default constructor
0052   L1MuBMTrack();
0053 
0054   /// constructor
0055   L1MuBMTrack(const L1MuBMSecProcId&);
0056 
0057   /// copy constructor
0058   L1MuBMTrack(const L1MuBMTrack&);
0059 
0060   /// destructor
0061   ~L1MuBMTrack() override;
0062 
0063   /// reset muon candidate
0064   void reset();
0065 
0066   /// get name of object
0067   inline std::string name() const { return m_name; }
0068 
0069   /// get pt-code (5 bits)
0070   inline unsigned int pt() const { return hwPt(); }
0071 
0072   /// get phi-code (8 bits)
0073   inline unsigned int phi() const { return hwPhi(); }
0074 
0075   /// get eta-code (6 bits)
0076   inline int eta() const { return hwEta(); }
0077 
0078   /// get fine eta bit
0079   inline bool fineEtaBit() const { return hwHF(); }
0080 
0081   /// get charge (1 bit)
0082   inline int charge() const { return hwSign(); }
0083 
0084   /// get quality
0085   inline unsigned int quality() const { return hwQual(); }
0086 
0087   /// get track-class
0088   inline TrackClass tc() const { return m_tc; }
0089 
0090   /// is it an empty  muon candidate?
0091   inline bool empty() const { return m_empty; }
0092 
0093   /// return Sector Processor in which the muon candidate was found
0094   inline const L1MuBMSecProcId& spid() const { return m_spid; }
0095 
0096   /// get address-array for this muon candidate
0097   inline L1MuBMAddressArray address() const { return m_addArray; }
0098 
0099   /// get relative address of a given station
0100   inline int address(int stat) const { return m_addArray.station(stat); }
0101 
0102   /// get the bunch crossing for this muon candidate
0103   inline int bx() const { return m_bx; }
0104 
0105   /// return number of phi track segments used to form the muon candidate
0106   inline int numberOfTSphi() const { return m_tsphiList.size(); }
0107 
0108   /// return number of eta track segments used to form the muon candidate
0109   inline int numberOfTSeta() const { return m_tsetaList.size(); }
0110 
0111   /// return all phi track segments of the muon candidate
0112   const std::vector<L1MuBMTrackSegPhi>& getTSphi() const { return m_tsphiList; }
0113 
0114   /// return start phi track segment of muon candidate
0115   const L1MuBMTrackSegPhi& getStartTSphi() const;
0116 
0117   /// return end phi track segment of muon candidate
0118   const L1MuBMTrackSegPhi& getEndTSphi() const;
0119 
0120   /// return all eta track segments of the muon candidate
0121   const std::vector<L1MuBMTrackSegEta>& getTSeta() const { return m_tsetaList; }
0122 
0123   /// return start eta track segment of muon candidate
0124   const L1MuBMTrackSegEta& getStartTSeta() const;
0125 
0126   /// return end eta track segment of muon candidate
0127   const L1MuBMTrackSegEta& getEndTSeta() const;
0128 
0129   /// enable muon candidate
0130   inline void enable() {
0131     m_empty = false;
0132     setTFIdentifiers(this->spid().sector(), l1t::tftype::bmtf);
0133   };
0134 
0135   /// disable muon candidate
0136   inline void disable() { m_empty = true; }
0137 
0138   /// set name of object
0139   inline void setName(std::string name) { m_name = name; }
0140 
0141   /// set track-class of muon candidate
0142   inline void setTC(TrackClass tc) { m_tc = tc; }
0143 
0144   /// set phi-code of muon candidate
0145   inline void setPhi(int phi) { setHwPhi(phi); }
0146 
0147   /// set eta-code of muon candidate
0148   void setEta(int eta);
0149 
0150   /// set fine eta bit
0151   inline void setFineEtaBit() { setHwHF(true); }
0152 
0153   /// set pt-code of muon candidate
0154   inline void setPt(int pt) { setHwPt(pt); }
0155 
0156   /// set charge of muon candidate
0157   inline void setCharge(int charge) { setHwSign(charge); }
0158 
0159   /// set charge of muon candidate
0160   inline void setBx(int bx) { m_bx = bx; }
0161 
0162   /// set quality of muon candidate
0163   inline void setQuality(unsigned int quality) { setHwQual(quality); }
0164 
0165   /// set relative addresses of muon candidate
0166   inline void setAddresses(const L1MuBMAddressArray& addr) { m_addArray = addr; }
0167 
0168   /// set phi track segments used to form the muon candidate
0169   void setTSphi(const std::vector<const L1MuBMTrackSegPhi*>& tsList);
0170 
0171   /// set eta track segments used to form the muon candidate
0172   void setTSeta(const std::vector<const L1MuBMTrackSegEta*>& tsList);
0173 
0174   /// assignment operator
0175   L1MuBMTrack& operator=(const L1MuBMTrack&);
0176 
0177   /// equal operator
0178   bool operator==(const L1MuBMTrack&) const;
0179 
0180   /// unequal operator
0181   bool operator!=(const L1MuBMTrack&) const;
0182 
0183   /// print parameters of muon candidate
0184   void print() const;
0185 
0186   /// output stream operator
0187   friend std::ostream& operator<<(std::ostream&, const L1MuBMTrack&);
0188 
0189   /// define a rank for muon candidates
0190   static bool rank(const L1MuBMTrack* first, const L1MuBMTrack* second) {
0191     unsigned short int rank_f = 0;  // rank of first
0192     unsigned short int rank_s = 0;  // rank of second
0193     if (first)
0194       rank_f = first->pt() + 512 * first->quality();
0195     if (second)
0196       rank_s = second->pt() + 512 * second->quality();
0197     return rank_f > rank_s;
0198   }
0199 
0200 private:
0201   L1MuBMSecProcId m_spid;  // which SP found the track
0202   std::string m_name;
0203   bool m_empty;
0204   TrackClass m_tc;
0205   int m_bx;
0206 
0207   L1MuBMAddressArray m_addArray;
0208   std::vector<L1MuBMTrackSegPhi> m_tsphiList;
0209   std::vector<L1MuBMTrackSegEta> m_tsetaList;
0210 };
0211 
0212 #endif