CbmRoot
CbmStsAddress Namespace Reference

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

Functions

Int_t GetAddress (UInt_t unit=0, UInt_t ladder=0, UInt_t halfladder=0, UInt_t module=0, UInt_t sensor=0, UInt_t side=0, UInt_t version=kCurrentVersion)
 Construct address. More...
 
Int_t GetAddress (UInt_t *elementId, UInt_t version)
 Construct address. More...
 
Int_t GetMotherAddress (Int_t address, Int_t level)
 Construct the address of an element from the address of a descendant element. More...
 
UInt_t GetElementId (Int_t address, Int_t level)
 Get the index of an element. More...
 
ECbmModuleId GetSystemId (Int_t address)
 Get system Id (should be ECbmModuleId::kSts) More...
 
UInt_t GetVersion (Int_t address)
 Extract version number. More...
 
Int_t SetElementId (Int_t address, Int_t level, UInt_t newId)
 Set the index of an element, leaving the other element levels untouched. More...
 
std::string ToString (Int_t address)
 String output. More...
 

Variables

const UShort_t kBits [kCurrentVersion+1][kStsNofLevels]
 
const Int_t kShift [kCurrentVersion+1][kStsNofLevels]
 
const Int_t kMask [kCurrentVersion+1][kStsNofLevels]
 
const UInt_t kCurrentVersion = 1
 
const Int_t kVersionSize = 4
 
const Int_t kVersionShift = 28
 
const Int_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]

Int_t CbmStsAddress::GetAddress ( UInt_t *  elementId,
UInt_t  version 
)

Construct address.

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

Definition at line 145 of file CbmStsAddress.cxx.

References kBits, kCurrentVersion, kShift, kSts, kStsNofLevels, kStsSystem, kVersionShift, and ToIntegralType().

◆ GetAddress() [2/2]

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

◆ GetElementId()

UInt_t CbmStsAddress::GetElementId ( Int_t  address,
Int_t  level 
)

◆ GetMotherAddress()

Int_t CbmStsAddress::GetMotherAddress ( Int_t  address,
Int_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 168 of file CbmStsAddress.cxx.

References GetVersion(), kShift, kStsNofLevels, kStsSystem, and kVersionShift.

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

◆ GetSystemId()

ECbmModuleId CbmStsAddress::GetSystemId ( Int_t  address)

Get system Id (should be ECbmModuleId::kSts)

Parameters
addressUnique element address

Definition at line 190 of file CbmStsAddress.cxx.

References GetElementId(), and kStsSystem.

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

◆ GetVersion()

UInt_t CbmStsAddress::GetVersion ( Int_t  address)

Extract version number.

Parameters
addressUnique element address @value Version number

The version is encoded in the last 6 bits (58 to 63). The maximal number of versions is 64.

Definition at line 198 of file CbmStsAddress.cxx.

References kVersionMask, and kVersionShift.

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

◆ SetElementId()

Int_t CbmStsAddress::SetElementId ( Int_t  address,
Int_t  level,
UInt_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 205 of file CbmStsAddress.cxx.

References GetVersion(), kBits, kMask, kShift, kStsNofLevels, and kStsSystem.

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

◆ ToString()

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

String output.

Parameters
addressUnique element address

Definition at line 221 of file CbmStsAddress.cxx.

References GetElementId(), GetVersion(), kStsHalfLadder, kStsLadder, kStsModule, kStsSensor, kStsSide, kStsSystem, and kStsUnit.

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

Variable Documentation

◆ kBits

const UShort_t CbmStsAddress::kBits[kCurrentVersion+1][kStsNofLevels]
Initial value:
= {
{
4,
4,
4,
1,
3,
2,
1
},
{
4,
6,
5,
1,
5,
4,
1
}
}

Definition at line 18 of file CbmStsAddress.cxx.

Referenced by GetAddress(), and SetElementId().

◆ kCurrentVersion

const UInt_t CbmStsAddress::kCurrentVersion = 1

Definition at line 47 of file CbmStsAddress.h.

Referenced by GetAddress().

◆ kMask

const Int_t CbmStsAddress::kMask[kCurrentVersion+1][kStsNofLevels]
Initial value:
= {
{(1 << kBits[0][0]) - 1,
(1 << kBits[0][1]) - 1,
(1 << kBits[0][2]) - 1,
(1 << kBits[0][3]) - 1,
(1 << kBits[0][4]) - 1,
(1 << kBits[0][5]) - 1,
(1 << kBits[0][6]) - 1},
{(1 << kBits[1][0]) - 1,
(1 << kBits[1][1]) - 1,
(1 << kBits[1][2]) - 1,
(1 << kBits[1][3]) - 1,
(1 << kBits[1][4]) - 1,
(1 << kBits[1][5]) - 1,
(1 << kBits[1][6]) - 1}}

Definition at line 67 of file CbmStsAddress.cxx.

Referenced by GetElementId(), and SetElementId().

◆ kShift

const Int_t CbmStsAddress::kShift[kCurrentVersion+1][kStsNofLevels]
Initial value:
= {
{0,
kShift[0][0] + kBits[0][0],
kShift[0][1] + kBits[0][1],
kShift[0][2] + kBits[0][2],
kShift[0][3] + kBits[0][3],
kShift[0][4] + kBits[0][4],
kShift[0][5] + kBits[0][5]},
{0,
kShift[1][0] + kBits[1][0],
kShift[1][1] + kBits[1][1],
kShift[1][2] + kBits[1][2],
kShift[1][3] + kBits[1][3],
kShift[1][4] + kBits[1][4],
kShift[1][5] + kBits[1][5]}}

Definition at line 47 of file CbmStsAddress.cxx.

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

◆ kVersionMask

const Int_t CbmStsAddress::kVersionMask = (1 << kVersionSize) - 1

Definition at line 53 of file CbmStsAddress.h.

Referenced by GetVersion().

◆ kVersionShift

const Int_t CbmStsAddress::kVersionShift = 28

Definition at line 52 of file CbmStsAddress.h.

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

◆ kVersionSize

const Int_t CbmStsAddress::kVersionSize = 4

Definition at line 51 of file CbmStsAddress.h.

CbmStsAddress::kBits
const UShort_t kBits[kCurrentVersion+1][kStsNofLevels]
Definition: CbmStsAddress.cxx:18
CbmStsAddress::kShift
const Int_t kShift[kCurrentVersion+1][kStsNofLevels]
Definition: CbmStsAddress.cxx:47