Belle II Software development
KLMChannelIndex Class Reference

KLM channel index. More...

#include <KLMChannelIndex.h>

Public Types

enum  IndexLevel {
  c_IndexLevelSubdetector = 1 ,
  c_IndexLevelSection = 2 ,
  c_IndexLevelSector = 3 ,
  c_IndexLevelLayer = 4 ,
  c_IndexLevelPlane = 5 ,
  c_IndexLevelStrip = 6
}
 Index level (loop over KLM elements at the specified level). More...
 

Public Member Functions

 KLMChannelIndex (enum IndexLevel indexLevel=c_IndexLevelStrip)
 Constructor.
 
 KLMChannelIndex (int subdetector, int section, int sector, int layer, int plane, int strip, enum IndexLevel indexLevel=c_IndexLevelStrip)
 Constructor.
 
 ~KLMChannelIndex ()
 Destructor.
 
void setIndexLevel (enum IndexLevel indexLevel)
 Set index level.
 
void useEKLMSegments (bool useSegments=true)
 Iterate over EKLM segments instead of strips.
 
void setKLMModule (KLMModuleNumber module)
 Set KLM module.
 
void setEKLMSegment (int segment)
 Set EKLM segment.
 
int getSubdetector () const
 Get subdetector.
 
int getSection () const
 Get section.
 
int getSector () const
 Get sector.
 
int getLayer () const
 Get layer.
 
int getPlane () const
 Get plane.
 
int getStrip () const
 Get strip.
 
KLMChannelNumber getKLMChannelNumber () const
 Get KLM channel number.
 
KLMPlaneNumber getKLMPlaneNumber () const
 Get KLM plane number.
 
KLMModuleNumber getKLMModuleNumber () const
 Get KLM module number.
 
KLMSectorNumber getKLMSectorNumber () const
 Get KLM sector number.
 
int getEKLMSegmentNumber () const
 Get EKLM segment number.
 
KLMChannelIndex beginBKLM ()
 First channel for BKLM.
 
KLMChannelIndexendBKLM ()
 Last channel for BKLM.
 
KLMChannelIndex beginEKLM ()
 First channel for EKLM.
 
KLMChannelIndexendEKLM ()
 Last channel for EKLM.
 
KLMChannelIndex begin ()
 First channel.
 
KLMChannelIndexend ()
 Last channel.
 
KLMChannelIndexoperator++ ()
 Operator ++.
 
KLMChannelIndexincrement ()
 Increment (to use in Python).
 
bool operator== (const KLMChannelIndex &index) const
 Operator ==.
 
bool operator!= (const KLMChannelIndex &index) const
 Operator !=.
 
KLMChannelIndexoperator* ()
 Operator *.
 

Protected Member Functions

void setNStripsPlane ()
 Set number of strips in the current plane.
 
void increment (enum IndexLevel indexLevel)
 Increment the index.
 

Protected Attributes

enum IndexLevel m_IndexLevel
 Index level.
 
int m_Subdetector
 Subdetector.
 
int m_Section
 Section.
 
int m_Sector
 Sector.
 
int m_Layer
 Layer.
 
int m_Plane
 Plane.
 
int m_Strip
 Strip.
 
bool m_UseEKLMSegments = false
 Iterate over EKLM segments instead of strips.
 
int m_NStripsPlane
 Number of strips in current plane.
 
const KLMElementNumbersm_ElementNumbers
 KLM element numbers.
 
const EKLMElementNumbersm_eklmElementNumbers
 EKLM element numbers.
 

Detailed Description

KLM channel index.

Definition at line 23 of file KLMChannelIndex.h.

Member Enumeration Documentation

◆ IndexLevel

enum IndexLevel

Index level (loop over KLM elements at the specified level).

Enumerator
c_IndexLevelSubdetector 

Subdetector (BKLM or EKLM).

c_IndexLevelSection 

Section.

c_IndexLevelSector 

Sector.

c_IndexLevelLayer 

Layer.

c_IndexLevelPlane 

