9 #include <framework/logging/Logger.h>
11 #include <arich/dbobjects/ARICHHvChannelsMapping.h>
17 ARICHHvChannelsMapping::ARICHHvChannelsMapping()
21 std::vector<int> ARICHHvChannelsMapping::getChannelValues(
int connectionID,
int pinID)
const
24 vector<int> channel{ -2, -2, -2};
25 for (
auto& i : m_channel2type) {
26 if (((i.second)[0] == connectionID) && ((i.second)[1] == pinID)) channel = i.first;
31 int ARICHHvChannelsMapping::getPinID(std::vector<int> channel)
const
33 std::vector<int> pinProp = m_channel2type.find(channel)->second;
37 int ARICHHvChannelsMapping::getConnectionID(std::vector<int> channel)
const
39 std::vector<int> pinProp = m_channel2type.find(channel)->second;
43 int ARICHHvChannelsMapping::getCrate(
int connectionID,
int pinID)
const
45 return (ARICHHvChannelsMapping::getChannelValues(connectionID, pinID))[0];
48 int ARICHHvChannelsMapping::getSlot(
int connectionID,
int pinID)
const
50 return (ARICHHvChannelsMapping::getChannelValues(connectionID, pinID))[1];
53 int ARICHHvChannelsMapping::getChannel(
int connectionID,
int pinID)
const
55 return (ARICHHvChannelsMapping::getChannelValues(connectionID, pinID))[2];
58 void ARICHHvChannelsMapping::addMapping(
int crate,
int slot,
int channelID,
int connectionID,
int pinID)
61 if (crate > 6 || crate < 3) { B2WARNING(
"ARICHHvChannelsMapping::addMapping: Crate ID number " << crate <<
" not valid!"); }
62 if (slot > 12 || slot < 0 || slot % 2 != 0) { B2WARNING(
"ARICHHvChannelsMapping::addMapping: Slot ID number " << slot <<
" not valid!"); }
64 std::vector<int> pinProp{connectionID, pinID};
65 std::vector<int> channelMap{crate, slot, channelID};
66 m_channel2type.insert(std::pair<std::vector<int>, std::vector<int>>(channelMap, pinProp));
Abstract base class for different kinds of events.