Belle II Software development
KLMChannelStatus Class Reference

KLM channel status. More...

#include <KLMChannelStatus.h>

Inheritance diagram for KLMChannelStatus:

Public Types

enum  ChannelStatus {
  c_Unknown ,
  c_Normal ,
  c_Dead ,
  c_Hot ,
  c_Undetermined
}
 Channel status. More...
 

Public Member Functions

 KLMChannelStatus ()
 Constructor.
 
 ~KLMChannelStatus ()
 Destructor.
 
enum ChannelStatus getChannelStatus (KLMChannelNumber channel) const
 Get channel status.
 
void setChannelStatus (KLMChannelNumber channel, enum ChannelStatus status)
 Set channel status.
 
void setStatusAllChannels (enum ChannelStatus status)
 Set status for all channels.
 
int getActiveStripsInModule (KLMChannelNumber module) const
 Get number of active strips in the specified KLM module.
 
bool operator== (KLMChannelStatus &status)
 Operator ==.
 
unsigned int newNormalChannels (KLMChannelStatus &status)
 Number of new channels with status c_Normal that have a different status in another channel-status data.
 

Private Member Functions

 ClassDef (Belle2::KLMChannelStatus, 1)
 Class version.
 

Private Attributes

std::map< KLMChannelNumber, enum ChannelStatusm_ChannelStatus
 Channel data.
 

Detailed Description

KLM channel status.

Definition at line 29 of file KLMChannelStatus.h.

Member Enumeration Documentation

◆ ChannelStatus

Channel status.

Enumerator
c_Unknown 

Unknown status (no data).

c_Normal 

Normally operating channel.

c_Dead 

Dead channel (no signal).

c_Hot 

Hot channel (large background).

c_Undetermined 

Undetermined (used during calibration).

Definition at line 36 of file KLMChannelStatus.h.

36 {
37
40
43
45 c_Dead,
46
48 c_Hot,
49
52
53 };
@ c_Hot
Hot channel (large background).
@ c_Undetermined
Undetermined (used during calibration).
@ c_Normal
Normally operating channel.
@ c_Dead
Dead channel (no signal).
@ c_Unknown
Unknown status (no data).

Constructor & Destructor Documentation

◆ KLMChannelStatus()

Constructor.

Definition at line 21 of file KLMChannelStatus.cc.

22{
23}

◆ ~KLMChannelStatus()

Destructor.

Definition at line 25 of file KLMChannelStatus.cc.

26{
27}

Member Function Documentation

◆ getActiveStripsInModule()

int getActiveStripsInModule ( KLMChannelNumber  module) const

Get number of active strips in the specified KLM module.

Parameters
[in]moduleModule number.

Definition at line 58 of file KLMChannelStatus.cc.

59{
60 int active;
61 int subdetector, section, sector, layer;
62 const KLMElementNumbers* elementNumbers =
64 elementNumbers->moduleNumberToElementNumbers(
65 module, &subdetector, &section, &sector, &layer);
66 KLMChannelIndex klmModule(subdetector, section, sector, layer, 1, 1);
67 /* Plane number is 0-based for BKLM. */
68 if (subdetector == KLMElementNumbers::c_BKLM) {
69 KLMChannelIndex klmModuleTemp(subdetector, section, sector, layer, 0, 1);
70 klmModule = klmModuleTemp;
71 }
72 klmModule.setIndexLevel(KLMChannelIndex::c_IndexLevelLayer);
73 KLMChannelIndex klmNextModule(klmModule);
74 ++klmNextModule;
75 KLMChannelIndex klmChannel(klmModule);
76 klmChannel.setIndexLevel(KLMChannelIndex::c_IndexLevelStrip);
77 active = 0;
78 for (; klmChannel != klmNextModule; ++klmChannel) {
79 KLMChannelNumber channel = klmChannel.getKLMChannelNumber();
80 ChannelStatus status = getChannelStatus(channel);
81 if (status == c_Unknown)
82 B2FATAL("Incomplete KLM channel data.");
83 if (status != c_Dead)
84 active++;
85 }
86 return active;
87}
KLM channel index.
enum ChannelStatus getChannelStatus(KLMChannelNumber channel) const
Get channel status.
ChannelStatus
Channel status.
KLM element numbers.
static const KLMElementNumbers & Instance()
Instantiation.
void moduleNumberToElementNumbers(KLMModuleNumber module, int *subdetector, int *section, int *sector, int *layer) const
Get element numbers by module number.
uint16_t KLMChannelNumber
Channel number.

