Belle II Software  release-08-01-10
ChannelMapper Class Reference

Provides mapping between electronic channels and pixels. More...

#include <ChannelMapper.h>

Collaboration diagram for ChannelMapper:

Public Types

enum  {
  c_numBoardstacks = 4 ,
  c_numCarrierBoards = 4 ,
  c_numAsics = 4 ,
  c_numChannels = 8 ,
  c_numRows = 2 ,
  c_numColumns = 16 ,
  c_numPixelRows = c_numRows * c_numCarrierBoards ,
  c_numPixelColumns = c_numColumns * c_numBoardstacks ,
  c_numPixels = c_numPixelRows * c_numPixelColumns ,
  c_invalidChannel = c_numPixels ,
  c_invalidPixelID = 0
}
 Enum for the number of different quantities etc. More...
 
enum  EType {
  c_unknown = 0 ,
  c_default = 1 ,
  c_IRS3B = 2 ,
  c_IRSX = 3
}
 Enum for electornic types.
 

Public Member Functions

 ChannelMapper ()
 constructor
 
 ~ChannelMapper ()
 destructor
 
void initialize (const GearDir &channelMapping)
 Initialize from Gearbox (XML) More...
 
void initialize ()
 Initialize from database.
 
bool isValid () const
 Checks if mapping is available. More...
 
void importPayload (const IntervalOfValidity &iov) const
 import mappings to database More...
 
EType getType () const
 Return electornic type (see enum) More...
 
std::string getName () const
 Return electornic name. More...
 
bool isPixelIDValid (int pixel) const
 Checks validity of pixel ID. More...
 
bool isChannelValid (unsigned channel) const
 Checks validity of hardware channel number. More...
 
unsigned getChannel (int pixel) const
 Converts pixel to hardware channel number (0-based) More...
 
unsigned getChannel (unsigned boardstack, unsigned carrier, unsigned asic, unsigned chan) const
 Returns hardware channel number (0-based) More...
 
void splitChannelNumber (unsigned channel, unsigned &boardstack, unsigned &carrier, unsigned &asic, unsigned &chan) const
 Splits hardware channel number into boardstack, carrier, asic and asic channel. More...
 
int getPixelID (unsigned channel) const
 Converts hardware channel number to pixel ID (1-based) More...
 
int getPmtID (int pixel) const
 Returns PMT ID (1-based) More...
 
void print () const
 Print mappings to terminal screen.
 
void test () const
 test that the conversion and inverse of it gives identity, if not B2ERROR
 

Private Member Functions

 ChannelMapper (const ChannelMapper &)
 Copy constructor.
 
ChannelMapperoperator= (const ChannelMapper &)
 Assignment operator.
 
void clear ()
 Clear.
 
void update ()
 re-do conversion arrays when DBArray has changed
 

Private Attributes

EType m_type = c_unknown
 electornic type
 
std::string m_typeName
 electronic type name
 
std::vector< TOPChannelMapm_mapping
 mappings from gearbox
 
DBArray< TOPChannelMap > * m_mappingDB = 0
 mappings from database
 
bool m_valid = false
 true if mapping available
 
bool m_fromDB = false
 true, if from database
 
const TOPChannelMapm_channels [c_numRows][c_numColumns] = {{0}}
 conversion array
 
const TOPChannelMapm_pixels [c_numAsics][c_numChannels] = {{0}}
 conversion array
 

Detailed Description

Provides mapping between electronic channels and pixels.

Definition at line 27 of file ChannelMapper.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enum for the number of different quantities etc.

Enumerator
c_numBoardstacks 

number of boardstacks per TOP module

c_numCarrierBoards 

number of carrier boards per boardstack

c_numAsics 

number of ASIC's per carrier board

c_numChannels 

number of channels per ASIC

c_numRows 

number of pixel rows per carrier board

c_numColumns 

number of pixel columns per carrier board

c_numPixelRows 

per module

c_numPixelColumns 

per module

c_numPixels 

per module

c_invalidChannel 

value of invalid channel number

c_invalidPixelID 

value of invalid pixel ID

Definition at line 33 of file ChannelMapper.h.

33  {c_numBoardstacks = 4,
34  c_numCarrierBoards = 4,
35  c_numAsics = 4,
36  c_numChannels = 8,
37  c_numRows = 2,
38  c_numColumns = 16,
43  c_invalidPixelID = 0
44  };
@ c_numCarrierBoards
number of carrier boards per boardstack
Definition: ChannelMapper.h:34
@ c_numColumns
number of pixel columns per carrier board
Definition: ChannelMapper.h:38
@ c_numChannels
number of channels per ASIC
Definition: ChannelMapper.h:36
@ c_numRows
number of pixel rows per carrier board
Definition: ChannelMapper.h:37
@ c_numBoardstacks
number of boardstacks per TOP module
Definition: ChannelMapper.h:33
@ c_invalidChannel
value of invalid channel number
Definition: ChannelMapper.h:42
@ c_invalidPixelID
value of invalid pixel ID
Definition: ChannelMapper.h:43
@ c_numAsics
number of ASIC's per carrier board
Definition: ChannelMapper.h:35

