Belle II Software development
ECLChannelMapper.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11/* ECL headers. */
12#include <ecl/dbobjects/ECLChannelMap.h>
13
14namespace Belle2 {
19 namespace ECL {
29 class ECLChannelMapper final {
30
33
35 int convertArrayBarrel[ECL_BARREL_CRATES * ECL_BARREL_SHAPERS_IN_CRATE * ECL_CHANNELS_IN_SHAPER];
37 int convertArrayFWD[ECL_FWD_CRATES * ECL_FWD_SHAPERS_IN_CRATE * ECL_CHANNELS_IN_SHAPER];
39 int convertArrayBKW[ECL_BKW_CRATES * ECL_BKW_SHAPERS_IN_CRATE * ECL_CHANNELS_IN_SHAPER];
41 int convertArrayInv[ECL_TOTAL_CHANNELS][3]; // 0 -- icrate, 1 -- iboard, 2 -- ichannel
44
45 public:
50
54 static ECLChannelMapper* getInstance(bool use_db = true);
55
57 bool initFromFile();
59 bool initFromFile(const char* eclMapFile);
61 bool initFromDB();
64
70 int getCrateID(int iCOPPERNode, int iFINESSE, bool pcie40 = false);
72 int getCellId(int iCrate, int iShaper, int iChannel);
74 int getCOPPERNode(int iCrate);
76 int getFINESSE(int iCrate);
78 int getSubSystem(int iCrate);
79
81 int getCrateID(int cellID);
83 int getShaperPosition(int cellID);
85 int getShaperChannel(int cellID);
87 int getElectronicsID(int cellID);
88
90 inline int getNShapersInCrate(int iCrate)
91 {
92 if (iCrate <= ECL_BARREL_CRATES) return ECL_BARREL_SHAPERS_IN_CRATE;
93 if (ECL_BARREL_CRATES < iCrate && iCrate <= ECL_BARREL_CRATES + ECL_FWD_CRATES) return ECL_FWD_SHAPERS_IN_CRATE;
94 if (ECL_BARREL_CRATES + ECL_FWD_CRATES < iCrate && iCrate <= ECL_CRATES) return ECL_BKW_SHAPERS_IN_CRATE;
95 return 0;
96 }
97
100 };
101 }
103}
DB object to store correspondence table of type (Crate id, ShaperDSP id, Channel id) <-> (ECL CellID)
Definition: ECLChannelMap.h:51
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
int getSubSystem(int iCrate)
Get ECL subsystem ID by given crate number: 0 – barrel, 1 – forward. 2 – backward endcap.
static ECLChannelMapper * instance
Main instance of ECLChannelMapper.
ClassDef(ECLChannelMapper, 1)
ClassDef.
bool initFromDB()
Initialize channel mapper from the conditions database.
bool isInitialized
initialization flag
ECLChannelMap getDBObject()
Convert internal data to ECLChannelMap database object.
bool initFromFile()
Initialize channel mapper using data stored in default location.
int getElectronicsID(int cellID)
Return channel index in ECLChannelMap.
~ECLChannelMapper()
Default destructor.
int convertArrayFWD[ECL_FWD_CRATES *ECL_FWD_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
convert (iCrate, iShaper, iChannel) to CellId for Forward endcap
int getFINESSE(int iCrate)
Get number of FINESSE (0/1) in COPPER by given crate number.
ECLChannelMapper()
Default constructor.
int getNShapersInCrate(int iCrate)
Get number of ShaperDSP modules in the given VME crate number.
int getCellId(int iCrate, int iShaper, int iChannel)
Get CellId by given crate number, shaper position in the crate and DSP channel number in the shaper.
int convertArrayBKW[ECL_BKW_CRATES *ECL_BKW_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
convert (iCrate, iShaper, iChannel) to CellId Backward endcap
int getShaperChannel(int cellID)
Get number of DSP channel in the shaper by given number of CellId.
int getShaperPosition(int cellID)
Get position of the shaper in the crate by given CellId.
int getCOPPERNode(int iCrate)
Get number of COPPER node by given crate number.
static ECLChannelMapper * getInstance(bool use_db=true)
Return main instance of ECLChannelMapper.
int convertArrayInv[ECL_TOTAL_CHANNELS][3]
convert CellId to (iCrate, iShaper, iChannel)
int convertArrayBarrel[ECL_BARREL_CRATES *ECL_BARREL_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
convert (iCrate, iShaper, iChannel) to CellId for Barrel ECL
int getCrateID(int iCOPPERNode, int iFINESSE, bool pcie40=false)
Get crate number by given COPPER node number and FINESSE number.
Abstract base class for different kinds of events.