BmnRoot
Loading...
Searching...
No Matches
BmnSsdAddress Namespace Reference

Functions to encode or decode the address field of SSD 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.
 
Int_t GetAddress (UInt_t *elementId, UInt_t version)
 Construct address.
 
Int_t GetMotherAddress (Int_t address, Int_t level)
 Construct the address of an element from the address of a descendant element.
 
UInt_t GetElementId (Int_t address, Int_t level)
 Get the index of an element.
 
UInt_t GetSystemId (Int_t address)
 Get system Id (should be kSSD)
 
UInt_t GetVersion (Int_t address)
 Extract version number.
 
Int_t SetElementId (Int_t address, Int_t level, UInt_t newId)
 Set the index of an element, leaving the other element levels untouched.
 
std::string ToString (Int_t address)
 String output.
 

Variables

const Int_t kBits [kCurrentVersion+1][kSsdNofLevels]
 
const Int_t kShift [kCurrentVersion+1][kSsdNofLevels]
 
const Int_t kMask [kCurrentVersion+1][kSsdNofLevels]
 
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 SSD data.

Namespace BmnSsdAddress

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 SSD is:

Level Bits Max. Elements Bit Position System (kSSD) 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 BmnSsdAddress::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 153 of file BmnSsdAddress.cxx.

References kBits, kCurrentVersion, kShift, kSSD, kSsdNofLevels, kSsdSystem, and kVersionShift.

◆ GetAddress() [2/2]

Int_t BmnSsdAddress::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.

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 96 of file BmnSsdAddress.cxx.

References kBits, kCurrentVersion, kShift, kSSD, kSsdHalfLadder, kSsdLadder, kSsdModule, kSsdSensor, kSsdSide, kSsdSystem, and kSsdUnit.

Referenced by BmnSsdModule::GetAddressFromName(), BmnSsdSensor::GetAddressFromName(), and BmnSsdSetup::Init().

◆ GetElementId()

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

Get the index of an element.

Parameters
addressUnique element address
levelHierarchy level
Returns
Element index

Definition at line 189 of file BmnSsdAddress.cxx.

References GetVersion(), kMask, kShift, kSsdNofLevels, and kSsdSystem.

Referenced by BmnSsdElement::ConstructName(), BmnSsdElement::ConstructName(), BmnSsdSetup::GetElement(), BmnSsdElement::GetIndex(), BmnSsdSensor::GetSensorId(), BmnSsdSetup::GetStationNumber(), GetSystemId(), and ToString().

◆ GetMotherAddress()

Int_t BmnSsdAddress::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 176 of file BmnSsdAddress.cxx.

References GetVersion(), kShift, kSsdNofLevels, kSsdSystem, and kVersionShift.

◆ GetSystemId()

UInt_t BmnSsdAddress::GetSystemId ( Int_t  address)

Get system Id (should be kSSD)

Parameters
addressUnique element address

Definition at line 200 of file BmnSsdAddress.cxx.

References GetElementId(), and kSsdSystem.

Referenced by BmnSsdSetup::GetElement().

◆ GetVersion()

UInt_t BmnSsdAddress::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 208 of file BmnSsdAddress.cxx.

References kVersionMask, and kVersionShift.

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

◆ SetElementId()

Int_t BmnSsdAddress::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 217 of file BmnSsdAddress.cxx.

References GetVersion(), kBits, kMask, kShift, kSsdNofLevels, and kSsdSystem.

Referenced by BmnSsdElement::InitDaughters().

◆ ToString()

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

String output.

Parameters
addressUnique element address

Definition at line 235 of file BmnSsdAddress.cxx.

References GetElementId(), GetVersion(), kSsdHalfLadder, kSsdLadder, kSsdModule, kSsdSensor, kSsdSide, kSsdSystem, and kSsdUnit.

Variable Documentation

◆ kBits

const Int_t BmnSsdAddress::kBits[kCurrentVersion+1][kSsdNofLevels]
Initial value:
=
{
{ 4,
4,
4,
1,
3,
2,
1
},
{ 4,
6,
5,
1,
5,
4,
1
}
}

Definition at line 17 of file BmnSsdAddress.cxx.

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

◆ kCurrentVersion

const UInt_t BmnSsdAddress::kCurrentVersion = 1

Definition at line 48 of file BmnSsdAddress.h.

Referenced by GetAddress(), and GetAddress().

◆ kMask

const Int_t BmnSsdAddress::kMask[kCurrentVersion+1][kSsdNofLevels]
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
}
}
const Int_t kBits[kCurrentVersion+1][kSsdNofLevels]

Definition at line 69 of file BmnSsdAddress.cxx.

Referenced by GetElementId(), and SetElementId().

◆ kShift

const Int_t BmnSsdAddress::kShift[kCurrentVersion+1][kSsdNofLevels]
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]
}
}
const Int_t kShift[kCurrentVersion+1][kSsdNofLevels]

Definition at line 45 of file BmnSsdAddress.cxx.

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

◆ kVersionMask

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

Definition at line 54 of file BmnSsdAddress.h.

Referenced by GetVersion().

◆ kVersionShift

const Int_t BmnSsdAddress::kVersionShift = 28

Definition at line 53 of file BmnSsdAddress.h.

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

◆ kVersionSize

const Int_t BmnSsdAddress::kVersionSize = 4

Definition at line 52 of file BmnSsdAddress.h.