Plane.

c_IndexLevelStrip 

Strip.

Definition at line 30 of file KLMChannelIndex.h.

30 {
31
34
37
40
43
46
49
50 };
@ c_IndexLevelSubdetector
Subdetector (BKLM or EKLM).

Constructor & Destructor Documentation

◆ KLMChannelIndex() [1/2]

KLMChannelIndex ( enum IndexLevel  indexLevel = c_IndexLevelStrip)
explicit

Constructor.

Parameters
[in]indexLevelIndex level.

Definition at line 18 of file KLMChannelIndex.cc.

18 :
19 m_IndexLevel(indexLevel),
21 m_Section(0),
22 m_Sector(1),
23 m_Layer(1),
24 m_Plane(0),
25 m_Strip(1),
28{
30}
static const EKLMElementNumbers & Instance()
Instantiation.
const KLMElementNumbers * m_ElementNumbers
KLM element numbers.
const EKLMElementNumbers * m_eklmElementNumbers
EKLM element numbers.
int m_Subdetector
Subdetector.
void setNStripsPlane()
Set number of strips in the current plane.
enum IndexLevel m_IndexLevel
Index level.
static const KLMElementNumbers & Instance()
Instantiation.

◆ KLMChannelIndex() [2/2]

KLMChannelIndex ( int  subdetector,
int  section,
int  sector,
int  layer,
int  plane,
int  strip,
enum IndexLevel  indexLevel = c_IndexLevelStrip 
)

Constructor.

Parameters
[in]subdetectorSubdetector.
[in]sectionSection.
[in]sectorSector.
[in]layerLayer.
[in]planePlane.
[in]stripStrip.
[in]indexLevelIndex level.

Definition at line 32 of file KLMChannelIndex.cc.

34 :
35 m_IndexLevel(indexLevel),
36 m_Subdetector(subdetector),
37 m_Section(section),
38 m_Sector(sector),
39 m_Layer(layer),
40 m_Plane(plane),
41 m_Strip(strip),
44{
46}

◆ ~KLMChannelIndex()

Destructor.

Definition at line 48 of file KLMChannelIndex.cc.

49{
50}

Member Function Documentation

◆ begin()

KLMChannelIndex begin ( )
inline

First channel.

Definition at line 199 of file KLMChannelIndex.h.

200 {
201 return beginBKLM();
202 }
KLMChannelIndex beginBKLM()
First channel for BKLM.

◆ beginBKLM()

KLMChannelIndex beginBKLM ( )

First channel for BKLM.

Definition at line 187 of file KLMChannelIndex.cc.

