9#include <framework/logging/Logger.h>
11#include <arich/dbobjects/ARICHChannelMapping.h>
20 m_xy2asic.assign(N_XCHANNELS * N_YCHANNELS, -1);
21 m_asic2xy.assign(N_XCHANNELS * N_YCHANNELS, -1);
26 if (asicChn > N_XCHANNELS * N_YCHANNELS - 1) {
27 B2ERROR(
"ARICHChannelMapping::getXYFromAsic: invalid channel asic number!");
31 if (chId == -1)
return false;
32 xChn = chId % N_XCHANNELS;
33 yChn = chId / N_XCHANNELS;
39 unsigned chId = yChn * N_XCHANNELS + xChn;
40 if (chId > N_XCHANNELS * N_YCHANNELS - 1) B2FATAL(
"ARICHChannelMapping::getAsicFromXY: invalid channel X,Y number!");
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;
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++) {
63 std::cout <<
" |" << std::endl;
64 std::cout <<
" " << setfill(
'-') << setw(73) <<
"-" << std::endl;
66 std::cout << setfill(
' ') <<
" ";
67 for (
int x = 0; x < N_XCHANNELS; x++) std::cout <<
"x " << setw(2) << x <<
" ";
68 std::cout << std::endl;
int getAsicFromXY(unsigned xChn, unsigned yChn) const
Get asic channel number from HAPD channel X,Y numbers.
ARICHChannelMapping()
Default constructor.
std::vector< uint8_t > m_xy2asic
map of X,Y to asic channels numbers
bool getXYFromAsic(unsigned asicChn, int &xChn, int &yChn) const
Get HAPD channel X,Y numbers from asic channel number.
std::vector< uint8_t > m_asic2xy
map of asic to X,Y channel numbers
void print() const
Print mapping parameters.
void mapXY2Asic(unsigned xChn, unsigned yChn, unsigned asicChn)
Add entry to channel map.
Abstract base class for different kinds of events.