Belle II Software development
ARICHMergerMapping Class Reference

The Class for ARICH mapping of modules to merger boards. More...

#include <ARICHMergerMapping.h>

Inheritance diagram for ARICHMergerMapping:

Public Member Functions

 ARICHMergerMapping ()
 Default constructor.
 
unsigned getModuleID (unsigned mergerID, unsigned febSlot) const
 Get ID of module connected to merger at FEB slot.
 
unsigned getMergerID (unsigned moduleID) const
 Get ID of merger to which module is connected.
 
unsigned getFEBSlot (unsigned moduleID) const
 Get FEB slot to which module is connected.
 
unsigned getMergerIDfromSN (unsigned mergerSN) const
 Get ID of merger from serial number.
 
unsigned getMergerSN (unsigned mergerID) const
 Get serial number of marger from its ID.
 
void addMapping (unsigned moduleID, unsigned mergerID, unsigned febSlot, unsigned mergerSN)
 Add mapping entry.
 
void print () const
 Pring mapping.
 

Private Member Functions

 ClassDef (ARICHMergerMapping, 2)
 ClassDef, must be the last term before the closing {}.
 

Private Attributes

std::vector< uint16_t > m_merger2module
 map of mergers to modules
 
std::vector< uint16_t > m_module2merger
 map of modules to mergers
 
std::vector< bool > m_isMapped
 vector of mapped modules
 
std::map< unsigned, unsigned > m_mergerID
 map mergers ID to SN
 

Detailed Description

The Class for ARICH mapping of modules to merger boards.

This class provides ARICH mapping of HAPD modules to merger boards, and their FEB slots It is assumed merger ID going from 1:73, febSlot goes from 1:6 change to std::map if merger IDs are "non-trivial"

Definition at line 29 of file ARICHMergerMapping.h.

Constructor & Destructor Documentation

◆ ARICHMergerMapping()

Default constructor.

Definition at line 17 of file ARICHMergerMapping.cc.

18{
19 m_merger2module.assign(N_MERGERS * N_FEB2MERGER, 0);
20 m_module2merger.assign(N_MERGERS * N_FEB2MERGER, 0);
21 m_isMapped.assign(N_MERGERS * N_FEB2MERGER, 0);
22}
std::vector< uint16_t > m_module2merger
map of modules to mergers
std::vector< bool > m_isMapped
vector of mapped modules
std::vector< uint16_t > m_merger2module
map of mergers to modules

Member Function Documentation

◆ addMapping()

void addMapping ( unsigned  moduleID,
unsigned  mergerID,
unsigned  febSlot,
unsigned  mergerSN 
)

Add mapping entry.

Parameters
moduleIDmodule ID number
mergerIDmerger ID number
mergerSNmerger serial number
febSlotFEB slot

Definition at line 59 of file ARICHMergerMapping.cc.

60{
61
62// if (!(mergerID > 0 && mergerID < N_MERGERS + 1 && febSlot > 0 && febSlot < N_FEB2MERGER + 1 && moduleID < N_MERGERS * N_FEB2MERGER)) { B2ERROR("ARICHMergerMapping::addMapping: invalid mergerID/febSlot/moduleID!"); return;}
63
64 m_module2merger[moduleID - 1] = (uint16_t)((mergerID - 1) * N_FEB2MERGER + (febSlot - 1));
65 m_merger2module[(mergerID - 1) * N_FEB2MERGER + (febSlot - 1)] = (uint16_t)moduleID;
66 m_isMapped[moduleID - 1] = 1;
67
68 m_mergerID.insert(std::pair<unsigned, unsigned>(mergerID, mergerSN));
69}
std::map< unsigned, unsigned > m_mergerID
map mergers ID to SN

◆ getFEBSlot()

unsigned getFEBSlot ( unsigned  moduleID) const

Get FEB slot to which module is connected.

Parameters
moduleIDmodule ID number
Returns
merger FEB slot

Definition at line 38 of file ARICHMergerMapping.cc.

39{
40 if (!m_isMapped[moduleID - 1]) { B2WARNING("ARICHMergerMapping::getMergerID: Module " << moduleID << " not not mapped to merger!"); return 0;}
41 unsigned id = (unsigned)m_module2merger[moduleID - 1] % N_FEB2MERGER + 1;
42 return id;
43}

