BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnScWallAddress.h
Go to the documentation of this file.
1
/** \class BmnScWallAddress
2
** \brief BmnScWall interface class to the unique address
3
** \author Nikolay Karpushkin <karpushkin@inr.ru>
4
** \version 1.0
5
**
6
** BmnScWallAddress is the class for the concrete interfaces to the unique address,
7
** which is encoded in a 32-bit field (uint32_t), for the ScWall detector elements.
8
**
9
** 3 2 1 0 Shift Bits Values
10
** Current definition: 10987654321098765432109876543210
11
** System id on bits 0- 4 00000000000000000000000000011111 << 0 5 31
12
** Cell id on bits 5-14 00000000000000000111111111100000 << 5 10 1023
13
**
14
**/
15
16
#ifndef BMNSCWALLADDRESS_H
17
#define BMNSCWALLADDRESS_H 1
18
19
#include "
BmnDetectorList.h
"
// for kSCWALL
20
21
#include <cassert>
// for assert
22
23
class
BmnScWallAddress
24
{
25
public
:
26
/**
27
* \brief Return address from system ID, Cell ID.
28
* \param[in] CellId Cell id.
29
**/
30
static
uint32_t
GetAddress
(uint32_t CellId)
31
{
32
assert((uint32_t)
kSCWALL
<=
fgkSystemIdLength
);
33
assert(CellId <=
fgkCellIdLength
);
34
return
((((uint32_t)
kSCWALL
) <<
fgkSystemIdShift
) | (CellId <<
fgkCellIdShift
));
35
}
36
37
/**
38
* \brief Return System identifier from address.
39
* \param[in] address Unique channel address.
40
* \return System identifier from address.
41
**/
42
static
uint32_t
GetSystemId
(uint32_t address)
43
{
44
return
(address & (
fgkSystemIdLength
<<
fgkSystemIdShift
)) >>
fgkSystemIdShift
;
45
}
46
47
/**
48
* \brief Return Cell id from address.
49
* \param[in] address Unique channel address.
50
* \return Cell id from address.
51
**/
52
static
uint32_t
GetCellId
(uint32_t address)
53
{
54
return
(address & (
fgkCellIdLength
<<
fgkCellIdShift
)) >>
fgkCellIdShift
;
55
}
56
57
private
:
58
// Length of the index of the corresponding volume
59
static
const
uint32_t
fgkSystemIdLength
= 31;
// 2^5 - 1
60
static
const
uint32_t
fgkCellIdLength
= 1023;
// 2^10- 1
61
62
// Number of a start bit for each volume
63
static
const
uint32_t
fgkSystemIdShift
= 0;
64
static
const
uint32_t
fgkCellIdShift
= 5;
65
};
66
67
#endif
kSCWALL
@ kSCWALL
Definition
BmnDetectorList.h:32
BmnScWallAddress
BmnScWall interface class to the unique address.
Definition
BmnScWallAddress.h:24
BmnScWallAddress::GetCellId
static uint32_t GetCellId(uint32_t address)
Return Cell id from address.
Definition
BmnScWallAddress.h:52
BmnScWallAddress::fgkSystemIdLength
static const uint32_t fgkSystemIdLength
Definition
BmnScWallAddress.h:59
BmnScWallAddress::GetAddress
static uint32_t GetAddress(uint32_t CellId)
Return address from system ID, Cell ID.
Definition
BmnScWallAddress.h:30
BmnScWallAddress::fgkCellIdLength
static const uint32_t fgkCellIdLength
Definition
BmnScWallAddress.h:60
BmnScWallAddress::fgkCellIdShift
static const uint32_t fgkCellIdShift
Definition
BmnScWallAddress.h:64
BmnScWallAddress::fgkSystemIdShift
static const uint32_t fgkSystemIdShift
Definition
BmnScWallAddress.h:63
BmnScWallAddress::GetSystemId
static uint32_t GetSystemId(uint32_t address)
Return System identifier from address.
Definition
BmnScWallAddress.h:42
BmnDetectorList.h
Defines unique identifiers (enum) for all BM@N detector systems.
install
include
BmnScWallAddress.h
Generated on
for BmnRoot by
1.17.0