188{
189 return KLMChannelIndex(KLMElementNumbers::c_BKLM, 0, 1, 1, 0, 1,
191}
KLM channel index.

◆ beginEKLM()

KLMChannelIndex beginEKLM ( )

First channel for EKLM.

Definition at line 203 of file KLMChannelIndex.cc.

204{
205 return KLMChannelIndex(KLMElementNumbers::c_EKLM, 1, 1, 1, 1, 1,
207}

◆ end()

KLMChannelIndex & end ( )
inline

Last channel.

Definition at line 207 of file KLMChannelIndex.h.

208 {
209 return endEKLM();
210 }
KLMChannelIndex & endEKLM()
Last channel for EKLM.

◆ endBKLM()

KLMChannelIndex & endBKLM ( )

Last channel for BKLM.

Definition at line 193 of file KLMChannelIndex.cc.

194{
195 /*
196 * The index level does not matter for end check, thus,
197 * the object can be created once.
198 */
199 static KLMChannelIndex index(KLMElementNumbers::c_EKLM, 1, 1, 1, 1, 1);
200 return index;
201}

◆ endEKLM()

KLMChannelIndex & endEKLM ( )

Last channel for EKLM.

Definition at line 209 of file KLMChannelIndex.cc.

210{
211 /*
212 * The index level does not matter for end check, thus,
213 * the object can be created once.
214 */
215 static KLMChannelIndex index(KLMElementNumbers::c_EKLM + 1, 1, 1, 1, 1, 1);
216 return index;
217}

◆ getEKLMSegmentNumber()

int getEKLMSegmentNumber ( ) const

Get EKLM segment number.

Definition at line 181 of file KLMChannelIndex.cc.

182{
185}
int segmentNumber(int section, int layer, int sector, int plane, int segment) const
Get segment number.

◆ getKLMChannelNumber()

KLMChannelNumber getKLMChannelNumber ( ) const

Get KLM channel number.

Definition at line 143 of file KLMChannelIndex.cc.

144{
148 } else {
151 }
152}
KLMChannelNumber channelNumberBKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for BKLM.
KLMChannelNumber channelNumberEKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for EKLM.

◆ getKLMModuleNumber()

KLMModuleNumber getKLMModuleNumber ( ) const

Get KLM module number.

Definition at line 165 of file KLMChannelIndex.cc.

166{
169 else
171}
KLMModuleNumber moduleNumberBKLM(int section, int sector, int layer) const
Get module number for BKLM.
KLMModuleNumber moduleNumberEKLM(int section, int sector, int layer) const
Get module number for EKLM.

◆ getKLMPlaneNumber()

KLMPlaneNumber getKLMPlaneNumber ( ) const

Get KLM plane number.

Definition at line 154 of file KLMChannelIndex.cc.

155{
159 } else {
162 }
163}
KLMPlaneNumber planeNumberEKLM(int section, int sector, int layer, int plane) const
Get channel number for EKLM.
KLMPlaneNumber planeNumberBKLM(int section, int sector, int layer, int plane) const
Get plane number for BKLM.

◆ getKLMSectorNumber()

KLMSectorNumber getKLMSectorNumber ( ) const

Get KLM sector number.

Definition at line 173 of file KLMChannelIndex.cc.

174{
177 else
179}
KLMSectorNumber sectorNumberEKLM(int section, int sector) const
Get sector number for EKLM.
KLMSectorNumber sectorNumberBKLM(int section, int sector) const
Get sector number for BKLM.

◆ getLayer()

int getLayer ( ) const
inline

Get layer.

Definition at line 130 of file KLMChannelIndex.h.

131 {
132 return m_Layer;
133 }

◆ getPlane()

int getPlane ( ) const
inline

Get plane.

Definition at line 138 of file KLMChannelIndex.h.

139 {
140 return m_Plane;
141 }

◆ getSection()

int getSection ( ) const
inline

Get section.

Definition at line 114 of file KLMChannelIndex.h.

115 {
116 return m_Section;
117 }

◆ getSector()

int getSector ( ) const
inline

Get sector.

Definition at line 122 of file KLMChannelIndex.h.

123 {
124 return m_Sector;
125 }

◆ getStrip()

int getStrip ( ) const
inline

Get strip.

Definition at line 146 of file KLMChannelIndex.h.

147 {
148 return m_Strip;
149 }

◆ getSubdetector()

int getSubdetector ( ) const
inline

Get subdetector.

Definition at line 106 of file KLMChannelIndex.h.

107 {
108 return m_Subdetector;
109 }

◆ increment() [1/2]

KLMChannelIndex & increment ( )

Increment (to use in Python).

Definition at line 314 of file KLMChannelIndex.cc.

315{
317 return *this;
318}
KLMChannelIndex & increment()
Increment (to use in Python).

◆ increment() [2/2]

void increment ( enum IndexLevel  indexLevel)
protected

Increment the index.

Definition at line 219 of file KLMChannelIndex.cc.

