Belle II Software development
KLMElementNumbers Class Reference

KLM element numbers. More...

#include <KLMElementNumbers.h>

Public Types

enum  Subdetector {
  c_BKLM = 1 ,
  c_EKLM = 2
}
 Subdetector constants. More...
 

Public Member Functions

KLMChannelNumber channelNumber (int subdetector, int section, int sector, int layer, int plane, int strip) const
 Get channel number.
 
KLMChannelNumber channelNumberBKLM (int section, int sector, int layer, int plane, int strip) const
 Get channel number for BKLM.
 
KLMChannelNumber channelNumberBKLM (int bklmChannel) const
 Get channel number for BKLM.
 
KLMChannelNumber channelNumberEKLM (int section, int sector, int layer, int plane, int strip) const
 Get channel number for EKLM.
 
KLMChannelNumber channelNumberEKLM (int eklmStrip) const
 Get channel number for EKLM.
 
bool isBKLMChannel (KLMChannelNumber channel) const
 Determine whether a given channel is in BKLM.
 
bool isEKLMChannel (KLMChannelNumber channel) const
 Determine whether a given channel is in EKLM.
 
int localChannelNumberBKLM (KLMChannelNumber channel) const
 Get local BKLM channel number.
 
int localChannelNumberEKLM (KLMChannelNumber channel) const
 Get local EKLM channel number.
 
void channelNumberToElementNumbers (KLMChannelNumber channel, int *subdetector, int *section, int *sector, int *layer, int *plane, int *strip) const
 Get element numbers by channel number.
 
KLMPlaneNumber planeNumber (int subdetector, int section, int sector, int layer, int plane) const
 Get plane number.
 
KLMPlaneNumber planeNumberBKLM (int section, int sector, int layer, int plane) const
 Get plane number for BKLM.
 
KLMPlaneNumber planeNumberEKLM (int section, int sector, int layer, int plane) const
 Get channel number for EKLM.
 
KLMModuleNumber moduleNumber (int subdetector, int section, int sector, int layer) const
 Get module number.
 
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.
 
KLMModuleNumber moduleNumberByChannel (KLMChannelNumber channel) const
 Get module number by channel number.
 
void moduleNumberToElementNumbers (KLMModuleNumber module, int *subdetector, int *section, int *sector, int *layer) const
 Get element numbers by module number.
 
unsigned int getNChannelsModule (KLMModuleNumber module) const
 Get number of channels in module.
 
KLMSectorNumber sectorNumberBKLM (int section, int sector) const
 Get sector number for BKLM.
 
KLMSectorNumber sectorNumberEKLM (int section, int sector) const
 Get sector number for EKLM.
 
int getExtrapolationLayer (int subdetector, int layer) const
 Get extrapolation layer number (BKLM - from 1 to 15, EKLM - from 16 to 29).
 
int getMinimalPlaneNumber (int subdetector) const
 Get minimal plane number.
 
std::string getSectorDAQName (int subdetector, int section, int sector) const
 Get DAQ name for a given sector.
 

Static Public Member Functions

static const KLMElementNumbersInstance ()
 Instantiation.
 
static constexpr int getMaximalExtrapolationLayer ()
 Get maximal extrapolation layer.
 
static constexpr int getTotalModuleNumber ()
 Get total number of modules.
 
static constexpr int getMaximalPlaneNumber ()
 Get maximal plane number.
 
static constexpr int getTotalChannelNumber ()
 Get total number of channels.
 

Private Member Functions

 KLMElementNumbers ()
 Constructor.
 
 ~KLMElementNumbers ()
 Destructor.
 

Private Attributes

const EKLMElementNumbersm_eklmElementNumbers
 EKLM element numbers.
 

Static Private Attributes

static constexpr uint16_t m_BKLMOffset = 0x8000
 BKLM offset.
 

Detailed Description

KLM element numbers.

Definition at line 28 of file KLMElementNumbers.h.

Member Enumeration Documentation

◆ Subdetector

Subdetector constants.

Enumerator
c_BKLM 

BKLM.

c_EKLM 

EKLM.

Definition at line 35 of file KLMElementNumbers.h.

35 {
36
38 c_BKLM = 1,
39
41 c_EKLM = 2,
42
43 };

Constructor & Destructor Documentation

◆ KLMElementNumbers()

KLMElementNumbers ( )
private

Constructor.

Definition at line 20 of file KLMElementNumbers.cc.

20 :
22{
23}
static const EKLMElementNumbers & Instance()
Instantiation.
const EKLMElementNumbers * m_eklmElementNumbers
EKLM element numbers.

◆ ~KLMElementNumbers()

~KLMElementNumbers ( )
private

Destructor.

Definition at line 25 of file KLMElementNumbers.cc.

26{
27}

Member Function Documentation

◆ channelNumber()

KLMChannelNumber channelNumber ( int  subdetector,
int  section,
int  sector,
int  layer,
int  plane,
int  strip 
) const

Get channel number.

Parameters
[in]subdetectorSundetector.
[in]sectionSection.
[in]sectorSector.
[in]layerLayer.
[in]planePlane.
[in]stripStrip.

Definition at line 35 of file KLMElementNumbers.cc.

38{
39 switch (subdetector) {
40 case c_BKLM:
41 return channelNumberBKLM(section, sector, layer, plane, strip);
42 case c_EKLM:
43 return channelNumberEKLM(section, sector, layer, plane, strip);
44 }
45 B2FATAL("Incorrect subdetector number: " << subdetector);
46}
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.

◆ channelNumberBKLM() [1/2]

KLMChannelNumber channelNumberBKLM ( int  bklmChannel) const

Get channel number for BKLM.

Parameters
[in]bklmChannelBKLM channel.

Definition at line 57 of file KLMElementNumbers.cc.

58{
59 return bklmChannel + m_BKLMOffset;
60}
static constexpr uint16_t m_BKLMOffset
BKLM offset.

◆ channelNumberBKLM() [2/2]

KLMChannelNumber channelNumberBKLM ( int  section,
int  sector,
int  layer,
int  plane,
int  strip 
) const

Get channel number for BKLM.

Parameters
[in]sectionForward (1) or backward (0) BKLM.
[in]sectorSector (1-based).
[in]layerLayer (1-based).
[in]planePlane (0-based).
[in]stripStrip (1-based).

Definition at line 48 of file KLMElementNumbers.cc.

50{
51 KLMChannelNumber channel;
53 section, sector, layer, plane, strip);
54 return channel + m_BKLMOffset;
55}
static KLMChannelNumber channelNumber(int section, int sector, int layer, int plane, int strip)
Get channel number.
uint16_t KLMChannelNumber
Channel number.

◆ channelNumberEKLM() [1/2]

KLMChannelNumber channelNumberEKLM ( int  eklmStrip) const

Get channel number for EKLM.

Parameters
[in]eklmStripEKLM strip number.

Definition at line 75 of file KLMElementNumbers.cc.

76{
77 return eklmStrip;
78}

◆ channelNumberEKLM() [2/2]

KLMChannelNumber channelNumberEKLM ( int  section,
int  sector,
int  layer,
int  plane,
int  strip 
) const

Get channel number for EKLM.

Parameters
[in]sectionSection number.
[in]sectorSector number.
[in]layerLayer number.
[in]planePlane number.
[in]stripStrip number.

Definition at line 62 of file KLMElementNumbers.cc.

64{
65 KLMChannelNumber channel;
66 /*
67 * Note that the default order of elements is different
68 * for EKLM-specific code!
69 */
71 section, layer, sector, plane, strip);
72 return channel;
73}
int stripNumber(int section, int layer, int sector, int plane, int strip) const
Get strip number.

◆ channelNumberToElementNumbers()

void channelNumberToElementNumbers ( KLMChannelNumber  channel,
int *  subdetector,
int *  section,
int *  sector,
int *  layer,
int *  plane,
int *  strip 
) const

Get element numbers by channel number.

Parameters
[in]channelKLM channel number.
[out]subdetectorSubdetector.
[out]sectionSection.
[out]sectorSector.
[out]layerLayer.
[out]planePlane.
[out]stripStrip.

Definition at line 104 of file KLMElementNumbers.cc.

107{
108 int localChannel;
109 if (isBKLMChannel(channel)) {
110 *subdetector = c_BKLM;
111 localChannel = localChannelNumberBKLM(channel);
113 localChannel, section, sector, layer, plane, strip);
114 } else {
115 *subdetector = c_EKLM;
116 localChannel = localChannelNumberEKLM(channel);
117 /*
118 * Note that the default order of elements is different
119 * for EKLM-specific code!
120 */
122 localChannel, section, layer, sector, plane, strip);
123 }
124}
static void channelNumberToElementNumbers(KLMChannelNumber channel, int *section, int *sector, int *layer, int *plane, int *strip)
Get element numbers by channel number.
void stripNumberToElementNumbers(int stripGlobal, int *section, int *layer, int *sector, int *plane, int *strip) const
Get element numbers by strip global number.
int localChannelNumberEKLM(KLMChannelNumber channel) const
Get local EKLM channel number.
bool isBKLMChannel(KLMChannelNumber channel) const
Determine whether a given channel is in BKLM.
int localChannelNumberBKLM(KLMChannelNumber channel) const
Get local BKLM channel number.

◆ getExtrapolationLayer()

int getExtrapolationLayer ( int  subdetector,
int  layer 
) const

Get extrapolation layer number (BKLM - from 1 to 15, EKLM - from 16 to 29).

Parameters
[in]subdetectorSubdetector.
[in]layerLayer.

Definition at line 246 of file KLMElementNumbers.cc.

247{
248 if (subdetector == c_BKLM)
249 return layer;
250 else
252}
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).

◆ getMaximalExtrapolationLayer()

static constexpr int getMaximalExtrapolationLayer ( )
inlinestaticconstexpr

Get maximal extrapolation layer.

Definition at line 244 of file KLMElementNumbers.h.

245 {
248 }
static constexpr int getMaximalLayerNumber()
Get maximal layer number.

◆ getMaximalPlaneNumber()

static constexpr int getMaximalPlaneNumber ( )
inlinestaticconstexpr

Get maximal plane number.

Definition at line 268 of file KLMElementNumbers.h.

269 {
270 /* BKLM plane number is 0-based! */
273 }
static constexpr int getMaximalPlaneNumber()
Get maximal plane number (0-based).
static constexpr int getMaximalPlaneNumber()
Get maximal plane number.

◆ getMinimalPlaneNumber()

int getMinimalPlaneNumber ( int  subdetector) const

Get minimal plane number.

Parameters
[in]subdetectorSubdetector.

Definition at line 254 of file KLMElementNumbers.cc.

255{
256 if (subdetector == c_BKLM)
257 return 0;
258 else
259 return 1;
260}

◆ getNChannelsModule()

unsigned int getNChannelsModule ( KLMModuleNumber  module) const

Get number of channels in module.

Parameters
[in]moduleKLM module number.

Definition at line 216 of file KLMElementNumbers.cc.

217{
218 if (isBKLMChannel(module)) {
219 int localModule = localChannelNumberBKLM(module);
220 int section, sector, layer;
222 localModule, &section, &sector, &layer);
223 return BKLMElementNumbers::getNStrips(section, sector, layer, 0) +
224 BKLMElementNumbers::getNStrips(section, sector, layer, 1);
225 } else {
227 }
228}
static void moduleNumberToElementNumbers(KLMModuleNumber module, int *section, int *sector, int *layer)
Get element numbers by module number.
static int getNStrips(int section, int sector, int layer, int plane)
Get number of strips.
static constexpr int getNStripsSector()
Get number of strips in a sector.

◆ getSectorDAQName()

std::string getSectorDAQName ( int  subdetector,
int  section,
int  sector 
) const

Get DAQ name for a given sector.

Parameters
[in]subdetectorSubdetector.
[in]sectionSection.
[in]sectorSector.

Definition at line 262 of file KLMElementNumbers.cc.

263{
264 std::string name;
265 if (subdetector == c_BKLM) {
268 name = "BB" + std::to_string(sector - 1);
270 name = "BF" + std::to_string(sector - 1);
271 }
272 if (subdetector == c_EKLM) {
275 name = "EB" + std::to_string(sector - 1);
277 name = "EF" + std::to_string(sector - 1);
278 }
279 if (name.empty())
280 B2FATAL("Invalid KLM sector."
281 << LogVar("Subdetector", subdetector)
282 << LogVar("Section", section)
283 << LogVar("Sector", sector));
284 return name;
285}
static bool checkSector(int sector, bool fatalError=true)
Check if sector number is correct.
bool checkSector(int sector, bool fatalError=true) const
Check if sector number is correct (fatal error if not).
Class to store variables with their name which were sent to the logging service.

◆ getTotalChannelNumber()

static constexpr int getTotalChannelNumber ( )
inlinestaticconstexpr

Get total number of channels.

Definition at line 286 of file KLMElementNumbers.h.

287 {
290 }
static constexpr int getTotalChannelNumber()
Get total number of channels.
static constexpr int getTotalChannelNumber()
Get total number of channels.

◆ getTotalModuleNumber()

static constexpr int getTotalModuleNumber ( )
inlinestaticconstexpr

Get total number of modules.

Definition at line 253 of file KLMElementNumbers.h.

254 {
257 }
static constexpr int getMaximalLayerGlobalNumber()
Get maximal layer global number.
static constexpr int getMaximalSectorGlobalNumber()
Get maximal sector global number.

◆ Instance()

const KLMElementNumbers & Instance ( )
static

Instantiation.

Definition at line 29 of file KLMElementNumbers.cc.

30{
31 static KLMElementNumbers klmElementNumbers;
32 return klmElementNumbers;
33}
KLM element numbers.

◆ isBKLMChannel()

bool isBKLMChannel ( KLMChannelNumber  channel) const

Determine whether a given channel is in BKLM.

This function also works for modules amd sectors.

Parameters
[in]channelKLM channel number.

Definition at line 80 of file KLMElementNumbers.cc.

81{
82 return (channel >= m_BKLMOffset);
83}

◆ isEKLMChannel()

bool isEKLMChannel ( KLMChannelNumber  channel) const

Determine whether a given channel is in EKLM.

This function also works for modules amd sectors.

Parameters
[in]channelKLM channel number.

Definition at line 85 of file KLMElementNumbers.cc.

86{
87 return (channel < m_BKLMOffset);
88}

◆ localChannelNumberBKLM()

int localChannelNumberBKLM ( KLMChannelNumber  channel) const

Get local BKLM channel number.

This function also works for modules amd sectors.

Parameters
[in]channelKLM channel number.

Definition at line 90 of file KLMElementNumbers.cc.

91{
92 if (!isBKLMChannel(channel))
93 B2FATAL("Cannot get BKLM local channel number for non-BKLM channel.");
94 return channel - m_BKLMOffset;
95}

◆ localChannelNumberEKLM()

int localChannelNumberEKLM ( KLMChannelNumber  channel) const

Get local EKLM channel number.

This function also works for modules amd sectors.

Parameters
[in]channelKLM channel number.

Definition at line 97 of file KLMElementNumbers.cc.

98{
99 if (!isEKLMChannel(channel))
100 B2FATAL("Cannot get EKLM local channel number for non-EKLM channel.");
101 return channel;
102}
bool isEKLMChannel(KLMChannelNumber channel) const
Determine whether a given channel is in EKLM.

◆ moduleNumber()

KLMModuleNumber moduleNumber ( int  subdetector,
int  section,
int  sector,
int  layer 
) const

Get module number.

Parameters
[in]subdetectorSubdetector.
[in]sectionSection.
[in]sectorSector (1-based).
[in]layerLayer (1-based).

Definition at line 156 of file KLMElementNumbers.cc.

158{
159 if (subdetector == c_BKLM)
160 return moduleNumberBKLM(section, sector, layer);
161 else
162 return moduleNumberEKLM(section, sector, layer);
163}
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.

◆ moduleNumberBKLM()

KLMModuleNumber moduleNumberBKLM ( int  section,
int  sector,
int  layer 
) const

Get module number for BKLM.

Parameters
[in]sectionForward (1) or backward (0) BKLM.
[in]sectorSector (1-based).
[in]layerLayer (1-based).

Definition at line 165 of file KLMElementNumbers.cc.

167{
168 KLMModuleNumber module;
169 module = BKLMElementNumbers::moduleNumber(section, sector, layer);
170 return module + m_BKLMOffset;
171}
static KLMModuleNumber moduleNumber(int section, int sector, int layer, bool fatalError=true)
Get module number.
uint16_t KLMModuleNumber
Module number.

◆ moduleNumberByChannel()

KLMModuleNumber moduleNumberByChannel ( KLMChannelNumber  channel) const

Get module number by channel number.

Parameters
[in]channelChannel.

Definition at line 185 of file KLMElementNumbers.cc.

187{
188 int subdetector, section, sector, layer, plane, strip;
189 channelNumberToElementNumbers(channel, &subdetector, &section, &sector,
190 &layer, &plane, &strip);
191 return moduleNumber(subdetector, section, sector, layer);
192}
void channelNumberToElementNumbers(KLMChannelNumber channel, int *subdetector, int *section, int *sector, int *layer, int *plane, int *strip) const
Get element numbers by channel number.
KLMModuleNumber moduleNumber(int subdetector, int section, int sector, int layer) const
Get module number.

◆ moduleNumberEKLM()

KLMModuleNumber moduleNumberEKLM ( int  section,
int  sector,
int  layer 
) const

Get module number for EKLM.

Parameters
[in]sectionSection number.
[in]sectorSector number.
[in]layerLayer number.

Definition at line 173 of file KLMElementNumbers.cc.

175{
176 KLMModuleNumber module;
177 /*
178 * Note that the default order of elements is different
179 * for EKLM-specific code!
180 */
181 module = m_eklmElementNumbers->sectorNumber(section, layer, sector);
182 return module;
183}
int sectorNumber(int section, int layer, int sector) const
Get sector number.

◆ moduleNumberToElementNumbers()