◆ getChannelStatus()

enum KLMChannelStatus::ChannelStatus getChannelStatus ( KLMChannelNumber  channel) const

Get channel status.

Parameters
[in]channelChannel number.

Definition at line 30 of file KLMChannelStatus.cc.

30 {
31 std::map<KLMChannelNumber, enum ChannelStatus>::const_iterator it;
32 it = m_ChannelStatus.find(channel);
33 if (it == m_ChannelStatus.end())
34 return c_Unknown;
35 return it->second;
36}
std::map< KLMChannelNumber, enum ChannelStatus > m_ChannelStatus
Channel data.

◆ newNormalChannels()

unsigned int newNormalChannels ( KLMChannelStatus status)

Number of new channels with status c_Normal that have a different status in another channel-status data.

Definition at line 107 of file KLMChannelStatus.cc.

108{
109 unsigned int channels = 0;
110 if (this->m_ChannelStatus.size() != status.m_ChannelStatus.size())
111 return 0;
112 std::map<KLMChannelNumber, enum ChannelStatus>::iterator it, it2;
113 it = this->m_ChannelStatus.begin();
114 it2 = status.m_ChannelStatus.begin();
115 while (it != this->m_ChannelStatus.end()) {
116 if (it->first != it2->first)
117 return 0;
118 if ((it->second == c_Normal) && (it2->second != c_Normal))
119 ++channels;
120 ++it;
121 ++it2;
122 }
123 return channels;
124}

◆ operator==()

bool operator== ( KLMChannelStatus status)

Operator ==.

Definition at line 89 of file KLMChannelStatus.cc.

90{
91 if (this->m_ChannelStatus.size() != status.m_ChannelStatus.size())
92 return false;
93 std::map<KLMChannelNumber, enum ChannelStatus>::iterator it, it2;
94 it = this->m_ChannelStatus.begin();
95 it2 = status.m_ChannelStatus.begin();
96 while (it != this->m_ChannelStatus.end()) {
97 if (it->first != it2->first)
98 return false;
99 if (it->second != it2->second)
100 return false;
101 ++it;
102 ++it2;
103 }
104 return true;
105}

◆ setChannelStatus()

void setChannelStatus ( KLMChannelNumber  channel,
enum ChannelStatus  status 
)

Set channel status.

Parameters
[in]channelChannel number.
[in]statusStatus.

Definition at line 38 of file KLMChannelStatus.cc.

40{
41 std::map<KLMChannelNumber, enum ChannelStatus>::iterator it;
42 it = m_ChannelStatus.find(channel);
43 if (it == m_ChannelStatus.end()) {
44 m_ChannelStatus.insert(
45 std::pair<KLMChannelNumber, enum ChannelStatus>(channel, status));
46 } else {
47 it->second = status;
48 }
49}

◆ setStatusAllChannels()

void setStatusAllChannels ( enum ChannelStatus  status)

Set status for all channels.

Parameters
[in]statusStatus.

Definition at line 51 of file KLMChannelStatus.cc.

52{
53 KLMChannelIndex klmChannels;
54 for (KLMChannelIndex& klmChannel : klmChannels)
55 setChannelStatus(klmChannel.getKLMChannelNumber(), status);
56}
void setChannelStatus(KLMChannelNumber channel, enum ChannelStatus status)
Set channel status.

Member Data Documentation

◆ m_ChannelStatus

std::map<KLMChannelNumber, enum ChannelStatus> m_ChannelStatus
private

Channel data.

Definition at line 104 of file KLMChannelStatus.h.


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