9 #include <arich/dbobjects/ARICHCopperMapping.h>
10 #include <framework/logging/Logger.h>
12 #include <arich/dbobjects/ARICHMergerMapping.h>
21 ARICHCopperMapping::ARICHCopperMapping()
23 m_merger2copper.assign(N_MERGERS, std::make_pair(0, 0));
26 unsigned ARICHCopperMapping::getCopperID(
unsigned mergerID)
const
29 return (
unsigned)m_merger2copper[mergerID - 1].first;
32 unsigned ARICHCopperMapping::getFinesse(
unsigned mergerID)
const
35 return (
unsigned)m_merger2copper[mergerID - 1].second;
38 void ARICHCopperMapping::addMapping(
unsigned mergerID,
unsigned copperID,
unsigned finesse)
42 if (finesse > 3) B2ERROR(
"ARICHCopperMapping::addMapping: invalid finesse number (0-3)!");
44 m_merger2copper[mergerID - 1] = std::make_pair(copperID, finesse);
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));
51 std::vector<uint16_t>& mergerList = m_copper2merger[copperID];
52 mergerList[finesse] = mergerID;
55 if (std::find(m_copperIDs.begin(), m_copperIDs.end(), uint16_t(copperID)) == m_copperIDs.end()) m_copperIDs.push_back(copperID);
58 unsigned ARICHCopperMapping::getMergerID(
unsigned copperID,
unsigned finesse)
const
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];
66 void ARICHCopperMapping::print()
const
69 cout <<
"Mapping of merger to copper boards" << 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;
Abstract base class for different kinds of events.