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

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

Namespaces

namespace  Detail
 

Enumerations

enum class  Level {
  System , Unit , Module , PhotoDet ,
  NumLevels
}
 

Functions

int32_t GetAddress (uint32_t Unit=0, uint32_t Module=0, uint32_t PhotoDet=0, uint32_t Version=kCurrentVersion)
 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.
 
uint32_t GetSystemId (int32_t address)
 Get system Id (should be integer value of ECbmModuleId::kFsd)
 
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.
 
std::string ToString (int32_t address)
 String output.
 

Variables

constexpr uint32_t kCurrentVersion = 0
 
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 FSD data.

Namespace CbmFsdAddress

Author
Lukas Chlad l.chl.nosp@m.ad@g.nosp@m.si.de

Inspired by the structure used by STS. The current definition (version 0) of the address bit field for the FSD is:

Level Bits Max. Elements Bit Position System (kFSD) 4 16 0 - 3 Unit 4 16 4 - 7 Module 15 32768 8 - 22 PhotoDetector 2 4 23 - 24 Unused 3 25 - 27 Version 4 16 28 - 31

Enumeration Type Documentation

◆ Level

enum class CbmFsdAddress::Level
strong

Enumerator for the hierarchy levels of the FSD setup

Enumerator
System 
Unit 
Module 
PhotoDet 
NumLevels 

Definition at line 40 of file CbmFsdAddress.h.

Function Documentation

◆ GetAddress()

int32_t CbmFsdAddress::GetAddress ( uint32_t Unit = 0,
uint32_t Module = 0,
uint32_t PhotoDet = 0,
uint32_t Version = kCurrentVersion )

Construct address.

Parameters
unitUnit index
moduleModule index in unit
photodetPhotoDetector index in module
Returns
Unique element address

Definition at line 23 of file CbmFsdAddress.cxx.

References kCurrentVersion, kFsd, kVersionShift, Module, PhotoDet, System, ToIntegralType(), and Unit.

Referenced by CbmFsdDigitize::Exec(), CbmFsdGeoHandler::GetAddress(), CbmFsdGeoHandler::GetCurrentAddress(), CbmFsdGeoHandler::GetCurrentAddress(), and CbmFsdDigi::SetAddress().

◆ GetElementId()

uint32_t CbmFsdAddress::GetElementId ( int32_t address,
int32_t level )

Get the index of an element.

Parameters
addressUnique element address
levelHierarchy level
Returns
Element index

Definition at line 73 of file CbmFsdAddress.cxx.

References GetVersion(), NumLevels, and System.

Referenced by CbmFsdHit::CbmFsdHit(), CbmFsdDigitize::Exec(), CbmFsdDigi::GetModuleID(), CbmFsdDigi::GetPhotoDetID(), GetSystemId(), CbmFsdDigi::GetUnitID(), CbmFsdHitProducer::ProcessData(), CbmFsdDigitize::ReleaseBuffer(), and ToString().

◆ GetMotherAddress()

int32_t CbmFsdAddress::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 55 of file CbmFsdAddress.cxx.

References GetVersion(), kVersionShift, NumLevels, and System.

◆ GetSystemId()

uint32_t CbmFsdAddress::GetSystemId ( int32_t address)

Get system Id (should be integer value of ECbmModuleId::kFsd)

Parameters
addressUnique element address

Definition at line 88 of file CbmFsdAddress.cxx.

References GetElementId(), and System.

◆ GetVersion()

uint32_t CbmFsdAddress::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 96 of file CbmFsdAddress.cxx.

References kVersionMask, and kVersionShift.

Referenced by GetElementId(), GetMotherAddress(), SetElementId(), and ToString().

◆ SetElementId()

int32_t CbmFsdAddress::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 104 of file CbmFsdAddress.cxx.

References GetVersion(), NumLevels, and System.

◆ ToString()

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

String output.

Parameters
addressUnique element address

Definition at line 123 of file CbmFsdAddress.cxx.

References GetElementId(), GetVersion(), Module, PhotoDet, System, and Unit.

Variable Documentation

◆ kCurrentVersion

uint32_t CbmFsdAddress::kCurrentVersion = 0
inlineconstexpr

Definition at line 49 of file CbmFsdAddress.h.

Referenced by GetAddress().

◆ kVersionMask

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

Definition at line 55 of file CbmFsdAddress.h.

Referenced by GetVersion().

◆ kVersionShift

int32_t CbmFsdAddress::kVersionShift = 28
inlineconstexpr

Definition at line 54 of file CbmFsdAddress.h.

Referenced by GetAddress(), GetMotherAddress(), and GetVersion().

◆ kVersionSize

int32_t CbmFsdAddress::kVersionSize = 4
inlineconstexpr

Definition at line 53 of file CbmFsdAddress.h.