ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
CaloRecGPU::NeighOffset Class Reference

#include <NeighArr.h>

Collaboration diagram for CaloRecGPU::NeighOffset:

Public Types

using carrier = unsigned long long int
 

Public Member Functions

constexpr operator carrier () const
 
constexpr NeighOffset (const carrier v)
 
constexpr NeighOffsetoperator= (const carrier v)
 
constexpr int get_number (const int i) const
 
constexpr int get_start_cell (const int option) const
 
constexpr int get_end_cell (const int option) const
 To clarify, this cell no longer corresponds to the option, so it's one past the end (like the end iterator of a C++ container)... More...
 
constexpr int get_total_number () const
 
constexpr int get_num_cells (const int option) const
 

Static Public Member Functions

static constexpr carrier offset_delta (const int i)
 Returns, for each i, what must be added to the offset to increase the stores numbers appropriately when a cell belonging to option (i-1) is added. More...
 

Public Attributes

carrier value
 

Static Protected Attributes

constexpr static carrier s_numbers_to_keep = NumNeighOptions - 1
 
constexpr static int s_bits_per_offset = 5
 
constexpr static int s_bits_per_last_offset = 6
 
constexpr static int s_more_bits_begin = 9
 
constexpr static carrier s_offset_mask = 0x1FULL
 
constexpr static carrier s_offset_mask_last = 0x3FULL
 
constexpr static carrier s_offset_delta_pattern = 0x0208210842108421ULL
 
constexpr static carrier s_last_bit_mask = 0x8000000000000000ULL
 
constexpr static carrier s_only_numbers_mask = ~s_last_bit_mask
 

Detailed Description

A class that expresses the offset from the beginning of the neighbours list for the several neighbour options.

Bit packed to store all cumulative offsets, since they fit in 5 or 6 bits. (NMaxNeighbours == 34)

Definition at line 26 of file NeighArr.h.

Member Typedef Documentation

◆ carrier

using CaloRecGPU::NeighOffset::carrier = unsigned long long int

Definition at line 28 of file NeighArr.h.

Constructor & Destructor Documentation

◆ NeighOffset()

constexpr CaloRecGPU::NeighOffset::NeighOffset ( const carrier  v)
inlineconstexpr

Definition at line 67 of file NeighArr.h.

67  : value(v)
68  {
69  }

Member Function Documentation

◆ get_end_cell()

constexpr int CaloRecGPU::NeighOffset::get_end_cell ( const int  option) const
inlineconstexpr

To clarify, this cell no longer corresponds to the option, so it's one past the end (like the end iterator of a C++ container)...

Definition at line 115 of file NeighArr.h.

116  {
117  /*
118  if (option < 0 || option >= NumNeighOptions)
119  {
120  return -1;
121  }
122  else
123  {*/
124  return get_number(option);
125  /*}*/
126  }

◆ get_num_cells()

constexpr int CaloRecGPU::NeighOffset::get_num_cells ( const int  option) const
inlineconstexpr

Definition at line 133 of file NeighArr.h.

134  {
135  return this->get_end_cell(option) - this->get_start_cell(option);
136  }

◆ get_number()

constexpr int CaloRecGPU::NeighOffset::get_number ( const int  i) const
inlineconstexpr

Definition at line 77 of file NeighArr.h.

78  {
79  carrier ret = value /*& s_only_numbers_mask*/;
80  //Not necessary to mask since we mask the result anyway.
81 
82  if (i >= s_more_bits_begin)
83  {
84  ret = ret >> (s_bits_per_offset * s_more_bits_begin);
85  ret = ret >> (s_bits_per_last_offset * (i - s_more_bits_begin));
86  ret &= s_offset_mask_last;
87  }
88  else
89  {
90  ret = ret >> (s_bits_per_offset * i);
91  ret &= s_offset_mask;
92  }
93  return (uint32_t) ret;
94  }

◆ get_start_cell()

constexpr int CaloRecGPU::NeighOffset::get_start_cell ( const int  option) const
inlineconstexpr

Definition at line 96 of file NeighArr.h.

97  {
98  if (option == 0)
99  {
100  return 0;
101  }
102  /*else if (option < 0 || option >= NumNeighOptions)
103  {
104  return -1;
105  }*/
106  else
107  {
108  return get_number(option - 1);
109  }
110  }

◆ get_total_number()

constexpr int CaloRecGPU::NeighOffset::get_total_number ( ) const
inlineconstexpr

Definition at line 128 of file NeighArr.h.

129  {
130  return get_number(NumNeighOptions - 1);
131  }

◆ offset_delta()

static constexpr carrier CaloRecGPU::NeighOffset::offset_delta ( const int  i)
inlinestaticconstexpr

Returns, for each i, what must be added to the offset to increase the stores numbers appropriately when a cell belonging to option (i-1) is added.

In other words, the neighbour counts starting from option i are incremented.

Definition at line 144 of file NeighArr.h.

