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 
10 public:
12 
15 
16  // Copy constructor, move constructor and copy assignment
20 
21  void swap(PhiMemoryImage& other);
22 
23  void reset();
24 
25  void set_bit(unsigned int layer, unsigned int bit);
26 
27  void clear_bit(unsigned int layer, unsigned int bit);
28 
29  bool test_bit(unsigned int layer, unsigned int bit) const;
30 
31  void set_word(unsigned int layer, unsigned int unit, value_type value);
32 
33  value_type get_word(unsigned int layer, unsigned int unit) const;
34 
35  void set_straightness(int s) { _straightness = s; }
36 
37  int get_straightness() const { return _straightness; }
38 
39  // Left rotation by n bits
40  void rotl(unsigned int n);
41 
42  // Right rotation by n bits
43  void rotr(unsigned int n);
44 
45  // Kind of like AND operator
46  // It returns a layer code which encodes
47  // bit 0: st3 or st4 hit
48  // bit 1: st2 hit
49  // bit 2: st1 hit
50  unsigned int op_and(const PhiMemoryImage& other) const;
51 
52  void print(std::ostream& out) const;
53 
54 private:
55  void check_input(unsigned int layer, unsigned int bit) const;
56 
57  // Num of layers
58  // [0,1,2,3] --> [st1,st2,st3,st4]
59  static const unsigned int _layers = 4;
60 
61  // Num of value_type allocated per layer
62  // 3 * 64 bits = 192 bits
63  static const unsigned int _units = 3;
64 
65  // Hits in non-key stations
67 
69 };
70 
71 // _____________________________________________________________________________
72 // Output streams
73 std::ostream& operator<<(std::ostream& o, const PhiMemoryImage& p);
74 
75 #endif
void set_word(unsigned int layer, unsigned int unit, value_type value)
void set_straightness(int s)
bool test_bit(unsigned int layer, unsigned int bit) const
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
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void clear_bit(unsigned int layer, unsigned int bit)
value_type _buffer[_layers][_units]
void print(std::ostream &out) const
void rotr(unsigned int n)
void rotl(unsigned int n)
Definition: value.py:1
Basic3DVector unit() const
void check_input(unsigned int layer, unsigned int bit) const
unsigned long long uint64_t
Definition: Time.h:13
PhiMemoryImage & operator=(PhiMemoryImage other)
unsigned int op_and(const PhiMemoryImage &other) const
int get_straightness() const
void swap(PhiMemoryImage &other)
std::ostream & operator<<(std::ostream &o, const PhiMemoryImage &p)
static const unsigned int _layers