CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTExtendedCand.h

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00013 //
00014 //   $Date $
00015 //   $Revision $
00016 //
00017 //   Author :
00018 //   H. Sakulin                  HEPHY Vienna
00019 //
00020 //   Migrated to CMSSW:
00021 //   I. Mikulec
00022 //
00023 //--------------------------------------------------
00024 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTExtendedCand_h
00025 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTExtendedCand_h
00026 
00027 //---------------
00028 // C++ Headers --
00029 //---------------
00030 
00031 #include <iosfwd>
00032 #include <functional>
00033 #include <string>
00034 
00035 //----------------------
00036 // Base Class Headers --
00037 //----------------------
00038 
00039 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h"
00040 
00041 //------------------------------------
00042 // Collaborating Class Declarations --
00043 //------------------------------------
00044 
00045 //              ---------------------
00046 //              -- Class Interface --
00047 //              ---------------------
00048 
00049 class L1MuGMTExtendedCand : public L1MuGMTCand {
00050 
00051   public:
00053     L1MuGMTExtendedCand();
00054    
00056     L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx=0);
00057    
00059     L1MuGMTExtendedCand(const L1MuGMTExtendedCand&);
00060 
00062      virtual ~L1MuGMTExtendedCand();
00063 
00065     void reset();
00066 
00067     //
00068     // Getters
00069     //
00070     
00072     unsigned int rank() const { return m_rank; }
00073     
00075     unsigned getDTCSCIndex() const { 
00076       return readDataField( IDXDTCSC_START, IDXDTCSC_LENGTH); 
00077     }
00078 
00080     unsigned getRPCIndex() const { 
00081       return readDataField( IDXRPC_START, IDXRPC_LENGTH); 
00082     }
00083 
00085     bool isFwd() const { return readDataField( FWDBIT_START, FWDBIT_LENGTH) == 1; }
00086 
00088     bool isRPC() const { return readDataField( ISRPCBIT_START, ISRPCBIT_LENGTH) == 1; }
00089 
00091     void setRank(unsigned int rank) { m_rank = rank; }
00092 
00096     unsigned int detector() const ;
00097 
00098     //
00099     // Setters
00100     // 
00101 
00103     void setDTCSCIndex(unsigned int idxdtcsc) { 
00104       writeDataField( IDXDTCSC_START, IDXDTCSC_LENGTH, idxdtcsc); 
00105     }
00106 
00108     void setRPCIndex(unsigned int idxrpc) { writeDataField( IDXRPC_START, IDXRPC_LENGTH, idxrpc); }
00109 
00111     void setFwdBit(unsigned int fwdbit) { writeDataField( FWDBIT_START, FWDBIT_LENGTH, fwdbit); }
00112 
00114     void setRPCBit(unsigned int rpcbit) { writeDataField( ISRPCBIT_START, ISRPCBIT_LENGTH, rpcbit); }
00115 
00117     bool operator==(const L1MuGMTExtendedCand&) const;
00118     
00120     bool operator!=(const L1MuGMTExtendedCand&) const;
00121 
00123     void print() const;
00124   
00126     friend std::ostream& operator<<(std::ostream&, const L1MuGMTExtendedCand&);
00127 
00129     class Rank : std::binary_function< const L1MuGMTExtendedCand*, const L1MuGMTExtendedCand*, bool> {
00130       public :
00131         bool operator()( const L1MuGMTExtendedCand* first, const L1MuGMTExtendedCand* second ) const {
00132           unsigned int rank_f = (first) ? first->rank(): 0;
00133           unsigned int rank_s = (second) ? second->rank() : 0;
00134           return rank_f > rank_s;
00135         }
00136     };
00137 
00139     class RankRef : std::binary_function< const L1MuGMTExtendedCand&, const L1MuGMTExtendedCand&, bool> {
00140       public :
00141         bool operator()( const L1MuGMTExtendedCand& first, const L1MuGMTExtendedCand& second ) const {
00142           unsigned int rank_f = first.rank();
00143           unsigned int rank_s = second.rank();
00144           return rank_f > rank_s;
00145         }
00146     };
00147 
00148   private:
00149     unsigned int m_rank;
00150     
00151     enum { IDXDTCSC_START=26}; enum { IDXDTCSC_LENGTH = 2}; // Bit  26:27 DT/CSC muon index
00152     enum { IDXRPC_START=28};   enum { IDXRPC_LENGTH = 2};   // Bit  28:29 RPC muon index
00153     enum { FWDBIT_START=30};   enum { FWDBIT_LENGTH = 1};   // Bit  30    fwd bit
00154     enum { ISRPCBIT_START=31}; enum { ISRPCBIT_LENGTH = 1}; // Bit  31    isRPC bit
00155 };
00156   
00157 #endif