Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:27

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   /// assignment operator
0058   L1MuGMTExtendedCand& operator=(const L1MuGMTExtendedCand&) = default;
0059 
0060   /// destructor
0061   ~L1MuGMTExtendedCand() override;
0062 
0063   /// reset muon candidate
0064   void reset();
0065 
0066   //
0067   // Getters
0068   //
0069 
0070   /// get rank
0071   unsigned int rank() const { return m_rank; }
0072 
0073   /// get index of contributing DT/CSC muon
0074   unsigned getDTCSCIndex() const { return readDataField(IDXDTCSC_START, IDXDTCSC_LENGTH); }
0075 
0076   /// get index of contributing RPC muon
0077   unsigned getRPCIndex() const { return readDataField(IDXRPC_START, IDXRPC_LENGTH); }
0078 
0079   /// get forward bit (true=forward, false=barrel)
0080   bool isFwd() const { return readDataField(FWDBIT_START, FWDBIT_LENGTH) == 1; }
0081 
0082   /// get RPC bit (true=RPC, false = DT/CSC or matched)
0083   bool isRPC() const { return readDataField(ISRPCBIT_START, ISRPCBIT_LENGTH) == 1; }
0084 
0085   /// set rank
0086   void setRank(unsigned int rank) { m_rank = rank; }
0087 
0088   /// get detector bits
0089   /// 1=rpc, 2=dtbx, 4=csc, 3=rpc+dtbx, 5=rpc+csc
0090   /// supported for backward compatibility only
0091   unsigned int detector() const;
0092 
0093   //
0094   // Setters
0095   //
0096 
0097   /// set index of contributing DT/CSC muon
0098   void setDTCSCIndex(unsigned int idxdtcsc) { writeDataField(IDXDTCSC_START, IDXDTCSC_LENGTH, idxdtcsc); }
0099 
0100   /// set index of contributing RPC muon
0101   void setRPCIndex(unsigned int idxrpc) { writeDataField(IDXRPC_START, IDXRPC_LENGTH, idxrpc); }
0102 
0103   /// set forward bit (1=forward, 0=barrel)
0104   void setFwdBit(unsigned int fwdbit) { writeDataField(FWDBIT_START, FWDBIT_LENGTH, fwdbit); }
0105 
0106   /// set RPC bit (1=RPC, 0=DT/CSC or matched)
0107   void setRPCBit(unsigned int rpcbit) { writeDataField(ISRPCBIT_START, ISRPCBIT_LENGTH, rpcbit); }
0108 
0109   /// equal operator
0110   bool operator==(const L1MuGMTExtendedCand&) const;
0111 
0112   /// unequal operator
0113   bool operator!=(const L1MuGMTExtendedCand&) const;
0114 
0115   /// print parameters of muon candidate
0116   void print() const;
0117 
0118   /// output stream operator
0119   friend std::ostream& operator<<(std::ostream&, const L1MuGMTExtendedCand&);
0120 
0121   /// define a rank for muon candidates
0122   static bool compareRank(const L1MuGMTExtendedCand* first, const L1MuGMTExtendedCand* second) {
0123     unsigned int rank_f = (first) ? first->rank() : 0;
0124     unsigned int rank_s = (second) ? second->rank() : 0;
0125     return rank_f > rank_s;
0126   }
0127 
0128   /// define a rank for muon candidates
0129   static bool rankRef(const L1MuGMTExtendedCand& first, const L1MuGMTExtendedCand& second) {
0130     unsigned int rank_f = first.rank();
0131     unsigned int rank_s = second.rank();
0132     return rank_f > rank_s;
0133   }
0134 
0135 private:
0136   unsigned int m_rank;
0137 
0138   enum { IDXDTCSC_START = 26 };
0139   enum { IDXDTCSC_LENGTH = 2 };  // Bit  26:27 DT/CSC muon index
0140   enum { IDXRPC_START = 28 };
0141   enum { IDXRPC_LENGTH = 2 };  // Bit  28:29 RPC muon index
0142   enum { FWDBIT_START = 30 };
0143   enum { FWDBIT_LENGTH = 1 };  // Bit  30    fwd bit
0144   enum { ISRPCBIT_START = 31 };
0145   enum { ISRPCBIT_LENGTH = 1 };  // Bit  31    isRPC bit
0146 };
0147 
0148 #endif