Belle II Software  release-05-02-19
ECLChannelMapper.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Shebalin Vasily *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #ifndef ECLCHANNELMAPPER_H
11 #define ECLCHANNELMAPPER_H
12 #include <ecl/dbobjects/ECLChannelMap.h>
13 namespace Belle2 {
18  namespace ECL {
28  class ECLChannelMapper {
29 
31  bool isInitialized;
32 
34  int convertArrayBarrel[ECL_BARREL_CRATES * ECL_BARREL_SHAPERS_IN_CRATE * ECL_CHANNELS_IN_SHAPER];
36  int convertArrayFWD[ECL_FWD_CRATES * ECL_FWD_SHAPERS_IN_CRATE * ECL_CHANNELS_IN_SHAPER];
38  int convertArrayBKW[ECL_BKW_CRATES * ECL_BKW_SHAPERS_IN_CRATE * ECL_CHANNELS_IN_SHAPER];
40  int convertArrayInv[ECL_TOTAL_CHANNELS][3]; // 0 -- icrate, 1 -- iboard, 2 -- ichannel
41 
42  public:
48  bool initFromFile();
50  bool initFromFile(const char* eclMapFile);
52  bool initFromDB();
55 
57  int getCrateID(int iCOPPERNode, int iFINESSE); // iFINNES = 0 (FINESSE A) or 1 (FINESSE B)
59  int getCellId(int iCrate, int iShaper, int iChannel);
61  int getCOPPERNode(int iCrate);
63  int getFINESSE(int iCrate);
65  int getSubSystem(int iCrate);
66 
68  int getCrateID(int cellID);
70  int getShaperPosition(int cellID);
72  int getShaperChannel(int cellID);
73 
75  inline int getNShapersInCrate(int iCrate)
76  {
77  if (iCrate <= ECL_BARREL_CRATES) return ECL_BARREL_SHAPERS_IN_CRATE;
78  if (ECL_BARREL_CRATES < iCrate && iCrate <= ECL_BARREL_CRATES + ECL_FWD_CRATES) return ECL_FWD_SHAPERS_IN_CRATE;
79  if (ECL_BARREL_CRATES + ECL_FWD_CRATES < iCrate && iCrate <= ECL_CRATES) return ECL_BKW_SHAPERS_IN_CRATE;
80  return 0;
81  }
82  };
83  }
85 }
86 #endif
Belle2::ECL::ECLChannelMapper::~ECLChannelMapper
~ECLChannelMapper()
Default destructor.
Definition: ECLChannelMapper.h:54
Belle2::ECL::ECLChannelMapper::getCrateID
int getCrateID(int iCOPPERNode, int iFINESSE)
get crate number by given COPPER node number and FINESSE number
Definition: ECLChannelMapper.cc:211
Belle2::ECL::ECLChannelMapper::getShaperPosition
int getShaperPosition(int cellID)
get position of the shaper in the crate by given CellId
Definition: ECLChannelMapper.cc:289
Belle2::ECL::ECLChannelMapper::getSubSystem
int getSubSystem(int iCrate)
get ECL subsystem ID by given crate number: 0 – barrel, 1 – forward. 2 – backward endcap
Definition: ECLChannelMapper.cc:322
Belle2::ECL::ECLChannelMapper::getShaperChannel
int getShaperChannel(int cellID)
get number of DSP channel in the shaper by given number of CellId
Definition: ECLChannelMapper.cc:296
Belle2::ECLChannelMap
DB object to store correspondence table of type (Crate id, ShaperDSP id, Channel id) <-> (ECL CellID)
Definition: ECLChannelMap.h:58
Belle2::ECL::ECLChannelMapper::initFromFile
bool initFromFile()
Initialize channel mapper using data stored in default location.
Definition: ECLChannelMapper.cc:31
Belle2::ECL::ECLChannelMapper::convertArrayInv
int convertArrayInv[ECL_TOTAL_CHANNELS][3]
convert CellId to (iCrate, iShaper, iChannel)
Definition: ECLChannelMapper.h:48
Belle2::ECL::ECLChannelMapper::getFINESSE
int getFINESSE(int iCrate)
get number of FINESSE (0/1) in COPPER by given crate number
Definition: ECLChannelMapper.cc:315
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECL::ECLChannelMapper::isInitialized
bool isInitialized
initialization flag
Definition: ECLChannelMapper.h:39
Belle2::ECL::ECLChannelMapper::getCellId
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
Definition: ECLChannelMapper.cc:244
Belle2::ECL::ECLChannelMapper::convertArrayBarrel
int convertArrayBarrel[ECL_BARREL_CRATES *ECL_BARREL_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
convert (iCrate, iShaper, iChannel) to CellId for Barrel ECL
Definition: ECLChannelMapper.h:42
Belle2::ECL::ECLChannelMapper::convertArrayBKW
int convertArrayBKW[ECL_BKW_CRATES *ECL_BKW_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
convert (iCrate, iShaper, iChannel) to CellId Backward endcap
Definition: ECLChannelMapper.h:46
Belle2::ECL::ECLChannelMapper::initFromDB
bool initFromDB()
Initialize channel mapper from the conditions database.
Definition: ECLChannelMapper.cc:105
Belle2::ECL::ECLChannelMapper::getCOPPERNode
int getCOPPERNode(int iCrate)
get number of COPPER node by given crate number
Definition: ECLChannelMapper.cc:303
Belle2::ECL::ECLChannelMapper::getNShapersInCrate
int getNShapersInCrate(int iCrate)
get number of ShaperDSP modules in the given VME crate number
Definition: ECLChannelMapper.h:83
Belle2::ECL::ECLChannelMapper::getDBObject
ECLChannelMap getDBObject()
Convert internal data to ECLChannelMap database object.
Definition: ECLChannelMapper.cc:183
Belle2::ECL::ECLChannelMapper::ECLChannelMapper
ECLChannelMapper()
Default constructor.
Definition: ECLChannelMapper.cc:14
Belle2::ECL::ECLChannelMapper::convertArrayFWD
int convertArrayFWD[ECL_FWD_CRATES *ECL_FWD_SHAPERS_IN_CRATE *ECL_CHANNELS_IN_SHAPER]
convert (iCrate, iShaper, iChannel) to CellId for Forward endcap
Definition: ECLChannelMapper.h:44