Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 /**  \class L1MuGMTExtendedCand
0004  *
0005  *   L1 Global Muon Trigger Extended Candidate.
0006  *
0007  *   This is a GMT candidate with extended information 
0008  *   that will be sent to Readout.
0009  * 
0010  *   This candidates contains extra information such 
0011  *   as sort rank and indices of the contributing muons.
0012 */
0013 //
0014 //
0015 //   Author :
0016 //   H. Sakulin                  HEPHY Vienna
0017 //
0018 //   Migrated to CMSSW:
0019 //   I. Mikulec
0020 //
0021 //--------------------------------------------------
0022 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTExtendedCand_h
0023 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTExtendedCand_h
0024 
0025 //---------------
0026 // C++ Headers --
0027 //---------------
0028 
0029 #include <iosfwd>
0030 #include <string>
0031 
0032 //----------------------
0033 // Base Class Headers --
0034 //----------------------
0035 
0036 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h"
0037 
0038 //------------------------------------
0039 // Collaborating Class Declarations --
0040 //------------------------------------
0041 
0042 //              ---------------------
0043 //              -- Class Interface --
0044 //              ---------------------
0045 
0046 class L1MuGMTExtendedCand : public L1MuGMTCand {
0047 public:
0048   /// constructor
0049   L1MuGMTExtendedCand();
0050 
0051   /// constructor
0052   L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx = 0);
0053 
0054   /// copy constructor
0055   L1MuGMTExtendedCand(const L1MuGMTExtendedCand&);
0056 
0057   /// destructor
0058   ~L1MuGMTExtendedCand() override;
0059 
0060   /// reset muon candidate
0061   void reset();
0062 
0063   //
0064   // Getters
0065   //
0066 
0067   /// get rank
0068   unsigned int rank() const { return m_rank; }
0069 
0070   /// get index of contributing DT/CSC muon
0071   unsigned getDTCSCIndex() const { return readDataField(IDXDTCSC_START, IDXDTCSC_LENGTH); }
0072 
0073   /// get index of contributing RPC muon
0074   unsigned getRPCIndex() const { return readDataField(IDXRPC_START, IDXRPC_LENGTH); }
0075 
0076   /// get forward bit (true=forward, false=barrel)
0077   bool isFwd() const { return readDataField(FWDBIT_START, FWDBIT_LENGTH) == 1; }
0078 
0079   /// get RPC bit (true=RPC, false = DT/CSC or matched)
0080   bool isRPC() const { return readDataField(ISRPCBIT_START, ISRPCBIT_LENGTH) == 1; }
0081 
0082   /// set rank
0083   void setRank(unsigned int rank) { m_rank = rank; }
0084 
0085   /// get detector bits
0086   /// 1=rpc, 2=dtbx, 4=csc, 3=rpc+dtbx, 5=rpc+csc
0087   /// supported for backward compatibility only
0088   unsigned int detector() const;
0089 
0090   //
0091   // Setters
0092   //
0093 
0094   /// set index of contributing DT/CSC muon
0095   void setDTCSCIndex(unsigned int idxdtcsc) { writeDataField(IDXDTCSC_START, IDXDTCSC_LENGTH, idxdtcsc); }
0096 
0097   /// set index of contributing RPC muon
0098   void setRPCIndex(unsigned int idxrpc) { writeDataField(IDXRPC_START, IDXRPC_LENGTH, idxrpc); }
0099 
0100   /// set forward bit (1=forward, 0=barrel)
0101   void setFwdBit(unsigned int fwdbit) { writeDataField(FWDBIT_START, FWDBIT_LENGTH, fwdbit); }
0102 
0103   /// set RPC bit (1=RPC, 0=DT/CSC or matched)
0104   void setRPCBit(unsigned int rpcbit) { writeDataField(ISRPCBIT_START, ISRPCBIT_LENGTH, rpcbit); }
0105 
0106   /// equal operator
0107   bool operator==(const L1MuGMTExtendedCand&) const;
0108 
0109   /// unequal operator
0110   bool operator!=(const L1MuGMTExtendedCand&) const;
0111 
0112   /// print parameters of muon candidate
0113   void print() const;
0114 
0115   /// output stream operator
0116   friend std::ostream& operator<<(std::ostream&, const L1MuGMTExtendedCand&);
0117 
0118   /// define a rank for muon candidates
0119   static bool compareRank(const L1MuGMTExtendedCand* first, const L1MuGMTExtendedCand* second) {
0120     unsigned int rank_f = (first) ? first->rank() : 0;
0121     unsigned int rank_s = (second) ? second->rank() : 0;
0122     return rank_f > rank_s;
0123   }
0124 
0125   /// define a rank for muon candidates
0126   static bool rankRef(const L1MuGMTExtendedCand& first, const L1MuGMTExtendedCand& second) {
0127     unsigned int rank_f = first.rank();
0128     unsigned int rank_s = second.rank();
0129     return rank_f > rank_s;
0130   }
0131 
0132 private:
0133   unsigned int m_rank;
0134 
0135   enum { IDXDTCSC_START = 26 };
0136   enum { IDXDTCSC_LENGTH = 2 };  // Bit  26:27 DT/CSC muon index
0137   enum { IDXRPC_START = 28 };
0138   enum { IDXRPC_LENGTH = 2 };  // Bit  28:29 RPC muon index
0139   enum { FWDBIT_START = 30 };
0140   enum { FWDBIT_LENGTH = 1 };  // Bit  30    fwd bit
0141   enum { ISRPCBIT_START = 31 };
0142   enum { ISRPCBIT_LENGTH = 1 };  // Bit  31    isRPC bit
0143 };
0144 
0145 #endif