Member Function Documentation

◆ getChannel() [1/2]

unsigned getChannel ( int  pixel) const

Converts pixel to hardware channel number (0-based)

Parameters
pixelpixel ID (1-based)
Returns
channel number (or c_invalidChannel for invalid pixel)

Definition at line 207 of file ChannelMapper.cc.

208  {
209  if (!isPixelIDValid(pixel)) return c_invalidChannel;
210 
211  unsigned pix = pixel - 1;
212  unsigned pixRow = pix / c_numPixelColumns;
213  unsigned pixCol = pix % c_numPixelColumns;
214 
215  unsigned carrier = pixRow / c_numRows;
216  unsigned row = pixRow % c_numRows;
217  unsigned boardstack = pixCol / c_numColumns;
218  unsigned col = pixCol % c_numColumns;
219 
220  const auto& map = m_channels[row][col];
221  if (!map) {
222  B2WARNING("TOP::ChannelMapper: no channel mapped to pixel. Return invalid channel."
223  << LogVar("pixelID", pixel));
224  return c_invalidChannel;
225  }
226  unsigned asic = map->getASICNumber();
227  unsigned chan = map->getASICChannel();
228 
229  return getChannel(boardstack, carrier, asic, chan);
230  }
bool isPixelIDValid(int pixel) const
Checks validity of pixel ID.
const TOPChannelMap * m_channels[c_numRows][c_numColumns]
conversion array
unsigned getChannel(int pixel) const
Converts pixel to hardware channel number (0-based)
Class to store variables with their name which were sent to the logging service.

◆ getChannel() [2/2]

unsigned getChannel ( unsigned  boardstack,
unsigned  carrier,
unsigned  asic,
unsigned  chan 
) const
inline

Returns hardware channel number (0-based)

Parameters
boardstackboardstack number (0-based)
carriercarrier board number (0-based)
asicASIC number (0-based)
chanASIC channel number (0-based)
Returns
channel number (or c_invalidChannel for invalid pixel)

Definition at line 136 of file ChannelMapper.h.

◆ getName()

std::string getName ( void  ) const
inline

Return electornic name.

Returns
name

Definition at line 98 of file ChannelMapper.h.

◆ getPixelID()

int getPixelID ( unsigned  channel) const

Converts hardware channel number to pixel ID (1-based)

Parameters
channelhardware channel number (0-based)
Returns
pixel ID (or c_invalidPixelID for invalid channel number)

Definition at line 248 of file ChannelMapper.cc.

◆ getPmtID()

int getPmtID ( int  pixel) const

Returns PMT ID (1-based)

Parameters
pixelpixelID (1-based)
Returns
PMT ID (or 0 for invalid pixel)

Definition at line 274 of file ChannelMapper.cc.

◆ getType()

EType getType ( ) const
inline

Return electornic type (see enum)

Returns
type

Definition at line 92 of file ChannelMapper.h.

◆ importPayload()

void importPayload ( const IntervalOfValidity iov) const

import mappings to database

Parameters
iovInterval of validity.

Definition at line 197 of file ChannelMapper.cc.

◆ initialize()

void initialize ( const GearDir channelMapping)

Initialize from Gearbox (XML)

Parameters
channelMappingXML data directory

Definition at line 44 of file ChannelMapper.cc.

◆ isChannelValid()

bool isChannelValid ( unsigned  channel) const
inline

Checks validity of hardware channel number.

Parameters
channelhardware channel number (0-based)
Returns
true for valid ID

Definition at line 116 of file ChannelMapper.h.

◆ isPixelIDValid()

bool isPixelIDValid ( int  pixel) const
inline

Checks validity of pixel ID.

Parameters
pixelpixel ID (1-based)
Returns
true for valid ID

Definition at line 105 of file ChannelMapper.h.

◆ isValid()

bool isValid ( ) const
inline

Checks if mapping is available.

Returns
true if available

Definition at line 80 of file ChannelMapper.h.

◆ splitChannelNumber()

void splitChannelNumber ( unsigned  channel,
unsigned &  boardstack,
unsigned &  carrier,
unsigned &  asic,
unsigned &  chan 
) const

Splits hardware channel number into boardstack, carrier, asic and asic channel.

Parameters
channelhardware channel number (0-based) [input]
boardstackboardstack number (0-based) [output]
carriercarrier board number (0-based) [output]
asicASIC number (0-based) [output]
chanASIC channel number (0-based) [output]

Definition at line 233 of file ChannelMapper.cc.


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