ATLAS Offline Software
Loading...
Searching...
No Matches
PhaseII::PixelRawDataContainer Class Reference

The container for pixel RDOs The base class is the InDetRawDataContainer with a coordinate dimension of 2. More...

#include <PhaseIIPixelRawDataContainer.h>

Inheritance diagram for PhaseII::PixelRawDataContainer:
Collaboration diagram for PhaseII::PixelRawDataContainer:

Public Member Functions

const std::vector< std::uint64_t > & errors () const
std::vector< std::uint64_t > & errors ()
bool isValid (unsigned int index) const
 return true if the index refers to an element in the container
const std::array< std::int16_t, NDim > & coordinates (unsigned int index) const
 return the coordinates i.e. column, row or strip of a certain RDO (read only).
const std::uint32_t & dataWord (unsigned int index) const
 return the packed data word of of a certain RDO (read only).
bool isSane () const
std::size_t size () const
 total number of RDOs which are in this container.
bool empty () const
 test whether the container is empty i.e. does not contain any RDOs
std::size_t capacity () const
 the maximum number RDOs this container can hold without reallocation.
void reserve (std::size_t new_capacity)
 reserve space for a certain number of RDOs.
void emplace_back (std::array< std::int16_t, NDim > &&coordinates, std::uint32_t data_word)
 Add a new RDO to the end of this container.
void erase_back (unsigned int begin_index)
 erase the elements at the end of the container
void move (InDetRawDataContainer &dest, unsigned int start_index)
 Move the coordinates and the data word of a certain number of elements at the end to a new container.

Static Public Member Functions

static int getToT (std::uint32_t dataWord)
static int getBCID (std::uint32_t dataWord)
static int getLVL1A (std::uint32_t dataWord)
static int getLVL1ID (std::uint32_t dataWord)
static std::uint32_t makeWord (int tot, int bcid, int lvl1a, int lvl1d)
static constexpr int unpack (std::uint32_t mask, unsigned int shift, unsigned int word)
 extract a value from a bit packed word.
static constexpr std::uint32_t pack (std::uint32_t mask, unsigned int shift, int input)
 Create a bit-packed word from an input value.

Static Protected Attributes

static constexpr std::uint32_t MASK_TOT = 0xFF
static constexpr unsigned int SHIFT_TOT = 0
static constexpr std::uint32_t MASK_BCID = 0xFF
static constexpr unsigned int SHIFT_BCID = 8
static constexpr std::uint32_t MASK_LVL1D = 0xFF
static constexpr unsigned int SHIFT_LVL1D = 16
static constexpr std::uint32_t MASK_LVL1A = 0xF
static constexpr unsigned int SHIFT_LVL1A = 24

Private Attributes

std::vector< std::uint64_t > m_errors
std::vector< std::array< std::int16_t, NDim > > m_coordinates
std::vector< std::uint32_t > m_word

Detailed Description

The container for pixel RDOs The base class is the InDetRawDataContainer with a coordinate dimension of 2.

Definition at line 18 of file PhaseIIPixelRawDataContainer.h.

Member Function Documentation

◆ capacity()

std::size_t PhaseII::InDetRawDataContainer< NDim >::capacity ( ) const
inlineinherited

the maximum number RDOs this container can hold without reallocation.

Definition at line 269 of file PhaseIIInDetRawDataContainer.h.

