9 #include <framework/logging/Logger.h>
11 #include <arich/dbobjects/ARICHHvCablesMapping.h>
17 ARICHHvCablesMapping::ARICHHvCablesMapping()
21 int ARICHHvCablesMapping::getModuleID(
int sectorID,
int cableID,
int innerID)
const
23 if (sectorID > 6 || sectorID < 1) { B2WARNING(
"ARICHHvCablesMapping::getcableID: Sector number " << sectorID <<
" not valid!");
return 0;}
24 if (cableID > 4 || cableID < 1) { B2WARNING(
"ARICHHvCablesMapping::getcableID: Cable number " << cableID <<
" not valid!");
return 0;}
25 if (innerID > 20 || innerID < 2) { B2WARNING(
"ARICHHvCablesMapping::getcableID: Inner cable number " << innerID <<
" not valid!");
return 0;}
28 std::vector<int> position{sectorID, cableID, innerID};
29 for (
auto& i : m_module2cable) {
30 if (i.second == position) module = i.first;
35 int ARICHHvCablesMapping::getSectorID(
int moduleID)
const
37 if (moduleID > 420 || moduleID < 1) { B2WARNING(
"ARICHHvCablesMapping::getcableID: Module number " << moduleID <<
" not valid!");
return 0;}
38 std::vector<int> sector = m_module2cable.find(moduleID)->second;
39 return (
int)sector[0];
42 int ARICHHvCablesMapping::getCableID(
int moduleID)
const
44 if (moduleID > 420 || moduleID < 1) { B2WARNING(
"ARICHHvCablesMapping::getcableID: Module number " << moduleID <<
" not valid!");
return 0;}
45 std::vector<int> cable = m_module2cable.find(moduleID)->second;
49 int ARICHHvCablesMapping::getInnerID(
int moduleID)
const
51 if (moduleID > 420 || moduleID < 1) { B2WARNING(
"ARICHHvCablesMapping::getcableID: Module number " << moduleID <<
" not valid!");
return 0;}
52 std::vector<int> inner = m_module2cable.find(moduleID)->second;
56 void ARICHHvCablesMapping::addMapping(
int moduleID,
int sectorID,
int cableID,
int innerID)
59 if (moduleID > 420 || moduleID < 1) { B2WARNING(
"ARICHHvCablesMapping::addMapping: Module number " << moduleID <<
" not valid!"); }
60 if (sectorID > 6 || sectorID < 1) { B2WARNING(
"ARICHHvCablesMapping::addMapping: Sector number " << sectorID <<
" not valid!"); }
61 if (cableID > 8 || cableID < 1) { B2WARNING(
"ARICHHvCablesMapping::addMapping: Cable number " << cableID <<
" not valid!"); }
62 if (innerID > 20 || innerID < 2) { B2WARNING(
"ARICHHvCablesMapping::addMapping: Inner cable number " << innerID <<
" not valid!"); }
64 std::vector<int> cableMap{sectorID, cableID, innerID};
65 m_module2cable.insert(std::pair<
int, std::vector<int>>(moduleID, cableMap));
69 void ARICHHvCablesMapping::print()
const
72 for (
int moduleID = 1; moduleID < N_MODULES + 1; moduleID++) {
73 cout <<
" Module " << moduleID <<
": sector " << getSectorID(moduleID) <<
", cable " << getCableID(
74 moduleID) <<
", inner " << getInnerID(moduleID) << endl;
78 cout <<
"Moving to finding module number... " << endl;
81 for (
int i = 1; i < 7 ; i++) {
82 for (
int j = 1; j < 5 ; j++) {
83 for (
int k = 2; k < 21; k++) {
85 if ((j == 1 || j == 4) && k == 20)
continue;
86 std::cout <<
" Module: " << getModuleID(i, j, k) <<
": sector " << i <<
", cable " << j <<
", inner " << k << std::endl;
92 cout <<
"number of modules = " << l << endl;
Abstract base class for different kinds of events.