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

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

#include <PhaseIIStripRawDataContainer.h>

Inheritance diagram for PhaseII::StripRawDataContainer:
Collaboration diagram for PhaseII::StripRawDataContainer:

Public Types

enum  ERawDataType { SCT1 = 1 , SCT3 =3 , UNKNOWN =0 }
 The data format of the RAW data. More...

Public Member Functions

ERawDataType dataType () const
 Return the type of the original RAW data the RDO container is based on.
void setDataType (ERawDataType type)
 Set the RAW data type of this container.
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 getGroupSize (std::uint32_t dataWord)
 Extract the number of consecutive strip hits starting from the coordinates of the corresponding RDO from the data word.
static int getTimeBin (std::uint32_t dataWord)
 Extract the time bin from the data word.
static int getErrors (std::uint32_t dataWord)
 Extract error information from the data word.
static bool OnTime (std::uint32_t dataWord)
static bool FirstHitError (std::uint32_t dataWord)
static bool SecondHitError (std::uint32_t dataWord)
static std::uint32_t makeWord (unsigned int group_size, unsigned int time_bin, unsigned int errors)
 Create a bit-packed data word.
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.

Protected Attributes

ERawDataType m_dataType =UNKNOWN

Static Protected Attributes

static constexpr std::uint32_t MASK_GROUPSIZE = 0x7FF
static constexpr unsigned int SHIFT_GROUPSIZE = 0
static constexpr std::uint32_t MASK_TIMEBIN = 0x7
static constexpr unsigned int SHIFT_TIMEBIN = 22
static constexpr std::uint32_t MASK_ERRORS = 0x7
static constexpr unsigned int SHIFT_ERRORS = 25
static constexpr std::uint32_t MASK_ONTIME = 0x1
static constexpr unsigned int SHIFT_ONTIME = 23
static constexpr std::uint32_t MASK_FIRSTHITERROR = 0x1
static constexpr unsigned int SHIFT_FIRSTHITERROR = 29
static constexpr std::uint32_t MASK_SECONDHITERROR = 0x1
static constexpr unsigned int SHIFT_SECONDHITERROR = 30

Private Attributes

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

Detailed Description

The container for strip RDOs The base class is the InDetRawDataContainer with a coordinate dimension of 1.

Definition at line 18 of file PhaseIIStripRawDataContainer.h.

Member Enumeration Documentation

◆ ERawDataType

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.

◆ dataType()

ERawDataType PhaseII::StripRawDataContainer::dataType ( ) const
inline

Return the type of the original RAW data the RDO container is based on.

Definition at line 59 of file PhaseIIStripRawDataContainer.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.

◆ FirstHitError()

bool PhaseII::StripRawDataContainer::FirstHitError ( std::uint32_t dataWord)
inlinestatic

Definition at line 45 of file PhaseIIStripRawDataContainer.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_FIRSTHITERROR
static constexpr std::uint32_t MASK_FIRSTHITERROR

◆ getErrors()

int PhaseII::StripRawDataContainer::getErrors ( std::uint32_t dataWord)
inlinestatic

Extract error information from the data word.

Definition at line 41 of file PhaseIIStripRawDataContainer.h.

static constexpr std::uint32_t MASK_ERRORS
static constexpr unsigned int SHIFT_ERRORS

◆ getGroupSize()

int PhaseII::StripRawDataContainer::getGroupSize ( std::uint32_t dataWord)
inlinestatic

Extract the number of consecutive strip hits starting from the coordinates of the corresponding RDO from the data word.

Definition at line 37 of file PhaseIIStripRawDataContainer.h.

static constexpr std::uint32_t MASK_GROUPSIZE
static constexpr unsigned int SHIFT_GROUPSIZE

◆ getTimeBin()

int PhaseII::StripRawDataContainer::getTimeBin ( std::uint32_t dataWord)
inlinestatic

Extract the time bin from the data word.

Definition at line 39 of file PhaseIIStripRawDataContainer.h.

static constexpr std::uint32_t MASK_TIMEBIN
static constexpr unsigned int SHIFT_TIMEBIN

◆ 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::StripRawDataContainer::makeWord ( unsigned int group_size,
unsigned int time_bin,
unsigned int errors )
inlinestatic

Create a bit-packed data word.

Definition at line 49 of file PhaseIIStripRawDataContainer.h.

49 {
50 return pack(MASK_GROUPSIZE, SHIFT_GROUPSIZE, group_size)
51 | pack(MASK_TIMEBIN, SHIFT_TIMEBIN, time_bin)
52 | pack(MASK_ERRORS, SHIFT_ERRORS, errors);
53 }
static constexpr std::uint32_t pack(std::uint32_t mask, unsigned int shift, int input)

◆ move()

void PhaseII::InDetRawDataContainer< NDim >::move ( InDetRawDataContainer< 1 > & 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

◆ OnTime()

bool PhaseII::StripRawDataContainer::OnTime ( std::uint32_t dataWord)
inlinestatic

Definition at line 44 of file PhaseIIStripRawDataContainer.h.

static constexpr std::uint32_t MASK_ONTIME
static constexpr unsigned int SHIFT_ONTIME

◆ 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.

◆ SecondHitError()

bool PhaseII::StripRawDataContainer::SecondHitError ( std::uint32_t dataWord)
inlinestatic

Definition at line 46 of file PhaseIIStripRawDataContainer.h.

◆ setDataType()

void PhaseII::StripRawDataContainer::setDataType ( ERawDataType type)
inline

Set the RAW data type of this container.

Definition at line 61 of file PhaseIIStripRawDataContainer.h.

◆ 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_dataType

ERawDataType PhaseII::StripRawDataContainer::m_dataType =UNKNOWN
protected

Definition at line 63 of file PhaseIIStripRawDataContainer.h.

◆ m_word

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

Definition at line 340 of file PhaseIIInDetRawDataContainer.h.

◆ MASK_ERRORS

std::uint32_t PhaseII::StripRawDataContainer::MASK_ERRORS = 0x7
staticconstexprprotected

Definition at line 26 of file PhaseIIStripRawDataContainer.h.

◆ MASK_FIRSTHITERROR

std::uint32_t PhaseII::StripRawDataContainer::MASK_FIRSTHITERROR = 0x1
staticconstexprprotected

Definition at line 31 of file PhaseIIStripRawDataContainer.h.

◆ MASK_GROUPSIZE

std::uint32_t PhaseII::StripRawDataContainer::MASK_GROUPSIZE = 0x7FF
staticconstexprprotected

Definition at line 22 of file PhaseIIStripRawDataContainer.h.

◆ MASK_ONTIME

std::uint32_t PhaseII::StripRawDataContainer::MASK_ONTIME = 0x1
staticconstexprprotected

Definition at line 29 of file PhaseIIStripRawDataContainer.h.

◆ MASK_SECONDHITERROR

std::uint32_t PhaseII::StripRawDataContainer::MASK_SECONDHITERROR = 0x1
staticconstexprprotected

Definition at line 33 of file PhaseIIStripRawDataContainer.h.

◆ MASK_TIMEBIN

std::uint32_t PhaseII::StripRawDataContainer::MASK_TIMEBIN = 0x7
staticconstexprprotected

Definition at line 24 of file PhaseIIStripRawDataContainer.h.

◆ SHIFT_ERRORS

unsigned int PhaseII::StripRawDataContainer::SHIFT_ERRORS = 25
staticconstexprprotected

Definition at line 27 of file PhaseIIStripRawDataContainer.h.

◆ SHIFT_FIRSTHITERROR

unsigned int PhaseII::StripRawDataContainer::SHIFT_FIRSTHITERROR = 29
staticconstexprprotected

Definition at line 32 of file PhaseIIStripRawDataContainer.h.

◆ SHIFT_GROUPSIZE

unsigned int PhaseII::StripRawDataContainer::SHIFT_GROUPSIZE = 0
staticconstexprprotected

Definition at line 23 of file PhaseIIStripRawDataContainer.h.

◆ SHIFT_ONTIME

unsigned int PhaseII::StripRawDataContainer::SHIFT_ONTIME = 23
staticconstexprprotected

Definition at line 30 of file PhaseIIStripRawDataContainer.h.

◆ SHIFT_SECONDHITERROR

unsigned int PhaseII::StripRawDataContainer::SHIFT_SECONDHITERROR = 30
staticconstexprprotected

Definition at line 34 of file PhaseIIStripRawDataContainer.h.

◆ SHIFT_TIMEBIN

unsigned int PhaseII::StripRawDataContainer::SHIFT_TIMEBIN = 22
staticconstexprprotected

Definition at line 25 of file PhaseIIStripRawDataContainer.h.


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