void moduleNumberToElementNumbers ( KLMModuleNumber  module,
int *  subdetector,
int *  section,
int *  sector,
int *  layer 
) const

Get element numbers by module number.

Parameters
[in]moduleKLM module number.
[out]subdetectorSubdetector.
[out]sectionSection.
[out]sectorSector.
[out]layerLayer.

Definition at line 194 of file KLMElementNumbers.cc.

197{
198 int localModule;
199 if (isBKLMChannel(module)) {
200 *subdetector = c_BKLM;
201 localModule = localChannelNumberBKLM(module);
203 localModule, section, sector, layer);
204 } else {
205 *subdetector = c_EKLM;
206 localModule = localChannelNumberEKLM(module);
207 /*
208 * Note that the default order of elements is different
209 * for EKLM-specific code!
210 */
212 localModule, section, layer, sector);
213 }
214}
void sectorNumberToElementNumbers(int sectorGlobal, int *section, int *layer, int *sector) const
Get element numbers by sector global number.

◆ planeNumber()

KLMPlaneNumber planeNumber ( int  subdetector,
int  section,
int  sector,
int  layer,
int  plane 
) const

Get plane number.

Parameters
[in]subdetectorSubdetector.
[in]sectionSection.
[in]sectorSector.
[in]layerLayer.
[in]planePlane.

Definition at line 126 of file KLMElementNumbers.cc.

128{
129 if (subdetector == c_BKLM)
130 return planeNumberBKLM(section, sector, layer, plane);
131 else
132 return planeNumberEKLM(section, sector, layer, plane);
133}
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.

◆ planeNumberBKLM()

KLMPlaneNumber planeNumberBKLM ( int  section,
int  sector,
int  layer,
int  plane 
) const

Get plane number for BKLM.

Parameters
[in]sectionForward (1) or backward (0) BKLM.
[in]sectorSector (1-based).
[in]layerLayer (1-based).
[in]planePlane (0-based).

Definition at line 135 of file KLMElementNumbers.cc.

137{
138 KLMPlaneNumber planeGlobal;
139 planeGlobal = BKLMElementNumbers::planeNumber(section, sector, layer, plane);
140 return planeGlobal + m_BKLMOffset;
141}
static KLMPlaneNumber planeNumber(int section, int sector, int layer, int plane)
Get plane number.
uint16_t KLMPlaneNumber
Plane number.

◆ planeNumberEKLM()

KLMPlaneNumber planeNumberEKLM ( int  section,
int  sector,
int  layer,
int  plane 
) const

Get channel number for EKLM.

Parameters
[in]sectionSection number.
[in]sectorSector number.
[in]layerLayer number.
[in]planePlane number.

Definition at line 143 of file KLMElementNumbers.cc.

145{
146 KLMPlaneNumber planeGlobal;
147 /*
148 * Note that the default order of elements is different
149 * for EKLM-specific code!
150 */
151 planeGlobal = m_eklmElementNumbers->planeNumber(
152 section, layer, sector, plane);
153 return planeGlobal;
154}
int planeNumber(int section, int layer, int sector, int plane) const
Get plane number.

◆ sectorNumberBKLM()

KLMSectorNumber sectorNumberBKLM ( int  section,
int  sector 
) const

Get sector number for BKLM.

Parameters
[in]sectionForward (1) or backward (0) BKLM.
[in]sectorSector (1-based).

Definition at line 230 of file KLMElementNumbers.cc.

232{
233 KLMSectorNumber sect;
234 sect = BKLMElementNumbers::sectorNumber(section, sector);
235 return sect + m_BKLMOffset;
236}
static KLMSectorNumber sectorNumber(int section, int sector)
Get sector number.
uint16_t KLMSectorNumber
Sector number.

◆ sectorNumberEKLM()

KLMSectorNumber sectorNumberEKLM ( int  section,
int  sector 
) const

Get sector number for EKLM.

Parameters
[in]sectionSection number.
[in]sectorSector number.

Definition at line 238 of file KLMElementNumbers.cc.

240{
241 KLMSectorNumber sect;
242 sect = m_eklmElementNumbers->sectorNumberKLMOrder(section, sector);
243 return sect;
244}
int sectorNumberKLMOrder(int section, int sector) const
Get sector number (KLM order of elements: section, sector, layer).

Member Data Documentation

◆ m_BKLMOffset

constexpr uint16_t m_BKLMOffset = 0x8000
staticconstexprprivate

BKLM offset.

Definition at line 305 of file KLMElementNumbers.h.

◆ m_eklmElementNumbers

const EKLMElementNumbers* m_eklmElementNumbers
private

EKLM element numbers.

Definition at line 308 of file KLMElementNumbers.h.


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