CMS 3D CMS Logo

PhiMemoryImage.h
Go to the documentation of this file.
1 #ifndef L1TMuonEndCap_PhiMemoryImage_h
2 #define L1TMuonEndCap_PhiMemoryImage_h
3 
4 #include <cstdint>
5 #include <iosfwd>
6 
7 // Originally written by Ivan Furic and Matt Carver (Univ of Florida)
8 
9 
11 public:
13 
16 
17  // Copy constructor, move constructor and copy assignment
21 
22  void swap(PhiMemoryImage& other);
23 
24  void reset();
25 
26  void set_bit(unsigned int layer, unsigned int bit);
27 
28  void clear_bit(unsigned int layer, unsigned int bit);
29 
30  bool test_bit(unsigned int layer, unsigned int bit) const;
31 
32  void set_word(unsigned int layer, unsigned int unit, value_type value);
33 
34  value_type get_word(unsigned int layer, unsigned int unit) const;
35 
36  void set_straightness(int s) { _straightness = s; }
37 
38  int get_straightness() const { return _straightness; }
39 
40  // Left rotation by n bits
41  void rotl(unsigned int n);
42 
43  // Right rotation by n bits
44  void rotr(unsigned int n);
45 
46  // Kind of like AND operator
47  // It returns a layer code which encodes
48  // bit 0: st3 or st4 hit
49  // bit 1: st2 hit
50  // bit 2: st1 hit
51  unsigned int op_and(const PhiMemoryImage& other) const;
52 
53  void print(std::ostream& out) const;
54 
55 private:
56  void check_input(unsigned int layer, unsigned int bit) const;
57 
58  // Num of layers
59  // [0,1,2,3] --> [st1,st2,st3,st4]
60  static const unsigned int _layers = 4;
61 
62  // Num of value_type allocated per layer
63  // 3 * 64 bits = 192 bits
64  static const unsigned int _units = 3;
65 
66  // Hits in non-key stations
67  value_type _buffer[_layers][_units];
68 
70 };
71 
72 // _____________________________________________________________________________
73 // Output streams
74 std::ostream& operator<<(std::ostream& o, const PhiMemoryImage& p);
75 
76 #endif
unsigned int op_and(const PhiMemoryImage &other) const
void set_word(unsigned int layer, unsigned int unit, value_type value)
void set_straightness(int s)
void set_bit(unsigned int layer, unsigned int bit)
static const unsigned int _units
uint64_t value_type
value_type get_word(unsigned int layer, unsigned int unit) const
void check_input(unsigned int layer, unsigned int bit) const
void clear_bit(unsigned int layer, unsigned int bit)
void print(std::ostream &out) const
value_type _buffer[_layers][_units]
int get_straightness() const
void rotr(unsigned int n)
void rotl(unsigned int n)
Definition: value.py:1
#define noexcept
unsigned long long uint64_t
Definition: Time.h:15
bool test_bit(unsigned int layer, unsigned int bit) const
void swap(PhiMemoryImage &other)
std::ostream & operator<<(std::ostream &o, const PhiMemoryImage &p)
static const unsigned int _layers