Belle II Software development
ARICHHvCablesMapping Class Reference

The Class for ARICH mapping of bias cables to modules. More...

#include <ARICHHvCablesMapping.h>

Inheritance diagram for ARICHHvCablesMapping:

Public Member Functions

 ARICHHvCablesMapping ()
 Default constructor.
 
int getModuleID (int sectorID, int cableID, int innerID) const
 Get ID of module connected to cable in sector.
 
int getSectorID (int moduleID) const
 Get ID of sector of a cable to which module is connected.
 
int getCableID (int moduleID) const
 Get ID of cable to which module is connected.
 
int getInnerID (int moduleID) const
 Get inner cable ID to which module is connected.
 
void addMapping (int moduleID, int sectorID, int cableID, int innerID)
 Add mapping entry.
 
void print () const
 Pring mapping.
 

Private Member Functions

 ClassDef (ARICHHvCablesMapping, 1)
 ClassDef, must be the last term before the closing {}.
 

Private Attributes

std::vector< std::tuple< int, int, int > > m_cable2module
 map of cables to modules
 
std::map< int, std::vector< int > > m_module2cable
 map of modules to cables
 

Detailed Description

The Class for ARICH mapping of bias cables to modules.

This class provides ARICH mapping of HAPD modules to bias cables. It is assumed sectorID going from 1:6, cableID goes from 1:8 and innerID goes from 1:9.

Definition at line 28 of file ARICHHvCablesMapping.h.

Constructor & Destructor Documentation

◆ ARICHHvCablesMapping()

Default constructor.

Definition at line 17 of file ARICHHvCablesMapping.cc.

18{
19}

Member Function Documentation

◆ addMapping()

void addMapping ( int  moduleID,
int  sectorID,
int  cableID,
int  innerID 
)

Add mapping entry.

Parameters
moduleIDmodule ID number
sectorIDsector ID
cableIDbias cable number
innerIDinner cable number

Definition at line 56 of file ARICHHvCablesMapping.cc.

57{
58
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!"); }
63
64 std::vector<int> cableMap{sectorID, cableID, innerID};
65 m_module2cable.insert(std::pair<int, std::vector<int>>(moduleID, cableMap));
66
67}
std::map< int, std::vector< int > > m_module2cable
map of modules to cables

◆ getCableID()

int getCableID ( int  moduleID) const

Get ID of cable to which module is connected.

Parameters
moduleIDmodule ID number
Returns
cableID cable ID number

Definition at line 42 of file ARICHHvCablesMapping.cc.

43{
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;
46 return (int)cable[1];
47}

◆ getInnerID()

int getInnerID ( int  moduleID) const

Get inner cable ID to which module is connected.

Parameters
moduleIDmodule ID number
Returns
innerID inner ID number

Definition at line 49 of file ARICHHvCablesMapping.cc.

50{
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;
53 return (int)inner[2];
54}

◆ getModuleID()

int getModuleID ( int  sectorID,
int  cableID,
int  innerID 
) const

Get ID of module connected to cable in sector.

Parameters
sectorIDsector ID
cableIDbias cable number
innerIDinner cable number
Returns
moduleID module ID number

Definition at line 21 of file ARICHHvCablesMapping.cc.

22{
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;}
26
27 int module = 0;
28 std::vector<int> position{sectorID, cableID, innerID};
29 for (auto& i : m_module2cable) {
30 if (i.second == position) module = i.first;
31 }
32 return module;
33}

◆ getSectorID()

int getSectorID ( int  moduleID) const

Get ID of sector of a cable to which module is connected.

Parameters
moduleIDmodule ID number
Returns
sectorID sector ID number

Definition at line 35 of file ARICHHvCablesMapping.cc.

36{
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];
40}

◆ print()

void print ( ) const

Pring mapping.

Definition at line 69 of file ARICHHvCablesMapping.cc.

70{
71
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;
75 }
76
77 cout << endl;
78 cout << "Moving to finding module number... " << endl;
79 int l = 0;
80
81 for (int i = 1; i < 7 ; i++) {
82 for (int j = 1; j < 5 ; j++) {
83 for (int k = 2; k < 21; k++) {
84 if (k == 7) continue;
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;
87 l++;
88 }
89 }
90 }
91
92 cout << "number of modules = " << l << endl;
93
94}
int getCableID(int moduleID) const
Get ID of cable to which module is connected.
int getSectorID(int moduleID) const
Get ID of sector of a cable to which module is connected.
int getModuleID(int sectorID, int cableID, int innerID) const
Get ID of module connected to cable in sector.
int getInnerID(int moduleID) const
Get inner cable ID to which module is connected.

Member Data Documentation

◆ m_cable2module

std::vector<std::tuple<int, int, int> > m_cable2module
private

map of cables to modules

Definition at line 81 of file ARICHHvCablesMapping.h.

◆ m_module2cable

std::map<int, std::vector<int> > m_module2cable
private

map of modules to cables

Definition at line 82 of file ARICHHvCablesMapping.h.


The documentation for this class was generated from the following files: