CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/L1Trigger/RPCTrigger/interface/RPCTBMuon.h

Go to the documentation of this file.
00001 #ifndef L1Trigger_RPCTBMuon_h
00002 #define L1Trigger_RPCTBMuon_h
00003 #include "L1Trigger/RPCTrigger/interface/RPCMuon.h"
00004 #include "L1Trigger/RPCTrigger/interface/RPCPacMuon.h"
00005 
00006 
00007 //---------------------------------------------------------------------------
00008 //output of the Pac (one LogCone),
00009 //used in m_TBGhostBuster
00010 //input and output of the m_TBGhostBuster
00011 
00019 class RPCTBMuon: public RPCMuon {
00020 public:
00021   enum MuonBitsType {
00022     mbtPACOut,
00023     mbtTBSortOut,
00024     mbtTCSortOut,
00025     mbtHSBOut,
00026     mbtFSBOut, 
00027     mbtUnset    
00028   };
00029 public:
00031   RPCTBMuon();
00032 
00033   RPCTBMuon(int ptCode, int quality, int sign, int patternNum, unsigned short firedPlanes);
00034   
00035   RPCTBMuon(int ptCode, int quality, int sign, MuonBitsType muonBitsType);
00036 
00037   RPCTBMuon(const RPCPacMuon& pacMuon);
00038 
00039   int getCode() const;
00040 
00041   void setCode(int code);
00042 
00043   void setPhiAddr(int phiAddr);
00044 
00045   void setSectorAddr(int sectorAddr);
00046 
00047   void setEtaAddr(int etaAddr);
00048   
00049   void setAddress(int etaAddr, int phiAddr);
00050 
00051   void setAddress(int tbNumber, int tbTower, int phiAddr);
00052   
00053   void setGBData(unsigned int gbData);
00054 
00055   int getEtaAddr() const;
00056 
00057   int getPhiAddr() const;
00058 
00059   int getSegmentAddr() const;
00060 
00061   int getSectorAddr() const;
00062 
00063   int getContinSegmAddr() const;
00064 
00065   void setCodeAndPhiAddr(int code, int phiAddr);
00066 
00067   void setCodeAndEtaAddr(int code, int etaAddr);
00068 
00069   int getGBData() const;
00070 
00071   std::string getGBDataBitStr() const;
00072   
00073   std::string printDebugInfo(int debugFormat) const;
00074 
00075   std::string printExtDebugInfo(int, int, int) const;
00076 
00077   void setGBDataKilledFirst();
00078 
00079   void setGBDataKilledLast();
00080 
00081   bool gBDataKilledFirst() const;
00082 
00083   bool gBDataKilledLast() const;
00084 
00085 //------need to perform ghost - busting ------------
00086   void kill();
00087 
00090   bool wasKilled() const;
00091 
00094   bool isLive() const;
00095 //aaa
00097   struct TMuonMore : public std::less<RPCTBMuon> {
00098     bool operator()(const RPCTBMuon& muonL,
00099                      const RPCTBMuon& muonR) const {
00100       return muonL.getCode() > muonR.getCode();
00101     }
00102   };
00103         
00104   unsigned int toBits(MuonBitsType muonBitsType) const;
00105   
00106   unsigned int toBits() const {
00107         return toBits(m_muonBitsType);
00108   }
00109     
00110   void fromBits(MuonBitsType muonBitsType, unsigned int value);
00111   
00112   std::string toString(int format) const;
00113 
00114 private:
00115   MuonBitsType m_muonBitsType;
00116 //------ hardware signals------------------------
00117   unsigned int m_EtaAddress;
00118 
00119   unsigned int m_PhiAddress;
00120 
00126   unsigned int m_GBData; 
00127 
00128 //------- need to perform ghost - busting ---------
00129   bool m_Killed; 
00130         
00131 //------ conversion to hardware signals------------------------
00132 public:
00133   class PACOut {
00134   private:
00135         static const int m_qualBitsCnt = 3;  static const unsigned int m_qualBitsMask = 0x7;
00136         static const int m_ptBitsCnt   = 5;  static const unsigned int m_ptBitsMask   = 0x1f;
00137         static const int m_signBitsCnt = 1;  static const unsigned int m_signBitsMask = 0x1;
00138   public:       
00139         static unsigned int toBits(const RPCTBMuon& muon);
00140         static void fromBits(RPCTBMuon& muon, unsigned int value);
00141         
00142         static const int getMuonBitsCnt() {
00143                 return m_qualBitsCnt + m_ptBitsCnt + m_signBitsCnt;
00144         }
00145   };
00146   friend class PACOut;
00147 
00148 class TBOut {
00149   private:      
00150         static const int m_qualBitsCnt = 3;  static const unsigned int m_qualBitsMask = 0x7;  
00151         static const int m_ptBitsCnt   = 5;  static const unsigned int m_ptBitsMask   = 0x1f;   
00152         static const int m_signBitsCnt = 1;  static const unsigned int m_signBitsMask = 0x1;
00153         static const int m_phiBitsCnt  = 4;  static const unsigned int m_phiBitsMask  = 0xf;
00154         static const int m_etaBitsCnt  = 2;  static const unsigned int m_etaBitsMask  = 0x3;
00155         static const int m_gbDataBitsCnt=2;  static const unsigned int m_gbDataBitsMask = 0x3;
00156         
00157   public:       
00158         static unsigned int toBits(const RPCTBMuon& muon);
00159         static void fromBits(RPCTBMuon& muon, unsigned int value);
00160   };
00161   friend class TBOut;
00162 
00163   class TCOut {
00164   private:
00165         static const int m_gbDataBitsCnt=2;  static const unsigned int m_gbDataBitsMask = 0x3;
00166         static const int m_etaBitsCnt  = 6;  static const unsigned int m_etaBitsMask  = 0x3f;
00167         static const int m_phiBitsCnt  = 4;  static const unsigned int m_phiBitsMask  = 0xf;
00168         static const int m_qualBitsCnt = 3;  static const unsigned int m_qualBitsMask = 0x7;
00169         static const int m_ptBitsCnt   = 5;  static const unsigned int m_ptBitsMask   = 0x1f;
00170         static const int m_signBitsCnt = 1;  static const unsigned int m_signBitsMask = 0x1;
00171   public:       
00172         static unsigned int toBits(const RPCTBMuon& muon);
00173         static void fromBits(RPCTBMuon& muon, unsigned int value);
00174   };
00175   friend class TCOut;
00176 
00177 
00178   class HSBOut {
00179   private:
00180         static const int m_signBitsCnt = 1;  static const unsigned int m_signBitsMask = 0x1;
00181         static const int m_ptBitsCnt   = 5;  static const unsigned int m_ptBitsMask   = 0x1f;
00182         static const int m_qualBitsCnt = 3;  static const unsigned int m_qualBitsMask = 0x7;    
00183         static const int m_phiBitsCnt  = 7;  static const unsigned int m_phiBitsMask  = 0x7f;           
00184         static const int m_etaBitsCnt  = 6;  static const unsigned int m_etaBitsMask  = 0x3f;
00185   public:               
00186         static unsigned int toBits(const RPCTBMuon& muon);
00187         static void fromBits(RPCTBMuon& muon, unsigned int value);
00188   };
00189   friend class HSBOut;
00190 
00191   class FSBOut {
00192   private:
00193         static const int m_phiBitsCnt  = 8;  static const unsigned int m_phiBitsMask  = 0xff;
00194         static const int m_ptBitsCnt   = 5;  static const unsigned int m_ptBitsMask   = 0x1f;
00195         static const int m_qualBitsCnt = 3;  static const unsigned int m_qualBitsMask = 0x7;
00196         static const int m_etaBitsCnt  = 6;  static const unsigned int m_etaBitsMask  = 0x3f;
00197         static const int m_signBitsCnt = 1;  static const unsigned int m_signBitsMask = 0x1;
00198   public:       
00199         static unsigned int toBits(const RPCTBMuon& muon);
00200         static void fromBits(RPCTBMuon& muon, unsigned int value);
00201   };
00202   friend class FSBOut;
00203   
00204 };
00205 
00206 typedef std::vector<RPCTBMuon> L1RpcTBMuonsVec;
00207 typedef std::vector<L1RpcTBMuonsVec> L1RpcTBMuonsVec2;
00208 
00209 #endif
00210