Belle II Software development
ARICHHvCrateCableMapping.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/logging/Logger.h>
10
11#include <arich/dbobjects/ARICHHvCrateCableMapping.h>
12
13using namespace std;
14using namespace Belle2;
15
17{
18}
19
20int ARICHHvCrateCableMapping::getSector(int connectionID) const
21{
22 std::vector<int> sectorCable = m_connection2cable.find(connectionID)->second;
23 return sectorCable[0];
24}
25
26int ARICHHvCrateCableMapping::getCable(int connectionID) const
27{
28 std::vector<int> sectorCable = m_connection2cable.find(connectionID)->second;
29 return sectorCable[1];
30}
31
32int ARICHHvCrateCableMapping::getConnectionID(const std::vector<int>& sectorCable) const
33{
34 int connectionID = -1;
35 for (auto& i : m_connection2cable) {
36 if (i.second == sectorCable) connectionID = i.first;
37 }
38 return connectionID;
39}
40
41
42void ARICHHvCrateCableMapping::addMapping(int connectionID, std::vector<int> sectorCable)
43{
44 m_connection2cable.insert(std::pair<int, std::vector<int>>(connectionID, sectorCable));
45}
46
48{
49 for (auto const& x : m_connection2cable) {
50 int connectionID = x.first;
51 std::vector<int> cables = x.second;
52 B2INFO("Connection " << connectionID << ": sector " << cables[0] << ", cable " << cables[1]);
53 }
54}
55
void addMapping(int connectionID, std::vector< int > sectorCable)
Add new entry to the mapping table.
int getCable(int connectionID) const
Get sector ID.
std::map< int, std::vector< int > > m_connection2cable
map of modules to cables
int getSector(int connectionID) const
Get sector ID.
void print() const
Print mapping parameters.
int getConnectionID(const std::vector< int > &sectorCable) const
Get sector ID.
Abstract base class for different kinds of events.
STL namespace.