Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:40

0001 #ifndef L1Trigger_RPCTBMuon_h
0002 #define L1Trigger_RPCTBMuon_h
0003 #include "L1Trigger/RPCTrigger/interface/RPCMuon.h"
0004 #include "L1Trigger/RPCTrigger/interface/RPCPacMuon.h"
0005 
0006 //---------------------------------------------------------------------------

0007 //output of the Pac (one LogCone),

0008 //used in m_TBGhostBuster

0009 //input and output of the m_TBGhostBuster

0010 
0011 /** \class RPCTBMuon

0012   * Used in Ghoust Busters and sorters.

0013   * Has additionall filds: m_Killed, m_GBData, m_EtaAddress, m_PhiAddress need in these algorithms.

0014   * \author Karol Bunkowski (Warsaw)

0015   */
0016 
0017 class RPCTBMuon : public RPCMuon {
0018 public:
0019   enum MuonBitsType { mbtPACOut, mbtTBSortOut, mbtTCSortOut, mbtHSBOut, mbtFSBOut, mbtUnset };
0020 
0021 public:
0022   ///Empty muon.

0023   RPCTBMuon();
0024 
0025   RPCTBMuon(int ptCode, int quality, int sign, int patternNum, unsigned short firedPlanes);
0026 
0027   RPCTBMuon(int ptCode, int quality, int sign, MuonBitsType muonBitsType);
0028 
0029   RPCTBMuon(const RPCPacMuon& pacMuon);
0030 
0031   int getCode() const;
0032 
0033   void setCode(int code);
0034 
0035   void setPhiAddr(int phiAddr);
0036 
0037   void setSectorAddr(int sectorAddr);
0038 
0039   void setEtaAddr(int etaAddr);
0040 
0041   void setAddress(int etaAddr, int phiAddr);
0042 
0043   void setAddress(int tbNumber, int tbTower, int phiAddr);
0044 
0045   void setGBData(unsigned int gbData);
0046 
0047   int getEtaAddr() const;
0048 
0049   int getPhiAddr() const;
0050 
0051   int getSegmentAddr() const;
0052 
0053   int getSectorAddr() const;
0054 
0055   int getContinSegmAddr() const;
0056 
0057   void setCodeAndPhiAddr(int code, int phiAddr);
0058 
0059   void setCodeAndEtaAddr(int code, int etaAddr);
0060 
0061   int getGBData() const;
0062 
0063   std::string getGBDataBitStr() const;
0064 
0065   std::string printDebugInfo(int debugFormat) const;
0066 
0067   std::string printExtDebugInfo(int, int, int) const;
0068 
0069   void setGBDataKilledFirst();
0070 
0071   void setGBDataKilledLast();
0072 
0073   bool gBDataKilledFirst() const;
0074 
0075   bool gBDataKilledLast() const;
0076 
0077   //------need to perform ghost - busting ------------

0078   void kill();
0079 
0080   /** @return true = was non-empty muon and was killed

0081     * false = was not killed or is zero */
0082   bool wasKilled() const;
0083 
0084   /** @return true = was no-zero muon and was not killed

0085     * false = is killed or is zero */
0086   bool isLive() const;
0087   //aaa

0088   ///Used in sorting.

0089   struct TMuonMore : public std::less<RPCTBMuon> {
0090     bool operator()(const RPCTBMuon& muonL, const RPCTBMuon& muonR) const { return muonL.getCode() > muonR.getCode(); }
0091   };
0092 
0093   unsigned int toBits(MuonBitsType muonBitsType) const;
0094 
0095   unsigned int toBits() const { return toBits(m_muonBitsType); }
0096 
0097   void fromBits(MuonBitsType muonBitsType, unsigned int value);
0098 
0099   std::string toString(int format) const;
0100 
0101 private:
0102   MuonBitsType m_muonBitsType;
0103   //------ hardware signals------------------------

0104   unsigned int m_EtaAddress;
0105 
0106   unsigned int m_PhiAddress;
0107 
0108   /** 2 bits,

0109     * 0 00 - this muon did not kill nothing on the sector edge

0110     * 1 01 - this muon killed muon from segment 0 (the "right" sector edge), or is in segment 0

0111     * 2 10 - this muon killed muon from segment 11 (the "left" sector edge), or is in segment 11

0112     * 3 11 - this muon killed muon from segment 0 and 11 */
0113   unsigned int m_GBData;
0114 
0115   //------- need to perform ghost - busting ---------

0116   bool m_Killed;  //!< true means that muon was killed during GB

0117 
0118   //------ conversion to hardware signals------------------------

0119 public:
0120   class PACOut {
0121   private:
0122     static const int m_qualBitsCnt = 3;
0123     static const unsigned int m_qualBitsMask = 0x7;
0124     static const int m_ptBitsCnt = 5;
0125     static const unsigned int m_ptBitsMask = 0x1f;
0126     static const int m_signBitsCnt = 1;
0127     static const unsigned int m_signBitsMask = 0x1;
0128 
0129   public:
0130     static unsigned int toBits(const RPCTBMuon& muon);
0131     static void fromBits(RPCTBMuon& muon, unsigned int value);
0132 
0133     static const int getMuonBitsCnt() { return m_qualBitsCnt + m_ptBitsCnt + m_signBitsCnt; }
0134   };
0135   friend class PACOut;
0136 
0137   class TBOut {
0138   private:
0139     static const int m_qualBitsCnt = 3;
0140     static const unsigned int m_qualBitsMask = 0x7;
0141     static const int m_ptBitsCnt = 5;
0142     static const unsigned int m_ptBitsMask = 0x1f;
0143     static const int m_signBitsCnt = 1;
0144     static const unsigned int m_signBitsMask = 0x1;
0145     static const int m_phiBitsCnt = 4;
0146     static const unsigned int m_phiBitsMask = 0xf;
0147     static const int m_etaBitsCnt = 2;
0148     static const unsigned int m_etaBitsMask = 0x3;
0149     static const int m_gbDataBitsCnt = 2;
0150     static const unsigned int m_gbDataBitsMask = 0x3;
0151 
0152   public:
0153     static unsigned int toBits(const RPCTBMuon& muon);
0154     static void fromBits(RPCTBMuon& muon, unsigned int value);
0155   };
0156   friend class TBOut;
0157 
0158   class TCOut {
0159   private:
0160     static const int m_gbDataBitsCnt = 2;
0161     static const unsigned int m_gbDataBitsMask = 0x3;
0162     static const int m_etaBitsCnt = 6;
0163     static const unsigned int m_etaBitsMask = 0x3f;
0164     static const int m_phiBitsCnt = 4;
0165     static const unsigned int m_phiBitsMask = 0xf;
0166     static const int m_qualBitsCnt = 3;
0167     static const unsigned int m_qualBitsMask = 0x7;
0168     static const int m_ptBitsCnt = 5;
0169     static const unsigned int m_ptBitsMask = 0x1f;
0170     static const int m_signBitsCnt = 1;
0171     static const unsigned int m_signBitsMask = 0x1;
0172 
0173   public:
0174     static unsigned int toBits(const RPCTBMuon& muon);
0175     static void fromBits(RPCTBMuon& muon, unsigned int value);
0176   };
0177   friend class TCOut;
0178 
0179   class HSBOut {
0180   private:
0181     static const int m_signBitsCnt = 1;
0182     static const unsigned int m_signBitsMask = 0x1;
0183     static const int m_ptBitsCnt = 5;
0184     static const unsigned int m_ptBitsMask = 0x1f;
0185     static const int m_qualBitsCnt = 3;
0186     static const unsigned int m_qualBitsMask = 0x7;
0187     static const int m_phiBitsCnt = 7;
0188     static const unsigned int m_phiBitsMask = 0x7f;
0189     static const int m_etaBitsCnt = 6;
0190     static const unsigned int m_etaBitsMask = 0x3f;
0191 
0192   public:
0193     static unsigned int toBits(const RPCTBMuon& muon);
0194     static void fromBits(RPCTBMuon& muon, unsigned int value);
0195   };
0196   friend class HSBOut;
0197 
0198   class FSBOut {
0199   private:
0200     static const int m_phiBitsCnt = 8;
0201     static const unsigned int m_phiBitsMask = 0xff;
0202     static const int m_ptBitsCnt = 5;
0203     static const unsigned int m_ptBitsMask = 0x1f;
0204     static const int m_qualBitsCnt = 3;
0205     static const unsigned int m_qualBitsMask = 0x7;
0206     static const int m_etaBitsCnt = 6;
0207     static const unsigned int m_etaBitsMask = 0x3f;
0208     static const int m_signBitsCnt = 1;
0209     static const unsigned int m_signBitsMask = 0x1;
0210 
0211   public:
0212     static unsigned int toBits(const RPCTBMuon& muon);
0213     static void fromBits(RPCTBMuon& muon, unsigned int value);
0214   };
0215   friend class FSBOut;
0216 };
0217 
0218 typedef std::vector<RPCTBMuon> L1RpcTBMuonsVec;
0219 typedef std::vector<L1RpcTBMuonsVec> L1RpcTBMuonsVec2;
0220 
0221 #endif