BmnRoot
Loading...
Searching...
No Matches
BmnSsdAddress.h
Go to the documentation of this file.
1
7#ifndef BMNSSDADDRESS_H
8#define BMNSSDADDRESS_H 1
9
10#include <cassert>
11#include <sstream>
12#include "FairLogger.h"
13
14
26
27
28
46namespace BmnSsdAddress {
47
48 const UInt_t kCurrentVersion = 1;
49
50 // --- These values are not to be changed if backward compatibility
51 // --- shall be maintained.
52 const Int_t kVersionSize = 4; // Bits for version number
53 const Int_t kVersionShift = 28; // First bit for version number
54 const Int_t kVersionMask = (1 << kVersionSize) -1;
55
56
67 Int_t GetAddress(UInt_t unit = 0,
68 UInt_t ladder = 0,
69 UInt_t halfladder = 0,
70 UInt_t module = 0,
71 UInt_t sensor = 0,
72 UInt_t side = 0,
73 UInt_t version = kCurrentVersion);
74
75
80 Int_t GetAddress(UInt_t* elementId, UInt_t version);
81
82
92 Int_t GetMotherAddress(Int_t address, Int_t level);
93
94
100 UInt_t GetElementId(Int_t address, Int_t level);
101
102
106 UInt_t GetSystemId(Int_t address);
107
108
116 UInt_t GetVersion(Int_t address);
117
118
126 Int_t SetElementId(Int_t address, Int_t level, UInt_t newId);
127
128
132 std::string ToString(Int_t address);
133
134} // Namespace BmnSsdAddress
135
136
137#endif // BMNSSDADDRESS_H
138
139
ESsdElementLevel
@ kSsdLadder
@ kSsdUnit
@ kSsdNofLevels
@ kSsdSystem
@ kSsdSensor
@ kSsdSide
@ kSsdModule
@ kSsdHalfLadder
Functions to encode or decode the address field of SSD data.
const Int_t kVersionShift
UInt_t GetVersion(Int_t address)
Extract version number.
UInt_t GetSystemId(Int_t address)
Get system Id (should be kSSD)
const Int_t kVersionSize
UInt_t GetElementId(Int_t address, Int_t level)
Get the index of an element.
Int_t SetElementId(Int_t address, Int_t level, UInt_t newId)
Set the index of an element, leaving the other element levels untouched.
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.
const UInt_t kCurrentVersion
std::string ToString(Int_t address)
String output.
Int_t GetMotherAddress(Int_t address, Int_t level)
Construct the address of an element from the address of a descendant element.
const Int_t kVersionMask