Belle II Software development
ARICHChannelMapping Class Reference

The Class for ARICH HAPD channel mapping. More...

#include <ARICHChannelMapping.h>

Inheritance diagram for ARICHChannelMapping:

Public Member Functions

 ARICHChannelMapping ()
 Default constructor.
 
bool getXYFromAsic (unsigned asicChn, int &xChn, int &yChn) const
 Get HAPD channel X,Y numbers from asic channel number.
 
int getAsicFromXY (unsigned xChn, unsigned yChn) const
 Get asic channel number from HAPD channel X,Y numbers.
 
void mapXY2Asic (unsigned xChn, unsigned yChn, unsigned asicChn)
 Add entry to channel map.
 
void print () const
 Print mapping parameters.
 

Private Member Functions

 ClassDef (ARICHChannelMapping, 1)
 ClassDef, must be the last term before the closing {}.
 

Private Attributes

std::vector< uint8_t > m_xy2asic
 map of X,Y to asic channels numbers
 
std::vector< uint8_t > m_asic2xy
 map of asic to X,Y channel numbers
 

Detailed Description

The Class for ARICH HAPD channel mapping.

This class provides mapping from hapd channel x,y numbers (both 0-11) to channel asic numbers (0-143)

Definition at line 28 of file ARICHChannelMapping.h.

Constructor & Destructor Documentation

◆ ARICHChannelMapping()

Default constructor.

Definition at line 18 of file ARICHChannelMapping.cc.

19{
20 m_xy2asic.assign(N_XCHANNELS * N_YCHANNELS, -1);
21 m_asic2xy.assign(N_XCHANNELS * N_YCHANNELS, -1);
22}
std::vector< uint8_t > m_xy2asic
map of X,Y to asic channels numbers
std::vector< uint8_t > m_asic2xy
map of asic to X,Y channel numbers

Member Function Documentation

◆ getAsicFromXY()

int getAsicFromXY ( unsigned  xChn,
unsigned  yChn 
) const

Get asic channel number from HAPD channel X,Y numbers.

Parameters
xChnchannel X number
yChnchannel Y number
Returns
asic channel number

Definition at line 37 of file ARICHChannelMapping.cc.

38{
39 unsigned chId = yChn * N_XCHANNELS + xChn;
40 if (chId > N_XCHANNELS * N_YCHANNELS - 1) B2FATAL("ARICHChannelMapping::getAsicFromXY: invalid channel X,Y number!");
41 return (int)m_xy2asic[chId];
42}

◆ getXYFromAsic()

bool getXYFromAsic ( unsigned  asicChn,
int &  xChn,
int &  yChn 
) const

Get HAPD channel X,Y numbers from asic channel number.

Parameters
asicChn
xChnreturned channel X number
yChnreturned channel Y number

Definition at line 24 of file ARICHChannelMapping.cc.

25{
26 if (asicChn > N_XCHANNELS * N_YCHANNELS - 1) {
27 B2ERROR("ARICHChannelMapping::getXYFromAsic: invalid channel asic number!");
28 return false;
29 }
30 int chId = (int)m_asic2xy[asicChn];
31 if (chId == -1) return false;
32 xChn = chId % N_XCHANNELS;
33 yChn = chId / N_XCHANNELS;
34 return true;
35}

◆ mapXY2Asic()

void mapXY2Asic ( unsigned  xChn,
unsigned  yChn,
unsigned  asicChn 
)

Add entry to channel map.

Parameters
xChnchannel X number
yChnchannel Y number
asicChnasic channel number

Definition at line 44 of file ARICHChannelMapping.cc.

45{
46 if (asicChn > N_XCHANNELS * N_YCHANNELS - 1 || xChn > N_XCHANNELS - 1
47 || yChn > N_YCHANNELS - 1) B2ERROR("ARICHChannelMapping::mapXY2Asich: invalid channel number!");
48 unsigned chId = yChn * N_XCHANNELS + xChn;
49 m_xy2asic.at(chId) = asicChn;
50 m_asic2xy.at(asicChn) = chId;
51}

◆ print()

void print ( ) const

Print mapping parameters.

Definition at line 53 of file ARICHChannelMapping.cc.

54{
55 std::cout << std::endl;
56 std::cout << "HAPD X,Y channel mapping to asic channels" << std::endl << std::endl;
57 std::cout << " " << setfill('-') << setw(73) << "-" << std::endl;
58 for (int y = N_YCHANNELS - 1; y > -1; y--) {
59 std::cout << setfill(' ') << "y " << setw(2) << y << " ";
60 for (int x = 0; x < N_XCHANNELS; x++) {
61 std::cout << " | " << setw(3) << getAsicFromXY(x, y);
62 }
63 std::cout << " |" << std::endl;
64 std::cout << " " << setfill('-') << setw(73) << "-" << std::endl;
65 }
66 std::cout << setfill(' ') << " ";
67 for (int x = 0; x < N_XCHANNELS; x++) std::cout << "x " << setw(2) << x << " ";
68 std::cout << std::endl;
69}
int getAsicFromXY(unsigned xChn, unsigned yChn) const
Get asic channel number from HAPD channel X,Y numbers.

Member Data Documentation

◆ m_asic2xy

std::vector<uint8_t> m_asic2xy
private

map of asic to X,Y channel numbers

Definition at line 67 of file ARICHChannelMapping.h.

◆ m_xy2asic

std::vector<uint8_t> m_xy2asic
private

map of X,Y to asic channels numbers

Definition at line 66 of file ARICHChannelMapping.h.


The documentation for this class was generated from the following files: