Belle II Software  release-08-01-10
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 #include <iostream>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 ARICHHvCrateCableMapping::ARICHHvCrateCableMapping()
18 {
19 }
20 
21 int ARICHHvCrateCableMapping::getSector(int connectionID) const
22 {
23  std::vector<int> sectorCable = m_connection2cable.find(connectionID)->second;
24  return sectorCable[0];
25 }
26 
27 int ARICHHvCrateCableMapping::getCable(int connectionID) const
28 {
29  std::vector<int> sectorCable = m_connection2cable.find(connectionID)->second;
30  return sectorCable[1];
31 }
32 
33 int ARICHHvCrateCableMapping::getConnectionID(const std::vector<int>& sectorCable) const
34 {
35  int connectionID = -1;
36  for (auto& i : m_connection2cable) {
37  if (i.second == sectorCable) connectionID = i.first;
38  }
39  return connectionID;
40 }
41 
42 
43 void ARICHHvCrateCableMapping::addMapping(int connectionID, std::vector<int> sectorCable)
44 {
45  m_connection2cable.insert(std::pair<int, std::vector<int>>(connectionID, sectorCable));
46 }
47 
48 void ARICHHvCrateCableMapping::print() const
49 {
50  for (auto const& x : m_connection2cable) {
51  int connectionID = x.first;
52  std::vector<int> cables = x.second;
53  B2INFO("Connection " << connectionID << ": sector " << cables[0] << ", cable " << cables[1]);
54  }
55 }
56 
Abstract base class for different kinds of events.