Belle II Software  release-05-01-25
ARICHHvCrateCableMapping.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Manca Mrvar *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <framework/logging/Logger.h>
12 
13 #include <arich/dbobjects/ARICHHvCrateCableMapping.h>
14 #include <iostream>
15 
16 using namespace std;
17 using namespace Belle2;
18 
19 ARICHHvCrateCableMapping::ARICHHvCrateCableMapping()
20 {
21 }
22 
23 int ARICHHvCrateCableMapping::getSector(int connectionID) const
24 {
25  std::vector<int> sectorCable = m_connection2cable.find(connectionID)->second;
26  return sectorCable[0];
27 }
28 
29 int ARICHHvCrateCableMapping::getCable(int connectionID) const
30 {
31  std::vector<int> sectorCable = m_connection2cable.find(connectionID)->second;
32  return sectorCable[1];
33 }
34 
35 int ARICHHvCrateCableMapping::getConnectionID(const std::vector<int>& sectorCable) const
36 {
37  int connectionID = -1;
38  for (auto& i : m_connection2cable) {
39  if (i.second == sectorCable) connectionID = i.first;
40  }
41  return connectionID;
42 }
43 
44 
45 void ARICHHvCrateCableMapping::addMapping(int connectionID, std::vector<int> sectorCable)
46 {
47  m_connection2cable.insert(std::pair<int, std::vector<int>>(connectionID, sectorCable));
48 }
49 
50 void ARICHHvCrateCableMapping::print() const
51 {
52  for (auto const& x : m_connection2cable) {
53  int connectionID = x.first;
54  std::vector<int> cables = x.second;
55  B2INFO("Connection " << connectionID << ": sector " << cables[0] << ", cable " << cables[1]);
56  }
57 }
58 
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19