◆ getMergerID()

unsigned getMergerID ( unsigned  moduleID) const

Get ID of merger to which module is connected.

Parameters
moduleIDmodule ID number
Returns
merger ID number

Definition at line 31 of file ARICHMergerMapping.cc.

32{
33 if (!m_isMapped[moduleID - 1]) { B2WARNING("ARICHMergerMapping::getMergerID: Module " << moduleID << " not not mapped to merger!"); return 0;}
34 unsigned id = (unsigned)m_module2merger[moduleID - 1] / N_FEB2MERGER + 1;
35 return id;
36}

◆ getMergerIDfromSN()

unsigned getMergerIDfromSN ( unsigned  mergerSN) const

Get ID of merger from serial number.

Parameters
mergerSNmerger serial number
Returns
mergerID merger ID number

Definition at line 51 of file ARICHMergerMapping.cc.

52{
53 unsigned mergerID = 99;
54 for (auto& i : m_mergerID) { if (i.second == mergerSN) mergerID = i.first; }
55
56 return mergerID;
57}

◆ getMergerSN()

unsigned getMergerSN ( unsigned  mergerID) const

Get serial number of marger from its ID.

Parameters
mergerIDmerger ID number
Returns
mergerSN merger serial number

Definition at line 45 of file ARICHMergerMapping.cc.

46{
47 unsigned mergerSN = m_mergerID.find(mergerID)->second;
48 return mergerSN;
49}

◆ getModuleID()

unsigned getModuleID ( unsigned  mergerID,
unsigned  febSlot 
) const

Get ID of module connected to merger at FEB slot.

Parameters
mergerIDmerger ID number
febSlotFEB slot
Returns
module ID number

Definition at line 24 of file ARICHMergerMapping.cc.

25{
26 if (!(mergerID > 0 && mergerID < N_MERGERS + 1 && febSlot > 0 && febSlot < N_FEB2MERGER + 1)) { B2ERROR("ARICHMergerMapping::getModuleID: invalid merger ID " << mergerID << " or febSlot " << febSlot); return 0;}
27 unsigned id = (mergerID - 1) * N_FEB2MERGER + (febSlot - 1);
28 return (unsigned)m_merger2module[id];
29}

◆ print()

void print ( ) const

Pring mapping.

Definition at line 71 of file ARICHMergerMapping.cc.

72{
73
74 std::cout << std::endl;
75 std::cout << "Mapping of modules to mergers" << std::endl;
76 std::cout << std::endl;
77 for (int i = 1; i < N_MERGERS + 1; i++) {
78 bool isUsed = false;
79 for (int j = 1; j < N_FEB2MERGER + 1; j++) {
80 if (getModuleID(i, j)) { isUsed = true; break;}
81 }
82
83 if (!isUsed) continue;
84 std::cout << " Modules connected to merger " << i << " (SN = " << getMergerSN(i) << ")" << std::endl;
85 for (int j = 1; j < N_FEB2MERGER + 1; j++) {
86 if (getModuleID(i, j)) std::cout << " FEB slot " << j << ": " << getModuleID(i, j) << std::endl;
87 else std::cout << " FEB slot " << j << " not connected" << std::endl;
88 }
89
90 }
91}
unsigned getModuleID(unsigned mergerID, unsigned febSlot) const
Get ID of module connected to merger at FEB slot.
unsigned getMergerSN(unsigned mergerID) const
Get serial number of marger from its ID.

Member Data Documentation

◆ m_isMapped

std::vector<bool> m_isMapped
private

vector of mapped modules

Definition at line 91 of file ARICHMergerMapping.h.

◆ m_merger2module

std::vector<uint16_t> m_merger2module
private

map of mergers to modules

Definition at line 88 of file ARICHMergerMapping.h.

◆ m_mergerID

std::map<unsigned, unsigned> m_mergerID
private

map mergers ID to SN

Definition at line 92 of file ARICHMergerMapping.h.

◆ m_module2merger

std::vector<uint16_t> m_module2merger
private

map of modules to mergers

Definition at line 89 of file ARICHMergerMapping.h.


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