220{
222 switch (indexLevel) {
224 m_Strip++;
225 if (m_Strip > m_NStripsPlane) {
226 m_Strip = 1;
229 }
230 break;
232 m_Plane++;
234 m_Plane = 0;
236 }
237 break;
239 m_Layer++;
241 m_Layer = 1;
243 }
244 break;
246 m_Sector++;
248 m_Sector = 1;
250 }
251 break;
253 m_Section++;
255 m_Section = 0;
257 }
258 break;
260 *this = beginEKLM();
261 break;
262 }
263 } else {
264 switch (indexLevel) {
266 m_Strip++;
267 if (m_Strip > m_NStripsPlane) {
268 m_Strip = 1;
271 }
272 break;
274 m_Plane++;
276 m_Plane = 1;
278 }
279 break;
281 m_Layer++;
283 m_Layer = 1;
285 }
286 break;
288 m_Sector++;
290 m_Sector = 1;
292 }
293 break;
295 m_Section++;
297 m_Section = 1;
299 }
300 break;
303 break;
304 }
305 }
306}
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
static constexpr int getMaximalSectionNumber()
Get maximal section number (0-based).
static constexpr int getMaximalPlaneNumber()
Get maximal plane number (0-based).
int getMaximalDetectorLayerNumber(int section) const
Get maximal detector layer number.
static constexpr int getMaximalSectorNumber()
Get maximal sector number.
static constexpr int getMaximalSectionNumber()
Get maximal section number.
static constexpr int getMaximalPlaneNumber()
Get maximal plane number.
int m_NStripsPlane
Number of strips in current plane.
KLMChannelIndex beginEKLM()
First channel for EKLM.

◆ operator!=()

bool operator!= ( const KLMChannelIndex index) const

Operator !=.

Definition at line 350 of file KLMChannelIndex.cc.

351{
352 switch (m_IndexLevel) {
354 if (m_Strip != index.getStrip())
355 return true;
356 [[fallthrough]];
358 if (m_Plane != index.getPlane())
359 return true;
360 [[fallthrough]];
362 if (m_Layer != index.getLayer())
363 return true;
364 [[fallthrough]];
366 if (m_Sector != index.getSector())
367 return true;
368 [[fallthrough]];
370 if (m_Section != index.getSection())
371 return true;
372 [[fallthrough]];
374 if (m_Subdetector != index.getSubdetector())
375 return true;
376 }
377 return false;
378}

◆ operator*()

KLMChannelIndex & operator* ( )

Operator *.

Definition at line 380 of file KLMChannelIndex.cc.

381{
382 return *this;
383}

◆ operator++()

KLMChannelIndex & operator++ ( )

Operator ++.

Definition at line 308 of file KLMChannelIndex.cc.

309{
311 return *this;
312}

◆ operator==()

bool operator== ( const KLMChannelIndex index) const

Operator ==.

Definition at line 320 of file KLMChannelIndex.cc.

321{
322 switch (m_IndexLevel) {
324 if (m_Strip != index.getStrip())
325 return false;
326 [[fallthrough]];
328 if (m_Plane != index.getPlane())
329 return false;
330 [[fallthrough]];
332 if (m_Layer != index.getLayer())
333 return false;
334 [[fallthrough]];
336 if (m_Sector != index.getSector())
337 return false;
338 [[fallthrough]];
340 if (m_Section != index.getSection())
341 return false;
342 [[fallthrough]];
344 if (m_Subdetector != index.getSubdetector())
345 return false;
346 }
347 return true;
348}

◆ setEKLMSegment()

void setEKLMSegment ( int  segment)

Set EKLM segment.

Parameters
[in]segmentSegment.

Definition at line 134 of file KLMChannelIndex.cc.

135{
137 segment, &m_Section, &m_Sector, &m_Layer, &m_Plane, &m_Strip);
141}
void segmentNumberToElementNumbers(int segmentGlobal, int *section, int *layer, int *sector, int *plane, int *segment) const
Get element numbers by segment global number.
void useEKLMSegments(bool useSegments=true)
Iterate over EKLM segments instead of strips.

◆ setIndexLevel()

void setIndexLevel ( enum IndexLevel  indexLevel)

Set index level.

If the index level is increased, then the index is set to the first element of the higher-order level.

Definition at line 65 of file KLMChannelIndex.cc.