145  {
146  carrier mask = 0xFFFFFFFFFFFFFFFFULL;
147  if (i >= s_more_bits_begin)
148  {
149  // coverity[overflow_const]
151  // coverity[overflow_const]
153  }
154  else
155  {
156  // coverity[overflow_const]
157  mask = mask << (s_bits_per_offset * i);
158  }
159 
160  //Suppressing coverity errors here since
161  //adding zeros to the beginning of the mask
162  //and ignoring the higher level bits
163  //is precisely the desired behaviour.
164 
166  return s_offset_delta_pattern & mask;
167  }

◆ operator carrier()

constexpr CaloRecGPU::NeighOffset::operator carrier ( ) const
inlineconstexpr

Definition at line 62 of file NeighArr.h.

63  {
64  return value;
65  }

◆ operator=()

constexpr NeighOffset& CaloRecGPU::NeighOffset::operator= ( const carrier  v)
inlineconstexpr

Definition at line 71 of file NeighArr.h.

72  {
73  value = v;
74  return (*this);
75  }

Member Data Documentation

◆ s_bits_per_last_offset

constexpr static int CaloRecGPU::NeighOffset::s_bits_per_last_offset = 6
staticconstexprprotected

Definition at line 37 of file NeighArr.h.

◆ s_bits_per_offset

constexpr static int CaloRecGPU::NeighOffset::s_bits_per_offset = 5
staticconstexprprotected

Definition at line 36 of file NeighArr.h.

◆ s_last_bit_mask

constexpr static carrier CaloRecGPU::NeighOffset::s_last_bit_mask = 0x8000000000000000ULL
staticconstexprprotected

Definition at line 50 of file NeighArr.h.

◆ s_more_bits_begin

constexpr static int CaloRecGPU::NeighOffset::s_more_bits_begin = 9
staticconstexprprotected

Definition at line 38 of file NeighArr.h.

◆ s_numbers_to_keep

constexpr static carrier CaloRecGPU::NeighOffset::s_numbers_to_keep = NumNeighOptions - 1
staticconstexprprotected

Definition at line 33 of file NeighArr.h.

◆ s_offset_delta_pattern

constexpr static carrier CaloRecGPU::NeighOffset::s_offset_delta_pattern = 0x0208210842108421ULL
staticconstexprprotected

Definition at line 46 of file NeighArr.h.

◆ s_offset_mask

constexpr static carrier CaloRecGPU::NeighOffset::s_offset_mask = 0x1FULL
staticconstexprprotected

Definition at line 44 of file NeighArr.h.

◆ s_offset_mask_last

constexpr static carrier CaloRecGPU::NeighOffset::s_offset_mask_last = 0x3FULL
staticconstexprprotected

Definition at line 45 of file NeighArr.h.

◆ s_only_numbers_mask

constexpr static carrier CaloRecGPU::NeighOffset::s_only_numbers_mask = ~s_last_bit_mask
staticconstexprprotected

Definition at line 54 of file NeighArr.h.

◆ value

carrier CaloRecGPU::NeighOffset::value

Definition at line 29 of file NeighArr.h.


The documentation for this class was generated from the following file:
CaloRecGPU::NeighOffset::s_only_numbers_mask
constexpr static carrier s_only_numbers_mask
Definition: NeighArr.h:54
CaloRecGPU::NeighOffset::value
carrier value
Definition: NeighArr.h:29
CaloRecGPU::NeighOffset::s_more_bits_begin
constexpr static int s_more_bits_begin
Definition: NeighArr.h:38
CaloRecGPU::NeighOffset::s_bits_per_last_offset
constexpr static int s_bits_per_last_offset
Definition: NeighArr.h:37
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CaloRecGPU::NeighOffset::get_end_cell
constexpr int get_end_cell(const int option) const
To clarify, this cell no longer corresponds to the option, so it's one past the end (like the end ite...
Definition: NeighArr.h:115
CaloRecGPU::NeighOffset::get_start_cell
constexpr int get_start_cell(const int option) const
Definition: NeighArr.h:96
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CaloRecGPU::NeighOffset::s_offset_delta_pattern
constexpr static carrier s_offset_delta_pattern
Definition: NeighArr.h:46
CaloRecGPU::NeighOffset::s_bits_per_offset
constexpr static int s_bits_per_offset
Definition: NeighArr.h:36
CaloRecGPU::NeighOffset::get_number
constexpr int get_number(const int i) const
Definition: NeighArr.h:77
CaloRecGPU::NeighOffset::carrier
unsigned long long int carrier
Definition: NeighArr.h:28
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloRecGPU::NeighOffset::s_offset_mask
constexpr static carrier s_offset_mask
Definition: NeighArr.h:44
python.PyAthena.v
v
Definition: PyAthena.py:154
CaloRecGPU::NumNeighOptions
constexpr int NumNeighOptions
Definition: BaseDefinitions.h:47
CaloRecGPU::NeighOffset::s_offset_mask_last
constexpr static carrier s_offset_mask_last
Definition: NeighArr.h:45