9#include <framework/logging/Logger.h>
11#include <arich/dbobjects/ARICHBiasChannelsMapping.h>
23 std::tuple<int, int, int, std::string> pinProp =
m_channel2type.find(channel)->second;
24 return std::get<0>(pinProp);
28 std::tuple<int, int, int, std::string> pinProp =
m_channel2type.find(channel)->second;
29 return std::get<1>(pinProp);
33 std::tuple<int, int, int, std::string> pinProp =
m_channel2type.find(channel)->second;
34 return std::get<2>(pinProp);
38 std::tuple<int, int, int, std::string> pinProp =
m_channel2type.find(channel)->second;
39 return std::get<3>(pinProp);
47 std::tuple<int, int, int, std::string> pinProp =
m_channel2type.find(channel)->second;
48 return std::make_tuple(std::get<1>(pinProp), std::get<2>(pinProp), std::get<3>(pinProp));
53 if (innerID > 9 || innerID < -2 || innerID == 0) { B2WARNING(
"ARICHBiasChannelsMapping::getChannelID: Inner ID " << innerID <<
" not valid!"); }
55 vector<int> channel{ -2, -2, -2};
57 if ((std::get<1>(i.second) == connectionID) && (std::get<2>(i.second) == innerID) && (std::get<3>(i.second) == type)
58 && ((i.first)[0] == crate) && ((i.first)[1] == slot)) channel = i.first;
64 if (innerID > 9 || innerID < -2 || innerID == 0) { B2WARNING(
"ARICHBiasChannelsMapping::getChannelID: Inner ID " << innerID <<
" not valid!"); }
66 vector<int> channel{ -2, -2, -2};
68 if ((std::get<1>(i.second) == connectionID) && (std::get<2>(i.second) == innerID)
69 && (std::get<3>(i.second) == type)) channel = i.first;
76 const std::string& type)
79 if (channelID > 47 || channelID < 0) { B2WARNING(
"ARICHBiasChannelsMapping::addMapping: Channel ID number " << channelID <<
" not valid!"); }
80 if (pinID > 46 || pinID < -2 || pinID == 0) { B2WARNING(
"ARICHBiasChannelsMapping::addMapping: Pin ID number " << pinID <<
" not valid!"); }
81 if (innerID > 9 || innerID < -2 || innerID == 0) { B2WARNING(
"ARICHBiasChannelsMapping::addMapping: Inner ID " << innerID <<
" not valid!"); }
83 auto pinProp = std::make_tuple(pinID, connectionID, innerID, type);
84 std::vector<int> channelMap{crate, slot, channelID};
85 m_channel2type.insert(std::pair<std::vector<int>, std::tuple<int, int, int, std::string>>(channelMap, pinProp));
92 for (
int crate = 0; crate < 3 ; crate++) {
93 for (
int slot = 0; slot < 15 ; slot++) {
94 for (
int channelID = 0; channelID < N_BIASCHANNELS; channelID++) {
95 std::vector<int> channel{crate, slot, channelID};
96 cout <<
" Channel " << channelID <<
" (crate " << crate <<
", slot " << slot <<
"): pinID " <<
getPinID(
std::vector< int > getChannelValues(int connectionID, int innerID, const std::string &type) const
Get bias power supply cratem slot and channel ID from inner cable type and ID.
int getConnectionID(std::vector< int > channel) const
Get inner cable pin ID from bias power supply channel ID.
int getInnerID(std::vector< int > channel) const
Get inner cable pin ID from bias power supply channel ID.
std::string getType(std::vector< int > channel) const
Get bias/guard type from channel.
int getChannelID(int crate, int slot, int connectionID, int innerID, const std::string &type) const
Get bias power supply channel ID from inner cable type and ID.
std::tuple< int, int, std::string > getInnerConnection(std::vector< int > channel) const
Get inner cable ID and type, connected to bias channel.
int getPinID(std::vector< int > channelID) const
Get inner cable pin ID from bias power supply channel ID.
ARICHBiasChannelsMapping()
Default constructor.
void addMapping(int crate, int slot, int channelID, int pinID, int connectionID, int innerID, const std::string &type)
Add new entry to the mapping table.
void print() const
Print properties.
std::map< std::vector< int >, std::tuple< int, int, int, std::string > > m_channel2type
power suply channel ID link to inner cable
Abstract base class for different kinds of events.