CMS 3D CMS Logo

L1MuGMTExtendedCand.h
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
13 //
14 //
15 // Author :
16 // H. Sakulin HEPHY Vienna
17 //
18 // Migrated to CMSSW:
19 // I. Mikulec
20 //
21 //--------------------------------------------------
22 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTExtendedCand_h
23 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTExtendedCand_h
24 
25 //---------------
26 // C++ Headers --
27 //---------------
28 
29 #include <iosfwd>
30 #include <string>
31 
32 //----------------------
33 // Base Class Headers --
34 //----------------------
35 
37 
38 //------------------------------------
39 // Collaborating Class Declarations --
40 //------------------------------------
41 
42 // ---------------------
43 // -- Class Interface --
44 // ---------------------
45 
47 public:
50 
52  L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx = 0);
53 
56 
59 
61  ~L1MuGMTExtendedCand() override;
62 
64  void reset();
65 
66  //
67  // Getters
68  //
69 
71  unsigned int rank() const { return m_rank; }
72 
75 
77  unsigned getRPCIndex() const { return readDataField(IDXRPC_START, IDXRPC_LENGTH); }
78 
80  bool isFwd() const { return readDataField(FWDBIT_START, FWDBIT_LENGTH) == 1; }
81 
83  bool isRPC() const { return readDataField(ISRPCBIT_START, ISRPCBIT_LENGTH) == 1; }
84 
86  void setRank(unsigned int rank) { m_rank = rank; }
87 
91  unsigned int detector() const;
92 
93  //
94  // Setters
95  //
96 
98  void setDTCSCIndex(unsigned int idxdtcsc) { writeDataField(IDXDTCSC_START, IDXDTCSC_LENGTH, idxdtcsc); }
99 
101  void setRPCIndex(unsigned int idxrpc) { writeDataField(IDXRPC_START, IDXRPC_LENGTH, idxrpc); }
102 
104  void setFwdBit(unsigned int fwdbit) { writeDataField(FWDBIT_START, FWDBIT_LENGTH, fwdbit); }
105 
107  void setRPCBit(unsigned int rpcbit) { writeDataField(ISRPCBIT_START, ISRPCBIT_LENGTH, rpcbit); }
108 
110  bool operator==(const L1MuGMTExtendedCand&) const;
111 
113  bool operator!=(const L1MuGMTExtendedCand&) const;
114 
116  void print() const;
117 
119  friend std::ostream& operator<<(std::ostream&, const L1MuGMTExtendedCand&);
120 
123  unsigned int rank_f = (first) ? first->rank() : 0;
124  unsigned int rank_s = (second) ? second->rank() : 0;
125  return rank_f > rank_s;
126  }
127 
130  unsigned int rank_f = first.rank();
131  unsigned int rank_s = second.rank();
132  return rank_f > rank_s;
133  }
134 
135 private:
136  unsigned int m_rank;
137 
138  enum { IDXDTCSC_START = 26 };
139  enum { IDXDTCSC_LENGTH = 2 }; // Bit 26:27 DT/CSC muon index
140  enum { IDXRPC_START = 28 };
141  enum { IDXRPC_LENGTH = 2 }; // Bit 28:29 RPC muon index
142  enum { FWDBIT_START = 30 };
143  enum { FWDBIT_LENGTH = 1 }; // Bit 30 fwd bit
144  enum { ISRPCBIT_START = 31 };
145  enum { ISRPCBIT_LENGTH = 1 }; // Bit 31 isRPC bit
146 };
147 
148 #endif
void writeDataField(unsigned start, unsigned count, unsigned value)
Definition: L1MuGMTCand.h:243
bool operator==(const L1MuGMTExtendedCand &) const
equal operator
unsigned getRPCIndex() const
get index of contributing RPC muon
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
int bx() const
get bunch crossing identifier
Definition: L1MuGMTCand.h:120
U second(std::pair< T, U > const &p)
~L1MuGMTExtendedCand() override
destructor
unsigned readDataField(unsigned start, unsigned count) const
Definition: L1MuGMTCand.h:238
void setFwdBit(unsigned int fwdbit)
set forward bit (1=forward, 0=barrel)
void print() const
print parameters of muon candidate
L1MuGMTExtendedCand & operator=(const L1MuGMTExtendedCand &)=default
assignment operator
friend std::ostream & operator<<(std::ostream &, const L1MuGMTExtendedCand &)
output stream operator
void reset()
reset muon candidate
L1MuGMTExtendedCand()
constructor
unsigned int detector() const
bool isRPC() const
get RPC bit (true=RPC, false = DT/CSC or matched)
unsigned int rank() const
get rank
static bool compareRank(const L1MuGMTExtendedCand *first, const L1MuGMTExtendedCand *second)
define a rank for muon candidates
static bool rankRef(const L1MuGMTExtendedCand &first, const L1MuGMTExtendedCand &second)
define a rank for muon candidates
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
bool operator!=(const L1MuGMTExtendedCand &) const
unequal operator
void setRank(unsigned int rank)
set rank
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
bool isFwd() const
get forward bit (true=forward, false=barrel)
void setRPCIndex(unsigned int idxrpc)
set index of contributing RPC muon
unsigned getDTCSCIndex() const
get index of contributing DT/CSC muon