pflib v3.9.5-18-g30f792c
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pflib::packing::SingleECONDRocErxMapping Class Reference

Mapping for link/channel IDs for single ECON-D collection. More...

#include <SingleECONDRocErxMapping.h>

Collaboration diagram for pflib::packing::SingleECONDRocErxMapping:
[legend]

Public Member Functions

 SingleECONDRocErxMapping (const std::vector< std::pair< int, int > > &roc_half_to_erx, const std::vector< int > &active_rocs)
 Construct the mapping.
 
std::pair< int, int > toROCHalf (int i_erx) const
 Get which ROC-half the input i_erx corresponds to.
 
std::pair< int, int > toROCChannel (int i_erx, int channel) const
 Convert the input (i_erx, channel) index to the (i_roc, channel) index using the RocErxMapping defined for the Target and which ROCs are active.
 
int toErx (int i_roc, int half) const
 Get the i_erx the input ROC-half corresponds to.
 
std::pair< int, int > toErxChannel (int i_roc, int channel) const
 Convert the input (i_roc, channel) index to the (i_erx, channel) index.
 

Private Attributes

std::vector< std::pair< int, int > > roc_half_to_erx_
 mapping from ROC-half to eRx input to ECON-D
 
std::vector< int > i_erx_to_erx_
 map from i_erx index in decoding to eRx ID input to ECON
 
std::vector< int > erx_to_i_erx_
 Map from eRx ID input to ECON to i_erx index in decoding.
 
std::vector< std::pair< int, int > > erx_to_roc_half_
 map from eRx ID input to ECON to ROC-half
 

Detailed Description

Mapping for link/channel IDs for single ECON-D collection.

Note
As the name implies, this logic only works for single-ECON-D setups where all the ROCs are going into a single ECON-D.

Invert the ROC -> eRx pair mapping including which ROCs are active

As far as I (Tom) know, the data is packed into the ECON-D packet in eRx order which, depending on the wiring of the board connecting the ROCs to the ECON-D, can lead to the "first" link not being eRx 0. This means we need to do two "mappings" to get back the ROC-half a specific link from the decoded data applies to.

  1. Map from link index (i_erx) to the eRx of the ECON-D (e.g. 0 -> 2 for HGCROC0 on the HcalBackplane)
  2. Map from eRx of the ECON-D to the ROC-half

For example, if HGCROC0 is active on an HcalBackplane, its pair of output links are mapped to eRx (3, 2) which are then packed into the ECONDEventPacket in eRx order and unpacked with i_erx (0, 1). i_erx 0 was eRx 2 which was the upper half (half 1) of HGCROC0.

Since we are dealing with re-mapping of indices and integers, I don't use std::map - I just use std::vector (but I'm still thinking of them as maps where the "keys" are the vector indices).

Constructor & Destructor Documentation

◆ SingleECONDRocErxMapping()

pflib::packing::SingleECONDRocErxMapping::SingleECONDRocErxMapping ( const std::vector< std::pair< int, int > > & roc_half_to_erx,
const std::vector< int > & active_rocs )

Construct the mapping.

We need to know two pieces of information:

  1. Which ROC indices are active (i.e. would be included in the data packet)
  2. How the hardware connects the ROCs to the eRx input to the ECON-D
Parameters
[in]roc_half_to_erxmapping of ROC halfs to the eRx input to ECON-D
[in]active_rocsthe ROC indices that are active

The main work of this constructor is inverting the input mapping and constructing the i_erx<->eRx mappings from the list of active_rocs. This "inversion" is done once to make the later conversion of these indices faster.

Member Function Documentation

◆ toErx()

int pflib::packing::SingleECONDRocErxMapping::toErx ( int i_roc,
int half ) const

Get the i_erx the input ROC-half corresponds to.

Parameters
[in]i_rocROC index
[in]half0 (lower) or 1 (upper) for which half of the ROC
Returns
i_erx index fo rthe eRx link that the ECON-D output

◆ toErxChannel()

std::pair< int, int > pflib::packing::SingleECONDRocErxMapping::toErxChannel ( int i_roc,
int channel ) const

Convert the input (i_roc, channel) index to the (i_erx, channel) index.

Parameters
[in]i_rocindex for an active ROC (no checking is done)
[in]channelchannel index within that ROC (0-72)
Returns
[i_erx, channel] where i_erx is the index of the eRx input into the ECON-D as output after decoding and channel is the channel within that eRx (0-36)

◆ toROCChannel()

std::pair< int, int > pflib::packing::SingleECONDRocErxMapping::toROCChannel ( int i_erx,
int channel ) const

Convert the input (i_erx, channel) index to the (i_roc, channel) index using the RocErxMapping defined for the Target and which ROCs are active.

Parameters
[in]i_erxindex for the eRx link that the ECON-D as output after decoding
[in]channelchannel index within that eRx (0-36)
Returns
[i_roc, channel] where i_roc is the ROC index (retrieve with roc(i_roc)) and channel is the channel within that ROC (0-72)

◆ toROCHalf()

std::pair< int, int > pflib::packing::SingleECONDRocErxMapping::toROCHalf ( int i_erx) const

Get which ROC-half the input i_erx corresponds to.

Parameters
[in]i_erxindex for the eRx link that the ECON-D output
Returns
[i_roc, half] where i_roc is the ROC index and half is 0 (lower) or 1 (upper)

Member Data Documentation

◆ erx_to_i_erx_

std::vector<int> pflib::packing::SingleECONDRocErxMapping::erx_to_i_erx_
private

Map from eRx ID input to ECON to i_erx index in decoding.

This depends on which ROCs are active.

◆ erx_to_roc_half_

std::vector<std::pair<int, int> > pflib::packing::SingleECONDRocErxMapping::erx_to_roc_half_
private

map from eRx ID input to ECON to ROC-half

This does not depend on which ROCs are active, but it does depend on how the hardware is wired. It is just an inversion of roc_half_to_erx_ that is given to us in the constructor.

◆ i_erx_to_erx_

std::vector<int> pflib::packing::SingleECONDRocErxMapping::i_erx_to_erx_
private

map from i_erx index in decoding to eRx ID input to ECON

This depends on which ROCs are active.


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