Base raw data container which provides coordinates of a certain dimension and a data word per RDO (ra...
std::size_t capacity() const
the maximum number RDOs this container can hold without reallocation.

◆ coordinates()

const std::array< std::int16_t, NDim > & PhaseII::InDetRawDataContainer< NDim >::coordinates ( unsigned int index) const
inlineinherited

return the coordinates i.e. column, row or strip of a certain RDO (read only).

Definition at line 252 of file PhaseIIInDetRawDataContainer.h.

◆ dataWord()

const std::uint32_t & PhaseII::InDetRawDataContainer< NDim >::dataWord ( unsigned int index) const
inlineinherited

return the packed data word of of a certain RDO (read only).

Definition at line 256 of file PhaseIIInDetRawDataContainer.h.

256{ assert(isValid(index)); return m_word[index]; }

◆ emplace_back()

void PhaseII::InDetRawDataContainer< NDim >::emplace_back ( std::array< std::int16_t, NDim > && coordinates,
std::uint32_t data_word )
inlineinherited

Add a new RDO to the end of this container.

Parameters
coordinatesthe coordinates of the RDO e.g. pixel row, column or strop.
data_worda bit packed data word which may contain e.g. the ToT.

Definition at line 281 of file PhaseIIInDetRawDataContainer.h.

281 {
282 // @TODO should bail out if container is filled concurrently and the
283 // size is equal to the capacity, but the container does not know.
286 assert(isSane());
287 }
void emplace_back(std::array< std::int16_t, NDim > &&coordinates, std::uint32_t data_word)
Add a new RDO to the end of this container.

◆ empty()

bool PhaseII::InDetRawDataContainer< NDim >::empty ( ) const
inlineinherited

test whether the container is empty i.e. does not contain any RDOs

Definition at line 267 of file PhaseIIInDetRawDataContainer.h.

267{ assert(isSane()); return m_coordinates.empty(); }
bool empty() const
test whether the container is empty i.e. does not contain any RDOs

◆ erase_back()

void PhaseII::InDetRawDataContainer< NDim >::erase_back ( unsigned int begin_index)
inlineinherited

erase the elements at the end of the container

Parameters
begin_indexthe index of the first element that is erased. Will erase all elements from begin_index till the end of the container. begin_index is expected to be smaller or equal to the container size. The result may be undefined if begin_index is larger than the container size.

Definition at line 294 of file PhaseIIInDetRawDataContainer.h.

294 {
297 m_word.erase( m_word.begin()+begin_index, m_word.end());
298 assert(isSane());
299 }
std::size_t size() const
total number of RDOs which are in this container.

◆ errors() [1/2]

std::vector< std::uint64_t > & PhaseII::PixelRawDataContainer::errors ( )
inline

Definition at line 57 of file PhaseIIPixelRawDataContainer.h.

57{ return m_errors; }

◆ errors() [2/2]

const std::vector< std::uint64_t > & PhaseII::PixelRawDataContainer::errors ( ) const
inline

Definition at line 55 of file PhaseIIPixelRawDataContainer.h.

55{ return m_errors; }

◆ getBCID()

int PhaseII::PixelRawDataContainer::getBCID ( std::uint32_t dataWord)
inlinestatic

Definition at line 42 of file PhaseIIPixelRawDataContainer.h.

static constexpr int unpack(std::uint32_t mask, unsigned int shift, unsigned int word)
const std::uint32_t & dataWord(unsigned int index) const
static constexpr unsigned int SHIFT_BCID
static constexpr std::uint32_t MASK_BCID

◆ getLVL1A()

int PhaseII::PixelRawDataContainer::getLVL1A ( std::uint32_t dataWord)
inlinestatic

Definition at line 43 of file PhaseIIPixelRawDataContainer.h.

static constexpr std::uint32_t MASK_LVL1A
static constexpr unsigned int SHIFT_LVL1A

◆ getLVL1ID()

int PhaseII::PixelRawDataContainer::getLVL1ID ( std::uint32_t dataWord)
inlinestatic

Definition at line 44 of file PhaseIIPixelRawDataContainer.h.

static constexpr std::uint32_t MASK_LVL1D
static constexpr unsigned int SHIFT_LVL1D

◆ getToT()

int PhaseII::PixelRawDataContainer::getToT ( std::uint32_t dataWord)
inlinestatic

Definition at line 41 of file PhaseIIPixelRawDataContainer.h.

41{ return unpack(MASK_TOT, SHIFT_TOT, dataWord); }
static constexpr unsigned int SHIFT_TOT
static constexpr std::uint32_t MASK_TOT

◆ isSane()

bool PhaseII::InDetRawDataContainer< NDim >::isSane ( ) const
inlineinherited

Definition at line 262 of file PhaseIIInDetRawDataContainer.h.

262{ return m_coordinates.size() == m_word.size(); }

◆ isValid()

bool PhaseII::InDetRawDataContainer< NDim >::isValid ( unsigned int index) const
inlineinherited

return true if the index refers to an element in the container

Definition at line 249 of file PhaseIIInDetRawDataContainer.h.

249{ assert( m_coordinates.size() == m_word.size()); return index < m_coordinates.size(); }

◆ makeWord()

std::uint32_t PhaseII::PixelRawDataContainer::makeWord ( int tot,
int bcid,
int lvl1a,
int lvl1d )
inlinestatic

Definition at line 47 of file PhaseIIPixelRawDataContainer.h.

47 {
48 return pack(MASK_TOT, SHIFT_TOT, tot)
49 | pack(MASK_BCID, SHIFT_BCID, bcid)
50 | pack(MASK_LVL1A, SHIFT_LVL1A, lvl1a)
51 | pack(MASK_LVL1D, SHIFT_LVL1D, lvl1d);
52 }
static constexpr std::uint32_t pack(std::uint32_t mask, unsigned int shift, int input)

◆ move()

void PhaseII::InDetRawDataContainer< NDim >::move ( InDetRawDataContainer< 2 > & dest,
unsigned int start_index )
inlineinherited

Move the coordinates and the data word of a certain number of elements at the end to a new container.

Parameters
destthe container to which the elements will be moved.
start_indexthe index of the first element that will be moved. Will copy the elements from start_index until then end to the container dest, and erase the copied elements from this container.

Definition at line 330 of file PhaseIIInDetRawDataContainer.h.

330 {
331 unsigned int copy_n_elements=size()-start_index;
335 std::memcpy(dest.m_word.data(), m_word.data()+start_index, copy_n_elements*sizeof(typename decltype(m_word)::value_type) );
336 this->erase_back(start_index);
337 }
std::vector< std::array< std::int16_t, NDim > > m_coordinates

◆ pack()

constexpr std::uint32_t PhaseII::InDetRawDataContainer< NDim >::pack ( std::uint32_t mask,
unsigned int shift,
int input )
inlinestaticconstexprinherited

Create a bit-packed word from an input value.

Parameters
maskthe mask to blend out bits of the input value which are not part of the actual value.
shiftthe bit number of the first bit in the bit packed data word.
inputthe input value.
Returns
a bit packed data word which only represents the input value. This value can be or-ed with other bit-packed values to form a complete data word. If the input value exceeds the maximum value fitting into the provided mask, then the result will be undefined.

Definition at line 319 of file PhaseIIInDetRawDataContainer.h.

319 {
320 // test that packing is loss-less
321 assert( static_cast<int>(static_cast<std::uint32_t>(input) & mask) ==input );
322 return static_cast<std::uint32_t>( (input & mask) << shift );
323 }

◆ reserve()

void PhaseII::InDetRawDataContainer< NDim >::reserve ( std::size_t new_capacity)
inlineinherited

reserve space for a certain number of RDOs.

Definition at line 272 of file PhaseIIInDetRawDataContainer.h.

272 {
276 }
void reserve(std::size_t new_capacity)
reserve space for a certain number of RDOs.

◆ size()

std::size_t PhaseII::InDetRawDataContainer< NDim >::size ( ) const
inlineinherited

total number of RDOs which are in this container.

Definition at line 265 of file PhaseIIInDetRawDataContainer.h.

265{ assert(isSane()); return m_coordinates.size(); }

◆ unpack()

constexpr int PhaseII::InDetRawDataContainer< NDim >::unpack ( std::uint32_t mask,
unsigned int shift,
unsigned int word )
inlinestaticconstexprinherited

extract a value from a bit packed word.

Parameters
maskthe mask to blend out bits not part of a certain value after shifting the data word.
shiftthe first bit of the value
wordthe bit packed data word
Returns
the unpacked value Will shift the data word and then apply the mask to blend out bits not part of the value.

Definition at line 307 of file PhaseIIInDetRawDataContainer.h.

307 {
308 return static_cast<int>( (word >> shift ) & mask );
309 }

Member Data Documentation

◆ m_coordinates

std::vector<std::array<std::int16_t,NDim> > PhaseII::InDetRawDataContainer< NDim >::m_coordinates
privateinherited

Definition at line 339 of file PhaseIIInDetRawDataContainer.h.

◆ m_errors

std::vector<std::uint64_t> PhaseII::PixelRawDataContainer::m_errors
private

Definition at line 37 of file PhaseIIPixelRawDataContainer.h.

◆ m_word

std::vector<std::uint32_t> PhaseII::InDetRawDataContainer< NDim >::m_word
privateinherited

Definition at line 340 of file PhaseIIInDetRawDataContainer.h.

◆ MASK_BCID

std::uint32_t PhaseII::PixelRawDataContainer::MASK_BCID = 0xFF
staticconstexprprotected

Definition at line 24 of file PhaseIIPixelRawDataContainer.h.

◆ MASK_LVL1A

std::uint32_t PhaseII::PixelRawDataContainer::MASK_LVL1A = 0xF
staticconstexprprotected

Definition at line 28 of file PhaseIIPixelRawDataContainer.h.

◆ MASK_LVL1D

std::uint32_t PhaseII::PixelRawDataContainer::MASK_LVL1D = 0xFF
staticconstexprprotected

Definition at line 26 of file PhaseIIPixelRawDataContainer.h.

◆ MASK_TOT

std::uint32_t PhaseII::PixelRawDataContainer::MASK_TOT = 0xFF
staticconstexprprotected

Definition at line 22 of file PhaseIIPixelRawDataContainer.h.

◆ SHIFT_BCID

unsigned int PhaseII::PixelRawDataContainer::SHIFT_BCID = 8
staticconstexprprotected

Definition at line 25 of file PhaseIIPixelRawDataContainer.h.

◆ SHIFT_LVL1A

unsigned int PhaseII::PixelRawDataContainer::SHIFT_LVL1A = 24
staticconstexprprotected

Definition at line 29 of file PhaseIIPixelRawDataContainer.h.

◆ SHIFT_LVL1D

unsigned int PhaseII::PixelRawDataContainer::SHIFT_LVL1D = 16
staticconstexprprotected

Definition at line 27 of file PhaseIIPixelRawDataContainer.h.

◆ SHIFT_TOT

unsigned int PhaseII::PixelRawDataContainer::SHIFT_TOT = 0
staticconstexprprotected

Definition at line 23 of file PhaseIIPixelRawDataContainer.h.


The documentation for this class was generated from the following file: