CbmRoot
Loading...
Searching...
No Matches
CbmStsAddress Namespace Reference

Functions to encode or decode the address field of STS data. More...

Namespaces

namespace  Detail
 

Functions

int32_t GetAddress (uint32_t unit=0, uint32_t ladder=0, uint32_t halfladder=0, uint32_t module=0, uint32_t sensor=0, uint32_t side=0, uint32_t version=kCurrentVersion)
 Construct address.
 
int32_t GetAddress (uint32_t *elementId, uint32_t version)
 Construct address.
 
int32_t GetMotherAddress (int32_t address, int32_t level)
 Construct the address of an element from the address of a descendant element.
 
uint32_t GetElementId (int32_t address, int32_t level)
 Get the index of an element.
 
ECbmModuleId GetSystemId (int32_t address)
 Get system Id (should be ECbmModuleId::kSts)
 
uint32_t GetVersion (int32_t address)
 Extract version number.
 
int32_t SetElementId (int32_t address, int32_t level, uint32_t newId)
 Set the index of an element, leaving the other element levels untouched.
 
XPU_D int32_t UnpackDigiAddress (int32_t digiAddress)
 Add version and system to compressed address that's stored in a digi.
 
XPU_D int32_t PackDigiAddress (int32_t address)
 Strip address to contain only unit, (half)ladder and module.
 
std::string ToString (int32_t address)
 String output.
 

Variables

constexpr uint32_t kCurrentVersion = 1
 
constexpr int32_t kVersionSize = 4
 
constexpr int32_t kVersionShift = 28
 
constexpr int32_t kVersionMask = (1 << kVersionSize) - 1
 

Detailed Description

Functions to encode or decode the address field of STS data.

Namespace CbmStsAddress

Author
V.Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e

The current definition (version 1) of the address bit field for the STS is:

Level Bits Max. Elements Bit Position System (kSTS) 4 16 0 - 3 Unit 6 64 4 - 9 Ladder 5 32 10 - 14 HalfLadder 1 2 15 Module 5 32 16 - 20 Sensor 4 16 21 - 24 Side 1 2 25 Unused 2 26 - 27 Version 4 16 28 - 31

Function Documentation

◆ GetAddress() [1/2]

int32_t CbmStsAddress::GetAddress ( uint32_t * elementId,
uint32_t version )

Construct address.

Parameters
elementIdsArray of element indices in their mother volumes
Returns
Unique element address

Definition at line 68 of file CbmStsAddress.cxx.

References kSts, kStsNofLevels, kStsSystem, and ToIntegralType().

◆ GetAddress() [2/2]

int32_t CbmStsAddress::GetAddress ( uint32_t unit = 0,
uint32_t ladder = 0,
uint32_t halfladder = 0,
uint32_t module = 0,
uint32_t sensor = 0,
uint32_t side = 0,
uint32_t version = kCurrentVersion )

Construct address.

Parameters
unitUnit index
ladderLadder index in station
halfladderHalfladder index in ladder
moduleModule index within halfladder
sensorSensor index within module
sideSide (0=front, 1=back) of sensor
channelChannel number
Returns
Unique element address

Definition at line 20 of file CbmStsAddress.cxx.

References kSts, kStsHalfLadder, kStsLadder, kStsModule, kStsSensor, kStsSide, kStsSystem, kStsUnit, and ToIntegralType().

Referenced by CbmOnlineParWrite::AddSts(), CbmStsModule::GetAddressFromName(), CbmStsSensor::GetAddressFromName(), CbmStsSimModule::GetAddressFromName(), CbmStsSimSensor::GetAddressFromName(), CbmStsSetup::Init(), TEST(), TEST(), and TEST().

◆ GetElementId()

◆ GetMotherAddress()

int32_t CbmStsAddress::GetMotherAddress ( int32_t address,
int32_t level )

Construct the address of an element from the address of a descendant element.

Parameters
addressAddress of descendant element
levelDesired hierarchy level
Returns
Address of element at desired hierarchy level

