Belle II Software  release-08-01-10
ECLChannelMapper Class Referencefinal

This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbobject/include/ECLChannelMap.h). More...

#include <ECLChannelMapper.h>

Collaboration diagram for ECLChannelMapper:

Public Member Functions

 ECLChannelMapper ()
 Default constructor.
 
 ~ECLChannelMapper ()
 Default destructor.
 
bool initFromFile ()
 Initialize channel mapper using data stored in default location.
 
bool initFromFile (const char *eclMapFile)
 Initialize channel mapper using data stored in the ASCII file.
 
bool initFromDB ()
 Initialize channel mapper from the conditions database.
 
ECLChannelMap getDBObject ()
 Convert internal data to ECLChannelMap database object.
 
int getCrateID (int iCOPPERNode, int iFINESSE, bool pcie40=false)
 Get crate number by given COPPER node number and FINESSE number. More...
 
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 getCOPPERNode (int iCrate)
 Get number of COPPER node by given crate number.
 
int getFINESSE (int iCrate)
 Get number of FINESSE (0/1) in COPPER by given crate number.
 
int getSubSystem (int iCrate)
 Get ECL subsystem ID by given crate number: 0 – barrel, 1 – forward. 2 – backward endcap.
 
int getCrateID (int cellID)
 Get crate number by given CellId.
 
int getShaperPosition (int cellID)
 Get position of the shaper in the crate by given CellId.
 
int getShaperChannel (int cellID)
 Get number of DSP channel in the shaper by given number of CellId.
 
int getElectronicsID (int cellID)
 Return channel index in ECLChannelMap.
 
int getNShapersInCrate (int iCrate)
 Get number of ShaperDSP modules in the given VME crate number.
 
 ClassDef (ECLChannelMapper, 1)
 ClassDef.
 

Static Public Member Functions

static ECLChannelMappergetInstance (bool use_db=true)
 Return main instance of ECLChannelMapper. More...
 

Private Attributes

bool isInitialized
 initialization flag
 
int convertArrayBarrel [ECL_BARREL_CRATES *ECL_BARREL_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
 convert (iCrate, iShaper, iChannel) to CellId for Barrel ECL
 
int convertArrayFWD [ECL_FWD_CRATES *ECL_FWD_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
 convert (iCrate, iShaper, iChannel) to CellId for Forward endcap
 
int convertArrayBKW [ECL_BKW_CRATES *ECL_BKW_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
 convert (iCrate, iShaper, iChannel) to CellId Backward endcap
 
int convertArrayInv [ECL_TOTAL_CHANNELS][3]
 convert CellId to (iCrate, iShaper, iChannel)
 

Static Private Attributes

static ECLChannelMapperinstance = nullptr
 Main instance of ECLChannelMapper.
 

Detailed Description

This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbobject/include/ECLChannelMap.h).

b) (** NOT SUPPORTED **) Loaded from the text file (standard location is FileSystem::findFile("ecl/data/ecl_channels_map.txt"))

Please note that (a) is recommended and (b) should be used only for very specific rare cases (such as prepation of new ECLChannelMap payloads)

Definition at line 29 of file ECLChannelMapper.h.

Member Function Documentation

◆ getCrateID()

int getCrateID ( int  iCOPPERNode,
int  iFINESSE,
bool  pcie40 = false 
)

Get crate number by given COPPER node number and FINESSE number.

Parameters
iCOPPERNodeNode ID (26 nodes in COPPER case, 3 nodes in PCIe40 case)
iFINESSEChannel number (0 or 1 in COPPER case, 0-17 in PCIe40 case)
pcie40Set to true if unpacking PCIe40 data

Definition at line 233 of file ECLChannelMapper.cc.

234 {
235  int iCrate;
236 
237  if (!pcie40) {
238  // Converting from COPPER nodes
239  if (iFINESSE > ECL_FINESSES_IN_COPPER - 1) {
240  B2ERROR("ECLChannelMapper::ERROR:: wrong FINESSE " << iFINESSE);
241  return -1;
242  }
243 
244  if ((iCOPPERNode & BECL_ID) == BECL_ID) {
245  iCrate = (iCOPPERNode - BECL_ID - 1) * ECL_FINESSES_IN_COPPER + iFINESSE + 1;
246  } else if ((iCOPPERNode & EECL_ID) == EECL_ID) {
247  iCrate = ECL_BARREL_CRATES + iFINESSE * ECL_FWD_CRATES + (iCOPPERNode - EECL_ID - 1) + 1;
248  } else {
249  B2ERROR("ECLChannelMapper::ERROR:: wrong COPPER NodeID 0x" << std::hex << iCOPPERNode << " BECL_ID 0x" << BECL_ID << " EECL_ID 0x"
250  << EECL_ID);
251  return -1;
252  }
253  } else {
254  // Converting from PCIe40 nodes
255  const int ECL_BARREL_FEE_IN_PCIE40 = 18;
256  const int ECL_ENDCAP_FEE_IN_PCIE40 = 16;
257 
258  // crates 1..18 -> PCIe40, #1
259  // crates 19..36 -> PCIe40, #2
260  // crates 37,45,38,46,..,44,52 -> PCIe40, #3
261 
262  if (iCOPPERNode == BECL_ID + 1 || iCOPPERNode == BECL_ID + 2) {
263  // Barrel crates
264  iCrate = (iCOPPERNode - BECL_ID - 1) * ECL_BARREL_FEE_IN_PCIE40 + iFINESSE + 1;
265  if (iFINESSE >= ECL_BARREL_FEE_IN_PCIE40) {
266  B2ERROR("ECLChannelMapper:: slot id must be less than 18, got slot id " << iFINESSE);
267  return -1;
268  }
269  } else if (iCOPPERNode == BECL_ID + 3) {
270  // Endcap crates
271  iCrate = 2 * ECL_BARREL_FEE_IN_PCIE40 + (iFINESSE % 2) * 8 + iFINESSE / 2 + 1;
272  if (iFINESSE >= ECL_ENDCAP_FEE_IN_PCIE40) {
273  B2ERROR("ECLChannelMapper:: slot id must be less than 16, got slot id " << iFINESSE);
274  return -1;
275  }
276  } else {
277  B2ERROR("ECLChannelMapper:: wrong COPPER NodeID 0x" << std::hex << iCOPPERNode << " expected BECL_ID 0x" << BECL_ID);
278  return -1;
279  }
280  }
281 
282  if (iCrate > ECL_CRATES || iCrate < 1) {
283  B2ERROR("ECLChannelMapper::getCrateID::ERROR:: wrong crate number " << iCrate << " return -1");
284  return -1;
285  }
286 
287  return iCrate;
288 }

◆ getInstance()

ECLChannelMapper * getInstance ( bool  use_db = true)
static

Return main instance of ECLChannelMapper.

Parameters
use_dbIf true, run initFromDB() at the creation of main instance

Definition at line 49 of file ECLChannelMapper.cc.


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