66{
67 if (indexLevel > m_IndexLevel) {
69 switch (m_IndexLevel) {
71 m_Section = 0;
72 [[fallthrough]];
74 m_Sector = 1;
75 [[fallthrough]];
77 m_Layer = 1;
78 [[fallthrough]];
80 m_Plane = 0;
81 [[fallthrough]];
83 m_Strip = 1;
84 [[fallthrough]];
86 break;
87 }
88 } else {
89 switch (m_IndexLevel) {
91 m_Section = 1;
92 [[fallthrough]];
94 m_Sector = 1;
95 [[fallthrough]];
97 m_Layer = 1;
98 [[fallthrough]];
100 m_Plane = 1;
101 [[fallthrough]];
103 m_Strip = 1;
104 [[fallthrough]];
106 break;
107 }
108 }
109 }
110 m_IndexLevel = indexLevel;
111 if (indexLevel == c_IndexLevelStrip)
113}

◆ setKLMModule()

void setKLMModule ( KLMModuleNumber  module)

Set KLM module.

Parameters
[in]moduleModule.

Definition at line 121 of file KLMChannelIndex.cc.

122{
124 module, &m_Subdetector, &m_Section, &m_Sector, &m_Layer);
126 m_Plane = 0;
127 else
128 m_Plane = 1;
129 m_Strip = 1;
130 useEKLMSegments(false);
132}
void moduleNumberToElementNumbers(KLMModuleNumber module, int *subdetector, int *section, int *sector, int *layer) const
Get element numbers by module number.

◆ setNStripsPlane()

void setNStripsPlane ( )
protected

Set number of strips in the current plane.

Definition at line 52 of file KLMChannelIndex.cc.

53{
57 } else {
60 else
62 }
63}
static int getNStrips(int section, int sector, int layer, int plane)
Get number of strips.
static constexpr int getMaximalStripNumber()
Get maximal strip number.
static constexpr int getMaximalSegmentNumber()
Get maximal segment number.
bool m_UseEKLMSegments
Iterate over EKLM segments instead of strips.

◆ useEKLMSegments()

void useEKLMSegments ( bool  useSegments = true)

Iterate over EKLM segments instead of strips.

Turning this on does not make sense for BKLM, in this case the iteration would still be performed over BKLM strips. Make sure that the iteration is performed for EKLM only, e. g. by using beginEKLM() and endEKLM().

Definition at line 115 of file KLMChannelIndex.cc.

116{
117 m_UseEKLMSegments = useSegments;
119}

Member Data Documentation

◆ m_eklmElementNumbers

const EKLMElementNumbers* m_eklmElementNumbers
protected

EKLM element numbers.

Definition at line 280 of file KLMChannelIndex.h.

◆ m_ElementNumbers

const KLMElementNumbers* m_ElementNumbers
protected

KLM element numbers.

Definition at line 277 of file KLMChannelIndex.h.

◆ m_IndexLevel

enum IndexLevel m_IndexLevel
protected

Index level.

Definition at line 250 of file KLMChannelIndex.h.

◆ m_Layer

int m_Layer
protected

Layer.

Definition at line 262 of file KLMChannelIndex.h.

◆ m_NStripsPlane

int m_NStripsPlane
protected

Number of strips in current plane.

Definition at line 274 of file KLMChannelIndex.h.

◆ m_Plane

int m_Plane
protected

Plane.

Definition at line 265 of file KLMChannelIndex.h.

◆ m_Section

int m_Section
protected

Section.

Definition at line 256 of file KLMChannelIndex.h.

◆ m_Sector

int m_Sector
protected

Sector.

Definition at line 259 of file KLMChannelIndex.h.

◆ m_Strip

int m_Strip
protected

Strip.

Definition at line 268 of file KLMChannelIndex.h.

◆ m_Subdetector

int m_Subdetector
protected

Subdetector.

Definition at line 253 of file KLMChannelIndex.h.

◆ m_UseEKLMSegments

bool m_UseEKLMSegments = false
protected

Iterate over EKLM segments instead of strips.

Definition at line 271 of file KLMChannelIndex.h.


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