Belle II Software development
ARICHCopperMapping Class Reference

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

#include <ARICHCopperMapping.h>

Inheritance diagram for ARICHCopperMapping:

Public Member Functions

 ARICHCopperMapping ()
 Default constructor.
 
unsigned getCopperID (unsigned mergerID) const
 Get copper board to which merger is connected.
 
unsigned getFinesse (unsigned mergerID) const
 Get finesse of copper board to which merger is connected.
 
void addMapping (unsigned mergerID, unsigned copperID, unsigned finesse)
 Add new entry to the mapping table.
 
unsigned getMergerID (unsigned copperID, unsigned finesse) const
 Get ID of merger connected to the given finesse of copper board.
 
const std::vector< uint16_t > & getCopperIDs () const
 Get vector of IDs of copper boards.
 
void print () const
 Print mapping parameters.
 

Private Member Functions

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

Private Attributes

std::vector< std::pair< uint16_t, uint16_t > > m_merger2copper
 map of mergers to copper boards
 
std::map< uint16_t, std::vector< uint16_t > > m_copper2merger
 map coppers to mergers
 
std::vector< uint16_t > m_copperIDs
 vector of IDs of used copper boards
 

Detailed Description

The Class for ARICH mapping of merger to copper boards.

This class provides ARICH mapping of merger to copper boards Cooper ID can be arbitrary number, finesse number goes from 0-3 Merger ID goes from 1 to 72

Definition at line 28 of file ARICHCopperMapping.h.

Constructor & Destructor Documentation

◆ ARICHCopperMapping()

Default constructor.

Definition at line 21 of file ARICHCopperMapping.cc.

22{
23 m_merger2copper.assign(N_MERGERS, std::make_pair(0, 0));
24}
std::vector< std::pair< uint16_t, uint16_t > > m_merger2copper
map of mergers to copper boards

Member Function Documentation

◆ addMapping()

void addMapping ( unsigned  mergerID,
unsigned  copperID,
unsigned  finesse 
)

Add new entry to the mapping table.

Parameters
mergerIDID of merger board
copperIDcopper board ID number
finessefinesse number

Definition at line 38 of file ARICHCopperMapping.cc.

39{
40
41// if (mergerID > N_MERGERS + 1 || mergerID == 0) B2ERROR("ARICHCopperMapping::addMapping: invalid merger ID number!");
42 if (finesse > 3) B2ERROR("ARICHCopperMapping::addMapping: invalid finesse number (0-3)!");
43
44 m_merger2copper[mergerID - 1] = std::make_pair(copperID, finesse);
45
46 if (m_copper2merger.find(copperID) == m_copper2merger.end()) {
47 std::vector<uint16_t> mergerList = {0, 0, 0, 0};
48 mergerList[finesse] = mergerID;
49 m_copper2merger.insert(std::pair<uint16_t, std::vector<uint16_t>>((uint16_t)copperID, mergerList));
50 } else {
51 std::vector<uint16_t>& mergerList = m_copper2merger[copperID];
52 mergerList[finesse] = mergerID;
53 }
54
55 if (std::find(m_copperIDs.begin(), m_copperIDs.end(), uint16_t(copperID)) == m_copperIDs.end()) m_copperIDs.push_back(copperID);
56}
std::map< uint16_t, std::vector< uint16_t > > m_copper2merger
map coppers to mergers
std::vector< uint16_t > m_copperIDs
vector of IDs of used copper boards

◆ getCopperID()

unsigned getCopperID ( unsigned  mergerID) const

Get copper board to which merger is connected.

Parameters
mergerIDID of merger board
Returns
copper board ID

Definition at line 26 of file ARICHCopperMapping.cc.

27{
28// if (mergerID > N_MERGERS + 1 || mergerID == 0) B2ERROR("ARICHCopperMapping::getCopperID: invalid merger ID number!");
29 return (unsigned)m_merger2copper[mergerID - 1].first;
30}

◆ getCopperIDs()

const std::vector< uint16_t > & getCopperIDs ( ) const
inline

Get vector of IDs of copper boards.

Returns
vector of copper IDs

Definition at line 70 of file ARICHCopperMapping.h.

70{ return m_copperIDs;}

◆ getFinesse()

unsigned getFinesse ( unsigned  mergerID) const

Get finesse of copper board to which merger is connected.

Parameters
mergerIDID of merger board
Returns
finesse number

Definition at line 32 of file ARICHCopperMapping.cc.

33{
34// if (mergerID > N_MERGERS + 1 || mergerID == 0) B2ERROR("ARICHCopperMapping::getFinesse: invalid merger ID number!");
35 return (unsigned)m_merger2copper[mergerID - 1].second;
36}

◆ getMergerID()

unsigned getMergerID ( unsigned  copperID,
unsigned  finesse 
) const

Get ID of merger connected to the given finesse of copper board.

Parameters
copperIDcopper board ID number
finessefinesse number
Returns
merger board ID

Definition at line 58 of file ARICHCopperMapping.cc.

59{
60 if (finesse > 3) B2ERROR("ARICHCopperMapping::getMergerID: invalid finesse number (0-3)!");
61 auto it = m_copper2merger.find(copperID);
62 if (it == m_copper2merger.end()) return 0;
63 return (unsigned)it->second[finesse];
64}

◆ print()

void print ( ) const

Print mapping parameters.

Definition at line 66 of file ARICHCopperMapping.cc.

67{
68 cout << endl;
69 cout << "Mapping of merger to copper boards" << endl;
70 cout << endl;
71 for (auto copper : m_copperIDs) {
72 cout << " Merger boards connected to copper board " << copper << endl;
73 for (int i = 0; i < 4; i++) {
74 if (getMergerID(copper, i)) cout << " Finesse " << i << ": " << getMergerID(copper, i) << endl;
75 else cout << " Finesse " << i << ": not connected" << endl;
76 }
77 }
78}
unsigned getMergerID(unsigned copperID, unsigned finesse) const
Get ID of merger connected to the given finesse of copper board.

Member Data Documentation

◆ m_copper2merger

std::map<uint16_t, std::vector<uint16_t> > m_copper2merger
private

map coppers to mergers

Definition at line 81 of file ARICHCopperMapping.h.

◆ m_copperIDs

std::vector<uint16_t> m_copperIDs
private

vector of IDs of used copper boards

Definition at line 83 of file ARICHCopperMapping.h.

◆ m_merger2copper

std::vector<std::pair<uint16_t, uint16_t> > m_merger2copper
private

map of mergers to copper boards

Definition at line 79 of file ARICHCopperMapping.h.


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