Belle II Software development
KLMElementArrayIndex Class Reference

KLM element array index. More...

#include <KLMElementArrayIndex.h>

Inheritance diagram for KLMElementArrayIndex:
KLMChannelArrayIndex KLMModuleArrayIndex KLMPlaneArrayIndex KLMSectorArrayIndex

Public Member Functions

 KLMElementArrayIndex (enum KLMChannelIndex::IndexLevel indexLevel)
 Constructor.
 
virtual ~KLMElementArrayIndex ()
 Destructor.
 
uint16_t getIndex (uint16_t number) const
 Get element index.
 
uint16_t getNumber (uint16_t index) const
 Get element number.
 
uint16_t getNElements () const
 Get number of elements.
 

Private Attributes

std::map< uint16_t, uint16_t > m_MapNumberIndex
 Map KLM element number - KLM element index.
 
std::map< uint16_t, uint16_t > m_MapIndexNumber
 Map KLM element index - KLM element number.
 
uint16_t m_NElements
 Number of elements.
 

Detailed Description

KLM element array index.

Definition at line 26 of file KLMElementArrayIndex.h.

Constructor & Destructor Documentation

◆ KLMElementArrayIndex()

KLMElementArrayIndex ( enum KLMChannelIndex::IndexLevel  indexLevel)
explicit

Constructor.

Definition at line 17 of file KLMElementArrayIndex.cc.

19{
20 uint16_t index = 0;
21 KLMChannelIndex klmElements(indexLevel);
22 m_NElements = 0;
23 for (KLMChannelIndex& klmElement : klmElements) {
24 uint16_t number;
25 switch (indexLevel) {
27 number = klmElement.getKLMChannelNumber();
28 break;
30 number = klmElement.getKLMPlaneNumber();
31 break;
33 number = klmElement.getKLMModuleNumber();
34 break;
36 number = klmElement.getKLMSectorNumber();
37 break;
38 default:
39 B2FATAL("Unsupported index level in KLMElementArrayIndex.");
40 }
41 m_MapNumberIndex.insert(std::pair<uint16_t, uint16_t>(number, index));
42 m_MapIndexNumber.insert(std::pair<uint16_t, uint16_t>(index, number));
43 index++;
45 }
46}
KLM channel index.
uint16_t m_NElements
Number of elements.
std::map< uint16_t, uint16_t > m_MapIndexNumber
Map KLM element index - KLM element number.
std::map< uint16_t, uint16_t > m_MapNumberIndex
Map KLM element number - KLM element index.

◆ ~KLMElementArrayIndex()

~KLMElementArrayIndex ( )
virtual

Destructor.

Definition at line 48 of file KLMElementArrayIndex.cc.

49{
50}

Member Function Documentation

◆ getIndex()

uint16_t getIndex ( uint16_t  number) const

Get element index.

Parameters
[in]numberElement number.

Definition at line 52 of file KLMElementArrayIndex.cc.

53{
54 std::map<uint16_t, uint16_t>::const_iterator it =
55 m_MapNumberIndex.find(number);
56 if (it == m_MapNumberIndex.end())
57 B2FATAL("Incorrect KLM element number.");
58 return it->second;
59}

◆ getNElements()

uint16_t getNElements ( ) const
inline

Get number of elements.

Definition at line 55 of file KLMElementArrayIndex.h.

56 {
57 return m_NElements;
58 }

◆ getNumber()

uint16_t getNumber ( uint16_t  index) const

Get element number.

Parameters
[in]indexElement index.

Definition at line 61 of file KLMElementArrayIndex.cc.

62{
63 std::map<uint16_t, uint16_t>::const_iterator it =
64 m_MapIndexNumber.find(index);
65 if (it == m_MapIndexNumber.end())
66 B2FATAL("Incorrect KLM element index.");
67 return it->second;
68}

Member Data Documentation

◆ m_MapIndexNumber

std::map<uint16_t, uint16_t> m_MapIndexNumber
private

Map KLM element index - KLM element number.

Definition at line 66 of file KLMElementArrayIndex.h.

◆ m_MapNumberIndex

std::map<uint16_t, uint16_t> m_MapNumberIndex
private

Map KLM element number - KLM element index.

Definition at line 63 of file KLMElementArrayIndex.h.

◆ m_NElements

uint16_t m_NElements
private

Number of elements.

Definition at line 69 of file KLMElementArrayIndex.h.


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