10#include <klm/dataobjects/eklm/EKLMElementNumbers.h>
13#include <framework/logging/Logger.h>
14#include <rawdata/dataobjects/RawCOPPERFormat.h>
36 B2FATAL(
"Number of section must be 1 (backward) or 2 (forward).");
56 bool fatalError)
const
59 const char* sectionName[2] = {
"backward",
"forward"};
62 B2FATAL(
"Number of layer must be from 1 to the maximal number of "
63 "detector layers in the " << sectionName[section - 1] <<
" section ("
99 B2FATAL(
"Number of segment must be from 1 to " <<
129 int layerGlobal,
int* section,
int* layer)
const
132 if (layerGlobal <= 0 || layerGlobal > maxLayer)
133 B2FATAL(
"Number of segment must be from 1 to " << maxLayer <<
".");
136 *layer = layerGlobal;
158 int sectorGlobal,
int* section,
int* layer,
int* sector)
const
162 if (sectorGlobal <= 0 || sectorGlobal > maxSector)
163 B2FATAL(
"Number of segment must be from 1 to " << maxSector <<
".");
178 int planeGlobal,
int* section,
int* layer,
int* sector,
int* plane)
const
182 if (planeGlobal <= 0 || planeGlobal > maxPlane)
183 B2FATAL(
"Number of segment must be from 1 to " << maxPlane <<
".");
190 int plane,
int segment)
const
198 int segmentGlobal,
int* section,
int* layer,
int* sector,
int* plane,
203 if (segmentGlobal <= 0 || segmentGlobal > maxSegment)
204 B2FATAL(
"Number of segment must be from 1 to " << maxSegment <<
".");
211 int plane,
int strip)
const
219 int stripGlobal,
int* section,
int* layer,
int* sector,
int* plane,
224 if (stripGlobal <= 0 || stripGlobal > maxStrip)
225 B2FATAL(
"Number of strip must be from 1 to " << maxStrip <<
".");
233 int section, layer, sector, plane, strip;
235 §ion, &layer, §or, &plane, &strip);
241 int section, layer, sector, plane, strip;
243 §ion, &layer, §or, &plane, &strip);
249 int section, layer, sector, plane, strip;
251 §ion, &layer, §or, &plane, &strip);
257 int section, layer, sector, plane, strip;
259 §ion, &layer, §or, &plane, &strip);
266 if (stripGlobal <= 0 || stripGlobal > maxStrip)
267 B2FATAL(
"Number of strip must be from 1 to " << maxStrip <<
".");
273 char hslb =
'a' + slot - 1;
274 return "800" + std::to_string(copper - EKLM_ID) + hslb;
static constexpr int m_MaximalStripNumber
Maximal strip number.
bool checkLayer(int layer, bool fatalError=true) const
Check if layer number is correct.
static constexpr int getMaximalLayerGlobalNumber()
Get maximal detector layer global number.
void planeNumberToElementNumbers(int planeGlobal, int *section, int *layer, int *sector, int *plane) const
Get element numbers by plane global number.
int getMaximalDetectorLayerNumber(int section) const
Get maximal detector layer number.
static const EKLMElementNumbers & Instance()
Instantiation.
int sectorNumber(int section, int layer, int sector) const
Get sector number.
~EKLMElementNumbers()
Destructor.
void sectorNumberToElementNumbers(int sectorGlobal, int *section, int *layer, int *sector) const
Get element numbers by sector global number.
static constexpr int m_MaximalPlaneNumber
Maximal plane number.
static constexpr int m_MaximalSectionNumber
Maximal section number.
static constexpr int m_MaximalDetectorLayerNumber[2]
Maximal detector layer number.
int getPlaneByGlobalStrip(int stripGlobal)
Get plane number by global strip number.
bool checkPlane(int plane, bool fatalError=true) const
Check if plane number is correct (fatal error if not).
bool checkDetectorLayer(int section, int layer, bool fatalError=true) const
Check if detector layer number is correct (fatal error if not).
int getStripByGlobalStrip(int stripGlobal)
Get strip number by global strip number.
int getSectorByGlobalStrip(int stripGlobal)
Get sector number by global strip number.
bool checkStrip(int strip, bool fatalError=true) const
Check if strip number is correct (fatal error if not).
void layerNumberToElementNumbers(int layerGlobal, int *section, int *layer) const
Get element numbers by detector layer global number.
int detectorLayerNumber(int section, int layer) const
Get detector layer number.
bool checkSegment(int segment, bool fatalError=true) const
Check if segment number is correct (fatal error if not).
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.
EKLMElementNumbers()
Constructor.
static constexpr int getMaximalPlaneGlobalNumber()
Get maximal plane global number.
bool checkSector(int sector, bool fatalError=true) const
Check if sector number is correct (fatal error if not).
static constexpr int getMaximalStripGlobalNumber()
Get maximal strip global number.
static std::string getHSLBName(int copper, int slot)
Get HSLB name.
static constexpr int m_MaximalSectorNumber
Maximal sector number.
static constexpr int getMaximalSegmentGlobalNumber()
Get maximal segment global number.
int getSectionByGlobalStrip(int stripGlobal)
Get section number by global strip number.
int segmentNumber(int section, int layer, int sector, int plane, int segment) const
Get segment number.
static constexpr int m_MaximalLayerNumber
Maximal layer number.
int getLayerByGlobalStrip(int stripGlobal)
Get layer number by global strip number.
static constexpr int getMaximalSectorGlobalNumber()
Get maximal sector global number.
bool checkSection(int section, bool fatalError=true) const
Check if section number is correct.
int planeNumber(int section, int layer, int sector, int plane) const
Get plane number.
static constexpr int m_MaximalSegmentNumber
Maximal segment number.
void segmentNumberToElementNumbers(int segmentGlobal, int *section, int *layer, int *sector, int *plane, int *segment) const
Get element numbers by segment global number.
Abstract base class for different kinds of events.