DAQChannelMap.h
Go to the documentation of this file.
1 #ifndef DAQCHANNELMAP_H
2 #define DAQCHANNELMAP_H
3 #include "DAQChannelMap/DAQChannelMapConstants.h"
4 
5 namespace daqchannelmap
6 {
8  {
9  public:
10 
11  static DAQChannelMap* getInstance(int detID);
12 
14 
15  //==================================================================
16  // The functions in this block are common to all detectors
17 
18  ///
19  /// Encode DAQ format information into a single 32 bit identifier.
20  ///
21  /// \param detID - detector ID from NovaDAQConventions
22  /// \param diblock - diblock ID number. Starts from 1
23  /// \param dcm - DCM id within diblock, starts from 1
24  /// \param feb - FEB id within DCM, starts from 0
25  /// \param pixel - pixel id within FEB, starts from 0
26  /// \returns 32-bit encoded channel "DAQ" ID
27  ///
28  dchan encodeDChan(int detID,
30  dcm_id_t dcm,
31  feb_t feb,
32  pixel_t pixel) const;
33  ///
34  /// Encode logical format information (physical detector
35  /// coordinates) into a single 32 bit identifier.
36  ///
37  /// \param detID - detector ID from NovaDAQConventions
38  /// \param plane - global plane number, starts from 0 at south
39  /// \param cell - global cell number, starts from 0 at bottom
40  /// \returns 32-bit encoded channel "logical" ID
41  ///
43 
44  /// Return the detector type given either a dchan or an lchan
45  /// identifier - in this case the decoding is the same
46  int getDetector(uint32_t anychan) const;
47 
48  /// Decode the diblock ID from a dchan
49  diblock_t getDiBlock(dchan daqchan) const;
50 
51  /// Decode the dcm ID from a dchan
52  dcm_id_t getDCM(dchan daqchan) const;
53 
54  /// Decode the feb id from a dchan
55  feb_t getFEB(dchan daqchan) const;
56 
57  /// Decode the pixel id from a dchan
58  pixel_t getPixel(dchan daqchan) const;
59 
60  /// Decode the plane number from an lchan
61  plane_t getPlane(lchan logicalchan) const;
62 
63  /// Decode the cell number from an lchan
64  cell_t getCell(lchan logicalchan) const;
65  //
66  //==================================================================
67 
68  //==================================================================
69  // The functions in this block must be implemented by the
70  // subclasses as they are detector-specific
71 
72  /// Convert a logical channel ID to a DAQ channel id
73  virtual dchan encodeDChan(lchan logicalchan) const = 0;
74 
75  /// Convert a DAQ channel ID to a logical channel id
76  virtual lchan encodeLChan(dchan daqchan) const = 0;
77 
78  /// Which view (X or Y) does this daq channel readout?
79  virtual DetView_TYPE getView(dchan daqchan) const = 0;
80 
81  /// Which block is this lchan in?
82  virtual block_t computeBlock(lchan logicalchan) const = 0;
83 
84  /// Which global plane in this lchan in?
85  virtual plane_t computePlaneInBlock(lchan logicalchan) const = 0;
86 
87  /// Which module in this lchan in?
88  virtual unsigned int computeModule(lchan logicalchan) const = 0;
89 
90  /// Which fiber does this dchan readout?
91  virtual fiber_t computeFiberInModule(dchan daqchan) const = 0;
92 
93  /// How many diblocks does the detector have?
94  virtual unsigned int getTotalNumberOfDiblocks() const = 0;
95 
96  /// How many DCMs does this diblock have?
97  virtual unsigned int getNumberOfDCM(DiBlock_TYPE dbt) const = 0;
98 
99  /// What format is the diblock? Only relevant in NDOS.
100  virtual DiBlock_TYPE getDiBlockType(dchan chan) const = 0;
101 
102  //
103  //==================================================================
104  protected:
105  /// DAQChannelMap is a singleton - keep the constructor private
106  DAQChannelMap();
107  };
108 }
109 
110 #endif
int getDetector(uint32_t anychan) const
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
virtual unsigned int getNumberOfDCM(DiBlock_TYPE dbt) const =0
How many DCMs does this diblock have?
uint32_t pixel_t
Type for physical pixel on APD.
virtual unsigned int computeModule(lchan logicalchan) const =0
Which module in this lchan in?
virtual DetView_TYPE getView(dchan daqchan) const =0
Which view (X or Y) does this daq channel readout?
cell_t getCell(lchan logicalchan) const
Decode the cell number from an lchan.
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
static DAQChannelMap * getInstance(int detID)
DAQChannelMap()
DAQChannelMap is a singleton - keep the constructor private.
virtual unsigned int getTotalNumberOfDiblocks() const =0
How many diblocks does the detector have?
uint32_t feb_t
Type for DCM link port. Counts from 0.
uint32_t dcm_id_t
Type for DCM number, counts from 1.
pixel_t getPixel(dchan daqchan) const
Decode the pixel id from a dchan.
uint32_t plane_t
Type for plane.
DetView_TYPE
Types of Detector View.
plane_t getPlane(lchan logicalchan) const
Decode the plane number from an lchan.
uint32_t diblock_t
Type for diblocks and blocks.
dcm_id_t getDCM(dchan daqchan) const
Decode the dcm ID from a dchan.
dchan encodeDChan(int detID, diblock_t diblock, dcm_id_t dcm, feb_t feb, pixel_t pixel) const
virtual fiber_t computeFiberInModule(dchan daqchan) const =0
Which fiber does this dchan readout?
DiBlock_TYPE
Types of Diblock.
virtual block_t computeBlock(lchan logicalchan) const =0
Which block is this lchan in?
uint32_t dchan
< DAQ Channel Map Package
virtual plane_t computePlaneInBlock(lchan logicalchan) const =0
Which global plane in this lchan in?
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
virtual DiBlock_TYPE getDiBlockType(dchan chan) const =0
What format is the diblock? Only relevant in NDOS.
feb_t getFEB(dchan daqchan) const
Decode the feb id from a dchan.