This strips of the address information of all hierarchy levels below the desired one.

Definition at line 91 of file CbmStsAddress.cxx.

References kStsNofLevels, and kStsSystem.

Referenced by CbmStsRecoModule::AddDigiToQueue(), CbmAlgoBuildRawEvents::CheckTriggerConditions(), and CbmRecoSts::ProcessData().

◆ GetSystemId()

ECbmModuleId CbmStsAddress::GetSystemId ( int32_t address)

Get system Id (should be ECbmModuleId::kSts)

Parameters
addressUnique element address

Definition at line 116 of file CbmStsAddress.cxx.

References kStsSystem.

Referenced by CbmStsSetup::GetElement(), CbmMatchRecoToMC::MatchStsTracks(), and CbmMatchRecoToMC::MatchTracks().

◆ GetVersion()

uint32_t CbmStsAddress::GetVersion ( int32_t address)

Extract version number.

Parameters
addressUnique element address @value Version number

The version is encoded in the last 4 bits (28 to 31). The maximal number of versions is 16.

Definition at line 125 of file CbmStsAddress.cxx.

◆ PackDigiAddress()

XPU_D int32_t CbmStsAddress::PackDigiAddress ( int32_t address)
inline

Strip address to contain only unit, (half)ladder and module.

Parameters
addressFull address
Returns
17 bit address that can be stored in a Digi

Definition at line 197 of file CbmStsAddress.h.

References kStsHalfLadder, kStsLadder, kStsModule, kStsUnit, and UnpackDigiAddress().

Referenced by cbm::algo::sts::HitfinderChain::CountDigisPerModules(), and CbmStsDigi::PackAddressAndTime().

◆ SetElementId()

int32_t CbmStsAddress::SetElementId ( int32_t address,
int32_t level,
uint32_t newId )

Set the index of an element, leaving the other element levels untouched.

Parameters
addressUnique element address
levelHierarchy level
newIdNew element index
Returns
New address

Definition at line 133 of file CbmStsAddress.cxx.

References kStsNofLevels, and kStsSystem.

Referenced by CbmStsElement::InitDaughters(), and CbmStsModule::InitDaughters().

◆ ToString()

std::string CbmStsAddress::ToString ( int32_t address)

String output.

Parameters
addressUnique element address

Definition at line 148 of file CbmStsAddress.cxx.

References kStsHalfLadder, kStsLadder, kStsModule, kStsSensor, kStsSide, kStsSystem, and kStsUnit.

Referenced by CbmOnlineParWrite::AddSts(), CbmRecoSts::ProcessData(), CbmStsModule::ToString(), and CbmStsSensor::ToString().

◆ UnpackDigiAddress()

XPU_D int32_t CbmStsAddress::UnpackDigiAddress ( int32_t digiAddress)
inline

Add version and system to compressed address that's stored in a digi.

Parameters
digiAddressCompressed address from digi
Returns
Full address

Definition at line 186 of file CbmStsAddress.h.

References kSts, kStsSystem, kStsUnit, kVersionShift, and ToIntegralType().

Referenced by PackDigiAddress(), and CbmStsDigi::UnpackAddress().

Variable Documentation

◆ kCurrentVersion

uint32_t CbmStsAddress::kCurrentVersion = 1
inlineconstexpr

Definition at line 56 of file CbmStsAddress.h.

◆ kVersionMask

int32_t CbmStsAddress::kVersionMask = (1 << kVersionSize) - 1
inlineconstexpr

Definition at line 62 of file CbmStsAddress.h.

◆ kVersionShift

int32_t CbmStsAddress::kVersionShift = 28
inlineconstexpr

Definition at line 61 of file CbmStsAddress.h.

Referenced by UnpackDigiAddress().

◆ kVersionSize

int32_t CbmStsAddress::kVersionSize = 4
inlineconstexpr

Definition at line 60 of file CbmStsAddress.h.