10#include <klm/dataobjects/KLMElementNumbers.h>
13#include <klm/dataobjects/bklm/BKLMElementNumbers.h>
16#include <framework/logging/Logger.h>
32 return klmElementNumbers;
36 int subdetector,
int section,
int sector,
int layer,
int plane,
39 switch (subdetector) {
45 B2FATAL(
"Incorrect subdetector number: " << subdetector);
49 int section,
int sector,
int layer,
int plane,
int strip)
const
53 section, sector, layer, plane, strip);
63 int section,
int sector,
int layer,
int plane,
int strip)
const
71 section, layer, sector, plane, strip);
93 B2FATAL(
"Cannot get BKLM local channel number for non-BKLM channel.");
100 B2FATAL(
"Cannot get EKLM local channel number for non-EKLM channel.");
105 KLMChannelNumber channel,
int* subdetector,
int* section,
int* sector,
int* layer,
106 int* plane,
int* strip)
const
113 localChannel, section, sector, layer, plane, strip);
122 localChannel, section, layer, sector, plane, strip);
127 int subdetector,
int section,
int sector,
int layer,
int plane)
const
129 if (subdetector ==
c_BKLM)
136 int section,
int sector,
int layer,
int plane)
const
144 int section,
int sector,
int layer,
int plane)
const
152 section, layer, sector, plane);
157 int subdetector,
int section,
int sector,
int layer)
const
159 if (subdetector ==
c_BKLM)
166 int section,
int sector,
int layer)
const
174 int section,
int sector,
int layer)
const
188 int subdetector, section, sector, layer, plane, strip;
190 &layer, &plane, &strip);
191 return moduleNumber(subdetector, section, sector, layer);
203 localModule, section, sector, layer);
212 localModule, section, layer, sector);
220 int section, sector, layer;
222 localModule, §ion, §or, &layer);
231 int section,
int sector)
const
239 int section,
int sector)
const
248 if (subdetector ==
c_BKLM)
256 if (subdetector ==
c_BKLM)
265 if (subdetector ==
c_BKLM) {
268 name =
"BB" + std::to_string(sector - 1);
270 name =
"BF" + std::to_string(sector - 1);
272 if (subdetector ==
c_EKLM) {
275 name =
"EB" + std::to_string(sector - 1);
277 name =
"EF" + std::to_string(sector - 1);
280 B2FATAL(
"Invalid KLM sector."
281 <<
LogVar(
"Subdetector", subdetector)
282 <<
LogVar(
"Section", section)
283 <<
LogVar(
"Sector", sector));
static void channelNumberToElementNumbers(KLMChannelNumber channel, int *section, int *sector, int *layer, int *plane, int *strip)
Get element numbers by channel number.
static KLMPlaneNumber planeNumber(int section, int sector, int layer, int plane)
Get plane number.
static bool checkSector(int sector, bool fatalError=true)
Check if sector number is correct.
static KLMChannelNumber channelNumber(int section, int sector, int layer, int plane, int strip)
Get channel number.
static KLMSectorNumber sectorNumber(int section, int sector)
Get sector number.
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
@ c_ForwardSection
Forward.
@ c_BackwardSection
Backward.
static KLMModuleNumber moduleNumber(int section, int sector, int layer, bool fatalError=true)
Get module number.
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.
int sectorNumber(int section, int layer, int sector) const
Get sector number.
void sectorNumberToElementNumbers(int sectorGlobal, int *section, int *layer, int *sector) const
Get element numbers by sector global number.
int stripNumber(int section, int layer, int sector, int plane, int strip) const
Get strip number.
int sectorNumberKLMOrder(int section, int sector) const
Get sector number (KLM order of elements: section, sector, layer).
void stripNumberToElementNumbers(int stripGlobal, int *section, int *layer, int *sector, int *plane, int *strip) const
Get element numbers by strip global number.
bool checkSector(int sector, bool fatalError=true) const
Check if sector number is correct (fatal error if not).
@ c_ForwardSection
Forward.
@ c_BackwardSection
Backward.
int planeNumber(int section, int layer, int sector, int plane) const
Get plane number.
KLMSectorNumber sectorNumberEKLM(int section, int sector) const
Get sector number for EKLM.
KLMModuleNumber moduleNumberByChannel(KLMChannelNumber channel) const
Get module number by channel number.
KLMChannelNumber channelNumberBKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for BKLM.
static constexpr uint16_t m_BKLMOffset
BKLM offset.
KLMChannelNumber channelNumber(int subdetector, int section, int sector, int layer, int plane, int strip) const
Get channel number.
const EKLMElementNumbers * m_eklmElementNumbers
EKLM element numbers.
int getMinimalPlaneNumber(int subdetector) const
Get minimal plane number.
static const KLMElementNumbers & Instance()
Instantiation.
int localChannelNumberEKLM(KLMChannelNumber channel) const
Get local EKLM channel number.
KLMPlaneNumber planeNumber(int subdetector, int section, int sector, int layer, int plane) const
Get plane number.
KLMPlaneNumber planeNumberEKLM(int section, int sector, int layer, int plane) const
Get channel number for EKLM.
bool isEKLMChannel(KLMChannelNumber channel) const
Determine whether a given channel is in EKLM.
void channelNumberToElementNumbers(KLMChannelNumber channel, int *subdetector, int *section, int *sector, int *layer, int *plane, int *strip) const
Get element numbers by channel number.
unsigned int getNChannelsModule(KLMModuleNumber module) const
Get number of channels in module.
int getExtrapolationLayer(int subdetector, int layer) const
Get extrapolation layer number (BKLM - from 1 to 15, EKLM - from 16 to 29).
void moduleNumberToElementNumbers(KLMModuleNumber module, int *subdetector, int *section, int *sector, int *layer) const
Get element numbers by module number.
KLMPlaneNumber planeNumberBKLM(int section, int sector, int layer, int plane) const
Get plane number for BKLM.
~KLMElementNumbers()
Destructor.
KLMModuleNumber moduleNumberBKLM(int section, int sector, int layer) const
Get module number for BKLM.
KLMModuleNumber moduleNumber(int subdetector, int section, int sector, int layer) const
Get module number.
KLMSectorNumber sectorNumberBKLM(int section, int sector) const
Get sector number for BKLM.
std::string getSectorDAQName(int subdetector, int section, int sector) const
Get DAQ name for a given sector.
KLMModuleNumber moduleNumberEKLM(int section, int sector, int layer) const
Get module number for EKLM.
bool isBKLMChannel(KLMChannelNumber channel) const
Determine whether a given channel is in BKLM.
int localChannelNumberBKLM(KLMChannelNumber channel) const
Get local BKLM channel number.
KLMElementNumbers()
Constructor.
KLMChannelNumber channelNumberEKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for EKLM.
Class to store variables with their name which were sent to the logging service.
uint16_t KLMSectorNumber
Sector number.
uint16_t KLMChannelNumber
Channel number.
uint16_t KLMModuleNumber
Module number.
uint16_t KLMPlaneNumber
Plane number.
Abstract base class for different kinds of events.